How to get the coordinates (lat, lng) of the four corners of an image in MATLAB and display them together with the image?

11 visualizzazioni (ultimi 30 giorni)
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 Commenti
Cristel Esmerna
Cristel Esmerna il 19 Apr 2022
These are the sample images that i have the image of the rice field and the gps info of the drone where it is located. Assuming that the drone is at the center and I want to get the coordinates of the corners of the image using matlab so that I can locate a point anywhere on the image using the range of the coordinates of the corners. Thanks for helping.

Accedi per commentare.

Risposte (1)

William Rose
William Rose il 24 Mag 2022
Modificato: William Rose il 24 Mag 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.

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by