13 min_cosine = cos(angle_thres);
14 dist2_thres = dist_thres * dist_thres;
19 int div = 1 << level_index;
20 f = make_float2(fx/div, fy/div);
21 c = make_float2(cx/div, cy/div);
22 finv = make_float2(1.f/f.x, 1.f/f.y);
40 operator float*() {
return locked_buffer.
data; }
41 operator cudaStream_t() {
return stream; }
48 float *data_A = A.val;
49 float *data_b = b.val;
52 for (
int i = 0; i < 6; ++i)
53 for (
int j = i; j < 7; ++j)
55 float value = locked_buffer.
data[shift++];
59 data_A[j * 6 + i] = data_A[i * 6 + j] = value;
70 const int iters[] = {10, 5, 4, 0};
71 std::vector<int> vector_iters(iters, iters + 4);
81 {
return dist_thres_; }
84 { dist_thres_ = distance; }
87 {
return angle_thres_; }
90 { angle_thres_ = angle; }
94 if (iters.size() >= MAX_PYRAMID_LEVELS)
95 iters_.assign(iters.begin(), iters.begin() + MAX_PYRAMID_LEVELS);
98 iters_ = vector<int>(MAX_PYRAMID_LEVELS, 0);
99 copy(iters.begin(), iters.end(),iters_.begin());
105 int i = MAX_PYRAMID_LEVELS - 1;
106 for(; i >= 0 && !iters_[i]; --i);
121 CV_Assert(!
"Not implemented");
127 const int LEVELS = getUsedLevelsNum();
131 affine = Affine3f::Identity();
133 for(
int level_index = LEVELS - 1; level_index >= 0; --level_index)
140 helper.
dcurr = dcurr[level_index];
141 helper.
ncurr = ncurr[level_index];
143 for(
int iter = 0; iter < iters_[level_index]; ++iter)
145 helper.
aff = device_cast<device::Aff3f>(affine);
146 helper(dprev[level_index], n, buffer_, sh, sh);
152 double det = cv::determinant(A);
154 if (fabs (det) < 1e-15 || cv::viz::isNan(det))
156 if (cv::viz::isNan(det)) cout <<
"qnan" << endl;
161 cv::solve(A, b, r, cv::DECOMP_SVD);
163 affine = Tinc * affine;
171 const int LEVELS = getUsedLevelsNum();
175 affine = Affine3f::Identity();
177 for(
int level_index = LEVELS - 1; level_index >= 0; --level_index)
185 helper.
vcurr = vcurr[level_index];
186 helper.
ncurr = ncurr[level_index];
188 for(
int iter = 0; iter < iters_[level_index]; ++iter)
190 helper.
aff = device_cast<device::Aff3f>(affine);
191 helper(v, n, buffer_, sh, sh);
197 double det = cv::determinant(A);
199 if (fabs (det) < 1e-15 || cv::viz::isNan (det))
201 if (cv::viz::isNan (det)) cout <<
"qnan" << endl;
206 cv::solve(A, b, r, cv::DECOMP_SVD);
209 affine = Tinc * affine;