Camera fov, yaw, pitch and position from a photo GPS and metadata?

Started by KirillK, November 14, 2018, 12:35:02 PM

Previous topic - Next topic

KirillK

   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




Oshyan

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

KirillK

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

KirillK

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 ? 

WAS

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.

KirillK

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

Oshyan

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

KirillK

Quote from: Oshyan on November 16, 2018, 01: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

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 ?

Oshyan

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