Author Topic: Camera fov, yaw, pitch and position from a photo GPS and metadata?  (Read 215 times)

Offline KirillK

  • Member
  • *
  • Posts: 68
   I guess it should be possible somehow to precisely  project a photo onto a USGS elevation based terrain  but I couldn't figure out how

What I see in Mavic pro drone captured image metadata for example :

<drone-dji:AbsoluteAltitude>+1431.87</drone-dji:AbsoluteAltitude>
         <drone-dji:RelativeAltitude>+50.50</drone-dji:RelativeAltitude>
         <drone-dji:GimbalRollDegree>+0.00</drone-dji:GimbalRollDegree>
         <drone-dji:GimbalYawDegree>-25.60</drone-dji:GimbalYawDegree>
         <drone-dji:GimbalPitchDegree>-8.60</drone-dji:GimbalPitchDegree>
         <drone-dji:FlightRollDegree>+5.10</drone-dji:FlightRollDegree>
         <drone-dji:FlightYawDegree>-25.30</drone-dji:FlightYawDegree>
         <drone-dji:FlightPitchDegree>+0.60</drone-dji:FlightPitchDegree>

and   

<exif:GPSVersionID>2.3.0.0</exif:GPSVersionID>
         <exif:GPSLatitude>39,31.7746N</exif:GPSLatitude>
         <exif:GPSLongitude>119,37.7523W</exif:GPSLongitude>
         <exif:GPSAltitudeRef>0</exif:GPSAltitudeRef>
         <exif:GPSAltitude>1431873/1000</exif:GPSAltitude>


How could I translate that 39,31.7746N and 119,37.7523W and altitude to Terragen values?    Would be nice if it could be set automatically somehow




Offline Oshyan

  • Planetside Staff
  • *
  • Posts: 12652
  • Holy snagging ducks!
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #1 on: November 14, 2018, 09:07:22 PM »
There is no existing functionality for this, you'd need to convert the Lat/Long into meters from the north pole, in the default setup. And that would only get you position, not camera orientation, etc. But once you figured out the calculations for position offset you could probably make a simple script or calculator to reproducibly derive these values, even programmatically from the drone data.

Or if you (or someone else who is interested) has coding ability you could probably use the SDK to create a drone movement data importer for camera data.

- Oshyan

Offline KirillK

  • Member
  • *
  • Posts: 68
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #2 on: November 14, 2018, 09:28:27 PM »
I think I figured it out. In other part of metadata those gps values are exactly in Terragen numbers. Same as in DEM loader.    Yaw and Pitch also seems comparable. Still I am getting kind of wrongly framed  landscape.(although very close)   I think it's in camera fov and film aperture. 

Could somebody explain please what  should I use there. There is very little info in the help.  "Focal length  in mm" I guess is 35mm equivalent, right?  and what should I put in Film apperture in mm for a Mavic Pro drone camera ?

Or it's a bad idea maybe ?   GPS data has just not enough precision to project an image back to the ground precisely?     I hoped it would be good enough for background things.

ps .They dig out lots of the ground in the picture so some mismatch is because of that. Otherwise I think it's a camera fov difference or something
« Last Edit: November 14, 2018, 09:38:42 PM by KirillK »

Offline KirillK

  • Member
  • *
  • Posts: 68
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #3 on: November 14, 2018, 10:17:49 PM »
BTW, do somebody know in what  texture painting soft it would be possible to load terrain geometry and cameras and use them for projective painting with an ability to morph the image slightly  to conform the terrain geometry?
Can I load cameras in Photoshop for example?  Or Mari ? 
 
« Last Edit: November 15, 2018, 02:41:18 AM by KirillK »

Offline WASasquatch

  • Member
  • *
  • Posts: 3052
  • The Homeless Landscape Artist
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #4 on: November 15, 2018, 12:34:42 AM »
This seems beyond me as I've never really played too much with GPS data, but it does look like the native terrain is in a wider shot. You may be able to zoom out you camera a bit to obtain similar.
Art can be a window into the soul

Offline KirillK

  • Member
  • *
  • Posts: 68
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #5 on: November 15, 2018, 02:45:35 AM »
I set the focus length  exactly as in the image metadata. So my guess it's "film aperture" probably.  Not sure I understand what it is

Offline Oshyan

  • Planetside Staff
  • *
  • Posts: 12652
  • Holy snagging ducks!
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #6 on: November 16, 2018, 05:34:43 AM »
As far as I know you should not need to change the aperture as long as the FoV measurements you have are 35mm equivalent, which is the standard in the digital photography world.

- Oshyana

Offline KirillK

  • Member
  • *
  • Posts: 68
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #7 on: November 16, 2018, 11:17:00 AM »
As far as I know you should not need to change the aperture as long as the FoV measurements you have are 35mm equivalent, which is the standard in the digital photography world.

- Oshyana

Thanks Oshyan, I have another question .

The only way I could set a camera in proper position is to put gps data in "39.5295785555; -119.629201361167"  format I found in  all cameras exif metadata ( looks like iphone writes yaw too as "direction")      as a planets "lat long at apex".     Same way I do to find where imported DEM is.     So I put only height  and yaw/pitch in camera dialog.

The question is how to make it stay where it is when I need to set a next camera projection and need to change planet Long lat apex again?

I bet the program code is already have something to put DEMs in proper position  based on same digits  so why not a camera?   Should be pretty simple vector math to add an altitude and gimbal /yaw / pitch/ roll values.        Could you make same panel as for georeferenced image please or maybe a camera input in the node?

Unfortunately i have zero programming skills myself.

Maybe It could be done in some 3d party soft and then be imported trough FBX or something?  Do somebody know one ?
« Last Edit: November 16, 2018, 12:01:52 PM by KirillK »

Offline Oshyan

  • Planetside Staff
  • *
  • Posts: 12652
  • Holy snagging ducks!
Re: Camera fov, yaw, pitch and position from a photo GPS and metadata?
« Reply #8 on: November 17, 2018, 04:49:36 AM »
I don't know of a way to automate that in Terragen currently. I would look into some kind of external tool to convert and save to FBX or CHAN (Nuke format).

- Oshyan