当前位置:网站首页>【ORB_SLAM2】void Frame::AssignFeaturesToGrid()
【ORB_SLAM2】void Frame::AssignFeaturesToGrid()
2022-08-02 02:09:00 【Xiaoqiu SLAM practical tutorial】
AssignFeaturesToGridThe main purpose of this function is based on https://blog.csdn.net/qq_21950671/article/details/126084120Calculated dewarped image bounds and grid size,Assign the distorted feature points to the corresponding grids,The purpose of this is to speed up the subsequent feature point matching.
// #define FRAME_GRID_ROWS 48
// #define FRAME_GRID_COLS 64
// Number of KeyPoints. int N;
void Frame::AssignFeaturesToGrid()
{
// Step 1 Gives a grid array storing feature points Frame::mGrid 预分配空间
// FRAME_GRID_COLS = 64,FRAME_GRID_ROWS=48
int nReserve = 0.5f*N/(FRAME_GRID_COLS*FRAME_GRID_ROWS);// 64 * 48
//开始对mGrideach of this two-dimensional arrayvectorElements are traversed and space is preallocated
for(unsigned int i=0; i<FRAME_GRID_COLS;i++)
for (unsigned int j=0; j<FRAME_GRID_ROWS;j++) {
// reserve的作用是更改vector的容量capacity, 使vector至少可以容纳n个元素
// std::vector<std::size_t> mGrid[FRAME_GRID_COLS][FRAME_GRID_ROWS]
// std::cout << "nReserve " << nReserve << std::endl;
// std::vector<std::size_t> mGrid[FRAME_GRID_COLS][FRAME_GRID_ROWS];
mGrid[i][j].reserve(nReserve);
}
// Step 2 遍历每个特征点,Put each feature point inmvKeysUnThe index value in is placed in the corresponding gridmGrid中
for(int i=0;i<N;i++)
{
//Get the feature points that have been distorted from the member variables of the class
const cv::KeyPoint &kp = mvKeysUn[i];
//Stores the grid coordinates of the grid where a feature point is located,nGridPosX范围:[0,FRAME_GRID_COLS], nGridPosY范围:[0,FRAME_GRID_ROWS]
int nGridPosX, nGridPosY;
// Calculate the grid coordinates of the grid where a feature point is located,If the grid coordinates where the feature points are located are found,记录在nGridPosX,nGridPosY里,返回true,没找到返回false
if(PosInGrid(kp,nGridPosX,nGridPosY))
//如果找到特征点所在网格坐标,将这个特征点的索引添加到对应网格的数组mGrid中
mGrid[nGridPosX][nGridPosY].push_back(i);
}
}
边栏推荐
- Typescript31 - any type
- to-be-read list
- ¶ Backtop back to the top is not effective
- openGauss切换后state状态显示不对
- Power button 1374. Generate each character string is an odd number
- 力扣(LeetCode)213. 打家劫舍 II(2022.08.01)
- typescript30-any类型
- Ringtone 1161. Maximum In-Layer Elements and
- 『网易实习』周记(三)
- Win Go开发包安装配置、GoLand配置
猜你喜欢
LeetCode Brushing Diary: 74. Searching 2D Matrix
MySQL8 download, start, configure, verify
Data transfer at the data link layer
The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
2022-07-30 mysql8 executes slow SQL-Q17 analysis
项目后台技术Express
typescript36-class的构造函数实例方法
Constructor instance method inheritance of typescript38-class (implement)
个人博客系统项目测试
Basic use of typescript34-class
随机推荐
Basic use of typescript34-class
LeetCode Review Diary: 153. Find the Minimum Value in a Rotated Sort Array
typescript31-any类型
bool框架::PosInGrid (const简历:关键点kp, int &posX, int诗句)
¶ Backtop back to the top is not effective
CodeTon Round 2 D. Magical Array 规律
LeetCode brushing diary: 53, the largest sub-array and
LeetCode brush diary: LCP 03. Machine's adventure
Redis Subscription and Redis Stream
Speed up your programs with bitwise operations
typescript32-ts中的typeof
Golang分布式应用之定时任务
『网易实习』周记(一)
[LeetCode Daily Question]——654. The largest binary tree
2022-08-01 mysql/stoonedb慢SQL-Q18分析
LeetCode刷题日记:34、 在排序数组中查找元素的第一个和最后一个位置
软件测试 接口自动化测试 pytest框架封装 requests库 封装统一请求和多个基础路径处理 接口关联封装 测试用例写在yaml文件中 数据热加载(动态参数) 断言
成都openGauss用户组招募啦!
LeetCode Review Diary: 34. Find the first and last position of an element in a sorted array
Handwritten Blog Platform ~ Day Two