当前位置:网站首页>【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);
}
}
边栏推荐
- Day116.尚医通:预约挂号详情 ※
- 编码经验之谈
- LeetCode Review Diary: 34. Find the first and last position of an element in a sorted array
- Data transfer at the data link layer
- From 2023 onwards, these regions will be able to obtain a certificate with a score lower than 45 in the soft examination.
- YGG Guild Development Plan Season 1 Summary
- LeetCode 213. Robbery II (2022.08.01)
- 优炫数据库导库导错了能恢复吗?
- Day115.尚医通:后台用户管理:用户锁定解锁、详情、认证列表审批
- LeetCode Review Diary: 153. Find the Minimum Value in a Rotated Sort Array
猜你喜欢
After graduating from three books, I was rejected by Tencent 14 times, and finally successfully joined Alibaba
6-25 Vulnerability Exploitation - irc Backdoor Exploitation
volatile原理解析
typescript34-class的基本使用
【Brush the title】Family robbery
Garbage Collector CMS and G1
MySQL optimization strategy
6-24 exploit-vnc password cracking
3. Bean scope and life cycle
Speed up your programs with bitwise operations
随机推荐
【LeetCode每日一题】——704.二分查找
Effects of Scraping and Aggregation
Win Go开发包安装配置、GoLand配置
搜罗汇总的效应
Data transfer at the data link layer
After graduating from three books, I was rejected by Tencent 14 times, and finally successfully joined Alibaba
[LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree
typeof in typescript32-ts
Redis 订阅与 Redis Stream
雇用WordPress开发人员:4个实用的方法
The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
PHP uses PHPRedis and Predis
AOF rewrite
Speed up your programs with bitwise operations
oracle查询扫描全表和走索引
编码经验之谈
C language inserted into the characters of simple exercises
hash table
Ask God to answer, how should this kind of sql be written?
"NetEase Internship" Weekly Diary (1)