MATLAB: GPS coordinate from jpeg file metadata

I'm working on a geo location progect and I need to plot some gps coordinate obtained from Jpeg pictures taken with a smartphone. Using info = imfinfo(filename) I get the information from the jpeg file but they are only ''visual'' information, so i would like to know if there's function to utilize the info i obtain from imfinfo to write a gps variable. To be clear:
imglatitude=0
info=imfinfo('file.jpg')
info =
scalar structure containing the fields:
Filename = C:\Users\...\file.jpg
FileModDate = 28-Apr-2015 17:20:16
FileSize = 3129532
Format = JPEG
GPSInfo =
scalar structure containing the fields:
GPSLatitudeRef = N
GPSLongitudeRef = E
GPSAltitude = 44
GPSLatitude =
xx.xxx
xx.xxx
xx.xxx
GPSLongitude =
xx.xxx
xx.xxx
xx.xxx
imglatitude=*GPSLatitude obtanined from imfinfo*
I've got no clue about how to get this gps info out from the imfinfo function! Thanks in advance for your help

Best Answer

The data returned from imfinfo is a structure and the fields can be accessed individually. If you have access to the Mapping Toolbox then with a little bit of effort you can use the wmmarker function display your image on a map.
Example: Use a sample image from the Image Processing Toolbox which contains geographic data.
handsInfo = imfinfo('hands1.jpg');
Display the GPS information
handsInfo.GPSInfo
ans =
GPSLatitudeRef: 'N'
GPSLatitude: [42 17 57.0600]
GPSLongitudeRef: 'W'
GPSLongitude: [71 21 5.8200]
GPSAltitudeRef: 0
GPSAltitude: 69.7069
GPSTimeStamp: [16 48 35]
GPSImgDirectionRef: 'T'
GPSImgDirection: 291.9459
GPSDateStamp: '2014:03:11'
Note that the latitude and longitude are given in Degrees, Minutes, and Seconds (DMS). We will need to convert them to decimal degrees.
lat = dms2degrees(handsInfo.GPSInfo.GPSLatitude);
lon = dms2degrees(handsInfo.GPSInfo.GPSLongitude);
The GPSLatitudeRef and GPSLongitudeRef fields determine if the lat and lon should be positive or negative.
if strcmp(handsInfo.GPSInfo.GPSLatitudeRef,'S')
lat = -1 * lat;
end
if strcmp(handsInfo.GPSInfo.GPSLongitudeRef,'W')
lon = -1 * lon;
end
Display the photo on a webmap to put it in context. This particualar image is small, but for a larger image you might want to use imresize to create a smaller thumbnail.
wmmarker(lat, lon, 'OverlayName', 'Hands1', 'Description', ...
'Photo taken at The Mathworks, Inc', 'Icon', 'hands1.jpg')