Friday, 5 October 2018

gps - Getting coordinates of pixel from georeferenced drone photo?


I have a problem with geo-referenced photos from a DJI drone. I have the coordinates of the center of the photo and the metadata related to the photo and I would like to know how to go from a pixel to its relative coordinates.


Example metadata [Exif]:


latitude: 45.6426621388889 
longitude: -94.5975223611111

AbsoluteAltitude: 332.743835
FlightPitchDegree: 0.3
FlightRollDegree: 3
FlightYawDegree: 89
GimbalPitchDegree: -90
GimbalRollDegree: 0
GimbalYawDegree: 7.8
RelativeAltitude: 40.700001
TlinearGain: 0
altitude: 332.7

altitude_ref: 0
aperture: 1.25
f_number: 1.25
focal_length: 13
image_make: "DJI"
image_model: "FLIR"

Having these and knowing that you have a box positioned at the pixels: 113 (xmin), 360 (ymin), 139 (xmax), 406 (ymax) how can I get its coordinates?


From a software I was able to extrapolate a solution that brings me back:


-94.6002156260815 (minimum longitude)

45.6413373184107 (minimum latitude)
-94.5998767997666 (maximum longitude)
45.6417408827611 (maximum latitude)

The problem is that I cannot understand whether it is right or whether it is calculated.



Answer



The approach you're looking for is called monoplotting in photogrammetry. If given your assumptions on camera orientation, you will need a digital elevation model (unless you also assume the ground is perfectly flat), and also the size of your camera's imaging sensor. I'll try here to describe a simplified version of this process.


Given the position (I recommend to convert the coordinates to some metric system, e.g. UTM, to help in the vector calculations), the focal length and the image sensor size, you can calculate a vector with x= sensor_x / 2, y = sensor_y / 2, z = focal_length, where sensor_xand sensor_y are the width and height of your imaging sensor. You can now extend that vector to the ground using the flight altitude. If you want to do it more accurately though, I'd recommend repeating this for each pixel and resampling the result to a consistent image.


Anyway, I suppose this is what your software did, though I can't tell whether the result is reliable because I don't know which software you used.


If you have several images that have some overlap and are not taken from the exact same position, I recommend you use some photogrammetry software to get a georeferenced orthophoto. This will be much more accurate than monoplotting, as it doesn't have to rely on all the assumptions you made (position accuracy, camera internal orientation, etc.). An example would be https://www.opendronemap.org/.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...