goofy_face.graph revision ff04485d07c73b8dc6b612ce7bcc720a6061e6f3
1//
2// Copyright (C) 2011 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17// Imports ---------------------------------------------------
18@import android.filterpacks.videosrc;
19@import android.filterpacks.videosink;
20@import android.filterpacks.ui;
21@import android.filterpacks.base;
22@import android.filterpacks.imageproc;
23
24@import com.google.android.filterpacks.facedetect;
25
26@setting autoBranch = "synced";
27
28// Externals -------------------------------------------------
29
30@external textureSourceCallback;
31@external recordingWidth;
32@external recordingHeight;
33@external recordingProfile;
34@external audioSource;
35
36@external previewSurface;
37@external previewWidth;
38@external previewHeight;
39
40// Filters ---------------------------------------------------
41
42// Camera input
43@filter SurfaceTextureSource source {
44  sourceListener = $textureSourceCallback;
45  width = $recordingWidth;
46  height = $recordingHeight;
47  closeOnTimeout = true;
48}
49
50// Face detection
51@filter ToPackedGrayFilter toPackedGray {
52  owidth = 320;
53  oheight = 240;
54  keepAspectRatio = true;
55}
56
57@filter MultiFaceTrackerFilter faceTracker {
58  numChannelsDetector = 3;
59  quality = 0.0f;
60  smoothness = 0.2f;
61  minEyeDist = 25.0f;
62  rollRange = 45.0f;
63  numSkipFrames = 9;
64  trackingError = 1.0;
65  mouthOnlySmoothing = 0;
66  useAffineCorrection = 1;
67  patchSize = 15;
68}
69
70// Goofyface
71@filter GoofyRenderFilter goofyrenderer {
72  distortionAmount = 1.0;
73}
74
75// Display output
76@filter SurfaceTargetFilter display {
77  surface = $previewSurface;
78  owidth = $previewWidth;
79  oheight = $previewHeight;
80}
81
82// Orientation rotation filter
83@filter FixedRotationFilter rotate {
84    rotation = 0;
85}
86
87// Orientation rotation filter for facemeta data
88@filter FaceMetaFixedRotationFilter metarotate {
89    rotation = 0;
90}
91
92
93// Recording output
94@filter MediaEncoderFilter recorder {
95  audioSource = $audioSource;
96  recordingProfile = $recordingProfile;
97  recording = false;
98  // outputFile, orientationHint, listeners will be set when recording starts
99}
100
101// Connections -----------------------------------------------
102// camera -> faceTracker
103@connect source[video] => rotate[image];
104@connect rotate[image] => toPackedGray[image];
105@connect toPackedGray[image] => faceTracker[image];
106// camera -> goofy
107@connect source[video] => goofyrenderer[image];
108// faceTracker -> metarotate -> goofy
109@connect faceTracker[faces] => metarotate[faces];
110@connect metarotate[faces] => goofyrenderer[faces];
111// goofy -> display out
112@connect goofyrenderer[outimage] => display[frame];
113// goofy -> record
114@connect goofyrenderer[outimage] => recorder[videoframe];
115