相机标定与测试

相机标定:

解决方案:

1.使用opencv自带程序进行标定

2.使用matlab进行标定

 

问题分析:

1.使用camera_calibration样例程序进行标定。一边采集一边标定。实际测试误差非常大,无法使用。

2.使用matlab进行单目标定或双目标定。傻瓜式操作,像素误差小,实际测试效果非常好!

 

 

相机矫正测试代码


#include <iostream>
#include <sstream>
#include <string>
#include <ctime>
#include <cstdio>

#include <opencv2/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>

using namespace cv;
using namespace std;

int main()
{
    Mat cameraMatrix{589.731393699140, 0., 351.418746830309, 0., 589.625032910833, 238.750288368969, 0., 0., 1.};
    cameraMatrix = cameraMatrix.reshape(0, 3);
    cout << cameraMatrix.cols << endl;
    cout << cameraMatrix.rows << endl;

    Mat distCoeffs{-0.403335580708005, 0.179421396179879, 0., 0., 0.};
    distCoeffs = distCoeffs.reshape(0, 5);
    //*********************畸变矫正**************************
    // 导入要矫正的图片
    Mat test_image = imread("/home/user/code/cvcode/calib3d/camera_calibration/images/original.jpg");
    Mat show_image;
    undistort(test_image, show_image, cameraMatrix, distCoeffs, cameraMatrix);
    imshow("result", show_image);
    waitKey(-1);
}

 

参考:

linux安装matlab: https://blog.csdn.net/m0_37775034/article/details/80876362

matlab双目标定:

https://blog.csdn.net/weixin_43956351/article/details/94394892

https://blog.csdn.net/H_____H/article/details/103392167

opencv calibration: https://blog.csdn.net/Thomson617/article/details/103987952

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值