How to get the coordinates (lat, lng) of the four corners of an image in MATLAB and display them together with the image?
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to locate a certain point in an image automatically by displaying the coordinates of the whole image in MATLAB. What should I do?
5 Kommentare
Antworten (1)
William Rose
am 24 Mai 2022
Bearbeitet: William Rose
am 24 Mai 2022
[edited: corrected typos]
Let's assume you know the field of view (FOV), in degrees, of the drone camera. Typically this is given by the camera maker or drone maker for the "horizontal" (wider) dimension of the image. You also know the aspect ratio (AR) of the image, for example 16:9=1.778 or 4:3=1.333. Let's assume the camera is pointed straight down. We also assume the ground under the drone is flat. I assume the altitude (Alt) is in meters. You also need to know the orientation of the image, i.e. the true compass bearing that corresponds to "up" in the image. I will assume the image is oriented so that "up" on the image corresponds to the north direction. We can adjust for other orientaitons later. Then the left side of the image is Alt*tand(FOV/2) meters west of the sub-drone point (where tand(x)=tangent of (x in degrees)), and the right side of the image is Alt*tand(FOV/2) meters east of the sub-drone point. The top edge of the image is Alt*tand(FOV/(2*AR)) meters north of the sub-drone point, and the right side of the image is Alt*tand(FOV/(2*AR)) meters south of the sub-drone point. Convert meters north/south to degrees of latitude (offset from sub-drone point) using the conversion factor 6371000*2*pi meters=360 degrees, i.e,. 1.112e5 m = 1 degree of latitude. Convert meters east/west to degrees of longitude using the conversion factor 6371000*2*pi*cos(Lat) meters)=360 degrees, i.e. 1.112e5*cos(Lat) meters = 1 degree of longitude. These conversion factors assume a spherical Earth, which is not quite correct. However, the error introduced by this assumption is almost surely smaller than the errors introduced by violations of other assumtptions.
The calculations above will yield estimates for the Lat, Long of the corners.
Once you have estimated the Lat, Long of the corners, you can use linear interpolation to estimate the lat & long of selected points or pixels in the image. That will be OK, but it is good to be aware of sources of error. Error source 1: One degree in the center of the image covers a shorter meter-distance, or lat-long difference, than one degree at the edge of the image, because the ground in the center is closer to the camera than the ground at the image edges, assuming the camera is pointed straight down. You can correct for this by using the inverse tangent function. Error source 2: Lens distortion, that is, a non-linear mapping of angles to pixels across the image.
Good luck with your image analysis.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Automated Driving Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!