blob: fe2c5d9f0ef638fccd7b676d942f6621e023351c [file] [log] [blame]
//
// 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;
// Not used by this graph, but simplifies higher-level
// graph initialization code.
@external orientation;
// Filters ---------------------------------------------------
// Camera input
@filter SurfaceTextureSource source {
sourceListener = $textureSourceCallback;
width = $recordingWidth;
height = $recordingHeight;
closeOnTimeout = true;
}
// Face detection
@filter ToPackedGrayFilter toPackedGray {
owidth = 320;
oheight = 240;
keepAspectRatio = true;
}
@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 GoofyFastRenderFilter 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, inputRegion, 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];