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

边栏推荐
猜你喜欢

volatile原理解析

ofstream,ifstream,fstream读写文件

typescript38-class的构造函数实例方法继承(implement)

【图像融合】基于加权和金字塔实现图像融合附matlab代码

检查IP或端口是否被封

The Paddle Open Source Community Quarterly Report is here, everything you want to know is here

The characteristics and principle of typescript29 - enumeration type

oracle查询扫描全表和走索引

3. Bean scope and life cycle

Hash collisions and consistent hashing
随机推荐
MySQL——增删查改操作
typescript31-any类型
CodeTon Round 2 D. Magical Array 规律
力扣、752-打开转盘锁
oracle查询扫描全表和走索引
LeetCode刷题日记:53、最大子数组和
Constructor instance method of typescript36-class
HSDC和独立生成树相关
bool Frame::PosInGrid(const cv::KeyPoint &kp, int &posX, int &posY)
The characteristics and principle of typescript29 - enumeration type
For effective automated testing, these software testing tools must be collected!!!
kubernetes之服务发现
Garbage Collector CMS and G1
力扣(LeetCode)213. 打家劫舍 II(2022.08.01)
华为5年女测试工程师离职:多么痛的领悟...
字节给我狠狠上了一课:危机来的时候你连准备时间都没有...
Pcie the inbound and outbound
¶Backtop 回到顶部 不生效
【ORB_SLAM2】void Frame::ComputeImageBounds(const cv::Mat &imLeft)
有效进行自动化测试,这几个软件测试工具一定要收藏好!!!