Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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.8k
1年分のデータが見たいと言われてやったこと/yearly_data_with_note
fromkk
0
960
note iOSチームの自動化 ver.2021/automation_with_iOS_team_on_note_ver2021
fromkk
0
1.9k
Bitrise体験会説明資料/bitrise_explore
fromkk
1
1.1k
noteのiOSアプリで実装したアクセシビリティの全て #iosdc #a /a11y_with_iOS_App_on_note
fromkk
2
3.8k
dSYMのアップロードで SPMを活用する/use_spm_with_upload_dsyms
fromkk
1
2.9k
Bitriseのリモートアクセス機能 #bitrise_meetup/remote_access_of_bitrise
fromkk
1
580
note社でのMagic Pod活用事例 #af_iosdc/magicpod_with_note
fromkk
2
11k
iOSには無いmacOS独自機能をCatalystで実装する #iosdc #d/make_macos_apps_with_catalyst
fromkk
9
2.1k
Other Decks in Programming
See All in Programming
[初登壇@jAZUG]アプリ開発者が気になるGoogleCloud/Azure+wasm/wasi
asaringo
0
130
複数アプリケーションを育てていくための共通化戦略
irof
10
3.9k
機械学習って何? 5分で解説頑張ってみる
kuroneko2828
0
210
try-catchを使わないエラーハンドリング!? PHPでResult型の考え方を取り入れてみよう
kajitack
3
510
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
200
エラーって何種類あるの?
kajitack
5
140
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
260
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
490
Elixir で IoT 開発、 Nerves なら簡単にできる!?
pojiro
1
130
Prism.parseで 300本以上あるエンドポイントに 接続できる権限の一覧表を作ってみた
hatsu38
1
110
インターフェース設計のコツとツボ
togishima
2
710
Perlで痩せる
yuukis
1
680
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
123
52k
The Cult of Friendly URLs
andyhume
79
6.4k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Done Done
chrislema
184
16k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
For a Future-Friendly Web
brad_frost
179
9.8k
Visualization
eitanlees
146
16k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.7k
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