OpenCV C++中给定校准数据的无失真图像
Undistort image from given calibration data in OpenCV C++
我有一个Foam_Image.jpg
的图像,我想从中去除鱼眼失真。我的calibration_data.xml
文件中已经有了相机校准数据。我真的是C++的新手,我听说过undistort
函数,但我不知道如何在OpenCV C++中应用它。有人能给我一个主意吗?
您是如何创建calibration_data.xml
的?
到目前为止你尝试了什么?
我假设它包含你从OpenCV的棋盘校准中获得的信息,比如这个
// Extract chessboard
vector<vector<Point3f>> object_points;
vector<vector<Point2f>> image_points;
// ...
bool found = findChessboardCorners(image, board_sz, corners, CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_FILTER_QUADS);
// ...
// Compute intrinsic camera parameters.
vector<Mat> rvecs;
vector<Mat> tvecs;
calibrateCamera(object_points, image_points, image.size(), Camera_Matrix, Distortion_Coefficients, rvecs, tvecs);
// Store results to calibration_data.xml
然后使用undistort()
可以像一样消除图像失真
#include <opencv2/highgui/highgui.hpp>
// ...
Mat Camera_Matrix; // From calibration_data.xml
Mat Distortion_Coefficients; // From calibration_data.xml
cv::Mat image = cv::imread( "Foam_Image,jpg" );
cv::Mat imageUndistorted; // Will be the undistorted version of the above image.
undistort(image, imageUndistorted, Camera_Matrix, Distortion_Coefficients);
// ...
我从aishack.in获取了以上信息,如果你在网上(或SO上)搜索,会发现更多详细的教程。
相关文章:
- C++浮点数据类型和字符串数据类型无法子到模板函数中
- 从矢量<无符号字符>转换为字符* 包括垃圾数据
- C++射线示踪剂ppm表示没有足够的数据来显示图像
- OpenCV(C++)处理来自JavaScript / Web Assembly的图像数据
- VTK 图像数据,访问数组中的 1 个图像
- C++ 窗口显示无框图像
- 指向(数据)成员的指针作为非类型模板参数,例如具有自动存储持续时间/无链接
- 在 std::vector<无符号字符中存储任意数据的方法>
- 这是我的程序,C++使用 OpenCv 库从数据集中读取图像序列,但它没有运行
- 以高数据速率发送图像数据超过提升::asio::udp?
- 如何使用stb_image将像素颜色数据写入 BMP 图像文件?
- 使用OpenCV的无失真视频帧
- 如何以最佳方式将高分辨率图像数据存储在无符号字符*中C++
- 访问私有数据以从图像中获取像素时C++错误
- 如何将Mat数据(OpenCV,图像的数据格式)转换为unity3d texutre
- sws_scale YUV --> RGB 失真图像
- 从原始缓冲区数据创建Mat图像
- OpenCV C++中给定校准数据的无失真图像
- 具有通用uint8_t数据存储的图像类的迭代器
- 用Qt从原始数据加载图像