How to get colormap of a non-indexed RGB image?

1 回表示 (過去 30 日間)
S C.Carl
S C.Carl 2022 年 3 月 22 日
回答済み: Rik 2022 年 3 月 22 日
I have an RGBImage (but not an indexed image).
I applied a denoising operation of its grayscale image and obtained a DenoisedImage as grayscale.
I want to show the grayscale DenoisedImage image with the same color with the RGBImage.
So,I wrote;
[Ind, colMap] = rgb2ind(RGBImage, ?); % <= To Learn The ColorMap, I tried rgb2ind(Im,128); rgb2ind(Im,256); rgb2ind(Im,65536);
DenoisedImgAsRGB = ind2rgb(DenoisedImage, colMap);
But, the "DenoisedImgAsRGB" is not similar to the DenoisedImage. What should I write as the second parameter of the rgb2ind fubction?
Or, is there any way to convert the grayscale image to rgb image?
  2 件のコメント
Rik
Rik 2022 年 3 月 22 日
What code did you use to denoise the image?
My guess is that you need to make sure the data types of Ind and DenoisedImage match.
S C.Carl
S C.Carl 2022 年 3 月 22 日
編集済み: S C.Carl 2022 年 3 月 22 日
Hi,
The data types of Ind and DenoisedImage are the same ( 450x600 uint8 matrix ). Denoising has been provided by average filtering.

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

回答 (1 件)

Rik
Rik 2022 年 3 月 22 日
Since a colormap is a symbolic representation of the colors (and the number are not actually guaranteed to mean anything), you may need to denoise each color channel separately, instead of converting to an indexed image. The performance will probably be worse compared to a method that is suited for RGB, but at least it should get you a proper result.

カテゴリ

Help Center および File ExchangeModify Image Colors についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by