-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquaternion_image_correlator.h
More file actions
131 lines (117 loc) · 4.58 KB
/
quaternion_image_correlator.h
File metadata and controls
131 lines (117 loc) · 4.58 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/** Copyright (C) 2016, Gavin J Stark. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @file quaternion_image_correlator.h
* @brief Two-image correlator for rotation, scale (and shear later)
*
*/
/*a Wrapper
*/
#ifdef __INC_QUATERNION_IMAGE_CORRELATOR
#else
#define __INC_QUATERNION_IMAGE_CORRELATOR
/*a Includes
*/
#include <vector>
#include <map>
#include "quaternion.h"
#include "filter.h"
/*a Defines
*/
/*a Types
*/
/*t t_qstm_count
*/
typedef struct
{
int count;
const class c_qi_src_tgt_match *qstm;
} t_qstm_count;
/*t t_qstm_score
*/
typedef struct
{
double score;
const class c_qi_src_tgt_match *qstm;
} t_qstm_score;
/*t t_quaternion_image_src_tgt_match_count_list
*/
typedef std::vector<t_qstm_count> t_quaternion_image_src_tgt_match_count_list;
/*t t_quaternion_image_src_tgt_match_list
*/
typedef std::vector<class c_qi_src_tgt_match *> t_quaternion_image_src_tgt_match_list;
/*t t_quaternion_image_src_tgt_match_score_list
*/
typedef std::vector<t_qstm_score> t_quaternion_image_src_tgt_match_score_list;
/*t t_quaternion_image_src_tgt_pair_mapping_list
*/
typedef std::vector<const class c_qi_src_tgt_pair_mapping *> t_quaternion_image_src_tgt_pair_mapping_list;
/*t t_quaternion_image_match_score
*/
typedef struct
{
double score;
t_quaternion_image_src_tgt_match_score_list match_list;
} t_quaternion_image_match_score;
/*c c_quaternion_image_correlator
*/
class c_quaternion_image_correlator
{
private:
const c_quaternion *find_or_add_src_q(const c_quaternion *src_q);
const c_quaternion *add_src_q(const c_quaternion *src_q);
class c_qi_src_tgt_match *find_or_add_tgt_q_to_src_q(const c_quaternion *src_qx,
t_quaternion_image_src_tgt_match_list *src_tgt_match_list,
const c_quaternion *tgt_q);
const c_quaternion *find_close_src_qx(const c_quaternion *src_q, double *cos_angle) const;
public:
const c_quaternion *find_closest_src_qx(const c_quaternion *src_q, double *cos_angle) const;
const class c_qi_src_tgt_match *find_closest_tgt_qx(const c_quaternion *src_qx, const c_quaternion *tgt_q, double *cos_angle) const;
c_quaternion_image_correlator(void);
int add_match(const c_quaternion *src_q,
const c_quaternion *tgt_q,
const t_point_value *pv);
int create_mappings(void);
double score_src_from_tgt(const c_quaternion *src_from_tgt_q);
const c_quaternion *qstm_tgt_q(const class c_qi_src_tgt_match *qstm) const;
const c_quaternion *qstm_src_q(const class c_qi_src_tgt_match *qstm) const;
const c_quaternion *nth_src_tgt_q_mapping(const class c_qi_src_tgt_match *qstm,
int n,
const c_quaternion *src_tgt_qs[4]) const;
const c_quaternion *qstpm_data(const class c_qi_src_tgt_pair_mapping *qstpm,
const c_quaternion *src_tgt_qs[4]) const;
const t_quaternion_image_src_tgt_match_count_list *best_matches_of_list(const t_quaternion_image_src_tgt_match_score_list *match_list,
double min_score=0.0);
const t_quaternion_image_src_tgt_pair_mapping_list *src_tgt_mappings_from_best_matches(const t_quaternion_image_src_tgt_match_count_list *best_matches,
int min_count=0);
std::vector<const c_quaternion *> src_qs;
std::map<const c_quaternion *, t_quaternion_image_src_tgt_match_list> matches_by_src_q;
double min_cos_angle_src_q;
double min_cos_angle_tgt_q;
double min_cos_sep_score;
double max_q_dist_score;
double max_angle_diff_ratio;
t_quaternion_image_match_score total_score;
};
/*a External functions
*/
/*a Wrapper
*/
#endif
/*a Editor preferences and notes
mode: c ***
c-basic-offset: 4 ***
c-default-style: (quote ((c-mode . "k&r") (c++-mode . "k&r"))) ***
outline-regexp: "/\\\*a\\\|[\t ]*\/\\\*[b-z][\t ]" ***
*/