Filter löschen
Filter löschen

How do i scan pixel from an rgb image and then if red value is higher than 200 show red only and if its lower = all 3 colors = 0

5 Ansichten (letzte 30 Tage)

Akzeptierte Antwort

David Fletcher
David Fletcher am 22 Mai 2021
Bearbeitet: David Fletcher am 22 Mai 2021
May not be the best answer - I don't do much image manipulation work
%load and display image
%Create mask for red colour data >200
%Apply mask to red channel
%Clear colour data from all channels
%Replace red channel with the masked data
%Show image with red channel mask mask
  10 Kommentare
Moe Makki
Moe Makki am 23 Mai 2021
oops my bad there was an error with imshow i replaced it with the same picture

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 22 Mai 2021
Try this:
% Find where red value is more than 200.
mask = rgbImage(:, :, 1) > 200;
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));
  6 Kommentare
Image Analyst
Image Analyst am 24 Mai 2021
Bearbeitet: Image Analyst am 24 Mai 2021
In the future, please "Tag" the post as homework if it's homework (I've done it for you now). That tells us not to post full working code, that, if you turn in as your own, may get you into trouble for plagiarism. We wouldn't want you to get into trouble.

Melden Sie sich an, um zu kommentieren.


Mehr zu Colormaps 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