depth-data
Last updated
Last updated
The most important thing while using 3D cameras is to get the depth value. This demo shows how to get the depth data from camera frame. Move the mouse in an OpenCV window and obtain the depth value of the mouse cursor position.
By adding mouse callback function on OpenCV window, we can get the (x,y) coordinate when mouse move over the window.
After converting depthFrame to OpenCV Mat format, we can retrieve the the data by cv::Mat::data
. Depth data is store in two bytes, so we use int16_t*
to access the data.
Depth data is store in row-major format. You can use the following code to get the value from given x and y coordinate.