Show last authors
1 (% style="text-align:center" %)
2 [[image:ezgif-5-7f21e39c31c7.gif||alt="" class="img-rounded"]]
3
4 (% class="box infomessage" %)
5 (((
6 Ever wanted to know how you look like with a clown nose? You only need a few bricks and the face recognition function of your phone to make your own snapchat filters! Start right now…
7 )))
8
9 (% class="box" %)
10 (((
11 == What bricks and objects do you need? ==
12
13 Create a new program and add the following object from the media library:
14
15 (% style="text-align:center" %)
16 [[image:1.png||alt=""]]
17 )))
18
19 (% class="row" %)
20 (((
21 (% class="col-xs-12 col-sm-6" %)
22 (((
23 (% class="box" %)
24 (((
25 = Now add these scripts to the Hat object: =
26
27 **~1. Step**
28
29 At first you want to activate your camera as soon as the program starts.
30
31 (% style="text-align:center" %)
32 [[image:2.png||alt=""]]
33 )))
34 )))
35
36 (% class="col-xs-12 col-sm-6" %)
37 (((
38 (% class="box" %)
39 (((
40 **2. Step**
41
42 Now add a forever loop to continuously check if a face is in front of the camera.
43
44 (% style="text-align:center" %)
45 [[image:3.png||alt=""]]
46 )))
47 )))
48 )))
49
50 (% class="row" %)
51 (((
52 (% class="col-xs-12 col-sm-6" %)
53 (((
54 (% class="box" %)
55 (((
56 **3. Step**
57
58 You actually need to check if the camera detects a face. Therefore you need an if-else-brick. In the condition of the brick insert the sensor value:** “is_face_detected”** which you find under the category: “devices” in the formula editor. So if your phone’s camera detects a face, your object should be shown, else insert a hide-brick in order to hide it.
59
60 (% style="text-align:center" %)
61 [[image:4.png||alt=""]]
62 )))
63 )))
64
65 (% class="col-xs-12 col-sm-6" %)
66 (((
67 (% class="box" %)
68 (((
69 **4. Step**
70
71 Every time the camera is detecting a face, your object is shown on the screen. Now you need to add movement to the object so it stays on a certain part of your face. Pick the place at X: Y: – brick and insert into the x-position field the sensor value **“face_x_position” **which you find under “devices” in the formula editor. Into the y-value field insert **“face_y_position + 500” **since the object is a hat.
72
73 (% style="text-align:center" %)
74 [[image:5.png||alt=""]]
75 )))
76 )))
77 )))
78
79 (% class="row" %)
80 (((
81 (% class="col-xs-12 col-sm-6" %)
82 (((
83 (% class="box" %)
84 (((
85 **5. Step**
86
87 For the last step you need to make sure that our hat adjusts according to your face size. If you are close to the camera you want a bigger hat, if you are further away a smaller one. Therefore add the set size to-brick and insert the sensor value** “face_size”**. Multiply this value with a certain number to fit your object to the correct size. In this case we choose to multiply it by 5 but you can try different values to get your perfect result.
88
89 (% style="text-align:center" %)
90 [[image:6.png||alt=""]]
91 )))
92 )))
93 )))
94
95 (% class="box" %)
96 (((
97 == Remix Inspirations ==
98
99 [[Hypno Medusa: Hypnotise the animals with your powerful stare, but avoid Medusa's gaze.>>https://share.catrob.at/pocketcode/program/3965]]
100 )))
101 (% class="box infomessage" %)
102 (((
103 [[Download the program>>https://share.catrob.at/pocketcode/program/33052]]
104 )))