フィルターのクリア

Convert Color to Bone colormap

3 ビュー (過去 30 日間)
Joe Tomaino
Joe Tomaino 2011 年 7 月 11 日
I would like to load a .jpg picture and convert it to grayscale using the bone colormap. Is this possible? I need to have blue/dark blue approach white and red/dark red approach black, or vice versa.
Thanks,
Joe

採用された回答

Walter Roberson
Walter Roberson 2011 年 7 月 11 日
If your image was originally an indexed image that was displayed (and saved) with the "bone" map, then you can reverse the color mapping and get back to the indexed image using:
indexedImage = rgb2ind(YourRGBImage, bone);
Once you have done that conversion, you can convert to an arbitrary new color map and convert that result to grayscale, by using
grayImage = ind2gray(indexedImage, NewMap);
For example, your NewMap could effectively be a gamma adjustment.
If you were custom-creating the new map and if it was just as easy to do it in gray in the first place, then you could make it a simple vector of gray levels, and use
grayImage = NewGMap(1+indexedImage);
  2 件のコメント
Joe Tomaino
Joe Tomaino 2011 年 7 月 13 日
Thanks Walter, I'm pretty sure that's the right thing to do, but the final image looks terrible. (I had to take a screen shot of the image, so I don't think Matlab is happy with it). I really appreciate your answer, thanks again!
Walter Roberson
Walter Roberson 2011 年 7 月 13 日
Perhaps instead of a screen shot, you could use print() with a resolution, or use Oliver's contribution export_fig, http://www.mathworks.com/matlabcentral/fileexchange/23629

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

その他の回答 (1 件)

Rick Rosson
Rick Rosson 2011 年 7 月 11 日
Please try:
doc rgb2gray
HTH.
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 7 月 11 日
That is suitable for RGB images, but not for using a particular color map.

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

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by