通过基本矩阵对未校准的摄像机进行校正 [英] Rectification of uncalibrated cameras, via fundamental matrix

查看:311
本文介绍了通过基本矩阵对未校准的摄像机进行校正的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Emgu / OpenCV对Kinect相机和外部相机进行校准。
我被困住了,我将不胜感激。

I'm trying to do calibration of Kinect camera and external camera, with Emgu/OpenCV. I'm stuck and I would really appreciate any help.

我选择通过基本矩阵(即对极几何)进行此操作。
但是结果与我预期的不同。结果图像为黑色,或完全没有意义。
Mapx和Mapy点通常都等于无穷大或-无穷大,或者都等于0.00,并且很少有正则值。

I've choose do this via fundamental matrix, i.e. epipolar geometry. But the result is not as I've expected. Result images are black, or have no sense at all. Mapx and mapy points are usually all equal to infinite or - infinite, or all equals to 0.00, and rarely have regular values.

这是我尝试进行纠正的方法:

This is how I tried to do rectification:

1。)查找图像点从一组图像中获得两个图像点阵列(每个摄像机一个)。我已经使用国际象棋棋盘和FindChessboardCorners函数完成了此操作。

1.) Find image points get two arrays of image points (one for every camera) from set of images. I've done this with chessboard and FindChessboardCorners function.

2。)查找基本矩阵

 CvInvoke.cvFindFundamentalMat(points1Matrix, points2Matrix, 
_fundamentalMatrix.Ptr, CV_FM.CV_FM_RANSAC,1.0, 0.99, IntPtr.Zero);

我是否要传递整套图像中的所有采集点,或者只是传递试图校正的两个图像中的所有采集点?

Do I pass all collected points from whole set of images, or just from two images trying to rectify?

3。)查找单应性矩阵

 CvInvoke.cvStereoRectifyUncalibrated(points11Matrix, points21Matrix, 
_fundamentalMatrix.Ptr, Size, h1.Ptr, h2.Ptr, threshold);

4。)获取mapx和mapy

double scale = 0.02;
CvInvoke.cvInvert(_M1.Ptr, _iM.Ptr, SOLVE_METHOD.CV_LU);

CvInvoke.cvMul(_H1.Ptr, _M1.Ptr, _R1.Ptr,scale);
CvInvoke.cvMul(_iM.Ptr, _R1.Ptr, _R1.Ptr, scale);
CvInvoke.cvInvert(_M2.Ptr, _iM.Ptr, SOLVE_METHOD.CV_LU);
CvInvoke.cvMul(_H2.Ptr, _M2.Ptr, _R2.Ptr, scale);
CvInvoke.cvMul(_iM.Ptr, _R2.Ptr, _R2.Ptr, scale);

CvInvoke.cvInitUndistortRectifyMap(_M1.Ptr,_D1.Ptr, _R1.Ptr, _M1.Ptr, 
mapxLeft.Ptr, mapyLeft.Ptr) ;

我这里有一个问题...因为我没有使用校准过的图像,所以我的相机是什么矩阵和失真系数?如何从基本矩阵或单应性矩阵中获得它?

I have a problem here...since I'm not using calibrated images, what is my camera matrix and distortion coefficients ? How can I get it from fundamental matrix or homography matrices?

5。)重新映射

CvInvoke.cvRemap(src.Ptr, destRight.Ptr, mapxRight, mapyRight, 
(int)INTER.CV_INTER_LINEAR, new MCvScalar(255));

这不会返回好的结果。如果有人告诉我我在做什么错,我将不胜感激。

And this doesn't returning good result. I would appreciate if someone would tell me what am I doing wrong.

我设置了25对图像,棋盘图案的大小为9x6。

I have set of 25 pairs of images, and chessboard pattern size 9x6.

推荐答案

cv :: findFundamentalMat 如果您的内在参数不起作用图像点是一个单位矩阵。换句话说,它无法处理未投影的图像点。

cv::findFundamentalMat cannot work if the intrinsic parameter of your image points is an identity matrix. In other words, it cannot work with unprojected image points.

这篇关于通过基本矩阵对未校准的摄像机进行校正的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆