Image Extraction From Another one

37 vues (au cours des 30 derniers jours)
Rasho
Rasho le 12 Oct 2021
Commenté : Rasho le 12 Oct 2021
Hello,
How can I get the color image from the color and gray image?
Thank you.

Réponse acceptée

Image Analyst
Image Analyst le 12 Oct 2021
Convert to HSV color space and take where the saturation > 0
hsvImage = rgb2hsv(rgbImage);
mask = hsvImage(:, :, 2) > 0;
% 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));
%maskedRgbImage = pagemtimes(rgbImage, cast(mask, 'like', rgbImage)); % R2020b and later.
  1 commentaire
Rasho
Rasho le 12 Oct 2021
Thank you it work.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox 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