Convert yaw, pitch and roll values to rVec for projectPoints.

asked 2019-06-12 14:18:12 -0500

CVPilot gravatar image

I'm trying to take a set of images and use projectPoints to take a real world Lat/Lng/Alt and draw markers on the images if the marker has a valid x,y within the image. I have the lat,lng,alt of the image along with the yaw, pitch and roll values from the camera that took the image. My YPR values are in the following format:

  • Yaw being the general orientation of the camera when on a horizontal plane: toward north=0, toward east = 90°, south=180°, west=270°, etc.
  • Pitch being the "nose" orientation of the camera: 0° = horizontal, -90° = looking down vertically, +90° = looking up vertically, 45° = looking up at an angle of 45° from the horizon, etc.
  • Roll being if the camera is tilted left or right when in your hands: +45° = tilted 45° in a clockwise rotation when you grab the camera, thus +90° (and -90°) would be the angle needed for a portrait picture for example, etc.

I have been stuck for a few days on how to take the yaw pitch and roll values to get a valid rVec value for the projectPoints function.

Thanks for any help.

edit retag flag offensive close merge delete


I suggest to do this thing manually using raycasting. Compute the Lat/Lon of the 4 corners of the image using Y/P/R and the FOV angles of the camera, then use interpolation to get the pixel coordinates of the marker.

It needs some trigonometrical calculations, but it won't take several days at least...

kbarni gravatar imagekbarni ( 2019-06-14 05:42:59 -0500 )edit