【发布时间】:2011-12-14 05:43:40
【问题描述】:
在相机校准后,我使用 OpenCV 对一组点进行还原。 代码如下。
const int npoints = 2; // number of point specified
// Points initialization.
// Only 2 ponts in this example, in real code they are read from file.
float input_points[npoints][2] = {{0,0}, {2560, 1920}};
CvMat * src = cvCreateMat(1, npoints, CV_32FC2);
CvMat * dst = cvCreateMat(1, npoints, CV_32FC2);
// fill src matrix
float * src_ptr = (float*)src->data.ptr;
for (int pi = 0; pi < npoints; ++pi) {
for (int ci = 0; ci < 2; ++ci) {
*(src_ptr + pi * 2 + ci) = input_points[pi][ci];
}
}
cvUndistortPoints(src, dst, &camera1, &distCoeffs1);
dst上面的代码后面包含以下数字:
-8.82689655e-001 -7.05507338e-001 4.16228324e-001 3.04863811e-001
与src 中的数字相比太小了。
同时,如果我通过调用不失真图像:
cvUndistort2( srcImage, dstImage, &camera1, &dist_coeffs1 );
我收到了良好的未失真图像,这意味着与单独的点相比,像素坐标没有被大幅修改。
如何获得与图像相同的特定点的不失真? 谢谢。
【问题讨论】:
-
你确定camera1和camera是一样的吗?
-
是的,同样 - 我有固定的问题。谢谢你指出。此外,最初我在 EmguCV 中收到这种行为,然后试图找出这种行为是在哪里引入的:在 OpenCV 或 EmguCV 本身中。它出现在 OpenCV 中。