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
360
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
650
PiPを応用した配信コメントバー機能の開発秘話と技術の詳解 / pip_streaming_comment_bar
narujpn
3
3.3k
Updating an App to Use Swift Concurrency 解説
narujpn
2
220
PiP で実現するミラティブの配信コメントバー / pip-streaming-comment-bar
narujpn
0
890
App Extension のスタックトレース情報からクラッシュを解析/集計する / Analyzing app extension's stack trace
narujpn
3
1.2k
ミラティブとWebRTC - WebRTC framework の中身を覗いてみよう / WebRTC framework AudioUnit Processing
narujpn
1
2k
CoreML3のオンデバイストレーニングでつくる母音推定
narujpn
0
370
AltConfと周辺の歩き方
narujpn
0
1.9k
エンジニア経験を活かしたスクラムマスターとして 開発チームとプロダクトを成長させる
narujpn
1
360
Other Decks in Technology
See All in Technology
LINE WORKSへ簡単通知!Incoming Webhookアプリの紹介
mmclsntr
0
110
目標設定は好きですか? アジャイルとともに目標と向き合い続ける方法 / Do you like target Management?
kakehashi
10
3k
AWS IAMのアンチパターン/AWSが考える最低権限実現へのアプローチ概略(JAWS-UG朝会#59資料改修20分版)
htan
0
330
データベース研修 DB基礎【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
210
運用改善、不都合な真実 / 20240722-ssmjp-kaizen
opelab
17
8k
AWSで”最小権限の原則”を実現するための考え方 /20240722-ssmjp-aws-least-privilege
opelab
10
4.3k
開発生産性をむしろ向上させる セキュリティパートナーの作り方 / Dev Productivity Con 2024
flatt_security
0
360
公共領域から学ぶ クラウド移行についてエンジニアが意識していること
kawakawa2222
0
140
AWSサービスメニュー開発をしていてAWSを好きだ!と感じた瞬間
toru_kubota
0
130
VPoEの視点から見た、ヘンリーがサーバーサイドKotlinを使う理由 / Why Server-side Kotlin 2024
cho0o0
1
420
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
150
Datadog Cloud SIEMを使ってAWS環境の脅威を可視化した話/lifeistech-datadog-cloud-siem
gidajun
0
480
Featured
See All Featured
For a Future-Friendly Web
brad_frost
173
9.2k
Fireside Chat
paigeccino
25
2.8k
Six Lessons from altMBA
skipperchong
24
3.2k
Creatively Recalculating Your Daily Design Routine
revolveconf
214
11k
Building a Scalable Design System with Sketch
lauravandoore
458
32k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
20
7.2k
[RailsConf 2023] Rails as a piece of cake
palkan
35
4.4k
The Illustrated Children's Guide to Kubernetes
chrisshort
39
47k
Raft: Consensus for Rubyists
vanstee
134
6.5k
5 minutes of I Can Smell Your CMS
philhawksworth
200
19k
Become a Pro
speakerdeck
PRO
15
4.8k
YesSQL, Process and Tooling at Scale
rocio
166
14k
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!