removed test whether z is negative in gpu::solvePnpRansac (there is no need in this for tests passing)
This commit is contained in:
parent
74c398e6b7
commit
4e6572acd9
@ -301,13 +301,10 @@ void cv::gpu::solvePnpRansac(const Mat& object, const Mat& image, const Mat& cam
|
||||
p_transf.x = rot[0] * p.x + rot[1] * p.y + rot[2] * p.z + transl[0];
|
||||
p_transf.y = rot[3] * p.x + rot[4] * p.y + rot[5] * p.z + transl[1];
|
||||
p_transf.z = rot[6] * p.x + rot[7] * p.y + rot[8] * p.z + transl[2];
|
||||
if (p_transf.z > 0.f)
|
||||
{
|
||||
p_proj.x = p_transf.x / p_transf.z;
|
||||
p_proj.y = p_transf.y / p_transf.z;
|
||||
if (norm(p_proj - image_normalized.at<Point2f>(0, i)) < params.max_dist)
|
||||
params.inliers->push_back(i);
|
||||
}
|
||||
p_proj.x = p_transf.x / p_transf.z;
|
||||
p_proj.y = p_transf.y / p_transf.z;
|
||||
if (norm(p_proj - image_normalized.at<Point2f>(0, i)) < params.max_dist)
|
||||
params.inliers->push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,14 +143,11 @@ namespace cv { namespace gpu
|
||||
rot_mat[0].x * p.x + rot_mat[0].y * p.y + rot_mat[0].z * p.z + transl_vec.x,
|
||||
rot_mat[1].x * p.x + rot_mat[1].y * p.y + rot_mat[1].z * p.z + transl_vec.y,
|
||||
rot_mat[2].x * p.x + rot_mat[2].y * p.y + rot_mat[2].z * p.z + transl_vec.z);
|
||||
if (p.z > 0)
|
||||
{
|
||||
p.x /= p.z;
|
||||
p.y /= p.z;
|
||||
float2 image_p = image[i];
|
||||
if (sqr(p.x - image_p.x) + sqr(p.y - image_p.y) < dist_threshold)
|
||||
++num_inliers;
|
||||
}
|
||||
p.x /= p.z;
|
||||
p.y /= p.z;
|
||||
float2 image_p = image[i];
|
||||
if (sqr(p.x - image_p.x) + sqr(p.y - image_p.y) < dist_threshold)
|
||||
++num_inliers;
|
||||
}
|
||||
|
||||
extern __shared__ float s_num_inliers[];
|
||||
|
@ -128,7 +128,10 @@ TEST(solvePnpRansac, accuracy)
|
||||
|
||||
Mat rvec;
|
||||
Mat tvec;
|
||||
solvePnpRansac(object, image, camera_mat, Mat(), rvec, tvec, SolvePnpRansacParams());
|
||||
SolvePnpRansacParams params;
|
||||
vector<int> inliers;
|
||||
params.inliers = &inliers;
|
||||
solvePnpRansac(object, image, camera_mat, Mat(), rvec, tvec, params);
|
||||
|
||||
ASSERT_LE(norm(rvec - rvec_gold), 1e-3f);
|
||||
ASSERT_LE(norm(tvec - tvec_gold), 1e-3f);
|
||||
|
Loading…
Reference in New Issue
Block a user