How to obtain an image from meshlsrm plot?

1 回表示 (過去 30 日間)
Simone Cordella
Simone Cordella 2017 年 2 月 4 日
コメント済み: Simone Cordella 2017 年 2 月 12 日
Hi, I have a Digital Elevation Model on a .tif file. In order to visualize a shaded relief version of it, I'm using this code:
A = geotiffread('dem.tif');
info = geotiffinfo('dem.tif');
lat = info.CornerCoords.Lat;
lon = info.CornerCoords.Lon;
RObj = georasterref('RasterSize',size(A),'LatitudeLimit',[min(lat(:)) max(lat(:))],'LongitudeLimit',[min(lon(:)) max(lon(:))]);
worldmap(A,RObj);
cmap = colormap(gray(256));
meshlsrm(A,RObj,[135, 27],cmap);
On the plot that result from meshlsrm, I have to do other elaboration (for example I need to use the canny edge detector, and the the Hough transform). Someone knows a way in order to obtain a gray scale image from meshlsrm?

採用された回答

Carl
Carl 2017 年 2 月 6 日
編集済み: Carl 2017 年 2 月 6 日
The color displayed is determined by the colormap. You can change it from the default to grayscale with the following command:
colormap gray
See the documentation for more information:
https://www.mathworks.com/help/matlab/ref/colormap.html
Afterward, you can do something like the following to obtain the actual image from the surface object:
image = frame2im(getframe(gcf));
image = rgb2gray(image);
figure; imshow(image);
  1 件のコメント
Simone Cordella
Simone Cordella 2017 年 2 月 12 日
thank you!

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by