Esempio n. 1
0
 public override KinectBaseImageFrame GetFrame(IntPtr handle)
 {
     var frame = new V2ImageFrame(m_reader, handle);
     if (!NewTimeStamp(frame.Time))
     {
         frame.Dispose();
         return null;
     }
     return frame;
 }
Esempio n. 2
0
 public override KinectBaseImageFrame GetFrame()
 {
     var frame = new V2ImageFrame(m_reader.AcquireLatestFrame());
     if (!NewTimeStamp(frame.Time))
     {
         frame.Dispose();
         return null;
     }
     return frame;
 }
Esempio n. 3
0
        public override KinectBaseImageFrame GetFrame(IntPtr handle)
        {
            var frame = new V2ImageFrame(m_reader, handle);

            if (!NewTimeStamp(frame.Time))
            {
                frame.Dispose();
                return(null);
            }
            return(frame);
        }
Esempio n. 4
0
        public override KinectBaseImageFrame GetFrame()
        {
            var frame = new V2ImageFrame(m_reader.AcquireLatestFrame());

            if (!NewTimeStamp(frame.Time))
            {
                frame.Dispose();
                return(null);
            }
            return(frame);
        }
Esempio n. 5
0
        Bitmap Convert(V2ImageFrame frame)
        {
            if (frame.Format == ColorImageFormat.ColorImageFormat_Bgra)
            {
                throw new NotImplementedException();
            }
            else
            {
                if (m_bitmap == null)
                {
                    m_bitmap = new Bitmap(frame.Width, frame.Height, PixelFormat.Format32bppRgb);
                }
                var data=m_bitmap.LockBits(new Rectangle(0, 0, m_bitmap.Width, m_bitmap.Height)
                    , System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
                frame.CopyConvertedFrameDataToArray(data.Stride * data.Height, data.Scan0);
                m_bitmap.UnlockBits(data);
                return m_bitmap;
            }

        }
Esempio n. 6
0
        public override KinectBaseImageFrame GetFrame()
        {
            try
            {
                if (waitHandle != null)
                {
                    m_data = m_reader.GetFrameArrivedEventData(waitHandle);
                    m_frameRef = m_data.get_FrameReference();
                    var frame = new V2ImageFrame(m_frameRef.AcquireFrame());
                    if (!NewTimeStamp(frame.Time))
                    {
                        return null;
                    }
                    return frame;
                }
                else
                {
                    var frame = new V2ImageFrame(m_reader.AcquireLatestFrame());
                    if (!NewTimeStamp(frame.Time))
                    {
                        return null;
                    }
                    return frame;
                }
            }
            catch (COMException ex)
            {
                if ((UInt32)ex.ErrorCode == 0x8000000A)
                {

                }
                else
                {
                    Console.WriteLine(ex);
                }
                return null;
            }
        }