当前位置:网站首页>bool Frame::PosInGrid(const cv::KeyPoint &kp, int &posX, int &posY)
bool Frame::PosInGrid(const cv::KeyPoint &kp, int &posX, int &posY)
2022-08-02 01:05:00 【小秋SLAM实战教程】
bool Frame::PosInGrid(const cv::KeyPoint &kp, int &posX, int &posY)
{
// 校正后的四个边界点已经不能够围成一个严格的矩形,因此在这个四边形的外侧加边框作为坐标的边界
// 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));//左下和右下纵坐标最小的
// mfGridElementWidthInv=static_cast<float>(FRAME_GRID_COLS)/static_cast<float>(mnMaxX-mnMinX); 一个图像像素相当于多少个图像网格列宽
// mfGridElementHeightInv=static_cast<float>(FRAME_GRID_ROWS)/static_cast<float>(mnMaxY-mnMinY); 一个图像像素相当于多少个图像网格行高
posX = round((kp.pt.x-mnMinX)*mfGridElementWidthInv);
posY = round((kp.pt.y-mnMinY)*mfGridElementHeightInv);
//Keypoint's coordinates are undistorted, which could cause to go out of the image
if(posX<0 || posX>=FRAME_GRID_COLS || posY<0 || posY>=FRAME_GRID_ROWS)
return false;
return true;
}
边栏推荐
猜你喜欢
随机推荐
go泛型使用方法
C语言实验十 函数(二)
Flink_CDC construction and simple use
网络请求技术--跨域
管理基础知识11
电商库存系统的防超卖和高并发扣减方案
IDEA找不到Database解决方法
管理基础知识12
管理基础知识14
Reflex WMS中阶系列6:对一个装货重复run pick会有什么后果?
管理基础知识15
Markdown (CSDN) MD编辑器(四)- 漂亮表格(表格背景色、跨行、跨列)
5年自动化测试经验的一些感悟:做UI自动化一定要跨过这10个坑
【刷题篇】打家劫舍
【图像融合】基于加权和金字塔实现图像融合附matlab代码
期货开户如何确定期货公司正规性?
Some insights from 5 years of automated testing experience: UI automation must overcome these 10 pits
百度、百图生科 | HelixFold-Single: 使用蛋白质语言模型作为替代进行无MSA蛋白质结构预测
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
ECMAScript 2022 正式发布,有你了解过的吗?









