我自己写了freenect_camera_to_world,但是

时间:2013-07-10 03:17:40

标签: kinect calibration

我使用opencv和openNi来校准kinect和我的高清摄像机,使用RGBDCaptureKinect中的方法, 它使用freenect_camera_to_world来

原始代码:

// camera -> world coordinate helper function
void freenect_camera_to_world(freenect_device* dev, int cx, int cy, int wz, double* wx, double* wy)
{
    double ref_pix_size = dev->registration.zero_plane_info.reference_pixel_size;
    double ref_distance = dev->registration.zero_plane_info.reference_distance;

      // We multiply cx and cy by these factors because they come from a 640x480 image,

// but the zero plane pixel size is for a 1280x1024 image.

// However, the 640x480 image is produced by cropping the 1280x1024 image

// to 1280x960 and then scaling by .5, so aspect ratio is maintained, and

// we should simply multiply by two in each dimension.
double factor = 2 * ref_pix_size * wz / ref_distance;
*wx = (double)(cx - DEPTH_X_RES/2) * factor;
*wy = (double)(cy - DEPTH_Y_RES/2) * factor;
}

我自己写了freenect_camera_to_world函数,但我不知道它是不是正确?

void freenect_camera_to_world(int cx,int cy,int wz, double *wx,double *wy)
{
double ref_pix_size = 0.1042; //how can I know these two value for my kienct?
double ref_distance = 120.0; 

double factor = 2*ref_pix_size*wz/ref_distance;
*wx = (double)(cx - DEPTH_X_RES/2)*factor;
*wy = (double)(cy - DEPTH_Y_RES/2)*factor;
}

1,我如何知道我的kienct这两个值?ref_pix_size& ref_distance

2,它是“零平面像素大小是1280x1024图像的标准”。???

1 个答案:

答案 0 :(得分:1)

ref_pix_size& ref_distance包含在每个Kinect的硬件中,它们与Kinect和Kinect不同,因为Depth相机与摄像机的位置不同,因为在工厂硬件板粘合时会有微小的差异。但如果你直接从以下网址阅读,你就不用担心:

dev->registration.zero_plane_info.reference_pixel_size;
dev->registration.zero_plane_info.reference_distance;

您可以在对kinect进行立体声校准后对其进行计算:http://wiki.ros.org/kinect_calibration/technical 但是你不需要手动校准它,因为freenect具有非常好的默认参数来使用FREENECT_DEPTH_REGISTERED来对齐颜色和深度图像。