-
Notifications
You must be signed in to change notification settings - Fork 1
/
Relocalizer.h
73 lines (62 loc) · 1.83 KB
/
Relocalizer.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
//
// Relocalizer.h
// cvar_core
//
// Created by Daichi Sakai on 2013/01/13.
// Copyright (c) 2013 Daichi Sakai. All rights reserved.
//
#ifndef __cvar_core__Relocalizer__
#define __cvar_core__Relocalizer__
#include <iostream>
#include "cvmath.h"
class Relocalizer
{
public:
Relocalizer();
//bool isKeyframe(const double roll, const double pitch, const double yaw,
// int& roll_idx, int& pitch_idx, int& yaw_idx);
//bool isKeyframe(const cv::Mat& euler,
// int& roll_idx, int& pitch_idx, int& yaw_idx);
bool checkKeyframe(const double roll, const double pitch, const double yaw,
int& roll_idx, int& pitch_idx, int& yaw_idx);
bool checkKeyframe(const cv::Mat& euler,
int& roll_idx, int& pitch_idx, int& yaw_idx);
bool isRegistered(const int roll_idx, const int pitch_idx, const int yaw_idx);
void registerKeyframe(const int roll_idx, const int pitch_idx, const int yaw_idx, const cv::Mat& rawframe, const cv::Mat& euler);
void showKeyframes();
bool searchKeyframe(const cv::Mat& rawframe, cv::Mat& euler);
private:
double roll_range;
double pitch_range;
double yaw_range;
int roll_bin;
int pitch_bin;
int yaw_bin;
double scale;
std::vector<std::vector<std::vector<cv::Mat> > > keyframes;
std::vector<std::vector<std::vector<cv::Mat> > > orientations; // euler angle matrices
bool getAngleIdx(const double range, const int bin, const double angle, int& idx)
{
double step=range/bin;
idx = static_cast<int>(angle/step) + bin;
return 0 <= idx && idx < 2*bin;
}
/*
bool nearKeyAngle(const double range, const int bin, const double th, const double angle, int& idx)
{
double step, w;
step=range/bin;
w = -range;
for (int i=-bin ; i<=bin; ++i, w+=step)
{
if ( w-th<angle && angle<w+th )
{
idx = i+bin;
return true;
}
}
return false;
}
*/
};
#endif /* defined(__cvar_core__Relocalizer__) */