Image conversion to RGB
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Noor us Saba
le 23 Avr 2019
Commenté : Noor us Saba
le 24 Avr 2019
How to convert the binary image (which is extracted from regionprops command) to again RGB image
here is the sample command
stats = regionprops(L,'Area','Centroid', 'Image');
1 commentaire
Réponse acceptée
Walter Roberson
le 23 Avr 2019
With difficulty. You would have to do something like xcorr2 in order to locate stats(K).Image within the label image.
It is a lot easier to instead request PixelIdxList or PixelList or SubarrayIdx, which give you information about the locations within the label image, and use those indices to extract the RGB from the original image. Or perhaps easier would be to use Image together with BoundingBox:
stats = regionprops(L, 'Area', 'Centroid', 'Image', 'BoundingBox');
for K = 1 : length(stats)
BB = stats(K).BoundingBox;
blobRGB = imcrop(YourRGBImage, BB);
mask = repmat(stats(K).Image, [1 1 3]);
blobsRGB{K} = blobRGB .* mask;
end
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Convert Image Type 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!