Пример #1
0
        /// <summary>
        /// Returns true if DetailedGear instances are equal
        /// </summary>
        /// <param name="other">Instance of DetailedGear to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DetailedGear other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     BrandName == other.BrandName ||
                     BrandName != null &&
                     BrandName.Equals(other.BrandName)
                     ) &&
                 (
                     ModelName == other.ModelName ||
                     ModelName != null &&
                     ModelName.Equals(other.ModelName)
                 ) &&
                 (
                     FrameType == other.FrameType ||
                     FrameType != null &&
                     FrameType.Equals(other.FrameType)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ));
        }
Пример #2
0
 public IUIObject CreateFrame(FrameType frameType, string name, IFrame parent, string inherits)
 {
     if (frameType.Equals(FrameType.Frame))
     {
         return(MockFrame(name, parent, inherits).Object);
     }
     throw new NotImplementedException();
 }
Пример #3
0
        private void MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e)
        {
            if (m_frameBool)
            {
                //pull multisource frame reference out
                MultiSourceFrame multiSourceFrame = e.FrameReference.AcquireFrame();
                //Return on null
                if (multiSourceFrame is null)
                {
                    return;
                }
                //Calibration and full get sampled number of frames
                if ((m_currentFrameType.Equals(FrameType.Calibration) || m_currentFrameType.Equals(FrameType.Full)))
                {
                    using (DepthFrame depthFrame = multiSourceFrame.DepthFrameReference.AcquireFrame())
                    {
                        //Store one frame
                        m_tempDepthData[m_sampleIndex] = new ushort[m_depthFrameDescription.Width * m_depthFrameDescription.Height];
                        depthFrame.CopyFrameDataToArray(m_tempDepthData[m_sampleIndex]);
                        m_minDepth = depthFrame.DepthMinReliableDistance;
                        m_maxDepth = depthFrame.DepthMaxReliableDistance;
                    }
                    //...until all samples are acquired
                    if (m_sampleIndex == m_samplingRate - 1)
                    {
                        //Then clean the points
                        CleanDepth();
                    }
                    else
                    {
                        //Not done, get next sample
                        m_sampleIndex++;
                        return;
                    }
                }
                //Instantiate images
                m_depthImage    = new WriteableBitmap(m_depthFrameDescription.Width, m_depthFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null);
                m_colorImage    = new WriteableBitmap(m_colorFrameDescription.Width, m_colorFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null);
                m_infraredImage = new WriteableBitmap(m_infraredFrameDescription.Width, m_infraredFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null);
                switch (m_currentFrameType)
                {
                case FrameType.Alignment:
                    using (DepthFrame depthframe = multiSourceFrame.DepthFrameReference.AcquireFrame())
                    {
                        depthframe.CopyFrameDataToArray(m_depthData);
                        m_maxDepth = depthframe.DepthMaxReliableDistance;
                        m_minDepth = depthframe.DepthMinReliableDistance;
                        ProcessDepth();
                        KinectFrameArgs args = new KinectFrameArgs(FrameType.Alignment, m_depthImage);
                        args.pointCloudV3 = m_cameraSpacePoints.Where(x => x.X != float.NegativeInfinity).Select(x => new Vector3(x.X, x.Y, x.Z)).ToArray();
                        FrameArrived.Invoke(HelperContext, args);
                    }
                    break;

                case FrameType.Calibration:
                    ProcessDepth();
                    FrameArrived.Invoke(HelperContext, new KinectFrameArgs(FrameType.Calibration, m_depthImage));
                    break;

                case FrameType.Full:
                    using (ColorFrame colorFrame = multiSourceFrame.ColorFrameReference.AcquireFrame())
                        using (InfraredFrame infraredFrame = multiSourceFrame.InfraredFrameReference.AcquireFrame())
                        {
                            ProcessDepth();
                            ProcessColor(colorFrame);
                            ProcessInfrared(infraredFrame);
                            KinectFrameArgs args = new KinectFrameArgs(FrameType.Full, m_depthImage, m_colorImage, m_infraredImage);
                            args.pointCloudCSP = m_cameraSpacePoints;
                            args.pointCloudV3  = m_cameraSpacePoints.Where(x => x.X != float.NegativeInfinity).Select(x => new Vector3(x.X, x.Y, x.Z)).ToArray();
                            FrameArrived.Invoke(HelperContext, args);
                        }
                    break;
                }
                m_frameBool = false;
            }
            else
            {
                return;
            }
        }