goofy_face.graph revision 9efb0b19fa929c528253f0a9b6f5b27791e1ee52
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} 55 56@filter MultiFaceTrackerFilter faceTracker { 57 numChannelsDetector = 3; 58 quality = 0.0f; 59 smoothness = 0.2f; 60 minEyeDist = 25.0f; 61 rollRange = 45.0f; 62 numSkipFrames = 9; 63 trackingError = 1.0; 64 mouthOnlySmoothing = 0; 65 useAffineCorrection = 1; 66 patchSize = 15; 67} 68 69// Goofyface 70@filter GoofyRenderFilter goofyrenderer { 71 distortionAmount = 1.0; 72} 73 74// Display output 75@filter SurfaceTargetFilter display { 76 surface = $previewSurface; 77 owidth = $previewWidth; 78 oheight = $previewHeight; 79} 80 81// Recording output 82@filter MediaEncoderFilter recorder { 83 audioSource = $audioSource; 84 recordingProfile = $recordingProfile; 85 recording = false; 86 // outputFile, orientationHint, listeners will be set when recording starts 87} 88 89// Connections ----------------------------------------------- 90// camera -> faceTracker 91@connect source[video] => toPackedGray[image]; 92@connect toPackedGray[image] => faceTracker[image]; 93// camera -> goofy 94@connect source[video] => goofyrenderer[image]; 95// faceTracker -> goofy 96@connect faceTracker[faces] => goofyrenderer[faces]; 97// goofy -> display out 98@connect goofyrenderer[outimage] => display[frame]; 99// goofy -> record 100@connect goofyrenderer[outimage] => recorder[videoframe]; 101