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.7k
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.5k
Alexa, Swiftで スマートスピーカーは実装できる?
motokiee
0
1.5k
iOSの自動化と仕組み化 ~コードと設計に集中する~
motokiee
11
2.9k
入力を型で表現する
motokiee
2
3.8k
Move Fast iOS Development
motokiee
4
3.7k
結婚式を支えた技術 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.6k
Other Decks in Technology
See All in Technology
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
150
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
330
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
170
AGIについてChatGPTに聞いてみた
blueb
0
130
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
強いチームと開発生産性
onk
PRO
35
11k
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1.1k
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
430
日経電子版のStoreKit2フルリニューアル
shimastripe
1
130
The Role of Developer Relations in AI Product Success.
giftojabu1
0
130
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Six Lessons from altMBA
skipperchong
27
3.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Building an army of robots
kneath
302
43k
A Tale of Four Properties
chriscoyier
156
23k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Practical Orchestrator
shlominoach
186
10k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Unsuck your backbone
ammeep
668
57k
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
͓ΘΓ