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
The Role of Developer Relations in AI Product Success.
giftojabu1
0
120
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
[FOSS4G 2024 Japan LT] LLMを使ってGISデータ解析を自動化したい!
nssv
1
210
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
220
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
AGIについてChatGPTに聞いてみた
blueb
0
130
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
3
200
Featured
See All Featured
Code Review Best Practice
trishagee
64
17k
BBQ
matthewcrist
85
9.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
Speed Design
sergeychernyshev
24
610
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Practical Orchestrator
shlominoach
186
10k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Designing Experiences People Love
moore
138
23k
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
͓ΘΓ