问题
The kinect v2 provides a depth frame with the resolution of 512 x 424
pixels with a fov of 70.6 x 60 degrees
resulting in an average of about 7 x 7
pixels per degree. [Source].
However I was unable to find any kind of information about the pixel size of the depth frame, or is there any kind of method to calculate the pixel size from the given information?
回答1:
Are you asking how you to map size of pixels in the depth data?
The depth coordinate system is orthogonal with it's origin and orientation at the KINECT sensor.
Basic trigonometry tells us a relationship between opposite side and adjacent side in a right angle triangle is Tan A = a/b
, so horizontally we have tan(FOV/2) = (FrameWidth/2)/depth
, hence FrameWidth = 2*depth*tan(35.3)
, and so the width of 1px = depth*2*tan(35.3)/512
, similarly the height of 1px = depth*2*tan(30)/414
.
const int FRAME_WIDTH = 512;
const int FRAME_HEIGHT = 424;
const float FOV_HORIZONTAL = 70.6 * PI / 180.0; // convert to radians
const float FOV_VERTICAL = 60.0 * PI / 180.0; // convert to radians
const float HORIZONTAL_SCALING = 2 * std::tan(FOV_HORIZONTAL / 2.0) / (float)FRAME_WIDTH;
const float VERTICAL_SCALING = 2 * std::tan(FOV_VERTICAL / 2.0) / (float)FRAME_HEIGHT;
for each depth pixel you can compute its width and height by doing a simple scaling:
width = HORIZONTAL_SCALING * (float)depth;
height = VERTICAL_SCALING * (float)depth;
来源:https://stackoverflow.com/questions/45183735/kinect-v2-depth-frame-pixel-size