当前位置:网站首页>[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;
}
}

边栏推荐
- PHP直播源码实现简单弹幕效果的相关代码
- Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021: Interpretation
- HSDC is related to Independent Spanning Tree
- 力扣 1374. 生成每种字符都是奇数个的字符串
- 力扣(LeetCode)213. 打家劫舍 II(2022.08.01)
- 记录一次数组转集合出现错误的坑点,尽量使用包装类型数组进行转换
- Yunhe Enmo: Let the value of the commercial database era continue to prosper in the openGauss ecosystem
- The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
- MySQL——增删查改操作
- Navicat data shows incomplete resolution
猜你喜欢
随机推荐
【ORB_SLAM2】void Frame::ComputeImageBounds(const cv::Mat &imLeft)
6-25漏洞利用-irc后门利用
typescript30 - any type
AntPathMatcher uses
力扣(LeetCode)213. 打家劫舍 II(2022.08.01)
Image fusion based on weighted 】 and pyramid image fusion with matlab code
Constructor instance method inheritance of typescript38-class (implement)
typescript35-class的构造函数
Huawei's 5-year female test engineer resigns: what a painful realization...
hash table
Golang分布式应用之Redis
PHP 使用 PHPRedis 与 Predis
Redis 订阅与 Redis Stream
YGG 公会发展计划第 1 季总结
MySQL——增删查改操作
Effects of Scraping and Aggregation
Basic use of typescript34-class
kubernetes之服务发现
LeetCode brush diary: LCP 03. Machine's adventure
typeof in typescript32-ts








