How do I change image background to red
9 次查看(过去 30 天)
显示 更早的评论
I have an image with black background, which I got from imfreehand function. I want to change that black background to red. Following is link for image.
0 个评论
采纳的回答
Image Analyst
2014-2-18
background = grayImage == 0; % Find black pixels.
redChannel = grayImage;
redChannel(background) = 255; % Set black pixels to max value.
% Create true color image.
rgbImage = cat(3, redChannel, grayImage, grayImage);
imshow(rgbImage); % Display it.
5 个评论
Image Analyst
2014-2-20
numberOfBackgroundPixels = sum(background(:)); % Red/white pixels in background.
numberOfROIPixels = numel(background) - numberOfBackgroundPixels;
更多回答(2 个)
Ravi Shekhar
2018-3-29
Hi, you can use following MATLAB code to change the color scheme of a gray image.
gray_image = imread('cameraman.tif');
map = colormap('autumn');
rgb_image = ind2rgb(gray_image,map);
You can get different color schemes under 'colormap' function in MATLAB.
0 个评论
hf fh
2018-9-19
Please help me I have an image and I want to make the background color white I used the previous method but did not good out with me
5 个评论
hf fh
2018-9-20
To make sure there is no noise in the image and also make sure the edges of the image
Image Analyst
2018-9-20
Making the surround white does not make sure there is no noise in the image. And you didn't finish the second part of the sentence about making sure the edges.....are what?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Red 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!