Depth (distance) images can be acquired with a resolution of 512 x 424. The measurable distance range is from 500 mm to 8000 mm, but the range to recognize human beings is from 500 mm to 4500 mm.
In the Kinect20.lib IDepthFrameSource has the "get_DepthMinReliableDistance()" and "get_DepthMaxReliableDistance()" functions, each returns 500 and 4500 respectively.
In NtKinect, the obtained Depth image is represented by UINT16 (16 bit unsigned integer) for each pixel.
type of return value | function name | descriptions |
---|---|---|
void | setDepth(bool raw = true) |
Set the Depth image to the member variable "depthImage". When this function is called with no argument or "true" as first argument, the distance is set in mm for each pixel. When this function is called with "false", a value obtained by multiplying the distance by 65535/4500 is set for each pixel. That is, the image is mapped to the luminance of the black and white image of 0 (black) to 65535 (white) with the distance of 0 mm to 4500 mm. |
type | variable name | descriptions |
---|---|---|
cv::Mat | depthImage | Depth image.
The resolution is of 512 x 424 and each pixel is represented by UINT16. The coordinates of the image are the position in the DepthSpace coordinate system.
UINT16 depth = rgbImage.at<UINT16>(y , x ); |
Call the kinect.setDepth() function and set distance data to kinect.depthImage. Since "false" is specified as an argument, the distance data is multiplied by 65535/4500.
The Depth data at the 500mm far point is 7281 (11%, black color), and the data at the 4500 mm point is 65535 (100%, white color).
main.cpp |
|
Since "false" is specified in the setDepth() function call, the Depth image displayed here is an image showing a close point (distance 0 mm) as black (0x0000) and a distant point (distance 4500 mm) as white (0xffff).
Since the above zip file may not include the latest "NtKinect.h", Download the latest version from here and replace old one with it.