フィルターのクリア

Creating a pseudo-color image from a grayscale image

28 ビュー (過去 30 日間)
cg
cg 2021 年 9 月 25 日
回答済み: yanqi liu 2021 年 9 月 26 日
How would I create a pseudo-color image from a grayscale image? I need to use the attached formulas to map the intensity to three color channels R, G, B. Then, I need to merge the channels to get the pseudocolor image.
I am very lost so any help would be appreciated!

採用された回答

yanqi liu
yanqi liu 2021 年 9 月 26 日
sir, may be you can ref the follow code
clc; clear all; close all;
im = imread('cameraman.tif');
x = double(im);
c1 = 0.5; c2 = 0.8; c3 = 0.3; c4 = 0.6;
rx = x .* (1 + c1*sin(pi*x./255) + c2*(1-cos(2*pi*x./255)));
gx = x .* (1 + c3*sin(pi*x./255) + c4*(1-cos(2*pi*x./255)));
bx = 3*x - rx - gx;
rgb = mat2gray(cat(3, rx, gx, bx));
figure; imshow(rgb)

その他の回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 9 月 25 日
(1) Embed these three equations for variable x and c1, c2, c3, c4 values
(2) Concatenate R, G, B that becomes the pseudocolor image.
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 9 月 25 日
In particular,
RGB = cat(3, R, G, B);
Depending on the range of values of R, G, B, and the data type, you might need to normalize the matrix.

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


Image Analyst
Image Analyst 2021 年 9 月 25 日
R = .....
G = .....
B = .....
cmap = [R(:), G(:), B(:)]
coloredImage = ind2rgb(grayImage, cmap);

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by