How to plot coast on an image
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Telmo Vieira
2020년 1월 13일
2 개 추천
load coastlines
figure(1);
imagesc('xdata', lon, 'ydata', (lat), 'cdata', var1);
line(coastlon, coastlat)
댓글 수: 1
Abdollah Darya
2021년 8월 8일
You are a lifesaver. Been searching for an answer to this problem for ages. Much appreciated.
카테고리
도움말 센터 및 File Exchange에서 Oceanography and Hydrology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!