フィルターのクリア

Converting RGB Image to Grayscale Intensity on arbitrary Colormap

8 ビュー (過去 30 日間)
Matt Gaidica
Matt Gaidica 2021 年 12 月 1 日
コメント済み: Matt Gaidica 2021 年 12 月 2 日
We have some thermal videos that have a colorscale presented along the side. I would like to run some thermal analysis on video frame regions. If I extract the colorscale from the video, how could I apply that to the image such that the result would be grayscale based on the intensity of the colorscale?
I have obtained a cmap for the custom scale by reading in that area, taking the mean over each column, resulting in a 1601x3 double, but I don't know how to map that onto a grayscale image as intensity values.

採用された回答

Image Analyst
Image Analyst 2021 年 12 月 2 日
People ask this all the time. So much so that I have a canned demo for it. See attached.
Adapt as needed, like to specify where in the image your image and colorbar are located.

その他の回答 (1 件)

DGM
DGM 2021 年 12 月 1 日
編集済み: DGM 2021 年 12 月 1 日
Something like this might be a start:
% you already found a colormap
cmap = parula(64);
% generate false-color test image
A = imread('cameraman.tif');
Aind = gray2ind(A,size(cmap,1)); % uniform quantization
Afalse = ind2rgb(Aind,cmap); % apply colormap
imshow(Afalse)
% convert back to intensity image
Arecovered = double(rgb2ind(Afalse,cmap))/(size(cmap,1)-1);
figure; imshow(Arecovered)
immse(im2double(A),Arecovered) % not perfect, but pretty good
ans = 2.9731e-05
  3 件のコメント
DGM
DGM 2021 年 12 月 2 日
All you need is the second part. The first part is just generating a falsecolor test image, in concept like the one you already have. Your image would be Afalse, and your colormap should be cmap.
Matt Gaidica
Matt Gaidica 2021 年 12 月 2 日
Thanks for your time DGM!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by