Effacer les filtres
Effacer les filtres

How to apply a mask to a list of same-size face images?

2 vues (au cours des 30 derniers jours)
Neuro
Neuro le 4 Mai 2023
Hi. I have a list of JPG images of faces (all same size and pixel number), and I want to apply a mask (same dimensions) to all of them. The purpose of this mask is to preserve the main facial features of the face and get rid of some of the hair, neck, etc. The mask must have the RGB values of [220 220 220].How can this be done with a script? I'm attaching the example of one image with the mask I need. Thank you very much!

Réponses (1)

Image Analyst
Image Analyst le 7 Mai 2023
You can just apply your mask to each color channel.
[r, g, b] = imsplit(r, g, b);
r(mask) = desiredRedValue;
g(mask) = desiredGreenValue;
b(mask) = desiredBlueValue;
rgb2 = cat(3, r, g, b);
imshow(rgb2);

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by