BodyIndex images can be acquired with a resolution of 512 x 424 as well as Depth images. Up to six people can be distinguished at the same time.
In NtKinect, the obtained BodyIndex image is represented by uchar or cv::Vector3b for each pixel.
type of return valueåž‹ | function name | descriptions |
---|---|---|
void | setBodyIndex(bool raw = true) | Set BodyIndex image to the member variable "bodyIndexImage" If the argument raw is "true" or there is no argument, the type of each pixel is uchar. If the argument raw is "false", the type of each pixel is cv::Vec3b. |
type | variable name | descriptions | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cv::Mat | bodyIndexImage | BodyIndex image. Up to six people can be detected at the same time, and BodyIndex itself is a number from 0 to 5 assigned to each detected person. The type of each pixel of the BodyIndex image may be uchar or cv::Vec3b. The coordinates of the image are positions in the DepthSpace coordinate system.
In case of uchar data typeThe value of each pixel is 0 to 5 in the pixel where a person is detected, and 255 in the other pixels.
uchar pixel = bodyIndexImage.at<uchar>(y , x ) In case of cv::Vec3b data typeThe value of each pixel is the RGB value corresponding to the bodyIndex number.
cv::Mat pixel = bodyIndexImage.at<cv::Vec3b>(y , x )
|
Call kinect.setBodyIndex() function to set bodyIndex data for each pixel in kinect.bodyIndexImage.
main.cpp |
|
Since calling the setBodyIndex() function with "false" argument, the obtained bodyIndex image is an image of cv::Vec3b type in each pixel. In the example execution, as the person being recognized is represented by cyan (light blue), we can see that his bodyIndex is 3.
Since the above zip file may not include the latest "NtKinect.h", Download the latest version from here and replace old one with it.