当前位置:网站首页>【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);
}
}
边栏推荐
猜你喜欢

使用百度EasyDL实现厂区工人抽烟行为识别

Redis 底层的数据结构

【Brush the title】Family robbery

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

oracle查询扫描全表和走索引

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

Day116.尚医通:预约挂号详情 ※

飞桨助力航天宏图PIE-Engine地球科学引擎构建

typescript32-ts中的typeof

After graduating from three books, I was rejected by Tencent 14 times, and finally successfully joined Alibaba
随机推荐
"NetEase Internship" Weekly Diary (1)
CodeTon Round 2 D. Magical Array 规律
【LeetCode每日一题】——704.二分查找
2022-08-01 mysql/stoonedb slow SQL-Q18 analysis
Ringtone 1161. Maximum In-Layer Elements and
Basic use of typescript34-class
hash table
软件测试 接口自动化测试 pytest框架封装 requests库 封装统一请求和多个基础路径处理 接口关联封装 测试用例写在yaml文件中 数据热加载(动态参数) 断言
Can Youxuan database import wrongly be restored?
【Brush the title】Family robbery
Huawei's 5-year female test engineer resigns: what a painful realization...
力扣(LeetCode)213. 打家劫舍 II(2022.08.01)
Rust P2P Network Application Combat-1 P2P Network Core Concepts and Ping Program
LeetCode Review Diary: 153. Find the Minimum Value in a Rotated Sort Array
The ultra-large-scale industrial practical semantic segmentation dataset PSSL and pre-training model are open source!
[LeetCode Daily Question]——654. The largest binary tree
哈希冲突和一致性哈希
2022河南青训联赛第(三)场
Handwriting a blogging platform ~ the first day
【LeetCode每日一题】——654.最大二叉树