Filter löschen
Filter löschen

satellite image color problem

3 Ansichten (letzte 30 Tage)
dakhli mohamed
dakhli mohamed am 11 Jan. 2019
Kommentiert: dakhli mohamed am 14 Jan. 2019
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');

Akzeptierte Antwort

Image Analyst
Image Analyst am 12 Jan. 2019
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 Kommentar
dakhli mohamed
dakhli mohamed am 14 Jan. 2019
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)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by