OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 18 Jun 2020 23:17:16 -0500pose estimation using RANSAChttp://answers.opencv.org/question/2436/pose-estimation-using-ransac/Hi
Hi Everyone,
As I posted before i had a problem with solvePnPRansac pose estimation. I solved that issues as I was doing something in mapping of my data.
I generate vectors of 2D points and corresponding 3D points (Top 20 matches). Then I generate a Camera Matrix =[fx 1 cx; 1 fy cy;0 0 1] and I assume distortion coefficients are zero. Then I apply solvePnPRANSAC to estimate the pose. I get inliers. I am using 10 Error Threshold in RANSAC function and run it for 200 iterations.
From pose, I reproject my points back. Some reprojected points are coming very far from actual image points. Please see the attached figure.
So I am wondering if there is any step needed before calling RANSAC to ensure good results. !
waiting for replies . .
[image description](/upfiles/13480983689416853.png) Wed, 19 Sep 2012 19:17:44 -0500http://answers.opencv.org/question/2436/pose-estimation-using-ransac/Answer by Jacek for <p>Hi
Hi Everyone,</p>
<p>As I posted before i had a problem with solvePnPRansac pose estimation. I solved that issues as I was doing something in mapping of my data. </p>
<p>I generate vectors of 2D points and corresponding 3D points (Top 20 matches). Then I generate a Camera Matrix =[fx 1 cx; 1 fy cy;0 0 1] and I assume distortion coefficients are zero. Then I apply solvePnPRANSAC to estimate the pose. I get inliers. I am using 10 Error Threshold in RANSAC function and run it for 200 iterations. </p>
<p>From pose, I reproject my points back. Some reprojected points are coming very far from actual image points. Please see the attached figure. </p>
<p>So I am wondering if there is any step needed before calling RANSAC to ensure good results. ! </p>
<p>waiting for replies . .
<a href="/upfiles/13480983689416853.png">image description</a> </p>
http://answers.opencv.org/question/2436/pose-estimation-using-ransac/?answer=2443#post-id-2443Camera matrix = [fx **1** cx; **1** fy cy;0 0 1] is wrong it should be [fx **0** cx; **0** fy cy;0 0 1] (or [fx **s** cx; **0** fy cy;0 0 1] if you have a camera with non-zero skew **s** but this is seldom the case).
Besides the procedure you described looks OK. Only reprojection error = 10 is huge, I'm not sure if this is for purpose but you usually should use reprojection error like 1 or 2 pixels.
Thu, 20 Sep 2012 02:10:47 -0500http://answers.opencv.org/question/2436/pose-estimation-using-ransac/?answer=2443#post-id-2443Comment by astronaut for <p>Camera matrix = [fx <strong>1</strong> cx; <strong>1</strong> fy cy;0 0 1] is wrong it should be [fx <strong>0</strong> cx; <strong>0</strong> fy cy;0 0 1] (or [fx <strong>s</strong> cx; <strong>0</strong> fy cy;0 0 1] if you have a camera with non-zero skew <strong>s</strong> but this is seldom the case).</p>
<p>Besides the procedure you described looks OK. Only reprojection error = 10 is huge, I'm not sure if this is for purpose but you usually should use reprojection error like 1 or 2 pixels.</p>
http://answers.opencv.org/question/2436/pose-estimation-using-ransac/?comment=231378#post-id-231378Hi. Just wondering if this method can lead to very accurate pose (position and orientation) estimation, Im looking for accuracy of plus-minus 1-2cm by 1m distance. Would be that possible?Thu, 18 Jun 2020 23:17:16 -0500http://answers.opencv.org/question/2436/pose-estimation-using-ransac/?comment=231378#post-id-231378Comment by Nabeel for <p>Camera matrix = [fx <strong>1</strong> cx; <strong>1</strong> fy cy;0 0 1] is wrong it should be [fx <strong>0</strong> cx; <strong>0</strong> fy cy;0 0 1] (or [fx <strong>s</strong> cx; <strong>0</strong> fy cy;0 0 1] if you have a camera with non-zero skew <strong>s</strong> but this is seldom the case).</p>
<p>Besides the procedure you described looks OK. Only reprojection error = 10 is huge, I'm not sure if this is for purpose but you usually should use reprojection error like 1 or 2 pixels.</p>
http://answers.opencv.org/question/2436/pose-estimation-using-ransac/?comment=2767#post-id-2767hi one thing i am wondering . . can i use 0 for both cx and cy ? or should it be the centre of the image?Mon, 01 Oct 2012 00:43:24 -0500http://answers.opencv.org/question/2436/pose-estimation-using-ransac/?comment=2767#post-id-2767