@@ -135,14 +135,22 @@ struct MACEImpl CV_FINAL : MACE {
135
135
}
136
136
}
137
137
138
- Mat sq; cv::sqrt (D, sq);
139
- Mat_<Vec2d> DINV = TOTALPIXEL * size / sq;
138
+ #if 0 // https://github.com/opencv/opencv_contrib/issues/1848
139
+ // FIXIT What is expected here? complex numbers math?
140
+ // D(,)[1] is 0 (always)
141
+ Mat sq; cv::sqrt(D, sq); // Per-element sqrt(): sq(,)[1] is 0 (always)
142
+ Mat_<Vec2d> DINV = TOTALPIXEL * size / sq; // "per-element" division which provides "Inf"
143
+ #else
144
+ Mat sq; cv::sqrt (D.reshape (1 ).col (0 ), sq);
145
+ Mat_<Vec2d> DINV (TOTALPIXEL, 1 , Vec2d (0 , 0 ));
146
+ DINV.reshape (1 ).col (0 ) = TOTALPIXEL * size / sq;
147
+ #endif
140
148
Mat_<Vec2d> DINV_S (TOTALPIXEL, size, 0.0 );
141
149
Mat_<Vec2d> SPLUS_DINV (size, TOTALPIXEL, 0.0 );
142
150
for (int l=0 ; l<size; l++) {
143
151
for (int m=0 ; m<TOTALPIXEL; m++) {
144
152
SPLUS_DINV (l, m)[0 ] = SPLUS (l,m)[0 ] * DINV (m,0 )[0 ];
145
- SPLUS_DINV (l, m)[1 ] = SPLUS (l,m)[1 ] * DINV (m,0 )[1 ];
153
+ SPLUS_DINV (l, m)[1 ] = SPLUS (l,m)[1 ] * DINV (m,0 )[1 ]; // FIXIT: DINV(,)[1] is 0 (always)
146
154
DINV_S (m, l)[0 ] = S (m,l)[0 ] * DINV (m,0 )[0 ];
147
155
DINV_S (m, l)[1 ] = S (m,l)[1 ] * DINV (m,0 )[1 ];
148
156
}
0 commit comments