# How can I map a specific location in MATLAB using the drone images with corresponding gps data latitude and longitude?

28 visualizzazioni (ultimi 30 giorni)

Mostra commenti meno recenti

##### 2 Commenti

KSSV
il 27 Feb 2022

What data you have? You have (lat,lon) and images? Do you have the geographic reference of images?

### Risposte (2)

AndresVar
il 27 Feb 2022

Modificato: AndresVar
il 27 Feb 2022

You can use geoplot: Plot line in geographic coordinates - MATLAB geoplot (mathworks.com)

You can ignore geolimits first, get a nice a view, query the limits and then set it.

lats = [34.07293; 34.08];

longs = [-118.44867; -118.45];

id_str = {'1';'2'}; % maybe use the file name instead or some timedate format

data = table(id_str,lats,longs)

geoplot(data.lats,data.longs,'*m')

text(data.lats,data.longs,data.id_str,'Color','m','FontSize',12)

geolimits([34.0452 34.0978],[-118.4800 -118.4])

geobasemap streets

##### 3 Commenti

AndresVar
il 1 Mar 2022

@Cristel Esmerna parse and collect the data in the loop but plot outside the loop otherwise you might need to use hold on

I don't know why it would show wrong location. Geoplot worked well with a location I got off googlemaps. Verify you lat and lon for just 1 photo on google maps.

William Rose
il 27 Feb 2022

My interpretation of your question is that you would like to show shapes on a basemap that will indicate the area covered by each drone image. In general, each rectangular drone image will map to a curvy quadrilateral on the basemap. You know the lat and long of the corners your basemap image, and therefore you can easily compute the lat and long of any point in the basemap, by simple linear interpolation from the corner points.

Approach 1. For a start, let's assume the ground covered by the basemap is all at the same altitude. Then you need to known the lat and long of the drone, which you said you have. You also need to know its altitude above the ground and the 3D orientation of the camera (which is described by 3 parameters, or by the 3x3 rotation matrix, which only has 3 independent parameters, even though it has 9 elements). You need to know the camera projection properties, which is a non-trivial thing. If you have all that information, then you can compute the lat and long of the edge points of your image, and you can draw a shape on th basemap with those points.

If you do not know the camera orientation and camera projection properties, then you need to identify several fiducial points, also known as reference points, on the base map, and associate them with corresponding points in the drone image. Then you use the associated points to solve for the constants in the projection equations that relate the drone image to the base map. Depending on the equations you choose for the projection, you may end up with an over-determined set of equations to solve. This will happen if you have M constants to solve for in the projection equations, and you have more than M/2 fiducial points - because you get 2 identities from every fiducial point If the system is overdetermined, then you take a least-squares approach to estimate the constants.

Example: Assume the camera projection is affine, which means that straight lines on the ground get mapped to straight lines in the camera image. Each point on the base map has a latitude ϕand longitude λ. The points in the drone image are described by the pixel coordinates: row i, i=1:M, and column j, j=1:N. The affine projection equations can be written as

With 3 non-co-linear fiducial points, you can solve for the unknowns a11,...,a23. If you have more than 3 fiducial points, you use singular value decomposition to find the values of the six constants that minimize the errors between the actual and predicted basemap coordinates of the fiducial points. Once you have the six unknowns, you use the projection equations to determine the latitudes and longitudes of the corners of the image, and you draw straight lines betweeen those points on the basemap.

##### 7 Commenti

William Rose
il 21 Mar 2022

I am not sure I have correctly undesrstood what you want to do.

I assume you would like to turn your drone image into a map-like image. There are nice ways to do it, with imwarp(). imwarp warps the image and with the right inputs, it can take a drone image and warp it into what the image would look like if it were taken from very high straight overhead, i.e. warp it into a map projection. But imwarp() has to know a bunch of stuff to do it. The fiducial points are one way to calculate what imwarp needs to know.

You have a lat and long and altitude. Is that for the drone when it took the photo, or for a place on the image?

Please post yor question as a whole new question. It deserves its own thread. Include an image and the lat-long-alt info if you are able share, or, if you cannot share it, make up a simulated problem analgous to yours, perhaps using google maps and 3D view, like I did for you. There are people on this forum who know a lot more than me about this, who can give better help, although I will try. Include @William Rose, in the posting, so that I get an email about it, because I have not been chekcing Matlab ansers regularly for the last couple of weeks. Or we can take it off line if you prefer to share an email.

Beth Carreon
il 22 Mar 2022

### Vedere anche

### Categorie

### Prodotti

### Community Treasure Hunt

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

Start Hunting!