private void MultiSourceFrameReader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e)
        {
            ColorFrame colorFrame = null;
            BodyFrame  bodyFrame  = null;

            try
            {
                MultiSourceFrame parentFrame = e.FrameReference.AcquireFrame();
                colorFrame = parentFrame.ColorFrameReference.AcquireFrame();
                bodyFrame  = parentFrame.BodyFrameReference.AcquireFrame();

                if (colorFrame != null && bodyFrame != null)
                {
                    FPS         = (int)(1.0 / colorFrame.ColorCameraSettings.FrameInterval.TotalSeconds);
                    IgnoreFrame = FPS > 16 && Force15FPS ? !IgnoreFrame : false;

                    if (ROI == null)
                    {
                        SetROI(colorFrame.FrameDescription);
                    }

                    if (bodyFrame != null && PositionHelper.HasValue)
                    {
                        Skeleton skeleton = bodyFrame.ToSkeleton();
                        if (skeleton != null)
                        {
                            if (Gait.POV == POV.Unknown)
                            {
                                if (Math.Abs(PositionHelper.Value) < FPS * 4)
                                {
                                    ReferenceSkeletonSequence.Add(skeleton);
                                    PositionHelper += (skeleton.Joints[JointType.HandLeft].DistanceFromCamera() >
                                                       skeleton.Joints[JointType.HandRight].DistanceFromCamera()) ? 1 : -1;
                                }
                                else
                                {
                                    POV inferredPosition = PositionHelper < 0 ? POV.Left : POV.Right;
                                    Gait = new Gait(ReferenceSkeletonSequence.AvgSkeleton(), inferredPosition);
                                }
                            }
                            else
                            {
                                Gait.Refresh(skeleton);
                            }
                        }
                    }

                    BitmapSource newBitmap = null;
                    if (!IgnoreFrame)
                    {
                        newBitmap = colorFrame.ToCroppedBitmap(ROI);
                    }
                    OnFrameProcessed(newBitmap, DateTime.UtcNow.Ticks, FPS);
                }
            }
            finally
            {
                if (colorFrame != null)
                {
                    colorFrame.Dispose();
                }
                if (bodyFrame != null)
                {
                    bodyFrame.Dispose();
                }
            }
        }