Need Help with Accessing the kinect Depth Image using OpenCV.
Hi All,
I tried to subscribe to kinect depth and color image topics from openni_launch..(/camera/rgb/image_color and /camera/depth/image )
I converted them to cv::Mat format using below code.
cv_rgb = cv_bridge::toCvCopy(color_image, enc::BGR8); cv_depth = cv_bridge::toCvCopy(depth_image, enc::BGR8); (I am not sure about this line)
Now I want to access each pixel values of both color and depth image. I am able to access the rgb image by the below code.
for(int i=0; i<cv_rgb->image.rows; i++)
{
for(int j=0; j<cv_rgb->image.cols; j++)
{
cv_rgb->image.at<cv::Vec3b>(i,j)[0] = 0;
cv_rgb->image.at<cv::Vec3b>(i,j)[1] = 0;
cv_rgb->image.at<cv::Vec3b>(i,j)[2] = 0;
}
}
I am unable to access the kinect depth image. It says me the type is 21. and Its a single channel image. Can anybody suggest me a way that I can access each pixel values of Kinect and how can this pixel values be translated in terms of real distance in mm ?