1
A
回答
1
我发现这是解决我的问题......
我没有发现比硬编码它,如果任何人有一个更好的方法,请让我知道其他的方式。
http://www.pages.drexel.edu/~nk752/depthMapTut.html#Step%204
for (row = 0; row < H; row++) {
for (col = 0; col < W; col++) {
i = (unsigned long)(row*3*W + col*3);
tempDepth = depthMapReal[row/increment][col/increment];
if(tempDepth < 43){
depthRed = tempDepth * 6;
depthGreen = 0;
depthBlue = tempDepth * 6;
}
if(tempDepth > 42 && tempDepth < 85){
depthRed = 255 - (tempDepth - 43) * 6;
depthGreen = 0;
depthBlue = 255;
}
if(tempDepth > 84 && tempDepth < 128){
depthRed = 0;
depthGreen = (tempDepth - 85) * 6;
depthBlue = 255;
}
if(tempDepth > 127 && tempDepth < 169){
depthRed = 0;
depthGreen = 255;
depthBlue = 255 - (tempDepth - 128) * 6;
}
if(tempDepth > 168 && tempDepth < 212){
depthRed = (tempDepth - 169) * 6;
depthGreen = 255;
depthBlue = 0;
}
if(tempDepth > 211 && tempDepth < 254){
depthRed = 255;
depthGreen = 255 - (tempDepth - 212) * 6;
depthBlue = 0;
}
if(tempDepth > 253){
depthRed = 255;
depthGreen = 0;
depthBlue = 0;
}
*(m_destinationBmp + i) = depthBlue;
*(m_destinationBmp + i + 1) = depthGreen;
*(m_destinationBmp + i + 2) = depthRed;
}
}
break;
}
告诉我们您的编程环境。语言?图书馆?操作系统? – 2012-03-04 19:35:55
我更新了这些信息,谢谢! – 2012-03-04 19:36:49