我正在尝试从颜色流中创建一个相反的镜像图片,即当右手向上移动时,我希望 kinect 将绘制左侧必须向上移动(不像在右手举起的真实镜子前面)我想操纵彩色图像来做到这一点:只需移动 X 位置。但是,我得到一个蓝屏:
void kinectSensor_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
{
try
{
using (ColorImageFrame colorImageFrame = e.OpenColorImageFrame())
{
if (colorImageFrame != null)
{
byte[] pixelsFromFrame = new byte[colorImageFrame.PixelDataLength];
colorImageFrame.CopyPixelDataTo(pixelsFromFrame);
Color[] color = new Color[colorImageFrame.Height * colorImageFrame.Width];
kinectRGBVideo = new Texture2D(graphics.GraphicsDevice, colorImageFrame.Width, colorImageFrame.Height);
// Go through each pixel and set the bytes correctly
// Remember, each pixel got a Rad, Green and Blue
int index = 0;
for (int y = 0; y < colorImageFrame.Height; y++)
{
for (int x = 0; x < colorImageFrame.Width; x++, index += 4)
{
color[(y * colorImageFrame.Width + x)] = new Color(pixelsFromFrame[(y+1)*(2560 -index)],
pixelsFromFrame[(y + 1) * (2560 - index)],
pixelsFromFrame[(y + 1) * (2560 - index)]);
}
}
// Set pixeldata from the ColorImageFrame to a Texture2D
kinectRGBVideo.SetData(color);
}
}
}
catch {
}
}
谁能告诉我什么是wearg?谢谢埃雷兹