Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Depth APIで簡易クロマキー合成 #geek_garage_ios/depth_api_...
Search
fromkk
June 27, 2017
Programming
3
2k
Depth APIで簡易クロマキー合成 #geek_garage_ios/depth_api_ios11_20170627
GEEK GARAGE iOS vol3で発表したiOS 11から利用出来るDepth APIについて
fromkk
June 27, 2017
Tweet
Share
More Decks by fromkk
See All by fromkk
note社の全員野球で品質向上活動について / note_qa_challenge #iOS_test_teatime
fromkk
3
1.9k
1年分のデータが見たいと言われてやったこと/yearly_data_with_note
fromkk
0
1k
note iOSチームの自動化 ver.2021/automation_with_iOS_team_on_note_ver2021
fromkk
0
2k
Bitrise体験会説明資料/bitrise_explore
fromkk
1
1.1k
noteのiOSアプリで実装したアクセシビリティの全て #iosdc #a /a11y_with_iOS_App_on_note
fromkk
2
4.3k
dSYMのアップロードで SPMを活用する/use_spm_with_upload_dsyms
fromkk
1
3.1k
Bitriseのリモートアクセス機能 #bitrise_meetup/remote_access_of_bitrise
fromkk
1
630
note社でのMagic Pod活用事例 #af_iosdc/magicpod_with_note
fromkk
2
11k
iOSには無いmacOS独自機能をCatalystで実装する #iosdc #d/make_macos_apps_with_catalyst
fromkk
9
2.2k
Other Decks in Programming
See All in Programming
関数実行の裏側では何が起きているのか?
minop1205
1
690
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
2.6k
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
320
チームをチームにするEM
hitode909
0
330
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
830
AIコーディングエージェント(NotebookLM)
kondai24
0
190
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
9
1.2k
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
6
1.3k
ゲームの物理 剛体編
fadis
0
350
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
220
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
420
Featured
See All Featured
Practical Orchestrator
shlominoach
190
11k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Building Applications with DynamoDB
mza
96
6.8k
Site-Speed That Sticks
csswizardry
13
1k
Navigating Team Friction
lara
191
16k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Transcript
Depth APIͰ؆қΫϩϚΩʔ߹ GEEK GARAGE iOS vol3 2017/06/27 1
Profile Kazuya Ueoka Timers inc.ͷiOSΤϯδχΞ Twitter: @fromkk Github: fromkk Qiita:
fromkk 2
WWDC 2017ʹߦͬͯདྷ·ͨ͠✈ ϒϩά͍͔ͭ͘ॻ͍ͨͷͰΑ͔ͬͨΒ؍ͯͶ! http://techblog.timers-inc.com/archive/category/ wwdc2017 3
ΫϩϚΩʔ߹ — ฐࣾͷݕ౼தࢪࡦͷதʹΫϩϚ Ωʔ߹͕ඞཁͳ͕͋ͬͨ — ࣸਅͷಛఆ৭ͷ෦ΛಁԽͯ͠എ ܠը૾ͱ߹(άϦʔϯόοΫ) — Ϣʔβʔ͕Ξοϓϩʔυ͢Δࣸਅ ͷഎܠ͕Ұ৭͚ͩͳΜͯ΄΅օແ
ը૾ૉࡐ:εϚʔτϑΥϯͰࠓͷҿ ΈձΛ༧ʢάϦʔϯόοΫʣ 4
ͦΜͳத 5
WWDC 2017ͰDepth Api͕ެ։͞Ε·ͨ͠! 6
Sessions — 507 Capturing Depth in iPhone Photography — 508
Image Editing with Depth 7
Depthͱ — iPhone 7 PlusͷϙʔτϨʔτϞʔυͰࡱӨͨࣸ͠ਅ͔Β Ͱऔಘग़དྷΔମͷڑ — ϙʔτϨʔτࡱӨͰԕ͘ʹ͍͘ʹ࿈Εͯڧ͍΅͔͠Τ ϑΣΫτΛೖΕ͍ͯΔ( CIDepthBlurEffect
) 8
Disparityͱ — ຊޠͰ֨ࠩ — ਂΛը૾Ͱදݱͨ͠ͱউखʹղऍ 9
͕ 10
ରԠ iPhone 7 Plus iOS 11Ҏ্ ͷΈ! 11
͍͔ͨͬͨͷͰ ϝΠϯ༻͍ͯ͠ΔiPhone 7 PlusʹiOS 11 betaΛΠϯε τʔϧ͠·ͨ͠! 12
ݪཧ — 2ͭͷΧϝϥͰࡱӨͨ͠ಛఆͷ2 ͷڑ͕͍ۙํ͕खલɾΕͯ Δํ͕Ԟ — σΟʔϓϥʔχϯάͷٕज़Λར༻ ͍ͯ͠ΔΒ͍͠ʢಛͷந ग़ʁʣ 13
੍ݶࣄ߲ — iOS 11ͰࡱӨͨ͠ը૾͔Β͔͠Disparity͕औಘग़དྷͳ͍ — HEIFϑΥʔϚοτͷΈରԠ 14
HEIF — iOS 11͔ΒରԠͨ͠৽͍͠ը૾ϑΥʔϚοτ — ͍ܰʂ — Alphaνϟϯωϧ/Depth/ΞχϝʔγϣϯରԠ — λΠϧಡΈࠐΈରԠ
— etc... 15
More info about HEIF — 503 Introducing HEIF and HEVC
— 513 High Efficiency Image File Format 16
Disparityը૾ͷऔಘ — طʹࡱӨͨࣸ͠ਅ͔Βऔಘ — PhotoKitΛར༻ let asset: PHAsset = ...
asset.requestContentEditingInput(with: nil) { (input, info) in guard let imageURL: URL = input?.fullSizeImageURL else { return } if let disparityImage: CIImage = CIImage(contentsOf: imageURL, options: [kCIImageAuxiliaryDisparity: true]) { self.disparityImageView.image = UIImage(ciImage: disparityImage) } } 17
ͪͳΈʹ self.asset.requestContentEditingInput(with: nil) { (input, info) in guard let imageURL:
URL = input?.fullSizeImageURL else { return } guard let source = CGImageSourceCreateWithURL(imageURL as CFURL, nil) else { return } guard let sourceProperties = CGImageSourceCopyProperties(source, nil) else { return } print(sourceProperties) } ͱ͢Ε 18
{ "{FileContents}" = { ImageCount = 1; Images = (
{ AuxiliaryData = ( { AuxiliaryDataType = kCGImageAuxiliaryDataTypeDisparity; Height = 768; Width = 576; } ); } ); }; } ͱ͍ͬͨใ͕औಘग़དྷΔ 19
ը૾߹ͯ͠ΈΔ let ciImage: CIImage = CIImage(image: image) let wallImage: UIImage
= #imageLiteral(resourceName: "wall") guard let wallCIImage: CIImage = CIImage(image: wallImage) else { return } let maskedImage: CIImage = ciImage.applyingFilter("CIBlendWithMask", withInputParameters: [ kCIInputBackgroundImageKey: wallCIImage, kCIInputMaskImageKey: disparityImage.applyingFilter("CIColorClamp", withInputParameters: nil), ]) self.disparityImageView.image = UIImage(ciImage: maskedImage) 20
ը૾ௐ CIColorMatrix Λར༻ͯ͠άϨʔͷೱ͞Λௐ let maskImage = disparityImage.applyingFilter("CIColorMatrix", withInputParameters: [ "inputRVector"
: CIVector(x: value, y: 0, z: 0, w: 0), "inputGVector" : CIVector(x: 0, y: value, z: 0, w: 0), "inputBVector" : CIVector(x: 0, y: 0, z: value, w: 0), "inputBiasVector" : CIVector(x: bias, y: bias, z: bias, w: 0)]) 21
Sample https://github.com/fromkk/DepthAPISampleForiOS11 22
ϋϚͬͨࣄ — ͦͦCIImageɺCIFilterશવΒͳ͔ͬͨ — kCIImageAuxiliaryDepth Ͱը૾͕औಘग़དྷΔͣͳͷ ʹग़དྷͳ͔ͬͨ — ճస͍ͯ͠Δը૾ʹରԠग़དྷͳ͔ͬͨʢৄ͍͠ਓ͍ͨΒڭ ͑ͯԼ͍͞!ʣ
— ֶͦͦతͳ͕ࣝແ͍ͷͰηογϣϯͷҙຯ͕͋· Γཧղग़དྷͳ͔ͬͨʢসʣ 23
Recap — ݸਓతʹҰ୴Disparityͷը૾͕औಘग़དྷͯ࠷ݶͷ߹ ͕ग़དྷͨͷͰຬ! — ݱ࣌ͰରԠ͕݅গͳ͔͘ͳΓχονͳػೳͳͷͰ͍ ಓ͕͍͠" — iOS 11Ҏ߱ͰࡱӨͨࣸ͠ਅ͔͠Disparityը૾͕औಘग़དྷ
ͳͯ͘൵͠Έ# 24
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠! 25