Plot an array greyscale but certain pixels marked in red
1 回表示 (過去 30 日間)
古いコメントを表示
I have an MxN array of integers that makes an image that can be plotted with imagesc. I'd like to plot the whole image with greyscale but plot all pixels that have value X in red. Any thoughts?
0 件のコメント
採用された回答
Walter Roberson
2012 年 1 月 24 日
mymap = gray; %copy the grayscale map
mymap(SomeIndex,:) = [1 0 0]; %set one particular entry to be red
imagesc(YourImage);
colormap(mymap);
This code does require that you figure out what map index the value X will be mapped to by imagesc.
There are alternatives involving overlaying a red image of exactly the same size that is transparent everywhere except for the places X is. This requires OpenGL (no other renderer handles transparency)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Red についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!