0

我使用 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图像”的标准吗???

4

1 回答 1

1

ref_pix_size 和 ref_distance 包含在每个 Kinect 的硬件中,它们因 Kinect 与 Kinect 不同而不同,因为在工厂粘在硬件板上时,深度摄像头与视频摄像头的对齐方式不同。但是,如果您直接从以下位置阅读它们,则不必担心:

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。

于 2014-04-22T16:43:56.540 回答