0

I have a frustum which is defined like this :

  • his origin is (0, 0, 0),
  • I know his orientation (heading, pitch, roll)
  • I know his bottom angle, his top angle, his left angle and his right angle.

I have a cv::Point3d and I would like project the point to the far-plane of the frustum. How can I do this with opencv?

artoon
  • 729
  • 2
  • 14
  • 41
  • its not clear to me what you want to achieve. do you want to project the point to the far-plane of the frustum? or do you want to know some "frustum coordinates" of that point (e.g. some kind of angle or sth)? – Micka Apr 20 '15 at 19:04
  • Sorry. I would like project the point to the far-plane of the frustum. – artoon Apr 20 '15 at 19:36
  • 1
    I think there are 2 common ways to do it, first one might be more efficient if you want to project only a few points for one static frustum, while the other one might be more efficient if you want to project a lot of points. 1. just interpret your poin as a vector from 0 to point position. scale that vector to fit the length of the frustum (noch check whether the point actually is within the frustum). 2. do it like in the rendering pipeline, span the frustum to be a cube around the z-axis and use orthogonal projection. – Micka Apr 21 '15 at 07:17
  • I have a lot of points so the second way seems better. I don't really see what you explain me ; do you have an example code ? – artoon Apr 21 '15 at 09:36
  • 1
    read about openGL rendering pipeline, there should be many explanations around the inernet. e.g. http://www.songho.ca/opengl/gl_projectionmatrix.html – Micka Apr 21 '15 at 09:42
  • Ok, I have the camera matrix. If I multiply a 3D point with the camera matrix I get my point view from the camera. I have also the projection matrix. We consider that the top left corner of my frustum is (0, 0), the top right corner is (1, 0), the bottom left corner is (0, 1) and the corner the bottom right is (1, 1). Now, how I use the projection matrix to compute the floating 2D coordinates of my point into my frustum ? – artoon Apr 21 '15 at 15:26
  • if z-axis is your optical axis, just set the z coordinate of your point to 1. After that, revert the transformations. – Micka Apr 21 '15 at 16:07

0 Answers0