연구 프로젝트에서 Kinect와 작업중인 Im은 지금까지 골격 추적을 망쳤습니다. 이제 깊이 흐름의 깊이로 들어가서 일부 깊이 스트림에서 볼 수있는 RGB 색상 비율을 만드는 방법을 알고 싶습니다. 내 것은 회색조입니다. 심도 이벤트에는 이해가 안되는 부분이 있는데 어떻게 작동하는지 이해하고 색을 바꿀 수있는 방법, 즉 intesity 변수의 정의를 이해하는 것이 중요합니다.거리에 따라 Kinect Depth를 그레이 스케일에서 RGB로 변환하려고 시도했습니다.
private void SensorDepthFrameReady(object sender, DepthImageFrameReadyEventArgs e){
using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
{
if (depthFrame != null)
{
// Copy the pixel data from the image to a temporary array
depthFrame.CopyDepthImagePixelDataTo(this.depthPixels);
// Get the min and max reliable depth for the current frame
int minDepth = depthFrame.MinDepth;
int maxDepth = depthFrame.MaxDepth;
// Convert the depth to RGB
int colorPixelIndex = 0;
for (int i = 0; i < this.depthPixels.Length; ++i)
{
// Get the depth for this pixel
short depth = depthPixels[i].Depth;
if (depth > 2000) depth = 0; //ive put this here just to test background elimination
byte intensity = (byte)(depth >= minDepth && depth <= maxDepth ? depth : 0);
//WHAT IS THIS LINE ABOVE DOING?
// Write out blue byte
this.colorPixels[colorPixelIndex++] = intensity;
// Write out green byte
this.colorPixels[colorPixelIndex++] = intensity;
// Write out red byte
this.colorPixels[colorPixelIndex++] = intensity;
// We're outputting BGR, the last byte in the 32 bits is unused so skip it
// If we were outputting BGRA, we would write alpha here.
++colorPixelIndex;
}
// Write the pixel data into our bitmap
this.colorBitmap.WritePixels(
new Int32Rect(0, 0, this.colorBitmap.PixelWidth, this.colorBitmap.PixelHeight),
this.colorPixels,
this.colorBitmap.PixelWidth * sizeof(int),
0);
}
}
}
깊이 이미지의 색상을 지정하기위한 해결책을 찾았습니까? – ThunderWiring
결국 나는 이것을위한 kinect 샘플에서 찾은 클래스를 사용했고, 파일의 이름은 DepthColorizer.cs입니다. 깊이있는 색상이있는 샘플을 살펴보십시오! – Diedre