OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 27 Feb 2014 00:09:31 -0600Finding 3D coordinate when all 3 coordinates can vary in the object coordinate systemhttp://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/I have the 3D coordinates of 4 coplanar points of my target in the object coordinate system.I also have their the 2D coordinates in every frame of a video.I have also calculated the intrinsic parameters (M) for the camera, the R (rotation) and t (translation) matrices between the object coordinate system and the camera coordinate system using solvepnp(). I have read [from here](http://stackoverflow.com/questions/12299870/computing-x-y-coordinate-3d-from-image-point) the complete process,which is very clear.It is also similar to the process I followed.Therefore I wanted to use the same equation
s [u v 1]<sup>T</sup> = M ( R [X Y Z]<sup>T</sup> + t)
for calculating my 3D coordinates but I have no constant as the link explains for calculating s.My target rotates about the x axis in the OpenCV coordinate system.My questions are -
1. Can anyone suggest me a way to find
s? Is it definitely mandatory for
this calculation or can i use s=1?
2.
Is there any other methods for
calculating the 3d point with what
parameters I have?Wed, 26 Feb 2014 01:47:22 -0600http://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/Comment by silentvalley for <p>I have the 3D coordinates of 4 coplanar points of my target in the object coordinate system.I also have their the 2D coordinates in every frame of a video.I have also calculated the intrinsic parameters (M) for the camera, the R (rotation) and t (translation) matrices between the object coordinate system and the camera coordinate system using solvepnp(). I have read <a href="http://stackoverflow.com/questions/12299870/computing-x-y-coordinate-3d-from-image-point">from here</a> the complete process,which is very clear.It is also similar to the process I followed.Therefore I wanted to use the same equation</p>
<p>s [u v 1]<sup>T</sup> = M ( R [X Y Z]<sup>T</sup> + t)</p>
<p>for calculating my 3D coordinates but I have no constant as the link explains for calculating s.My target rotates about the x axis in the OpenCV coordinate system.My questions are - </p>
<ol>
<li>Can anyone suggest me a way to find
s? Is it definitely mandatory for
this calculation or can i use s=1?</li>
<li>
Is there any other methods for
calculating the 3d point with what
parameters I have?</li>
</ol>
http://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/?comment=29147#post-id-29147i updated the link i referred to in the question
Thu, 27 Feb 2014 00:04:08 -0600http://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/?comment=29147#post-id-29147Answer by Will Stewart for <p>I have the 3D coordinates of 4 coplanar points of my target in the object coordinate system.I also have their the 2D coordinates in every frame of a video.I have also calculated the intrinsic parameters (M) for the camera, the R (rotation) and t (translation) matrices between the object coordinate system and the camera coordinate system using solvepnp(). I have read <a href="http://stackoverflow.com/questions/12299870/computing-x-y-coordinate-3d-from-image-point">from here</a> the complete process,which is very clear.It is also similar to the process I followed.Therefore I wanted to use the same equation</p>
<p>s [u v 1]<sup>T</sup> = M ( R [X Y Z]<sup>T</sup> + t)</p>
<p>for calculating my 3D coordinates but I have no constant as the link explains for calculating s.My target rotates about the x axis in the OpenCV coordinate system.My questions are - </p>
<ol>
<li>Can anyone suggest me a way to find
s? Is it definitely mandatory for
this calculation or can i use s=1?</li>
<li>
Is there any other methods for
calculating the 3d point with what
parameters I have?</li>
</ol>
http://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/?answer=29125#post-id-29125I'm not completely sure I understand your precise problem, but have you researched findHomography() and perspectiveTransform()?
http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html
From one plane to another requires one pose;
http://dsp.stackexchange.com/questions/1484/how-to-compute-camera-pose-from-homography-matrix
to a 3D plane requires at least two poses.
http://stackoverflow.com/questions/7836134/get-3d-coord-from-2d-image-pixel-if-we-know-extrinsic-and-intrinsic-parameters/10750648#10750648
Wed, 26 Feb 2014 13:01:44 -0600http://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/?answer=29125#post-id-29125Comment by silentvalley for <p>I'm not completely sure I understand your precise problem, but have you researched findHomography() and perspectiveTransform()?
<a href="http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html">http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html</a></p>
<p>From one plane to another requires one pose;
<a href="http://dsp.stackexchange.com/questions/1484/how-to-compute-camera-pose-from-homography-matrix">http://dsp.stackexchange.com/questions/1484/how-to-compute-camera-pose-from-homography-matrix</a></p>
<p>to a 3D plane requires at least two poses.
<a href="http://stackoverflow.com/questions/7836134/get-3d-coord-from-2d-image-pixel-if-we-know-extrinsic-and-intrinsic-parameters/10750648#10750648">http://stackoverflow.com/questions/7836134/get-3d-coord-from-2d-image-pixel-if-we-know-extrinsic-and-intrinsic-parameters/10750648#10750648</a></p>
http://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/?comment=29148#post-id-29148Thanks for the answer. I have updated my question. And to answer your other question - yes, i have used findHomography() to find the 2d image points to give as input to solvepnp().Thu, 27 Feb 2014 00:09:31 -0600http://answers.opencv.org/question/29067/finding-3d-coordinate-when-all-3-coordinates-can-vary-in-the-object-coordinate-system/?comment=29148#post-id-29148