I want to extract the geopgraphic coordinates from a smartphone picture. All our photos are georeferenced and that info is embedded in headers somewhere. Is there a matlab or python function that can tell me a pictures geographic coordinates? I want to write a script which can calculate the distance between the two images, so if I can extract geographic coordinates of the two photos then I will be able to calculate the distance. thanks
If you want to use MATLAB, there is a function called imfinfo
that extracts the exif data from an image file and saves it in a struct. You can find the GPS information in the GPSInfo
field. Example:
info = imfinfo('filename.png');
info.GPSInfo
Then, to access the individual Latitude and Longitude values (expressed in degrees, minutes, seconds) you can check the fields GPSLatitude
and GPSLongitude
:
info.GPSInfo.GPSLatitude
info.GPSInfo.GPSLongitude