主要内容

undistortPoints

对透镜畸变的点坐标进行修正

描述

undistortedPoints= undistortPoints (cameraParams返回点坐标校正的镜头失真。该函数采用数值非线性最小二乘优化。

例子

undistortedPointsreprojectionErrors) = undistortPoints (cameraParams另外,返回用于评估未变形点精度的误差。

例子

全部折叠

创建一个包含校准图像的imageDatastore对象。

图像= imageDatastore (fullfile (toolboxdir (“愿景”),“visiondata”...“校准”“莫诺”));imageFileNames = images.Files;

检测校准模式。

[imagePoints, boardSize] = detectCheckerboardPoints (imageFileNames);

生成方块角落的世界坐标。正方形的大小以毫米为单位。

squareSize = 29;worldPoints = generateCheckerboardPoints (boardSize squareSize);

校准相机。

I = readimage(图片,10);imageSize = [size(I, 1), size(I, 2)];params = estimateCameraParameters (imagePoints worldPoints,...“图象尺寸”、图象尺寸);

加载图像并检测棋盘点。

点= detectCheckerboardPoints(我);

Undistort点

undistortedPoints = undistortPoints(点,params);

Undistort图像。

[J, newOrigin] = undistortion timage (I,params,“OutputView”“全部”);

翻译不失真点

undistortion points = [undistortion points (:,1) - newOrigin(1),...undistortedPoints (: 2), newOrigin (2)];

显示结果

图;imshow(我);持有;情节(点(:1),点(:,2),“r * - - - - - -”);标题(“发现点”);持有

图中包含一个轴对象。标题为“检测点”的轴对象包含两个类型为image, line的对象。

图;imshow (J);持有;情节(undistortedPoints (: 1) undistortedPoints (:, 2),“g * - - - - - -”);标题(“不失真点”);持有

图中包含一个轴对象。标题为un扭曲点的轴对象包含两个类型为image, line的对象。

输入参数

全部折叠

输入点,指定一个2的矩阵[x y]坐标的数目。

摄像机参数,指定为cameraParameterscameraIntrinsics对象。你可以退回cameraParameters对象使用estimateCameraParameters函数。的cameraParameters对象包含相机的内在、外在和镜头畸变参数。

输出参数

全部折叠

未扭曲的点,返回为2矩阵。的undistortedPoints输出包含xy点坐标校正的镜头失真。当你输入点为,函数输出undistortedPoints作为.否则,它输出undistortedPoints作为单身。

数据类型:|

重投影错误,返回为1的向量。您可以使用这些误差来评估未变形点的精度。该函数通过对未失真点施加失真,然后取结果与相应输入点之间的距离来计算误差。的reprojectionErrors输出以像素为单位。

介绍了R2014b