How to change a part of the histogram of an image in MATLAB

3 次查看(过去 30 天)
Hi there,
I want to remove some parts(for example in 0-1 scale I want to remove 0.6 up to 0.9) in a RGB image. How can I do that?
I have a picture which background is white but there are noises there( the noises are like you have written something and cleared it with a rubber carelessly, so there are some shades or smth there remained), the written is with blue,black and red pens. I want to write a code that converts colors more than for example 0.8 to 1 so the background would be completely white.
Thanks in advance.

回答(1 个)

Image Analyst
Image Analyst 2020-11-25
You cannot remove pixels, you can only change them to a different value. What new value do you want to assign pixels that have original values in the range 0.6 to 0.9? Zero? One? What color is the background?
You forgot to attach your image. Please do so if you want more help.
  4 个评论
Eman Ezatfar
Eman Ezatfar 2020-11-26
Thanks.
It was usefull, but I do the mask on a grayscale image,can I convert again to RGB ? or do it on RGB ?
Thanks again.
Image Analyst
Image Analyst 2020-11-26
I did the mask on a gray scale image, like you want. Here is an alternative way that will work with either type of image:
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
% Works for gray scale as well as RGB Color images.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by