I am trying to convert RGB coordinates of libfreenect to DEPTH coordinates to find the z coordinate (object distance). I tried so many things, but I couldn’t get the resolutions right. Any ideas?
I am using rgbmat to apply a Kalman filter. Therefore, I only have the coordinates of the center of the RGB object:
libfreenect2::Frame undistorted(512, 424, 4), registered(512, 424, 4), depth2rgb(1920, 1080 + 2, 4);
libfreenect2::Frame *rgb = frames[libfreenect2::Frame::Color];
Mat(rgb->height, rgb->width, CV_8UC4, rgb->data).copyTo(rgbmat);
registration->apply(rgb, depth, &undistorted, ®istered, true, &depth2rgb);
Search for xyz coordinates from an undistorted frame, with input center X and center Y from rgb frame:
float centerX, centerY, centerZ;
registration->getPointXYZ(&undistorted, center.y, center.x, centerX, centerY, centerZ);
With this code, the output is always wrong. In most cases, the values are "inf" or "-inf". When I execute my tracking algorithm on registered frames, the output (distance) is correct, although I cannot use registered frames because I need to analyze RGB frames.
"" getPointXYZ() "depth2rgb", : (
RGB ?