Extracting the indices in a 2D map associted with lines drawn over the map

조회 수: 1 (최근 30일)
Sai Prasanth
Sai Prasanth 2021년 5월 20일
댓글: Sai Prasanth 2021년 6월 11일
Hello,
I have a 2D map of some geophysical variable. Visually, to mark the regions of interest and draw cross-sections, I have drawn several lines that indicate the various regions of the map. Now, I would like to extract the indices associated with each of these lines. I would then like to average the geophysical variable once I know the indices (which is simple). I just don't know how to extract the indices given these lines.
Any guidance will be appreciated!

답변 (1개)

Image Analyst
Image Analyst 2021년 5월 20일
Use improfile() to draw your lines. Two of the outputs will be the vector of x and vector of y values for the line you drew.
  댓글 수: 10
Sai Prasanth
Sai Prasanth 2021년 6월 5일
I guess, my problem would instantly be solved if there was a way to extract these indices from a line drawn on a plot - without the need for converting it to an image. Since improfile only works on images, the indices of an image are totally different.
Please see in the below code that creates a line on a simple pcolor plot - I would just like to know the indices that it passes through (without converting to an image).
f3 = figure('DefaultAxesFontSize',18, 'DefaultAxesTitleFontWeight','bold')
set(gcf,'color','w');
set(0,'DefaultAxesFontName','Times New Roman','DefaultTextFontName','Times New Roman','DefaultAxesFontWeight', 'bold');
pcolor(wrfvars_time1.XLONG,wrfvars_time1.XLAT,log10(Int_icepath))
xlabel('Longitude')
ylabel('Latitude')
title('log_{10}(Vertically Integrated Ice-Water) in g/m^2')
shading flat
caxis([-2 5])
xlim([-36 -25])
ylim([6 16.15])
colormap(map)
colorbar;
x1 = -34.49;
x2 = -31.58;
y1 = 11.01;
y2 = 11.67;
plot([x1 x2], [y1 y2],'LineWidth',3,'Color','red');
Sai Prasanth
Sai Prasanth 2021년 6월 11일
@Image Analyst : Hi, can you please help me out with this one? I'd like to extract the indices from a line without going through an image.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by