【发布时间】:2016-03-05 13:07:33
【问题描述】:
我使用示例 OpenCV 程序从我的相机计算相机矩阵和失真系数,并生成了一个包含相关数据的 xml 文件。
我正在尝试通过undistort 函数使用它,但我不确定如何将值存储为Mat。
Mat cameraMatrix;
Mat distortionCoefficients;
undistort(image, newImage, cameraMatrix, distortionCoefficients);
我试过了:
Mat cameraMatrix = 1.7514028018776246e+03 0. 1.2635000000000000e+03 0. 1.7514028018776246e+03 9.2750000000000000e+02 0. 0. 1.;
Mat distortionCoefficients = 1.3287735059062630e-01 -6.8376776294978103e-01 0. 0. 8.1215478360827675e-01;
我是否需要尝试为Mat var 指定一系列行和列,然后为每个值分配一个索引?
【问题讨论】:
-
所以你需要知道如何创建一个包含一些值的矩阵?或者如何从 xml 中加载一个矩阵?
-
我只需要知道如何将这些值应用到它们各自的变量中,以便在
undistort函数中使用。第一种方法就足够了。 -
谢谢,我需要为
distortionCoefficients提供什么参数来代替(3,3)? -
(1, N),其中N是 4、5 或 8
标签: c++ opencv matrix camera-calibration