satellite image color problem

3 次查看(过去 30 天)
Hello
I have a black and white image and I want the white area to be displayed in red. I have a code but badly the zone in black is displayed in red. I just want to change the code to have my result,
and thanks in advance and thanks for Image Analyst
I have attached the image.
rgbImage = imread('C1fig.jpg');
whos rgbImage
subplot(2, 1, 1);
imshow(rgbImage);
title('Original RGB image C1fig.jpg');
axis('on', 'image');
impixelinfo
mask = rgbImage(:, :, 1) == 0;
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
redChannel(mask) = 255;
greenChannel(mask) = 0;
blueChannel(mask) = 0;
% Recombine separate color channels into a single, true color RGB image.
rgbImage = cat(3, redChannel, greenChannel, blueChannel);
subplot(2, 1, 2);
imshow(rgbImage);
axis('on', 'image');
impixelinfo
title('Altered RGB image');

采纳的回答

Image Analyst
Image Analyst 2019-1-12
This is a duplicate question. I already answered it here: in your duplicate post
Like I already said, essentially you just define the mask to find white pixels instead of black pixels:
mask = rgbImage(:, :, 1) > 250; % or whatever value you want.
Why did that not work for you, such that you had to post a duplicate question on it???
  1 个评论
dakhli mohamed
dakhli mohamed 2019-1-14
the size of my image is 190 * 190
I did not understand that the program takes the whole picture there is parity useless
my starting image (attached)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by