@@ -55,34 +55,34 @@ namespace sfm
55
55
56
56
template <typename T>
57
57
void
58
- homogeneousToEuclidean (const Mat & _X , Mat & _x )
58
+ homogeneousToEuclidean (const Mat & X_ , Mat & x_ )
59
59
{
60
- int d = _X .rows - 1 ;
60
+ int d = X_ .rows - 1 ;
61
61
62
- const Mat_<T> & X_rows = _X .rowRange (0 ,d);
63
- const Mat_<T> h = _X .row (d);
62
+ const Mat_<T> & X_rows = X_ .rowRange (0 ,d);
63
+ const Mat_<T> h = X_ .row (d);
64
64
65
65
const T * h_ptr = h[0 ], *h_ptr_end = h_ptr + h.cols ;
66
66
const T * X_ptr = X_rows[0 ];
67
- T * x_ptr = _x .ptr <T>(0 );
67
+ T * x_ptr = x_ .ptr <T>(0 );
68
68
for (; h_ptr != h_ptr_end; ++h_ptr, ++X_ptr, ++x_ptr)
69
69
{
70
70
const T * X_col_ptr = X_ptr;
71
- T * x_col_ptr = x_ptr, *x_col_ptr_end = x_col_ptr + d * _x .step1 ();
72
- for (; x_col_ptr != x_col_ptr_end; X_col_ptr+=X_rows.step1 (), x_col_ptr+=_x .step1 () )
71
+ T * x_col_ptr = x_ptr, *x_col_ptr_end = x_col_ptr + d * x_ .step1 ();
72
+ for (; x_col_ptr != x_col_ptr_end; X_col_ptr+=X_rows.step1 (), x_col_ptr+=x_ .step1 () )
73
73
*x_col_ptr = (*X_col_ptr) / (*h_ptr);
74
74
}
75
75
}
76
76
77
77
void
78
- homogeneousToEuclidean (InputArray _X , OutputArray _x )
78
+ homogeneousToEuclidean (InputArray X_ , OutputArray x_ )
79
79
{
80
80
// src
81
- const Mat X = _X .getMat ();
81
+ const Mat X = X_ .getMat ();
82
82
83
83
// dst
84
- _x .create (X.rows -1 , X.cols , X.type ());
85
- Mat x = _x .getMat ();
84
+ x_ .create (X.rows -1 , X.cols , X.type ());
85
+ Mat x = x_ .getMat ();
86
86
87
87
// type
88
88
if ( X.depth () == CV_32F )
@@ -96,11 +96,11 @@ homogeneousToEuclidean(InputArray _X, OutputArray _x)
96
96
}
97
97
98
98
void
99
- euclideanToHomogeneous (InputArray _x , OutputArray _X )
99
+ euclideanToHomogeneous (InputArray x_ , OutputArray X_ )
100
100
{
101
- const Mat x = _x .getMat ();
101
+ const Mat x = x_ .getMat ();
102
102
const Mat last_row = Mat::ones (1 , x.cols , x.type ());
103
- vconcat (x, last_row, _X );
103
+ vconcat (x, last_row, X_ );
104
104
}
105
105
106
106
template <typename T>
@@ -111,16 +111,16 @@ projectionFromKRt(const Mat_<T> &K, const Mat_<T> &R, const Mat_<T> &t, Mat_<T>
111
111
}
112
112
113
113
void
114
- projectionFromKRt (InputArray _K , InputArray _R , InputArray _t , OutputArray _P )
114
+ projectionFromKRt (InputArray K_ , InputArray R_ , InputArray t_ , OutputArray P_ )
115
115
{
116
- const Mat K = _K .getMat (), R = _R .getMat (), t = _t .getMat ();
116
+ const Mat K = K_ .getMat (), R = R_ .getMat (), t = t_ .getMat ();
117
117
const int depth = K.depth ();
118
118
CV_Assert ((K.cols == 3 && K.rows == 3 ) && (t.cols == 1 && t.rows == 3 ) && (K.size () == R.size ()));
119
119
CV_Assert ((depth == CV_32F || depth == CV_64F) && depth == R.depth () && depth == t.depth ());
120
120
121
- _P .create (3 , 4 , depth);
121
+ P_ .create (3 , 4 , depth);
122
122
123
- Mat P = _P .getMat ();
123
+ Mat P = P_ .getMat ();
124
124
125
125
// type
126
126
if ( depth == CV_32F )
@@ -136,33 +136,33 @@ projectionFromKRt(InputArray _K, InputArray _R, InputArray _t, OutputArray _P)
136
136
137
137
template <typename T>
138
138
void
139
- KRtFromProjection ( const Mat_<T> &_P , Mat_<T> _K , Mat_<T> _R , Mat_<T> _t )
139
+ KRtFromProjection ( const Mat_<T> &P_ , Mat_<T> K_ , Mat_<T> R_ , Mat_<T> t_ )
140
140
{
141
141
libmv::Mat34 P;
142
142
libmv::Mat3 K, R;
143
143
libmv::Vec3 t;
144
144
145
- cv2eigen ( _P , P );
145
+ cv2eigen ( P_ , P );
146
146
147
147
libmv::KRt_From_P ( P, &K, &R, &t );
148
148
149
- eigen2cv ( K, _K );
150
- eigen2cv ( R, _R );
151
- eigen2cv ( t, _t );
149
+ eigen2cv ( K, K_ );
150
+ eigen2cv ( R, R_ );
151
+ eigen2cv ( t, t_ );
152
152
}
153
153
154
154
void
155
- KRtFromProjection ( InputArray _P , OutputArray _K , OutputArray _R , OutputArray _t )
155
+ KRtFromProjection ( InputArray P_ , OutputArray K_ , OutputArray R_ , OutputArray t_ )
156
156
{
157
- const Mat P = _P .getMat ();
157
+ const Mat P = P_ .getMat ();
158
158
const int depth = P.depth ();
159
159
CV_Assert ((P.cols == 4 && P.rows == 3 ) && (depth == CV_32F || depth == CV_64F));
160
160
161
- _K .create (3 , 3 , depth);
162
- _R .create (3 , 3 , depth);
163
- _t .create (3 , 1 , depth);
161
+ K_ .create (3 , 3 , depth);
162
+ R_ .create (3 , 3 , depth);
163
+ t_ .create (3 , 1 , depth);
164
164
165
- Mat K = _K .getMat (), R = _R .getMat (), t = _t .getMat ();
165
+ Mat K = K_ .getMat (), R = R_ .getMat (), t = t_ .getMat ();
166
166
167
167
// type
168
168
if ( depth == CV_32F )
@@ -177,29 +177,29 @@ KRtFromProjection( InputArray _P, OutputArray _K, OutputArray _R, OutputArray _t
177
177
178
178
template <typename T>
179
179
T
180
- depthValue ( const Mat_<T> &_R , const Mat_<T> &_t , const Mat_<T> &_X )
180
+ depthValue ( const Mat_<T> &R_ , const Mat_<T> &t_ , const Mat_<T> &X_ )
181
181
{
182
- Matx<T,3 ,3 > R (_R );
183
- Vec<T,3 > t (_t );
182
+ Matx<T,3 ,3 > R (R_ );
183
+ Vec<T,3 > t (t_ );
184
184
185
- if ( _X .rows == 3 )
185
+ if ( X_ .rows == 3 )
186
186
{
187
- Vec<T,3 > X (_X );
187
+ Vec<T,3 > X (X_ );
188
188
return (R*X)(2 ) + t (2 );
189
189
}
190
190
else
191
191
{
192
- Vec<T,4 > X (_X );
192
+ Vec<T,4 > X (X_ );
193
193
Vec<T,3 > Xe;
194
194
homogeneousToEuclidean (X,Xe);
195
195
return depthValue<T>( Mat (R), Mat (t), Mat (Xe) );
196
196
}
197
197
}
198
198
199
199
double
200
- depth ( InputArray _R , InputArray _t , InputArray _X )
200
+ depth ( InputArray R_ , InputArray t_ , InputArray X_ )
201
201
{
202
- const Mat R = _R .getMat (), t = _t .getMat (), X = _X .getMat ();
202
+ const Mat R = R_ .getMat (), t = t_ .getMat (), X = X_ .getMat ();
203
203
const int depth = R.depth ();
204
204
CV_Assert ( R.rows == 3 && R.cols == 3 && t.rows == 3 && t.cols == 1 );
205
205
CV_Assert ( (X.rows == 3 && X.cols == 1 ) || (X.rows == 4 && X.cols == 1 ) );
0 commit comments