How can I generate whiteish images with this image? This code is for example.

10 vues (au cours des 30 derniers jours)
Kiha Kim
Kiha Kim le 13 Déc 2021
Modifié(e) : DGM le 13 Nov 2022
A = im2double(imread('fruit.png'));
B = 1-((1-A).*(1-permute([1 0 0],[1 3 2])));
figure;
imshow(B)
  2 commentaires
DGM
DGM le 13 Nov 2022
Modifié(e) : DGM le 13 Nov 2022
The above operation is a 'screen' blend with red. It does not create the output image shown.
This thread is a consequence of the examples here:
At the end, I gave a handful of examples for the "whiteish" case.

Connectez-vous pour commenter.

Réponses (2)

Voss
Voss le 13 Déc 2021
I don't know if this is what you have in mind, but maybe something like this:
whiteness = 0.5;
A = im2double(imread('fruit.png'));
B = mean(A,3).*ones(1,1,3)*(1-whiteness)+whiteness;
figure;
imshow(B)
Here, whiteness is a parameter for you to tune (between 0 and 1, inclusive) in order to achieve the desired "whiteish"-ness.
whiteness = 0; will give you the grey-scale version of the original image where each RBG channel is the average of all three RGB channels in the original image. whiteness = 1; will give you an image of all white.

Image Analyst
Image Analyst le 13 Déc 2021
You can make an image "whiter" by decreasing the saturation and increasing the value.
hsvImage = rgb2hsv(rgbImage);
[hImage, sImage, vImage] = imsplit(hsvImage);
sImage = someFactor1 * sImage; % someFactor1 < 1 to reduce vividness of color
vImage = someFactor2 * vImage; % someFactor2 > 1 to brighten the image
hsvImage = cat(3, himage, sImage, vImage);
rgbImage = hsv2rgb(hsvImage);

Catégories

En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by