change white to gray in an image
21 views (last 30 days)
Show older comments
I have this image and I want to turn all the white pixels to gray, but I don´t know how to do it, can somebody help me?.thakns in advance
0 Comments
Answers (1)
Ameer Hamza
on 3 Sep 2020
Try this
im = imread('image.png');
im_gray = rgb2gray(im);
mask = imbinarize(im_gray);
im(mask(:,:,[1 1 1])) = 255*0.8; % 255*0 is black and 255*1 is white, any other value between is shade of gray
imshow(im);
0 Comments
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!