我正在尝试在程序中使用方法findEssentialMat。我有两个图像,两个特征和焦点数组。但是此方法需要将摄像机矩阵(类型:IInputArray)作为属性。那么问题是如何在没有相机校准的情况下手动初始化相机矩阵?
此代码不起作用,因为double [,]是cameraMatrix表示形式的错误类型。
double[,] camMat = {
{ focal, 0, imgInput1.Size.Width / 2 },
{ 0, focal, imgInput1.Size.Height / 2 },
{ 0, 0, 1 }
};
VectorOfPointF vpfpoints1 = new VectorOfPointF(mKPstoPF(foundedFeatures1));
VectorOfPointF vpfpoints2 = new VectorOfPointF(currFeat);
CvInvoke.FindEssentialMat(points1: vpfpoints1,
points2: vpfpoints2,
cameraMatrix: camMat,
method: Emgu.CV.CvEnum.FmType.Ransac,
prob: 0.999,
threshold: 1,
mask: null);
答案 0 :(得分:0)
我已经使用这种方式来定义相机矩阵:
Matrix<double> matr = new Matrix<double>(3, 3);
matr[0, 0] = focal;
matr[0, 1] = 0;
matr[0, 2] = imgInput1.Size.Width / 2;
matr[1, 0] = 0;
matr[1, 1] = focal;
matr[1, 2] = imgInput1.Size.Width / 2;
matr[2, 0] = 0;
matr[2, 1] = 0;
matr[2, 2] = 1;