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

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

            if (!NewTimeStamp(frame.Time))
            {
                frame.Dispose();
                return(null);
            }
            return(frame);
        }
Ejemplo n.º 5
0
        Bitmap Convert(V2DepthFrame frame)
        {
            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);

            var buffer=new Int16[frame.BufferSize];
            Marshal.Copy(frame.Buffer, buffer, 0, buffer.Length);

            Marshal.Copy(buffer.SelectMany(d =>{
                    var dd=(Byte)((int)(d));
                    return new Byte[] { dd, dd, dd, dd }; 
                }).ToArray()
                , 0, data.Scan0, (Int32)(buffer.Length * 4));

            m_bitmap.UnlockBits(data);
            return m_bitmap;
        }
Ejemplo n.º 6
0
        public override KinectBaseImageFrame GetFrame()
        {
            try
            {
                var frame = new V2DepthFrame(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;
            }
        }