Code for making a reddish image from an RGB image

5 ビュー (過去 30 日間)
ANCY
ANCY 2014 年 1 月 3 日
回答済み: DGM 2022 年 4 月 24 日
If anyone knows the code for make a reddish image from an RGB image.Then plz share with me

回答 (3 件)

Walter Roberson
Walter Roberson 2014 年 1 月 3 日
編集済み: Image Analyst 2014 年 1 月 3 日
grayimg = rgb2gray(RGBImage);
redimage = cat(3, grayimg, zeros(size(grayimg)), zeros(size(grayimg)));
image(redimage);

Image Analyst
Image Analyst 2014 年 1 月 3 日
Walter gave one way, which is to convert it to a grayscale image and then make that into a red image. Another alternative is to just extract the red channel from the RGB image,
redChannel = rgbImage(:,:,1);
redImage = cat(3, redChannel, zeros(size(redChannel), 'uint8'), zeros(size(redChannel), 'uint8'))
or zero out the green and blue channels
redImage = rgbImage; % Initialize
redImage(:,:,2:3) = 0; % Erase green and blue channels.
The above two ways will give you a different image than via Walter's method. Use whichever gives you the image you want (a monochrome/weighted image or the red channel-only image). If you don't know why they're different, or what I'm talking about, then ask.
  2 件のコメント
Image Analyst
Image Analyst 2014 年 1 月 3 日
Yet another way is to not create an RGB image and just keep the gray scale image and apply a colormap
redColorMap=[(0:255)',zeros(256,2)]
imshow(grayImage);
% grayImage is either rgbImage(:,:,1) or rgb2gray(rgbImage)
colormap(redColorMap);
Image Analyst
Image Analyst 2014 年 1 月 4 日
ANCY - Are you still there? What's going on?

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


DGM
DGM 2022 年 4 月 24 日
I've answered a couple very similar-sounding questions recently:
How to make image "yellowish"? (explaining 'screen' blend, alternatives with imblend & MIMT tools)
How do I make image "reddish"? (basic non-MIMT blends, opacity comp, HSV colorize, Y+R)
This is also probably tangential to equally vague requests to colorize grayscale images:

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by