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
Make faces big by Vision and CoreGraphics
Search
naru-jpn
March 02, 2018
Technology
0
320
Make faces big by Vision and CoreGraphics
“Can you make faces big?”
naru-jpn
March 02, 2018
Tweet
Share
More Decks by naru-jpn
See All by naru-jpn
配信アプリのためのリアルタイムプッシュ通知ぼかしの夢
narujpn
2
570
PiPを応用した配信コメントバー機能の開発秘話と技術の詳解 / pip_streaming_comment_bar
narujpn
3
3.1k
Updating an App to Use Swift Concurrency 解説
narujpn
2
190
PiP で実現するミラティブの配信コメントバー / pip-streaming-comment-bar
narujpn
0
810
App Extension のスタックトレース情報からクラッシュを解析/集計する / Analyzing app extension's stack trace
narujpn
3
1.1k
ミラティブとWebRTC - WebRTC framework の中身を覗いてみよう / WebRTC framework AudioUnit Processing
narujpn
1
1.9k
CoreML3のオンデバイストレーニングでつくる母音推定
narujpn
0
360
AltConfと周辺の歩き方
narujpn
0
1.8k
エンジニア経験を活かしたスクラムマスターとして 開発チームとプロダクトを成長させる
narujpn
1
360
Other Decks in Technology
See All in Technology
Google Cloud Next '24 Recap(Cloud Run/k8s)
mokocm
0
250
JAWS-UG Bedrock Claude Night
yamahiro
3
620
20240418_Google ColabにLLMが搭載されたようなのでPython x データ分析の勉強方法を考えてみる
doradora09
0
140
家族アルバム みてねにおけるGrafana活用術 / Grafana Meetup Japan Vol.1 LT
isaoshimizu
1
810
Terraformあれやこれ/terraform-this-and-that
emiki
8
1.5k
チームでロジカルシンキングに改めて向き合っている話 〜学習環境と実践⽅法〜
sansantech
PRO
3
2.9k
開発生産性大幅アップ!Postman VS Code拡張機能
nagix
2
430
Cypress or Playwright?
rainerhahnekamp
0
130
Postman v10リリース後を振り返る / Looking back at Postman v10 after release
yokawasa
1
160
FrontDoorとWebAppsを組み合わせた際のリダイレクト処理の注意点
kenichirokimura
1
590
GraphQL 成熟度モデルの紹介と、プロダクトに当てはめた事例 / GraphQL maturity model
mh4gf
7
1.4k
Building Dashboards as a Hobby
egmc
0
270
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
The Mythical Team-Month
searls
216
42k
The Brand Is Dead. Long Live the Brand.
mthomps
49
29k
The Illustrated Children's Guide to Kubernetes
chrisshort
31
46k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
What the flash - Photography Introduction
edds
64
11k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
40
4.4k
Making the Leap to Tech Lead
cromwellryan
124
8.5k
Building Applications with DynamoDB
mza
88
5.6k
A designer walks into a library…
pauljervisheath
200
23k
Imperfection Machines: The Place of Print at Facebook
scottboms
260
12k
Transcript
Make faces big by Vision and CoreGraphics VisionͱCoreGraphicsͰإΛσΧ͘͢Δ Naruki Chigira,
Timers inc. @naruchigi Try! Swift 2018
“Can you make faces big?”
“In about a week.”
None
Core Image want actual
Core ML too much learning cost (also for me) …
Vision
Vision ɾFace Detection and Recognition ɾBarcode Detection ɾText Detection ɾHorizon
Detection ɾObject Detection and Tracking
VNFaceLandmarkRegion2D Class 2D geometry information for a specific facial feature.
VNFaceObservation Class Face or facial-feature information detected by an image analysis request.
Face Couture [CGPoint]
// 1. Create VNDetectFaceLandmarksRequest let request = VNDetectFaceLandmarksRequest() { (request,
error) in guard let results = request.results else { return } let faceObservations = results.flatMap({ $0 as? VNFaceObservation }) // 3. Handle results // … } // 2. Create VNImageRequestHandler and perform let handler = VNImageRequestHandler(cgImage: cgImage, options: [:]) try! handler.perform([request]) How to get VNFaceLandmarkRegion2D
Face Couture
None
None
None
None
None
Core Graphics
CGPoint Structure A structure that contains a point in a
two-dimensional coordinate system.
CGAffineTransform Structure An affine transformation matrix for use in drawing
2D graphics.
CGPoint Structure Instance Method func applying(_ t: CGAffineTransform) -> CGPoint
O
O 1. translate
O 1. translate 2. rotate
O 1. translate 2. rotate 3. reverse + joint
O 1. translate 2. rotate 3. reverse + joint 4.
rotate-1
O 1. translate 2. rotate 3. reverse + joint 4.
rotate-1 5. translate-1
O A A-1 } } 1. translate 2. rotate 3.
reverse + joint 4. rotate-1 5. translate-1
Modify [CGPoint] in Swift // 1. Create CGAffineTransform A let
A = CGAffineTransform(rotationAngle: -theta).translatedBy(x: x, y: y) // 2. Apply A let transformed = points.map { $0.applying(A) } // 3. Reverse & Joint let oval = transformed + transformed.map { CGPoint(x: -$0.x, y: -$0.y) } // 4. Apply A-1 let result = oval.map { $0.applying(A.inverted()) }
Result
None
None
Summary Get facial features from Vision (iOS 11.0~) Process data
using CoreGraphics (iOS 2.0~) +
Thank you!