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

边栏推荐
- typescript34-class的基本使用
- 三本毕业的我被腾讯拒绝了十四次,最终成功入职阿里
- LeetCode Review Diary: 153. Find the Minimum Value in a Rotated Sort Array
- Byte taught me a hard lesson: When a crisis comes, you don't even have time to prepare...
- 秒懂大模型 | 3步搞定AI写摘要
- Fundamentals of Cryptography: X.690 and Corresponding BER CER DER Encodings
- Redis Subscription and Redis Stream
- Ask God to answer, how should this kind of sql be written?
- pcie inbound和outbound关系
- CodeTon Round 2 D. Magical Array 规律
猜你喜欢

Day115.尚医通:后台用户管理:用户锁定解锁、详情、认证列表审批

Constructor instance method of typescript36-class

密码学的基础:X.690和对应的BER CER DER编码

用位运算为你的程序加速

手写一个博客平台~第三天

Day115. Shangyitong: Background user management: user lock and unlock, details, authentication list approval

Yunhe Enmo: Let the value of the commercial database era continue to prosper in the openGauss ecosystem

YGG 公会发展计划第 1 季总结

typescript32-ts中的typeof

喜报 | AR 开启纺织产业新模式,ALVA Systems 再获殊荣!
随机推荐
力扣 1161. 最大层内元素和
AOF rewrite
超大规模的产业实用语义分割数据集PSSL与预训练模型开源啦!
手写一个博客平台~第一天
《自然语言处理实战入门》 基于知识图谱的问答机器人
Huawei's 5-year female test engineer resigns: what a painful realization...
Rust P2P网络应用实战-1 P2P网络核心概念及Ping程序
typescript35-class的构造函数
ofstream,ifstream,fstream读写文件
JDBC PreparedStatement 的命名参数实现
LeetCode brush diary: LCP 03. Machine's adventure
Analysis of volatile principle
Handwriting a blogging platform ~ the first day
Day115.尚医通:后台用户管理:用户锁定解锁、详情、认证列表审批
搜罗汇总的效应
Moonbeam与Project Galaxy集成,为社区带来全新的用户体验
Golang分布式应用之定时任务
Navicat数据显示不完全的解决方法
数据链路层的数据传输
typescript33 - high-level overview of typescript