-
Notifications
You must be signed in to change notification settings - Fork 26
/
mapping.coffee
61 lines (50 loc) · 1.33 KB
/
mapping.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{affine, srt} = require './transforms'
# -- AFFINE
# affine mappings have a list of control points. the first two numbers are
# the x,y coords of a pixel on the overlay image. The next two numbers are
# a point on the destination image (expressed percentage, 0-100). You can
# use the various face.{eye_left,eye_right,nose,mouth_left,...} helpers.
module.exports =
hipster: affine (face) -> [
[138, 80, face.eye_left]
[314, 80, face.eye_right]
]
# hipster: srt (face) -> [
# [234.5, 72]
# face.width * 1.1 / 469
# face.roll
# @middle(face.eye_left, face.eye_right)
# ]
mustache: srt (face) -> [
[249, 105]
face.width / 491
face.roll
face.mouth_center
]
# The original mustachio algorithm
mustache2: srt (face) -> [
[249, 105]
@distance(face.nose, face.mouth_center) / 105
@angle(face.mouth_left, face.mouth_right)
face.mouth_center
]
clown: srt (face, photo) -> [
[108, 111]
face.width * 0.5 / 202
0
face.nose
]
scumbag: affine (face) -> [
[79, 129, face.eye_left]
[137, 120, face.eye_right]
]
jason: affine (face) -> [
[95, 176, face.eye_left]
[223, 208, face.eye_right]
[131, 316, face.mouth_center]
]
rohan: affine (face) -> [
[49, 107, face.eye_left]
[135, 107, face.eye_right]
[88, 202, face.mouth_center]
]