How can I to do bwlabel for RGB image

7 vues (au cours des 30 derniers jours)
YU HAN SIAO
YU HAN SIAO le 4 Juin 2021
Commenté : DGM le 4 Juin 2021
clc ; clear all ;
imgs = imread('hand.jpg') ;
img = double (imgs) ;
[ii , jj , kk] = size(img) ;
img1 = zeros(ii,jj);
img2 = zeros(ii,jj);
imghsv = rgb2hsv(img) ;
img1(imghsv(:,:,1)<0.1) = 1 ;
img2(imghsv(:,:,1)>0) = 1 ;
img3 = img1 & img2 ;
imgreo = imerode(img3,ones(3)) ;
imgdil = imdilate(imgreo,ones(5)) ;
leb = bwlabel(imgdil) ;
im1 = (leb==1) ;
im2 = (leb==2) ;
subplot(2,2,1);imshow(imgs);
subplot(2,2,2);imshow(imgdil);
subplot(2,2,3);imshow(im1);
subplot(2,2,4);imshow(im2);
I can do bwlabel for Binarization image,but I don't know how to do RGB image?
I want to do the bwlabel for my top left image(imgs = imread('hand.jpg') ;), how can I do ?
  1 commentaire
DGM
DGM le 4 Juin 2021
bwlabel() only works on binary images, hence the prefix 'bw'. That aside, what would the results of such an operation look like? bwlabel returns a map of the connected components in a binary image. What is a connected component of an RGB image? Is it a non-white region? Is it a region whose color points lie within a rectangular prism in 3D space? What about an ellipsoid? Is there any answer to that question which does not describe the process of binarization of the image?

Connectez-vous pour commenter.

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