How to plot coast on an image
Afficher commentaires plus anciens
Hi,
Here is my problem :
I got an image wich is 10980*10980 (from sentinel-2, in jp2). Showing a part of the england (in the south west). There is land, water and cloud.
First, I displayed the picture from RGB to B&W. And now i'm trying to find the coast (and land) to create a mask on the B&W image.
Here is my question : How can I do that ?
I already have use the m_map toolbox (free to use and I can't go for the mapping toolbox unfortunatly). I used the m_gshhs (with full resolution) on my region of interest. And now, I'm looking for "ploting" the mask from m_gshhs to my image. My problem here is that m_gshhs don't give any matrix at all (and so no image) meaning that I can't "compare" them.
EDIT : I just find a way with m_gshhs (from m_map) and my coordinate. But I can't get a matrix from this function.. so I'm trying to "plot" my picture in a georefenced grid currently.
EDIT2 : Currently my image gives me a matrix of intensity. I have the latitude/longitude of the top left corner and right bottom corner. I'm using mercator representation. When I'm using the m_map toolbox I got a white picture. Is there a way to associate long./lat. to my data and plot all of that on a map ? Here is, what I have currently :
% figure,
m_proj('mercator','lon',[a b],'lat',[c d]) %where a,b,c & d are my coordinates (long./lat.)
image([a b],[c d], Inb); % I'm trying to fix my image with the coordinate i have
m_grid; % making a grid which just making my image disappear...
As I know it's a georeference problem, but I don't know how to handle that... How can said to matlab that the point for Img(1,1) refered to lat1/long1 ?
If someone have any ideas to look at.. Thank You,
Lionel DETE
Réponse acceptée
Plus de réponses (1)
Telmo Vieira
le 13 Jan 2020
2 votes
load coastlines
figure(1);
imagesc('xdata', lon, 'ydata', (lat), 'cdata', var1);
line(coastlon, coastlat)
1 commentaire
Abdollah Darya
le 8 Août 2021
You are a lifesaver. Been searching for an answer to this problem for ages. Much appreciated.
Catégories
En savoir plus sur Mapping Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!