Skip to content

Instantly share code, notes, and snippets.

@non117 non117/cut.cs
Created Dec 13, 2014

Embed
What would you like to do?
for (int y = 0; y < depthHeight; ++y)
{
for (int x = 0; x < depthWidth; ++x)
{
int depthIndex = (y * depthWidth) + x;
byte player = bodyIndexBuffer[depthIndex];
if (player != 0xff)
{
ushort depth = depthBuffer[depthIndex];
ColorSpacePoint colorPoint = this.coordinateMapper.MapDepthPointToColorSpace(x, y, depth);
// 値のチェックをここですべき
CameraSpacePoint worldPoint = this.coordinateMapper.MapDepthPointToCameraSpace(x, y, depth);
int colorX = (int)Math.Floor(colorPoint.X + 0.5);
int colorY = (int)Math.Floor(colorPoint.Y + 0.5);
// 境界値チェックすべき
int colorIndex = ((colorY * colorSize.Width) + colorX) * bytesPerPixel; // チャンネル数
byte r = colorPixels[colorIndex + redOffset]
// ....
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.