forked from freeclouds/remove_ros_VINS-position-constraint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeature_tracker.h
75 lines (53 loc) · 1.59 KB
/
feature_tracker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// Created by grn on 11/1/18.
//
#ifndef VINS_FEATURE_TRACKER_H
#define VINS_FEATURE_TRACKER_H
#pragma once
#include <cstdio>
#include <iostream>
#include <queue>
#include <execinfo.h>
#include <csignal>
#include <opencv2/opencv.hpp>
#include <eigen3/Eigen/Dense>
#include "camodocal/camera_models/CameraFactory.h"
#include "camodocal/camera_models/CataCamera.h"
#include "camodocal/camera_models/PinholeCamera.h"
#include "parameters.h"
#include "utility/tic_toc.h"
using namespace std;
using namespace camodocal;
using namespace Eigen;
bool inBorder(const cv::Point2f &pt);
void reduceVector(vector<cv::Point2f> &v, vector<uchar> status);
void reduceVector(vector<int> &v, vector<uchar> status);
class FeatureTracker
{
public:
FeatureTracker();
void readImage(const cv::Mat &_img,double _cur_time);
void setMask();
void addPoints();
bool updateID(unsigned int i);
void readIntrinsicParameter(const string &calib_file);
void showUndistortion(const string &name);
void rejectWithF();
void undistortedPoints();
cv::Mat mask;
cv::Mat fisheye_mask;
cv::Mat prev_img, cur_img, forw_img;
vector<cv::Point2f> n_pts;
vector<cv::Point2f> prev_pts, cur_pts, forw_pts;
vector<cv::Point2f> prev_un_pts, cur_un_pts; //归一化相机坐标系下的坐标
vector<cv::Point2f> pts_velocity;
vector<int> ids;
vector<int> track_cnt;
map<int, cv::Point2f> cur_un_pts_map;
map<int, cv::Point2f> prev_un_pts_map;
camodocal::CameraPtr m_camera;
double cur_time;
double prev_time;
static int n_id;
};
#endif //VINS_FEATURE_TRACKER_H