我使用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
号码比较。
在如果我经由呼叫undistort图像相同的时间:
cvUndistort2(srcImage, dstImage, &camera1, &dist_coeffs1);
我收到良好的失真的图像,这意味着像素坐标不与单独的点比较修改,以便大幅度。
如何获得与图像相同的不失真的特定点? 谢谢。
你确定camera1和相机是一样的吗? – Sam 2011-12-14 06:47:04
是的,相同 - 我有固定的问题。感谢您指出。此外,最初我在EmguCV中收到了这样的行为,然后试图找出引入此类行为的位置:OpenCV或EmguCV本身。它出现在OpenCV中。 – sergtk 2011-12-14 12:40:47