Advertisement

Reconstruct from a disparity map

Started by July 22, 2004 10:58 AM
3 comments, last by jcgs 20 years, 7 months ago
Hi, From a disparity image (grayscale I mean) I get 3D coordenates and save them in a txt file. From that txt file I wish to reconstruct the image from the points. Between all the points there is the same distance, like a grid. Now, I want to do the invers process. From the coordenates 3D I want to reconstruct the image. Any ideas or code that could be useful? Thanks
Convert the 3D coordinates' y value to the appropriate range (0 - 255 for 8bit greyscale) and save as bitmap, targa or whetever.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Advertisement
for determining the grayscale value, how about:
y_range = max_y - min_y;
for (int i = 0; i < num_pnts; i++)
{
gray_here = (int)((pnt.y - min_y) / y_range + . 5) * 255;
}

the only problem i can see with this is if original image used to create the heightmap doesn't include pure white and pure black, but the code above should produce at least one black value and one white value.
Do you scale the heights of the vertices when you read them from the image? If so, store this scaling factor in the .txt file, so when you read the values from that file, you can scale them back to the original 0-255 range.
Hi,
First thanks to all for your answers.

I will explain a little more what im doing. From two webcams I capture images from a scene. The webcams are in a stereo configuration. With OpenCV functions (OpenCV are Intel VC++ functions for image processing) I take an image from each webcam, then I calcule a disparity map from both image. Finally from that map I take coordinate' z. How? I try to asign a value depending of the gray level. For a black pixel corresponds the infinity and I put a 0 in z' coordinate, in case of a white pixel I put the maximun value, but what is that value?. In other words, what are the max_z and min_z values?
The second question is how I could reconstruct image from 3D coordinates?
The third, there is any code that reconstruct image from a TGA file?
Thanks for all

This topic is closed to new replies.

Advertisement