1 Star 0 Fork 0

李梦凡/gocv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
calib3d.cpp 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
Bassem 提交于 2020-03-23 21:33 . add draw chessboard
#include "calib3d.h"
void Fisheye_UndistortImage(Mat distorted, Mat undistorted, Mat k, Mat d) {
cv::fisheye::undistortImage(*distorted, *undistorted, *k, *d);
}
void Fisheye_UndistortImageWithParams(Mat distorted, Mat undistorted, Mat k, Mat d, Mat knew, Size size) {
cv::Size sz(size.width, size.height);
cv::fisheye::undistortImage(*distorted, *undistorted, *k, *d, *knew, sz);
}
void InitUndistortRectifyMap(Mat cameraMatrix,Mat distCoeffs,Mat r,Mat newCameraMatrix,Size size,int m1type,Mat map1,Mat map2) {
cv::Size sz(size.width, size.height);
cv::initUndistortRectifyMap(*cameraMatrix,*distCoeffs,*r,*newCameraMatrix,sz,m1type,*map1,*map2);
}
Mat GetOptimalNewCameraMatrixWithParams(Mat cameraMatrix,Mat distCoeffs,Size size,double alpha,Size newImgSize,Rect* validPixROI,bool centerPrincipalPoint) {
cv::Size sz(size.width, size.height);
cv::Size newSize(newImgSize.width, newImgSize.height);
cv::Rect rect(validPixROI->x,validPixROI->y,validPixROI->width,validPixROI->height);
cv::Mat* mat = new cv::Mat(cv::getOptimalNewCameraMatrix(*cameraMatrix,*distCoeffs,sz,alpha,newSize,&rect,centerPrincipalPoint));
validPixROI->x = rect.x;
validPixROI->y = rect.y;
validPixROI->width = rect.width;
validPixROI->height = rect.height;
return mat;
}
void Undistort(Mat src, Mat dst, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix) {
cv::undistort(*src, *dst, *cameraMatrix, *distCoeffs, *newCameraMatrix);
}
bool FindChessboardCorners(Mat image, Size patternSize, Mat corners, int flags) {
cv::Size sz(patternSize.width, patternSize.height);
return cv::findChessboardCorners(*image, sz, *corners, flags);
}
void DrawChessboardCorners(Mat image, Size patternSize, Mat corners, bool patternWasFound) {
cv::Size sz(patternSize.width, patternSize.height);
cv::drawChessboardCorners(*image, sz, *corners, patternWasFound);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/vanlemon/gocv.git
git@gitee.com:vanlemon/gocv.git
vanlemon
gocv
gocv
master

搜索帮助