OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 06 Dec 2012 20:03:28 -0600how can I do back-projection?http://answers.opencv.org/question/4862/how-can-i-do-back-projection/I calibrated my single camera using Camera Calibration Toolbox for Matlab(http://www.vision.caltech.edu/bouguetj/calib_doc/), and already have the intrinsic and extrinsic parameters.
Now given a pixel of one image, how can i do back-projection from 2D pixel to 3D ray? That is, how can i calculate the equation of ray connecting the camera center and the pixel point on the image sensor plane? And how can i know the equation of physical image sensor plane in world reference frame?
thx very much.Mon, 03 Dec 2012 20:56:50 -0600http://answers.opencv.org/question/4862/how-can-i-do-back-projection/Answer by AlexanderShishkov for <p>I calibrated my single camera using Camera Calibration Toolbox for Matlab(<a href="http://www.vision.caltech.edu/bouguetj/calib_doc">http://www.vision.caltech.edu/bouguetj/calib_doc</a>/), and already have the intrinsic and extrinsic parameters.</p>
<p>Now given a pixel of one image, how can i do back-projection from 2D pixel to 3D ray? That is, how can i calculate the equation of ray connecting the camera center and the pixel point on the image sensor plane? And how can i know the equation of physical image sensor plane in world reference frame?</p>
<p>thx very much.</p>
http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?answer=4875#post-id-4875For projecting 3d point to the image plane you should use the equations:
![image description](http://docs.opencv.org/_images/math/69a88b04c61001bf4e198abae39569e8bc3e81c2.png)
I assume that there is no distortion (or you already have called undistort() function)
For back projection you also can use these equations. Let you have pixel with coordinates (u,v) and you want to find 3d points that can be projected to this point (it is a ray in 3d space).
These points:
z = some value > 0
x = (u-cx)*z/fx
y = (v-cy)*z/fy
Tue, 04 Dec 2012 05:09:01 -0600http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?answer=4875#post-id-4875Comment by gslshbs for <p>For projecting 3d point to the image plane you should use the equations:</p>
<p><img alt="image description" src="http://docs.opencv.org/_images/math/69a88b04c61001bf4e198abae39569e8bc3e81c2.png"></p>
<p>I assume that there is no distortion (or you already have called undistort() function)
For back projection you also can use these equations. Let you have pixel with coordinates (u,v) and you want to find 3d points that can be projected to this point (it is a ray in 3d space).</p>
<p>These points:</p>
<pre><code>z = some value > 0
x = (u-cx)*z/fx
y = (v-cy)*z/fy
</code></pre>
http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4922#post-id-4922Thank you for your answer. But I think image plane should be a plane z > 0. If it's the plane z = 0, then the point on the image plane calculated by x = (u-cx)z/fx and y = (v-cy)z/fy will be P(0, 0, 0). Isn't that the camera center should be O(0, 0, 0)? Image plane locates before camera center, so I think image plane should be a plane z > 0. But how can I get the exact equation of the image plane(the physical image sensor plane)?Wed, 05 Dec 2012 06:58:50 -0600http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4922#post-id-4922Comment by gslshbs for <p>For projecting 3d point to the image plane you should use the equations:</p>
<p><img alt="image description" src="http://docs.opencv.org/_images/math/69a88b04c61001bf4e198abae39569e8bc3e81c2.png"></p>
<p>I assume that there is no distortion (or you already have called undistort() function)
For back projection you also can use these equations. Let you have pixel with coordinates (u,v) and you want to find 3d points that can be projected to this point (it is a ray in 3d space).</p>
<p>These points:</p>
<pre><code>z = some value > 0
x = (u-cx)*z/fx
y = (v-cy)*z/fy
</code></pre>
http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4965#post-id-4965Thx again. I use pixel size deltaD to get focal length and z value: f = deltaD*(fx+fy)/2, z = f. Then I can know the exact 3D position of points on image plane.Thu, 06 Dec 2012 20:03:28 -0600http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4965#post-id-4965Comment by AlexanderShishkov for <p>For projecting 3d point to the image plane you should use the equations:</p>
<p><img alt="image description" src="http://docs.opencv.org/_images/math/69a88b04c61001bf4e198abae39569e8bc3e81c2.png"></p>
<p>I assume that there is no distortion (or you already have called undistort() function)
For back projection you also can use these equations. Let you have pixel with coordinates (u,v) and you want to find 3d points that can be projected to this point (it is a ray in 3d space).</p>
<p>These points:</p>
<pre><code>z = some value > 0
x = (u-cx)*z/fx
y = (v-cy)*z/fy
</code></pre>
http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4876#post-id-4876More info here: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.htmlTue, 04 Dec 2012 05:09:41 -0600http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4876#post-id-4876Comment by AlexanderShishkov for <p>For projecting 3d point to the image plane you should use the equations:</p>
<p><img alt="image description" src="http://docs.opencv.org/_images/math/69a88b04c61001bf4e198abae39569e8bc3e81c2.png"></p>
<p>I assume that there is no distortion (or you already have called undistort() function)
For back projection you also can use these equations. Let you have pixel with coordinates (u,v) and you want to find 3d points that can be projected to this point (it is a ray in 3d space).</p>
<p>These points:</p>
<pre><code>z = some value > 0
x = (u-cx)*z/fx
y = (v-cy)*z/fy
</code></pre>
http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4941#post-id-4941Yes, you are right z > 0. In this model it is impossible to find equation of the image plane. You need some more input data, e.g. pixel size in mm.Thu, 06 Dec 2012 02:34:11 -0600http://answers.opencv.org/question/4862/how-can-i-do-back-projection/?comment=4941#post-id-4941