Reputation: 702
I am trying to figure out how to detect an object and it's X,Y,Z position in real world using Kinect's RGB and Depth camera.
I read this question: Kinect intrinsic parameters from field of view
To apply this, I need Xv, Yv, and Zw..
So far, I have successfully detected an object from the RGB camera (Xv,Yv position on screen), but I am not sure how to get the Zw value from the depth camera "correctly".
Here is the picture of the object that I'm detecting (right: only RGB, left: RGB+Depth overlay)
The red object detection rectangle on the right window is perfectly fine, but on the left window, the rectangle has slightly drifted away from the depth image. That means that I cannot simply read the value at (Xv, Yv) from Depth camera and use it as Zw value.
P.S. I'm using freenect and opencv on Ubuntu
Please help me figure out how to get the object's Z position.
Upvotes: 0
Views: 1152
Reputation: 510
If you look at the docs of HighGUI carefully, there is a flag called CV_CAP_PROP_OPENNI_REGISTRATION that indicates two camera's values remapped or not.
Try
VideoCapture capture(CV_CAP_OPENNI);
..
capture.set(CV_CAP_PROP_OPENNI_REGISTRATION,0);
Upvotes: 1