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
1.9k
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
890
note iOSチームの自動化 ver.2021/automation_with_iOS_team_on_note_ver2021
fromkk
0
1.9k
Bitrise体験会説明資料/bitrise_explore
fromkk
1
1k
noteのiOSアプリで実装したアクセシビリティの全て #iosdc #a /a11y_with_iOS_App_on_note
fromkk
2
3.4k
dSYMのアップロードで SPMを活用する/use_spm_with_upload_dsyms
fromkk
1
2.6k
Bitriseのリモートアクセス機能 #bitrise_meetup/remote_access_of_bitrise
fromkk
1
520
note社でのMagic Pod活用事例 #af_iosdc/magicpod_with_note
fromkk
2
10k
iOSには無いmacOS独自機能をCatalystで実装する #iosdc #d/make_macos_apps_with_catalyst
fromkk
9
2k
Other Decks in Programming
See All in Programming
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
C++でシェーダを書く
fadis
6
4.1k
subpath importsで始めるモック生活
10tera
0
300
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
CSC509 Lecture 12
javiergs
PRO
0
160
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
133
8.9k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Automating Front-end Workflow
addyosmani
1366
200k
KATA
mclloyd
29
14k
Become a Pro
speakerdeck
PRO
25
5k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
GraphQLとの向き合い方2022年版
quramy
43
13k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Optimizing for Happiness
mojombo
376
70k
How STYLIGHT went responsive
nonsquared
95
5.2k
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