show an image as categorised
古いコメントを表示
I have an image with 3 layers (R,G,B). I want to show each layer as a cateogorised image as I can define the range of values in each category. I also want to add a legend as it show the range of values and the assigned color, a map scale (in kilometer) and geographical north direction. for eaxample I want to show the layer 1 as: 0.05-0.1>>blue 0.1-0.15>>green 0.15-0.2>>yellow 0.2-0.25>>red
Could you please help me about that?
回答 (2 件)
Walter Roberson
2011 年 6 月 29 日
0 投票
Perhaps you could use contour() and supply the level list
9 件のコメント
Hassan
2011 年 6 月 29 日
Walter Roberson
2011 年 6 月 29 日
To turn off the lines in contour(), pass the additional parameter 'none' as the linespec argument.
Hassan
2011 年 6 月 29 日
Walter Roberson
2011 年 6 月 29 日
It appears that 'none' is a later version than you or I are using. But you can use this:
[edges,chandle] = contourf(Myimg(:,:,1));
set(chandle,'LineStyle','none');
Hassan
2011 年 6 月 29 日
Walter Roberson
2011 年 6 月 29 日
[edges,chandle] = contourf(Myimg(:,:,1).', [0.1, 0.15, 0.2, 0.25]);
set(chandle,'LineStyle','none');
colorbar;
colormap([0 0 1; 0 1 0; 1 1 0; 1 0 0]);
annotation('arrow', [X1 X2],[Y1 Y2], 'HeadStyle', 'hypocycloid'); %with appropriate X and Y
I do not know if there is a good way to create a map scale with tick marks.
Hassan
2011 年 6 月 30 日
Walter Roberson
2011 年 6 月 30 日
Which direction does using Myimg(:,:,1) display relative to what you would like displayed?
Hassan
2011 年 6 月 30 日
Sean de Wolski
2011 年 6 月 29 日
0 投票
Perhaps you could convert it to be identical to a label image and then use label2rgb to show it?
6 件のコメント
Hassan
2011 年 6 月 29 日
Sean de Wolski
2011 年 6 月 29 日
Yes. So set every pixel in each range to an integer monotonically increasing from 1. label2rgb sounds like exactly what you want!
Hassan
2011 年 6 月 29 日
Sean de Wolski
2011 年 6 月 29 日
Use hist on each channel reshaped to a vector; get the second output (the bin); reshape all three channels back into their beginning shape; set up some criteria on which bins make what values and then label based on the values.
Show us a better set of sample data and the expected results. Perhaps a 2x2x3 matrix and the criteria used to determine "category"
Hassan
2011 年 6 月 29 日
Hassan
2011 年 6 月 30 日
カテゴリ
ヘルプ センター および File Exchange で Images についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!