how to calculate the area of different labels and remove the labels with smaller area??
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    santosh patil
 el 2 de Abr. de 2015
  
    
    
    
    
    Respondida: Image Analyst
      
      
 el 3 de Abr. de 2015
            i labeled an image using CC = bwconncomp(BW).how to find area of different labels?? and how do i remove labels with smaller area???
0 comentarios
Respuesta aceptada
  Michael Haderlein
      
 el 2 de Abr. de 2015
        
      Editada: Michael Haderlein
      
 el 2 de Abr. de 2015
  
      CC is a struct including the field PixelIdxList. If you define the area as number of pixels, you just need the number of elements of each cell:
 elemsize=cellfun(@numel,CC.PixelIdxList);
To remove the small ones (I define "small" as "less than 100 pixels"):
 BW2=BW;
 BW2(vertcat((CC.PixelIdxList{cellfun(@numel,CC.PixelIdxList)<100})))=0;
You can of course do this without copying BW (just ignore the first line and use BW instead of BW2 in the second line).
Edit: If you also want to remove these from CC:
 CC.PixelIdxList(cellfun(@numel,CC.PixelIdxList)<100)=[];
 CC.NumObjects=numel(CC.PixelIdxList);
Más respuestas (1)
  Image Analyst
      
      
 el 3 de Abr. de 2015
        This is what's done in my Image Processing Tutorial, attached.
0 comentarios
Ver también
Categorías
				Más información sobre Modify Image Colors en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


