当前位置:网站首页>【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);
}
}
边栏推荐
- How to adjust the cross cursor too small, CAD dream drawing calculation skills
- 2022河南青训联赛第(三)场
- nacos启动报错,已配置数据库,单机启动
- CodeTon Round 2 D. Magical Array
- AOF重写
- The characteristics and principle of typescript29 - enumeration type
- Speed up your programs with bitwise operations
- Scheduled tasks for distributed applications in Golang
- LeetCode刷题日记:34、 在排序数组中查找元素的第一个和最后一个位置
- volatile原理解析
猜你喜欢

nacos启动报错,已配置数据库,单机启动

typescript35-class的构造函数

LeetCode brush diary: LCP 03. Machine's adventure

Fly propeller power space future PIE - Engine Engine build earth science

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

数据链路层的数据传输
软件测试功能测试全套常见面试题【开放性思维题】面试总结4-3

2022-07-30 mysql8 executes slow SQL-Q17 analysis

Constructor instance method of typescript36-class

Understand the big model in seconds | 3 steps to get AI to write a summary
随机推荐
nacos启动报错,已配置数据库,单机启动
Huawei's 5-year female test engineer resigns: what a painful realization...
垃圾回收器CMS和G1
【LeetCode每日一题】——654.最大二叉树
使用百度EasyDL实现厂区工人抽烟行为识别
AntPathMatcher使用
typescript35-class的构造函数
AntPathMatcher uses
Win Go开发包安装配置、GoLand配置
记录一次数组转集合出现错误的坑点,尽量使用包装类型数组进行转换
typescript33 - high-level overview of typescript
Handwriting a blogging platform ~ the first day
HSDC和独立生成树相关
Ask God to answer, how should this kind of sql be written?
Typescript31 - any type
【Brush the title】Family robbery
typescript33-typescript高级概述
typescript31-any类型
The ultra-large-scale industrial practical semantic segmentation dataset PSSL and pre-training model are open source!
to-be-read list