imshow - plotting a circular image, how to make corners white?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi
I have a circular image but it's stored as a grayscale matrix, ie. square. When I use "imshow" with the jet colormap it automatically makes the areas outside the circle blue (because the matrix elements are all 0s).
Is there a fix for this? I want the areas outside the circle to be white, or not plotted, without messing with the colormap (which then ruins the colorbar).
Thanks for any help
Mike
0 件のコメント
回答 (2 件)
Junaid
2012 年 4 月 26 日
Could you share your matrix. Or try following command.
colormap gray;
This will make show boundary either black or white.
0 件のコメント
Image Analyst
2012 年 4 月 26 日
Just adjust the colormap:
% Start with the jet colormap.
cmap = jet(256);
% Change 0 from blue to white.
% Gray level of zero will now show up as white rather than blue.
cmap(0,:) = [1 1 1];
% Apply the colormap (a modified jet colormap).
colormap(cmap);
参考
カテゴリ
Help Center および File Exchange で White についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!