public void Loop(LoopObjects loopObjects) { if (!_camera.Face.IsVisible) { return; } var emotionInfo = _camera.Manager.QueryEmotion(); if (emotionInfo == null) { return; } PXCMEmotion.EmotionData[] allEmotions; emotionInfo.QueryAllEmotionData(0, out allEmotions); emotionInfo.Dispose(); if (allEmotions == null) { return; } var emotions = allEmotions.Where(e => e.eid > 0 && (int)e.eid <= 64 && e.intensity > 0.4).ToList(); if (emotions.Any()) { var emotion = emotions.OrderByDescending(e => e.evidence).First(); _camera.Face.Emotion = (Emotion)emotion.eid; } else { _camera.Face.Emotion = Emotion.None; } }
public void Loop(LoopObjects loopObjects) { PXCMFaceData.Face face = loopObjects.Get <PXCMFaceData.Face>(); PXCMFaceData faceData = loopObjects.Get <PXCMFaceData>(); var rdata = face.QueryRecognition(); var userId = rdata.QueryUserID(); switch (_recognitionState) { case RecognitionState.Idle: break; case RecognitionState.Requested: rdata.RegisterUser(); _recognitionState = RecognitionState.Working; break; case RecognitionState.Working: if (userId > 0) { _recognitionState = RecognitionState.Done; } break; case RecognitionState.Done: SaveDatabase(faceData); _recognitionState = RecognitionState.Idle; break; default: throw new ArgumentOutOfRangeException(); } _camera.Face.UserId = userId; }
public void Loop(LoopObjects loopObjects) { _faceData.Update(); var face = FindFace(_faceData); if (face == null) { return; } loopObjects.Add(face); TrackFace(face); }
private void TrackFingers(Hand hand, PXCMHandData.AccessOrderType label, LoopObjects loopObjects) { var handInfo = loopObjects.Get <PXCMHandData.IHand>(label.ToString()); if (handInfo == null) { return; } TrackIndex(hand.Index, handInfo); TrackMiddle(hand.Middle, handInfo); TrackRing(hand.Ring, handInfo); TrackPinky(hand.Pinky, handInfo); TrackThumb(hand.Thumb, handInfo); }
public void Loop(LoopObjects loopObjects) { PXCMFaceData.Face face = loopObjects.Get <PXCMFaceData.Face>(); PXCMFaceData.ExpressionsData data = face?.QueryExpressions(); if (data == null) { return; } _camera.Face.Mouth.IsSmiling = CheckFaceExpression(data, FaceExpression.EXPRESSION_SMILE, SmileThreshold); _camera.Face.Mouth.IsOpen = CheckFaceExpression(data, FaceExpression.EXPRESSION_MOUTH_OPEN, MonthOpenThreshold); _camera.Face.LeftEye.IsOpen = !CheckFaceExpression(data, FaceExpression.EXPRESSION_EYES_CLOSED_LEFT, EyesClosedThreshold); _camera.Face.RightEye.IsOpen = !CheckFaceExpression(data, FaceExpression.EXPRESSION_EYES_CLOSED_RIGHT, EyesClosedThreshold); _camera.Face.EyesDirection = GetEyesDirection(data); }
public void Loop(LoopObjects loopObjects) { var handModule = _camera.Manager.QueryHand(); if (handModule == null) { return; } var handData = handModule.CreateOutput(); handData.Update(); TrackHandAndFingers(_camera.LeftHand, handData, PXCMHandData.AccessOrderType.ACCESS_ORDER_LEFT_HANDS); TrackHandAndFingers(_camera.RightHand, handData, PXCMHandData.AccessOrderType.ACCESS_ORDER_RIGHT_HANDS); handData.Dispose(); }
public void Loop(LoopObjects loopObjects) { var sample = _camera.Manager.QuerySample(); PXCMImage image = sample?.color; if (image == null) { return; } PXCMImage.ImageData imageData; image.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32, out imageData); Bitmap bitmap = imageData.ToBitmap(0, image.info.width, image.info.height); using (var ms = new MemoryStream()) { bitmap.Save(ms, ImageFormat.Bmp); _camera.ImageStream.CurrentBitmapImage = ms.ToArray(); image.ReleaseAccess(imageData); } }
public void Loop(LoopObjects loopObjects) { var segmentation = _camera.Manager.Query3DSeg(); if (segmentation == null) { return; } PXCMImage image = segmentation.AcquireSegmentedImage(); PXCMImage.ImageData imageData; image.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32, out imageData); PXCMImage.ImageInfo imageInfo = image.QueryInfo(); using (var bitmap = new Bitmap(imageData.ToBitmap(0, imageInfo.width, imageInfo.height))) { using (var ms = new MemoryStream()) { bitmap.Save(ms, ImageFormat.Bmp); _camera.SegmentationStream.CurrentBitmapImage = ms.ToArray(); image.ReleaseAccess(imageData); } } }
public void Loop(LoopObjects loopObjects) { }
public void Loop(LoopObjects loopObjects) { TrackFingers(_camera.LeftHand, PXCMHandData.AccessOrderType.ACCESS_ORDER_LEFT_HANDS, loopObjects); TrackFingers(_camera.LeftHand, PXCMHandData.AccessOrderType.ACCESS_ORDER_RIGHT_HANDS, loopObjects); }