Disparity image reconstruction
I am using two prosilica cameras in order to generate the disparity image. by the help of stereo_image_proc I can generate the disparity image and is available in /stereo/disparity_image topic. Now in another node I am reconstructing the disparity image using raw data[].
int count = 0;
sensor_msgs::Image img = disp.image;
int h = (img.height);
int w = (img.width);
cv::WImageBuffer3_b pic(h,w);
ROS_INFO("height width and step [%d] [%d] [%d]" ,img.height,img.width,img.step);
count = 0;
for(int i=(h-1);i>=0;i--) {
for(int j=(w-1);j>=0;j--) {
count++;
*(pic(i,j)) = (img.data[count]);
count++;
*(pic(i,j)+1) = (img.data[count]);
count++;
*(pic(i,j)+2) = (img.data[count]);
count++;
}
}
for each set of pixel data I am ignoring one data as it provides the depth.. during viewing the reconstructed image only the colors get swaped. that menas the portion with green switched to some other color and so on..
in the DosparityImage format there is a fuled name Image. In Image field there is data[]. is that data contains RGB and Depth info raw data of the iamge or something else.. thanks in advance ????