Skip to content

Instantly share code, notes, and snippets.

@kaorun55
Created November 1, 2015 12:26
Show Gist options
  • Select an option

  • Save kaorun55/28c7613759479d413d6d to your computer and use it in GitHub Desktop.

Select an option

Save kaorun55/28c7613759479d413d6d to your computer and use it in GitHub Desktop.
// Face
if ( IsSenseOptionSet( SenseOption.SenseOptionID.Face, true ) ) {
var faceModule = SenseManager.QueryFace();
var faceConfiguration = faceModule.CreateActiveConfiguration();
if ( faceConfiguration == null ) throw new UnityException( "CreateActiveConfiguration returned null" );
faceConfiguration.Update();
faceConfiguration.detection.isEnabled = true;
faceConfiguration.detection.smoothingLevel = PXCMFaceConfiguration.SmoothingLevelType.SMOOTHING_DISABLED;
faceConfiguration.landmarks.isEnabled = true;
faceConfiguration.landmarks.smoothingLevel = PXCMFaceConfiguration.SmoothingLevelType.SMOOTHING_DISABLED;
// poseはR200で使えない
//faceConfiguration.pose.isEnabled = true;
faceConfiguration.pose.isEnabled = false;
faceConfiguration.pose.smoothingLevel = PXCMFaceConfiguration.SmoothingLevelType.SMOOTHING_DISABLED;
faceConfiguration.DisableAllAlerts();
faceConfiguration.strategy = PXCMFaceConfiguration.TrackingStrategyType.STRATEGY_APPEARANCE_TIME;
if ( (NumberOfDetectedFaces < 1) || (NumberOfDetectedFaces > 15) ) {
Debug.Log( "Ilegal value for Number Of Detected Faces, value is set to 1" );
NumberOfDetectedFaces = 1;
}
faceConfiguration.detection.maxTrackedFaces = NumberOfDetectedFaces;
faceConfiguration.landmarks.maxTrackedFaces = NumberOfDetectedFaces;
faceConfiguration.pose.maxTrackedFaces = NumberOfDetectedFaces;
// R200では表情は未サポート
//PXCMFaceConfiguration.ExpressionsConfiguration expressionConfig = faceConfiguration.QueryExpressions();
//expressionConfig.Enable();
//expressionConfig.EnableAllExpressions();
faceConfiguration.ApplyChanges();
faceConfiguration.Dispose();
FaceModuleOutput = faceModule.CreateOutput();
UnsetSenseOption( SenseOption.SenseOptionID.VideoColorStream );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment