This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WriteableBitmap createPlayerMaskWBitmap(DepthImagePixel[] depthImagePixels, ColorImagePoint[] colorImagePoints) { | |
int width = KINECT.DepthStream.FrameWidth; | |
byte[] outputColor = new Byte[KINECT.ColorStream.FramePixelDataLength]; | |
WriteableBitmap testBitmap = new WriteableBitmap(colorFrameWidth, colorFrameHeight, 96, 96, PixelFormats.Bgr32, null); | |
for (int i = 0; i < depthImagePixels.Length; i++) { | |
int colorIndex = ((colorImagePoints[i].Y * width) + colorImagePoints[i].X) * 4; | |
if (depthImagePixels[i].PlayerIndex != 0) { | |
outputColor[colorIndex] = 255; | |
outputColor[colorIndex + 1] = 255; | |
outputColor[colorIndex + 2] = 255; | |
outputColor[colorIndex + 3] = 0; | |
} else { | |
outputColor[colorIndex] = 0; | |
outputColor[colorIndex + 1] = 0; | |
outputColor[colorIndex + 2] = 0; | |
outputColor[colorIndex + 3] = 0; | |
} | |
} | |
testBitmap.WritePixels(ColorImageBitmapRect, outputColor, ColorImageStride, 0); | |
return testBitmap; | |
} |
0 件のコメント:
コメントを投稿