本文整理汇总了C#中DepthImageFormat类的典型用法代码示例。如果您正苦于以下问题:C# DepthImageFormat类的具体用法?C# DepthImageFormat怎么用?C# DepthImageFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DepthImageFormat类属于命名空间,在下文中一共展示了DepthImageFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CoordinateConverter
public CoordinateConverter(IEnumerable<byte> kinectParams, ColorImageFormat cif,
DepthImageFormat dif)
{
mapper = new CoordinateMapper(kinectParams);
this.cif = cif;
this.dif = dif;
}
开发者ID:ushadow,项目名称:handinput,代码行数:7,代码来源:CoordinateConverter.cs
示例2: KinectHelper
private KinectHelper(TransformSmoothParameters tsp, bool near = false,
ColorImageFormat colorFormat = ColorImageFormat.RgbResolution1280x960Fps12,
DepthImageFormat depthFormat = DepthImageFormat.Resolution640x480Fps30)
{
_kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected);
if (_kinectSensor == null)
{
throw new Exception("No Kinect-Sensor found.");
}
if (near)
{
_kinectSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
_kinectSensor.DepthStream.Range = DepthRange.Near;
_kinectSensor.SkeletonStream.EnableTrackingInNearRange = true;
}
DepthImageFormat = depthFormat;
ColorImageFormat = colorFormat;
_kinectSensor.SkeletonStream.Enable(tsp);
_kinectSensor.ColorStream.Enable(colorFormat);
_kinectSensor.DepthStream.Enable(depthFormat);
_kinectSensor.AllFramesReady += AllFramesReady;
_kinectSensor.Start();
_faceTracker = new FaceTracker(_kinectSensor);
}
开发者ID:rechc,项目名称:KinectMiniApps,代码行数:28,代码来源:KinectHelper.cs
示例3: ProcessData
public void ProcessData(KinectSensor kinectSensor, ColorImageFormat colorImageFormat,
byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage,
Skeleton[] skeletons, int skeletonFrameNumber)
{
if (skeletons == null)
{
return;
}
// Update the list of trackers and the trackers with the current frame information
foreach (Skeleton skeleton in skeletons)
{
if (skeleton.TrackingState == SkeletonTrackingState.Tracked ||
skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
{
// We want keep a record of any skeleton, tracked or untracked.
if (!this._trackedSkeletons.ContainsKey(skeleton.TrackingId))
{
this._trackedSkeletons.Add(skeleton.TrackingId, new SkeletonFaceTracker());
}
// Give each tracker the upated frame.
SkeletonFaceTracker skeletonFaceTracker;
if (this._trackedSkeletons.TryGetValue(skeleton.TrackingId, out skeletonFaceTracker))
{
skeletonFaceTracker.OnFrameReady(kinectSensor, colorImageFormat, colorImage, depthImageFormat,
depthImage, skeleton);
skeletonFaceTracker.LastTrackedFrame = skeletonFrameNumber;
}
}
}
RemoveOldTrackers(skeletonFrameNumber);
}
开发者ID:konni-arcadia,项目名称:kinect-data-transmitter,代码行数:34,代码来源:FaceTracker.cs
示例4: FaceTracker
/// <summary>
/// Initializes a new instance of the FaceTracker class from a reference of the Kinect device.
/// <param name="sensor">Reference to kinect sensor instance</param>
/// </summary>
public FaceTracker(KinectSensor sensor)
{
if (sensor == null) {
throw new ArgumentNullException("sensor");
}
if (!sensor.ColorStream.IsEnabled) {
throw new InvalidOperationException("Color stream is not enabled yet.");
}
if (!sensor.DepthStream.IsEnabled) {
throw new InvalidOperationException("Depth stream is not enabled yet.");
}
this.operationMode = OperationMode.Kinect;
this.coordinateMapper = sensor.CoordinateMapper;
this.initializationColorImageFormat = sensor.ColorStream.Format;
this.initializationDepthImageFormat = sensor.DepthStream.Format;
var newColorCameraConfig = new CameraConfig(
(uint)sensor.ColorStream.FrameWidth,
(uint)sensor.ColorStream.FrameHeight,
sensor.ColorStream.NominalFocalLengthInPixels,
FaceTrackingImageFormat.FTIMAGEFORMAT_UINT8_B8G8R8X8);
var newDepthCameraConfig = new CameraConfig(
(uint)sensor.DepthStream.FrameWidth,
(uint)sensor.DepthStream.FrameHeight,
sensor.DepthStream.NominalFocalLengthInPixels,
FaceTrackingImageFormat.FTIMAGEFORMAT_UINT16_D13P3);
this.Initialize(newColorCameraConfig, newDepthCameraConfig, IntPtr.Zero, IntPtr.Zero, this.DepthToColorCallback);
}
开发者ID:ushadow,项目名称:handinput,代码行数:35,代码来源:FaceTracker.cs
示例5: DepthFrameClass
public DepthFrameClass(KinectSensor sensor, DepthImageFormat depthFormat, float depthScale)
{
switch (depthFormat)
{
case DepthImageFormat.Resolution640x480Fps30:
this.FrameWidth = 640;
this.FrameHeight = 480;
break;
case DepthImageFormat.Resolution320x240Fps30:
this.FrameWidth = 320;
this.FrameHeight = 240;
break;
case DepthImageFormat.Resolution80x60Fps30:
this.FrameWidth = 80;
this.FrameHeight = 60;
break;
default:
throw new FormatException();
}
this.kinectSensor = sensor;
this.DepthScale = depthScale;
this.AllocateMemory();
}
开发者ID:YoshihisaMaruya,项目名称:TARP,代码行数:25,代码来源:DepthFrameClass.cs
示例6: KinectChooser
/// <summary>
/// Initializes a new instance of the KinectChooser class.
/// </summary>
/// <param name="game">The related game object.</param>
/// <param name="colorFormat">The desired color image format.</param>
/// <param name="depthFormat">The desired depth image format.</param>
public KinectChooser(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
: base(game)
{
this.colorImageFormat = colorFormat;
this.depthImageFormat = depthFormat;
this.nearMode = false;
this.seatedMode = false;
this.SimulateMouse = false;
if (!Game1.SIMULATE_NO_KINECT)
{
KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
this.DiscoverSensor();
}
this.statusMap.Add(KinectStatus.Undefined, "Not connected, or in use");
this.statusMap.Add(KinectStatus.Connected, string.Empty);
this.statusMap.Add(KinectStatus.DeviceNotGenuine, "Device Not Genuine");
this.statusMap.Add(KinectStatus.DeviceNotSupported, "Device Not Supported");
this.statusMap.Add(KinectStatus.Disconnected, "Required");
this.statusMap.Add(KinectStatus.Error, "Error");
this.statusMap.Add(KinectStatus.Initializing, "Initializing...");
this.statusMap.Add(KinectStatus.InsufficientBandwidth, "Insufficient Bandwidth");
this.statusMap.Add(KinectStatus.NotPowered, "Not Powered");
this.statusMap.Add(KinectStatus.NotReady, "Not Ready");
}
开发者ID:shadarath,项目名称:SpaceExplorer,代码行数:33,代码来源:KinectChooser.cs
示例7: KinectManager
/*/////////////////////////////////////////
* CONSTRUCTOR(S)/DESTRUCTOR(S)
*/
///////////////////////////////////////
public KinectManager(ColorImageFormat p_colour_format,
DepthImageFormat p_depth_format,
KinectGame_WindowsXNA p_game)
{
// Initialise the Kinect selector...
this.colour_image_format = p_colour_format;
this.depth_image_format = p_depth_format;
this.root_game = p_game;
this.colour_stream = null;
this.depth_stream = null;
this.skeleton_stream = null;
this.debug_video_stream_dimensions = new Vector2(200, 150);
status_map = new Dictionary<KinectStatus, string>();
KinectSensor.KinectSensors.StatusChanged += this.KinectSensorsStatusChanged; // handler function for changes in the Kinect system
this.DiscoverSensor();
this.status_map.Add(KinectStatus.Undefined, "UNKNOWN STATUS MESSAGE");
this.status_map.Add(KinectStatus.Connected, "Connected.");//string.Empty);
this.status_map.Add(KinectStatus.DeviceNotGenuine, "Detected device is not genuine!");
this.status_map.Add(KinectStatus.DeviceNotSupported, "Detected device is not supported!");
this.status_map.Add(KinectStatus.Disconnected, "Disconnected/Device required!");
this.status_map.Add(KinectStatus.Error, "Error in Kinect sensor!");
this.status_map.Add(KinectStatus.Initializing, "Initialising Kinect sensor...");
this.status_map.Add(KinectStatus.InsufficientBandwidth, "Insufficient bandwidth for Kinect sensor!");
this.status_map.Add(KinectStatus.NotPowered, "Detected device is not powered!");
this.status_map.Add(KinectStatus.NotReady, "Detected device is not ready!");
// Load the status message font:
this.msg_font = this.root_game.Content.Load<SpriteFont>("Fonts/Segoe16");
this.msg_label_pos = new Vector2(4.0f, 2.0f);
}
开发者ID:nhunt93,项目名称:CS3013_GROUP_9_PROJECT,代码行数:38,代码来源:KinectManager.cs
示例8: VideoShot
public VideoShot(ColorImageProcesser processer, MainWindow window, int videoNum,
KinectSensor kinectDevice,
int dWidht, int dHeight,
int cWidth, int cHeight,
DepthImageFormat dImageFormat, ColorImageFormat cImageFormat)
{
parentProcesser = processer;
videoName = PadLeft(videoNum);
_windowUI = window;
_kinectDevice = kinectDevice;
depthFrameWidth = dWidht;
depthFrameHeight = dHeight;
colorFrameWidth = cWidth;
colorFrameHeight = cHeight;
depthFrameStride = depthFrameWidth * BytesPerPixel;
colorFrameStride = colorFrameWidth * BytesPerPixel;
depthImageFormat = dImageFormat;
colorImageFormat = cImageFormat;
screenHeight = SystemParameters.PrimaryScreenHeight;
screenWidth = SystemParameters.PrimaryScreenWidth;
Start();
}
开发者ID:BillHuangg,项目名称:CMKinectImageProcess,代码行数:28,代码来源:VideoShot.cs
示例9: Kinect
public Kinect(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
: base(game)
{
this.colorImageFormat = colorFormat;
this.depthImageFormat = depthFormat;
KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
this.DiscoverSensor();
}
开发者ID:kira333,项目名称:MyProjects,代码行数:9,代码来源:Kinect.cs
示例10: MapDepthPointToSketelonPoint
/// <summary>
/// Map PointDepth3D to PointSkeleton3D
/// </summary>
/// <param name="depthImageFormat"></param>
/// <param name="pointDepth3D"></param>
/// <returns></returns>
public PointSkeleton3D MapDepthPointToSketelonPoint(DepthImageFormat depthImageFormat, PointDepth3D pointDepth3D)
{
DepthImagePoint point = new DepthImagePoint();
point.X = pointDepth3D.X;
point.Y = pointDepth3D.Y;
point.Depth = pointDepth3D.Depth;
return new PointSkeleton3D(mapper.MapDepthPointToSkeletonPoint(depthImageFormat, point));
}
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:15,代码来源:CoordinateMapperPlus.cs
示例11: MapSkeletonPointToDepthPoint
/// <summary>
/// Map PointSkeleton3D to PointDepth3D
/// </summary>
/// <param name="pointSkleton3D"></param>
/// <param name="depthImageFormat"></param>
/// <returns></returns>
public PointDepth3D MapSkeletonPointToDepthPoint(PointSkeleton3D pointSkleton3D,DepthImageFormat depthImageFormat)
{
SkeletonPoint point = new SkeletonPoint();
point.X = pointSkleton3D.X;
point.Y = pointSkleton3D.Y;
point.Z = pointSkleton3D.Z;
return new PointDepth3D(mapper.MapSkeletonPointToDepthPoint(point,depthImageFormat));
}
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:15,代码来源:CoordinateMapperPlus.cs
示例12: MapDepthPointsToSketelonPoints
/// <summary>
/// Map PointDepth3D List to PointSkeleton3D List
/// </summary>
/// <param name="depthImageFormat"></param>
/// <param name="pointDepth3D"></param>
/// <returns></returns>
public List<PointSkeleton3D> MapDepthPointsToSketelonPoints(DepthImageFormat depthImageFormat, List<PointDepth3D> pointDepth3D)
{
List<PointSkeleton3D> ret = new List<PointSkeleton3D>();
foreach (var element in pointDepth3D)
{
ret.Add(MapDepthPointToSketelonPoint(depthImageFormat, element));
}
return ret;
}
开发者ID:jiliyutou,项目名称:FingerTracking,代码行数:15,代码来源:CoordinateMapperPlus.cs
示例13: OnKinectChanged
protected override void OnKinectChanged(KinectSensor oldKinectSensor, KinectSensor newKinectSensor)
{
if (oldKinectSensor != null) {
oldKinectSensor.DepthFrameReady -= this.DepthImageReady;
kinectDepthImage.Source = null;
this.lastImageFormat = DepthImageFormat.Undefined;
}
if (newKinectSensor != null && newKinectSensor.Status == KinectStatus.Connected) {
ResetFrameRateCounters();
newKinectSensor.DepthFrameReady += this.DepthImageReady;
}
}
开发者ID:nuwud,项目名称:Robosapien,代码行数:14,代码来源:KinectDepthViewer.xaml.cs
示例14: GetDepthSize
/// <summary>
/// Get the depth image size from the depth image format.
/// </summary>
/// <param name="imageFormat">The depth image format.</param>
/// <returns>The width and height of the depth image format.</returns>
public static Size GetDepthSize(DepthImageFormat imageFormat)
{
switch (imageFormat)
{
case DepthImageFormat.Resolution320x240Fps30:
return new Size(320, 240);
case DepthImageFormat.Resolution640x480Fps30:
return new Size(640, 480);
case DepthImageFormat.Resolution80x60Fps30:
return new Size(80, 60);
case DepthImageFormat.Undefined:
return new Size(0, 0);
}
throw new ArgumentOutOfRangeException("imageFormat");
}
开发者ID:kit-cat,项目名称:ColorFaceFusion,代码行数:23,代码来源:FormatHelper.cs
示例15: KinectChooser
/// <summary>
/// Initializes a new instance of the KinectChooser class.
/// </summary>
/// <param name="game">The related game object.</param>
/// <param name="colorFormat">The desired color image format.</param>
/// <param name="depthFormat">The desired depth image format.</param>
public KinectChooser(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
: base(game)
{
this.colorImageFormat = colorFormat;
this.depthImageFormat = depthFormat;
KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
this.DiscoverSensor();
this.statusMap.Add(KinectStatus.Connected, string.Empty);
this.statusMap.Add(KinectStatus.DeviceNotGenuine, "Device Not Genuine");
this.statusMap.Add(KinectStatus.DeviceNotSupported, "Device Not Supported");
this.statusMap.Add(KinectStatus.Disconnected, "Required");
this.statusMap.Add(KinectStatus.Error, "Error");
this.statusMap.Add(KinectStatus.Initializing, "Initializing...");
this.statusMap.Add(KinectStatus.InsufficientBandwidth, "Insufficient Bandwidth");
this.statusMap.Add(KinectStatus.NotPowered, "Not Powered");
this.statusMap.Add(KinectStatus.NotReady, "Not Ready");
}
开发者ID:KinAudio,项目名称:Master,代码行数:25,代码来源:KinectChooser.cs
示例16: Render
public void Render(CompositePlayer[] players, KinectSensor sensor, DepthImageFormat format)
{
var colorizer = new BoneColorizer();
var data = players.Where(p => p.PlayerId > 0)
.Select(player =>
{
var verts = player.DepthPoints.Select(dp => sensor.CoordinateMapper.MapDepthPointToSkeletonPoint(format, dp))
.Select(sp => new Vector3(sp.X, sp.Y, sp.Z)).ToArray();
Vector3[] normals = player.DepthPoints.Select(_ => new Vector3(0, 0, -1)).ToArray();
Color[] colors = player.DepthPoints.Select(_ => Color.Gray).ToArray();
if (player.Skeleton != null && player.Skeleton.TrackingState == Microsoft.Kinect.SkeletonTrackingState.Tracked)
{
var bones = Bone.Interpret(player.Skeleton);
var interp = verts.Select(v =>
{
Bone[] close;
double[] scaling;
bones.Interpolate(v, out close, out scaling);
return new { bones = close, scaling = scaling, v = v };
}).ToArray();
colors = interp.Select(item => colorizer.Colorize(item.bones, item.scaling)).ToArray();
normals = interp.Select(item => Bone.Normal(item.v, item.bones, item.scaling)).ToArray();
//normals = verts.Select(v => Normal(Closest(player.Skeleton.Joints, v), v)).ToArray();
//colors = verts.Select(v => Closest(player.Skeleton.Joints, v)).Select(j => Colorize(j)).ToArray();
}
return new { Vertices = verts, Normals = normals, Colors = colors };
}).ToArray();
if (data.Length > 0)
{
output.SetPositions(data.SelectMany(d => d.Vertices).ToArray(),
data.SelectMany(d => d.Normals).ToArray(),
data.SelectMany(d => d.Colors).ToArray());
}
else
{
output.SetPositions(new float[0][]);
}
}
开发者ID:virrkharia,项目名称:dynamight,代码行数:39,代码来源:Rendering.cs
示例17: ProcessFrame
internal void ProcessFrame(CoordinateMapper mapper, Skeleton skeletonOfInterest, DepthImageFormat depthImageFormat)
{
_joints.Clear();
if (skeletonOfInterest != null)
{
var size = FormatHelper.GetDepthSize(depthImageFormat);
var depthWidth = (int)size.Width;
var headJoint = skeletonOfInterest.Joints[JointType.Head];
var neckJoint = skeletonOfInterest.Joints[JointType.ShoulderCenter];
var _headPoint = mapper.MapSkeletonPointToDepthPoint(headJoint.Position, depthImageFormat);
var _neckPoint = mapper.MapSkeletonPointToDepthPoint(neckJoint.Position, depthImageFormat);
_headPoint.X = depthWidth - _headPoint.X;
_neckPoint.X = depthWidth - _neckPoint.X;
_joints.Add(_headPoint);
_joints.Add(_neckPoint);
}
RaiseFrameUpdated();
}
开发者ID:kit-cat,项目名称:ColorFaceFusion,代码行数:24,代码来源:SkeletonJointViewModel.cs
示例18: ColorImageProcesser
public ColorImageProcesser(MainWindow window, KinectSensor kinectDevice,
int depthDataLength, int colorDataLength,
int dWidht, int dHeight,
int cWidth, int cHeight,
DepthImageFormat dImageFormat, ColorImageFormat cImageFormat)
{
_windowUI = window;
_kinectDevice = kinectDevice;
depthPixelData = new short[depthDataLength];
colorPixelData = new byte[colorDataLength];
depthFrameWidth = dWidht;
depthFrameHeight = dHeight;
colorFrameWidth = cWidth;
colorFrameHeight = cHeight;
depthFrameStride = depthFrameWidth * BytesPerPixel;
colorFrameStride = colorFrameWidth * BytesPerPixel;
depthImageFormat = dImageFormat;
colorImageFormat = cImageFormat;
}
开发者ID:BillHuangg,项目名称:CMKinectImageProcess,代码行数:24,代码来源:ColorImageProcesser.cs
示例19: OnFrameReady
/// <summary>
/// Updates the face tracking information for this skeleton
/// </summary>
internal void OnFrameReady(KinectSensor kinectSensor, ColorImageFormat colorImageFormat, byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage, Skeleton skeletonOfInterest)
{
this.skeletonTrackingState = skeletonOfInterest.TrackingState;
if (this.skeletonTrackingState != SkeletonTrackingState.Tracked)
{
// nothing to do with an untracked skeleton.
return;
}
if (this.faceTracker == null)
{
try
{
this.faceTracker = new FaceTracker(kinectSensor);
}
catch (InvalidOperationException)
{
// During some shutdown scenarios the FaceTracker
// is unable to be instantiated. Catch that exception
// and don't track a face.
Debug.WriteLine("AllFramesReady - creating a new FaceTracker threw an InvalidOperationException");
this.faceTracker = null;
}
}
if (this.faceTracker != null)
{
FaceTrackFrame frame = this.faceTracker.Track(
colorImageFormat, colorImage, depthImageFormat, depthImage, skeletonOfInterest);
this.lastFaceTrackSucceeded = frame.TrackSuccessful;
if (this.lastFaceTrackSucceeded)
{
if (faceTriangles == null)
{
// only need to get this once. It doesn't change.
faceTriangles = frame.GetTriangles();
}
//getting the Animation Unit Coefficients
this.AUs = frame.GetAnimationUnitCoefficients();
var jawLowerer = AUs[AnimationUnit.JawLower];
var browLower = AUs[AnimationUnit.BrowLower];
var browRaiser = AUs[AnimationUnit.BrowRaiser];
var lipDepressor = AUs[AnimationUnit.LipCornerDepressor];
var lipRaiser = AUs[AnimationUnit.LipRaiser];
var lipStretcher = AUs[AnimationUnit.LipStretcher];
//set up file for output
using (System.IO.StreamWriter file = new System.IO.StreamWriter
(@"C:\Users\Public\data.txt"))
{
file.WriteLine("FaceTrack Data, started recording at " + DateTime.Now.ToString("HH:mm:ss tt"));
}
//here is the algorithm to test different facial features
//BrowLower is messed up if you wear glasses, works if you don't wear 'em
//surprised
if ((jawLowerer < 0.25 || jawLowerer > 0.25) && browLower < 0)
{
System.Diagnostics.Debug.WriteLine("surprised");
using (System.IO.StreamWriter file = new System.IO.StreamWriter
(@"C:\Users\Public\data.txt", true))
{
file.WriteLine(DateTime.Now.ToString("HH:mm:ss tt") + ": surprised");
file.WriteLine("JawLowerer: " + jawLowerer);
file.WriteLine("BrowLowerer: " + browLower);
}
}
//smiling
if (lipStretcher > 0.4 || lipDepressor<0)
{
System.Diagnostics.Debug.WriteLine("Smiling");
using (System.IO.StreamWriter file = new System.IO.StreamWriter
(@"C:\Users\Public\data.txt", true))
{
file.WriteLine(DateTime.Now.ToString("HH:mm:ss tt") + ": smiling");
file.WriteLine("LipStretcher: " + lipStretcher);
}
}
//kissing face
if (lipStretcher < -0.75)
{
System.Diagnostics.Debug.WriteLine("kissing face");
using (System.IO.StreamWriter file = new System.IO.StreamWriter
(@"C:\Users\Public\data.txt", true))
{
file.WriteLine(DateTime.Now.ToString("HH:mm:ss tt") + ": kissing face");
file.WriteLine("LipStretcher: " + lipStretcher);
}
}
//sad
if (browRaiser < 0 && lipDepressor>0)
{
System.Diagnostics.Debug.WriteLine("sad");
//.........这里部分代码省略.........
开发者ID:Phoberos,项目名称:thesis-facetracking,代码行数:101,代码来源:FaceTrackingViewer.xaml.cs
示例20: OnFrameReady
/// <summary>
/// Updates the face tracking information for this skeleton
/// </summary>
internal void OnFrameReady(KinectSensor kinectSensor, ColorImageFormat colorImageFormat, byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage, Skeleton skeletonOfInterest, FaceRecognitionActivityWindow win)
{
if (CheckFace(kinectSensor, colorImageFormat, colorImage, depthImageFormat, depthImage, skeletonOfInterest))
{
count++;
}
else count = 0;
if (count == 1)
{
count = 0;
currentState = (currentState + 1) % 3;
// highlight the next exercise
if (currentState == 0)
{
Color tileFill = Color.FromRgb(76, 76, 76);
SolidColorBrush brush1 = new SolidColorBrush(tileFill);
win.SadTile.Fill = brush1;
Color focusTileFill = Color.FromRgb(96, 96, 96);
SolidColorBrush brush2 = new SolidColorBrush(focusTileFill);
win.HappyTile.Fill = brush2;
Color secTileFill = Color.FromRgb(76, 76, 76);
SolidColorBrush brush3 = new SolidColorBrush(tileFill);
win.AngryTile.Fill = brush3;
// display the large icon
win.ActivityImage.Source = new BitmapImage(new Uri(@"happy_big.png"));
win.ActivityLabel.Content = "Happy";
}
else if (currentState == 1)
{
Color tileFill = Color.FromRgb(96, 96, 96);
SolidColorBrush brush1 = new SolidColorBrush(tileFill);
win.SadTile.Fill = brush1;
Color focusTileFill = Color.FromRgb(76, 76, 76);
SolidColorBrush brush2 = new SolidColorBrush(focusTileFill);
win.HappyTile.Fill = brush2;
Color secTileFill = Color.FromRgb(76, 76, 76);
SolidColorBrush brush3 = new SolidColorBrush(tileFill);
win.AngryTile.Fill = brush3;
// display the large icon
win.ActivityImage.Source = new BitmapImage(new Uri(@"sad_big.png"));
win.ActivityLabel.Content = "Sad";
}
else if (currentState == 2)
{
Color tileFill = Color.FromRgb(76, 76, 76);
SolidColorBrush brush1 = new SolidColorBrush(tileFill);
win.SadTile.Fill = brush1;
Color focusTileFill = Color.FromRgb(76, 76, 76);
SolidColorBrush brush2 = new SolidColorBrush(focusTileFill);
win.HappyTile.Fill = brush2;
Color secTileFill = Color.FromRgb(96, 96, 96);
SolidColorBrush brush3 = new SolidColorBrush(tileFill);
win.AngryTile.Fill = brush3;
// display the large icon
win.ActivityImage.Source = new BitmapImage(new Uri(@"angry_big.png"));
win.ActivityLabel.Content = "Angry";
}
this.speech.SpeakAsync("Moving to next level");
// Notify to change face
Trace.WriteLine("Change state to: " + states[currentState]);
}
}
开发者ID:Hitchhikrr,项目名称:harley,代码行数:79,代码来源:FaceTrackingViewer.xaml.cs
注:本文中的DepthImageFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论