public ColorFrame(Microsoft.Kinect.ColorFrame cf) { Type = FrameType.Color; underlyingColorFrame = cf; FrameDescription cfd = underlyingColorFrame.CreateFrameDescription(ColorImageFormat.Bgra); Width = cfd.Width; Height = cfd.Height; // Stride is the number of bytes allocated for one scanline of the bitmap // Fact: Scanlines must be aligned on 32-bit boundaries // So, each scanline may have padded bytes at the end to ensure this // so stride is: ((w * bitsPerPixel + (padBits-1)) / padBits) * padToNBytes // where padBits = 8 * padToNBytes // See https://msdn.microsoft.com/en-us/library/windows/desktop/aa473780(v=vs.85).aspx stride = (Width * PixelFormats.Bgra32.BitsPerPixel + 7) / 8; if (colorData == null) { colorData = new byte[stride * Height]; using (KinectBuffer colorBuffer = cf.LockRawImageBuffer()) { // TODO: crop and convert to jpeg. underlyingColorFrame.CopyConvertedFrameDataToArray(colorData, ColorImageFormat.Bgra); } colorDataBitmap = new Bitmap(Width, Height, stride, System.Drawing.Imaging.PixelFormat.Format32bppArgb, Marshal.UnsafeAddrOfPinnedArrayElement(colorData, 0)); } }
public SegmentedColorFrame(Microsoft.Kinect.ColorFrame cf, ClosestBodyFrame cbf) : base(cf) { underlyingClosestBodyFrame = cbf; SetCenter(); // If unable to segment, then the reader should return a null frame segmented = Segment(); // No need to threshold because there is no depth data }
public ColorFrame(Microsoft.Kinect.ColorFrame colorFrame) { _colorFrame = colorFrame ?? throw new ArgumentNullException(nameof(colorFrame)); }
public HeadColorFrame(Microsoft.Kinect.ColorFrame cf, ClosestBodyFrame cbf) : base(cf, cbf) { Type = FrameType.HeadColor; }