当前位置:网站首页>[ORB_SLAM2] void Frame::ComputeImageBounds(const cv::Mat & imLeft)
[ORB_SLAM2] void Frame::ComputeImageBounds(const cv::Mat & imLeft)
2022-08-02 02:00:00 【Xiaoqiu SLAM practical tutorial】
ComputeImageBoundsThe main purpose of this function is to get to the scope of the distortion after image coordinates,For subsequent meshing boundary value,This function will only be in the first frame come in or internal changed is called,Here the boundary value of selected using the maximum coverage criterion,Which is the top left corner in small,The lower right corner to take big,Which can cover the whole to distortion after image
void Frame::ComputeImageBounds(const cv::Mat &imLeft)
{
// 如果畸变参数不为0,用OpenCV函数进行畸变矫正
if(mDistCoef.at<float>(0)!=0.0)
{
// Save the correct image in front of the four boundary point coordinates: (0,0) (cols,0) (0,rows) (cols,rows)
cv::Mat mat(4,2,CV_32F);
mat.at<float>(0,0)=0.0; //左上
mat.at<float>(0,1)=0.0;
mat.at<float>(1,0)=imLeft.cols; //右上
mat.at<float>(1,1)=0.0;
mat.at<float>(2,0)=0.0; //左下
mat.at<float>(2,1)=imLeft.rows;
mat.at<float>(3,0)=imLeft.cols; //右下
mat.at<float>(3,1)=imLeft.rows;
// Undistort corners
// Operation and calibration feature points in front,Will this a few boundary points as the input for correction
mat=mat.reshape(2);
cv::undistortPoints(mat,mat,mK,mDistCoef,cv::Mat(),mK);
mat=mat.reshape(1);
//After correction of the four boundary point is not able to round into a rigid rectangular,So add borders as coordinates on the outside of the quadrilateral boundary
mnMinX = min(mat.at<float>(0,0),mat.at<float>(2,0));//左上和左下横坐标最小的
mnMaxX = max(mat.at<float>(1,0),mat.at<float>(3,0));//右上和右下横坐标最大的
mnMinY = min(mat.at<float>(0,1),mat.at<float>(1,1));//左上和右上纵坐标最小的
mnMaxY = max(mat.at<float>(2,1),mat.at<float>(3,1));//左下和右下纵坐标最小的
}
else
{
// If the distortion parameters as0,Direct access to the image boundary
mnMinX = 0.0f;
mnMaxX = imLeft.cols;
mnMinY = 0.0f;
mnMaxY = imLeft.rows;
}
}

边栏推荐
猜你喜欢

一本适合职场新人的好书

Hiring a WordPress Developer: 4 Practical Ways

"NetEase Internship" Weekly Diary (1)

typescript30-any类型

kubernetes之服务发现

手写博客平台~第二天

LeetCode刷题日记:LCP 03.机器人大冒险

Record the pits where an error occurs when an array is converted to a collection, and try to use an array of packaging types for conversion

Understand the big model in seconds | 3 steps to get AI to write a summary

hash table
随机推荐
雇用WordPress开发人员:4个实用的方法
电商库存系统的防超卖和高并发扣减方案
【刷题篇】打家劫舍
Kubernetes之本地存储
软件测试 接口自动化测试 pytest框架封装 requests库 封装统一请求和多个基础路径处理 接口关联封装 测试用例写在yaml文件中 数据热加载(动态参数) 断言
有效进行自动化测试,这几个软件测试工具一定要收藏好!!!
5年自动化测试经验的一些感悟:做UI自动化一定要跨过这10个坑
hash table
The characteristics and principle of typescript29 - enumeration type
typescript31-any类型
LeetCode brush diary: LCP 03. Machine's adventure
乱七八糟的网站
Constructor instance method inheritance of typescript38-class (implement)
秒懂大模型 | 3步搞定AI写摘要
手写一个博客平台~第三天
华为5年女测试工程师离职:多么痛的领悟...
飞桨助力航天宏图PIE-Engine地球科学引擎构建
When paying attention to the "Internet +" model, you usually only focus on the "Internet +" model itself
PHP 使用 PHPRedis 与 Predis
AntPathMatcher使用