summaryrefslogtreecommitdiffstats
path: root/res/raw/goofy_face.graph
blob: cceceb031b331ac7a3f9dad9c7321fccff06f677 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//
// Copyright (C) 2011 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// Imports ---------------------------------------------------
@import android.filterpacks.videosrc;
@import android.filterpacks.videosink;
@import android.filterpacks.ui;
@import android.filterpacks.base;
@import android.filterpacks.imageproc;

@import com.google.android.filterpacks.facedetect;

@setting autoBranch = "synced";

// Externals -------------------------------------------------

@external textureSourceCallback;
@external recordingWidth;
@external recordingHeight;
@external recordingProfile;
@external audioSource;

@external previewSurface;
@external previewWidth;
@external previewHeight;

// Filters ---------------------------------------------------

// Camera input
@filter SurfaceTextureSource source {
  sourceListener = $textureSourceCallback;
  width = $recordingWidth;
  height = $recordingHeight;
  closeOnTimeout = true;
}

// Face detection
@filter ToPackedGrayFilter toPackedGray {
  owidth = 320;
  oheight = 240;
}

@filter MultiFaceTrackerFilter faceTracker {
  numChannelsDetector = 3;
  quality = 0.0f;
  smoothness = 0.2f;
  minEyeDist = 25.0f;
  rollRange = 45.0f;
  numSkipFrames = 9;
  trackingError = 1.0;
  mouthOnlySmoothing = 0;
  useAffineCorrection = 1;
  patchSize = 15;
}

// Goofyface
@filter GoofyRenderFilter goofyrenderer {
  distortionAmount = 1.0;
}

// Display output
@filter SurfaceTargetFilter display {
  surface = $previewSurface;
  owidth = $previewWidth;
  oheight = $previewHeight;
}

// Orientation rotation filter
@filter FixedRotationFilter rotate {
    rotation = 0;
}

// Orientation rotation filter for facemeta data
@filter FaceMetaFixedRotationFilter metarotate {
    rotation = 0;
}


// Recording output
@filter MediaEncoderFilter recorder {
  audioSource = $audioSource;
  recordingProfile = $recordingProfile;
  recording = false;
  // outputFile, orientationHint, listeners will be set when recording starts
}

// Connections -----------------------------------------------
// camera -> faceTracker
@connect source[video] => rotate[image];
@connect rotate[image] => toPackedGray[image];
@connect toPackedGray[image] => faceTracker[image];
// camera -> goofy
@connect source[video] => goofyrenderer[image];
// faceTracker -> metarotate -> goofy
@connect faceTracker[faces] => metarotate[faces];
@connect metarotate[faces] => goofyrenderer[faces];
// goofy -> display out
@connect goofyrenderer[outimage] => display[frame];
// goofy -> record
@connect goofyrenderer[outimage] => recorder[videoframe];