matlab自带很多好用的应用的!!!!良心推荐
- 制作标定版并拍照
像这样的相机照片多个角度拍摄几次,然后打开cameracalibrator,即单目相机标定。
如果熟悉c++编程的话可以执行:
```cpp
#include "opencv2/opencv.hpp"
#include <string>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
VideoCapture inputVideo(0); //视情况选择预标定摄像头
//inputVideo.set(CAP_PROP_FRAME_WIDTH, 320); //可选项,调整窗口大小
//inputVideo.set(CAP_PROP_FRAME_HEIGHT, 240);
if (!inputVideo.isOpened())
{
cout << "Could not open the input video " << endl;
return -1;
}
Mat frame;
string imgname;
int f = 1;
while (1) //Show the image captured in the window and repeat
{
inputVideo >> frame; // read
if (frame.empty()) break; // check if at end
imshow("Camera", frame);
char key = waitKey(1);
if (key == 27) break; //按ESC退出
if (key == 'q' || key == 'Q')
{
imgname = to_string(f++) + ".jpg"; //输出文件名为 f.jpg, 保留在工程文件夹中
imwrite(imgname, frame);
}
}
cout << "Finished writing" << endl;
return 0;
}
- 添加图片
选择add images
-
设置标定板参数
-
依次导入后直接calibrate运行
-
左边查看参数,右边保存内外参