Azzera filtri
Azzera filtri

satellite image color problem

3 visualizzazioni (ultimi 30 giorni)
dakhli mohamed
dakhli mohamed il 11 Gen 2019
Commentato: dakhli mohamed il 14 Gen 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');

Risposta accettata

Image Analyst
Image Analyst il 12 Gen 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 Commento
dakhli mohamed
dakhli mohamed il 14 Gen 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)

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by