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
Vision Framework 入門
Search
Motoki Narita
August 09, 2017
Technology
2
1.8k
Vision Framework 入門
potatotips #42
https://potatotips.connpass.com/event/60015/
※公開されている情報を元に構成されています
Motoki Narita
August 09, 2017
Tweet
Share
More Decks by Motoki Narita
See All by Motoki Narita
Mercari 10years iOS Development
motokiee
5
3.6k
Alexa, Swiftで スマートスピーカーは実装できる?
motokiee
0
1.5k
iOSの自動化と仕組み化 ~コードと設計に集中する~
motokiee
11
2.9k
入力を型で表現する
motokiee
2
3.8k
Move Fast iOS Development
motokiee
4
3.8k
結婚式を支えた技術 Firebaseを活用したサーバレスiOSアプリケーション開発
motokiee
33
25k
Lightweight Dependency Injection tips
motokiee
10
2.9k
Hello React Native
motokiee
8
590
RxSwift in Practice
motokiee
11
5.7k
Other Decks in Technology
See All in Technology
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
CustomCopを使ってMongoidのコーディングルールを整えてみた
jinoketani
0
220
C++26 エラー性動作
faithandbrave
2
700
kargoの魅力について伝える
magisystem0408
0
200
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
680
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
250
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
150
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
150
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
730
podman_update_2024-12
orimanabu
1
260
Featured
See All Featured
Thoughts on Productivity
jonyablonski
67
4.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Scaling GitHub
holman
458
140k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
We Have a Design System, Now What?
morganepeng
51
7.3k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
For a Future-Friendly Web
brad_frost
175
9.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Transcript
7JTJPO'SBNFXPSLೖ !NPUPLJFF QPUBUPUJQT
ࣗݾհ w HJUIVC UXJUUFS!NPUPLJFF w ϝϧΧϦικJ04ΤϯδχΞ w ϝϧΧϦΧϧνʔϜ w J04%$+BQBOελοϑ
7JTJPO'SBNFXPSLͱ
$PSF.-ͱ7JTJPOͷҧ͍ʁ
ΞϓϦέʔγϣϯ 7JTJPO /-1 $PSF.- "DDFMFSBUF .14 IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΛࢀߟʹ࡞
ΞϓϦέʔγϣϯ 7JTJPO /-1 /BUVSBM-BOHVBHF1SPDFTTJOH $PSF.- "DDFMFSBUF .14 %PNBJO4QFDJpD ಛఆͷλεΫʹಛԽͨ͠ը૾ղੳͷͨΊͷϑϨʔϜϫʔΫ
ΞϓϦέʔγϣϯ 7JTJPO /-1 /BUVSBM-BOHVBHF1SPDFTTJOH $PSF.- "DDFMFSBUF .14 7JTJPOը૾ղੳʹಛԽ͍ͯ͠Δ %PNBJO4QFDJpD
ΞϓϦέʔγϣϯ 7JTJPO /-1 /BUVSBM-BOHVBHF1SPDFTTJOH $PSF.- "DDFMFSBUF .14 %PNBJO4QFDJpD 7JTJPO$PSF.-͕ϕʔεʹͳ͍ͬͯΔ
ΞϓϦέʔγϣϯ 7JTJPO /-1 /BUVSBM-BOHVBHF1SPDFTTJOH $PSF.- "DDFMFSBUF .14 %PNBJO4QFDJpD ྡΓʹ͋Δ/-1'PVOEBUJPOʹΈࠐ·Ε͍ͯͯɺ /4-JOHVJTUJD5BHHFSͳͲͰΘΕ͍ͯΔͱͷ͜ͱ
ࠓճΓ͔ͨͬͨͷɺ 7JTJPOͰόʔίʔυΛݕग़͢Δ͜ͱ
Barcode Detection IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΑΓ
w 7JTJPOΛͬͯόʔίʔυͷݕग़Λ͍ͨ͠ w ͔݁Βݴ͏ͱ7JTJPO .-&YBNQMFͱ͍͏88%$ ͷηογϣϯͰΘΕ͍ͯͨαϯϓϧΛݩʹػց ֶशͷ͕ࣝͳͯ͘͢ΜͳΓ7JTJPOಈ͔͢͜ͱ ͕Ͱ͖ͨ w ͨͩ͠ͱ͍͏Λ͢Δ
࣮ํ๏
IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΑΓ Analyzing an Image The Machinery The Results The Asks
IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΑΓ Analyzing an Image The Machinery The Results The Asks
Requests VNDetectBarcodesRequest VNDetectFaceLandmarksRequest VNDetectFaceRectanglesRequest … Observations VNClassificationObservation VNDetectedObjectObservation VNFaceObservation … RequestHandler VNImageRequestHandler
w ը૾͔ΒόʔίʔυΛݕग़ w 7/%FUFDU#BSDPEFT3FRVFTUΛͬͯɺը૾͔Β όʔίʔυΛಡΈऔΔ
Analyzing an Image The Machinery The Results The Asks Requests
VNDetectBarcodesRequest VNDetectFaceLandmarksRequest VNDetectFaceRectanglesRequest … Observations VNClassificationObservation VNDetectedObjectObservation VNFaceObservation … RequestHandler VNImageRequestHandler IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΑΓ
let handler = VNImageRequestHandler(ciImage: ciImage, orientation: orientation) try! handler.perform([barcodeClassificationRequest])
w ը૾͔Βόʔίʔυͷ*4#/ίʔυΛऔΓग़͢
Analyzing an Image The Machinery The Results The Asks Requests
VNDetectBarcodesRequest VNDetectFaceLandmarksRequest VNDetectFaceRectanglesRequest … Observations VNClassificationObservation VNDetectedObjectObservation VNFaceObservation … RequestHandler VNImageRequestHandler IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΑΓ
lazy var barcodeClassificationRequest: VNDetectBarcodesRequest = { return VNDetectBarcodesRequest(completionHandler: { request,
error in guard let observations = request.results as? [VNBarcodeObservation] else { return } let rects = observations.map { $0.boundingBox } DispatchQueue.main.async { [weak self] in for rect in rects { let view = UIView(frame: convertedRect(rect: rect, to: self!.imageView.frame.size)) view.backgroundColor = .green self?.imageView.addSubview(view) } } let _ = observations.flatMap { observation -> CIBarcodeDescriptor? in if let desc = observation.barcodeDescriptor as? CIBarcodeDescriptor { return desc } else { return nil } } }) }()
lazy var barcodeClassificationRequest: VNDetectBarcodesRequest = { return VNDetectBarcodesRequest(completionHandler: { request,
error in guard let observations = request.results as? [VNBarcodeObservation] else { return } let rects = observations.map { $0.boundingBox } DispatchQueue.main.async { [weak self] in for rect in rects { let view = UIView(frame: convertedRect(rect: rect, to: self!.imageView.frame.size)) view.backgroundColor = .green self?.imageView.addSubview(view) } } let _ = observations.flatMap { observation -> CIBarcodeDescriptor? in if let desc = observation.barcodeDescriptor as? CIBarcodeDescriptor { return desc } else { return nil } } }) }()
ͱΓ͋͑ͣͰ͖ͨ
͕ɺ
όʔίʔυ͕Ͳ͜ʹ͋Δ͔Θ͔͚ͬͨͲɺ ༰ʢ&"/ίʔυʣ͔Βͳ͔ͬͨʜ
lazy var barcodeClassificationRequest: VNDetectBarcodesRequest = { return VNDetectBarcodesRequest(completionHandler: { request,
error in guard let observations = request.results as? [VNBarcodeObservation] else { return } let rects = observations.map { $0.boundingBox } DispatchQueue.main.async { [weak self] in for rect in rects { let view = UIView(frame: convertedRect(rect: rect, to: self!.imageView.frame.size)) view.backgroundColor = .green self?.imageView.addSubview(view) } } let _ = observations.flatMap { observation -> CIBarcodeDescriptor? in if let desc = observation.barcodeDescriptor as? CIBarcodeDescriptor { return desc } else { return nil } } }) }()
w $*#BS$PEF%FTDSJQUPSͰ&"/ίʔυ͕औಘͰ͖Δ ͣɺͱࢥ͍͕ͬͯͨɺͦΜͳͷͳ͔ͬͨ w $*#BS$PEF%FTDSJQUPS/40CKFDUͷαϒΫϥεͰ ಛʹԿ࣮͞Ε͍ͯͳ͍
IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΑΓ Framework Barcode Support Several frameworks support various barcodes types
AVFoundation.framework Vision.framework CoreImage.framework Detection of barcodes during capture Detection of barcodes after capture Rendering barcodes CIBarcodeDescriptor
IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPODPSFJNBHFDJCBSDPEFEFTDSJQUPS
w ࣮$*#BS$PEF%FTDSJQUPSͷαϒΫϥεʹҕͶΒ Ε͍ͯͯɺ͍·ཉ͍͠ͷ&"/ίʔυʹରԠͨ͠ ͷͳ͔ͬͨ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPODPSFJNBHFDJCBSDPEFEFTDSJQUPS
w $*23$PEF%FTDSJQUPS w $*"[UFD$PEF%FTDSJQUPS w $*1%'$PEF%FTDSJQUPS w $*%BUB.BUSJY$PEF%FTDSJQUPS ରԠ͍ͯ͠Δ̎࣍ݩίʔυ
Framework Barcode Support Several frameworks support various barcodes types AVFoundation.framework
Vision.framework CoreImage.framework Detection of barcodes during capture Detection of barcodes after capture Rendering barcodes CIBarcodeDescriptor
·ͱΊ w 7JTJPOΛ͏ͱόʔίʔυ͕ը૾ͷதʹ͋Δͱ͍͏ ͜ͱ͔Δ w ը໘্ͷͲ͜ʹ͋Δ͔ͷ࠲ඪऔΕΔͷͰɺؤுͬ ͯ&"/ίʔυม·ͰͰ͖Δͣ w IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZ XXED
UJNF
͓ΘΓ