1

私は Kinect プログラミングを行っており、カラー ストリームを有効にすると、毎秒 30 フレームのベイヤー形式 (ColorImageFormat.RawBayerResolution640x480Fps30) を使用するように定義しました。

画像をレンダリングするときは、次のコードを使用します。

    PixelFormat format = PixelFormats.Bgr32;

    // Bitmap source to write to.
    WriteableBitmap src = new WriteableBitmap((int)_kinectSensor.ColorStream.FrameWidth, (int)_kinectSensor.ColorStream.FrameHeight, 96, 96, format, null);

    // Stride for image.
    var stride = (int)_kinectSensor.ColorStream.FrameWidth * format.BitsPerPixel / 8;

    // Write pixels to bitmap source.
    src.WritePixels(new Int32Rect(0, 0, (int)imgPic.Width, (int)imgPic.Height), rawBayerPixels, stride, 0);

    // Set XAML image source = Bitmap source.
    imgPic.Source = src;

選択した ColorImageFormat に基づいて、上記のようにハードコーディングせずに PixelFormat をワークアウトするにはどうすればよいですか?

前もって感謝します!

4

1 に答える 1