フィルターのクリア

satellite image color problem

3 ビュー (過去 30 日間)
dakhli mohamed
dakhli mohamed 2019 年 1 月 11 日
コメント済み: dakhli mohamed 2019 年 1 月 14 日
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 Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by