Presentation is loading. Please wait.

Presentation is loading. Please wait.

IMAGE SEGMENTATION – CONNECTED COMPONENT LABELING

Similar presentations


Presentation on theme: "IMAGE SEGMENTATION – CONNECTED COMPONENT LABELING"— Presentation transcript:

1 IMAGE SEGMENTATION – CONNECTED COMPONENT LABELING
Segmentation can be viewed as a process of pixel classification; the image is segmented into objects or regions by assigning individual pixels to classes. Connected Component Labeling assigns pixels to specific classes by verifying if an adjoining pixel (i.e., neighboring pixel) already belongs to that class. There are two “standard” definitions of pixel connectivity: 4 neighbor connectivity and 8 neighbor connectivity.

2 IMAGE SEGMENTATION – CONNECTED COMPONENT LABELING
4 Neighbor Connectivity 8 Neighbor Connectivity Pi,j Pi,j

3 CONNECTED COMPONENT LABELING: FIRST PASS
EQUIVALENCE: B=C A A A B B C C B B B C C B B B B B B

4 CONNECTED COMPONENT LABELING: SECOND PASS
TWO OBJECTS! A A A B B C B B C B B B B C B C B B B B B B

5 CONNECTED COMPONENT LABELING: EXAMPLE (DEMO)

6 CONNECTED COMPONENT LABELING: TABLE OF EQUIVALENCES
2 = 5 16 27 50 81 112 127 9 28 39 86 134 34 51 137 10 37 87 138 46 111 66 113 12 40 41 72 119 120 18 76 23 122

7 CONNECTED COMPONENT LABELING: TABLE OF EQUIVALENCES
2 = 5 37 86 111 138 9 39 87 10 40 41 112 12 46 113 16 50 119 18 51 120 23 66 122 27 72 127 28 76 134 34 81 137

8 Basic Connected Component Labeling
Binary Image with Background=0, Objects=1 x =

9 Basic Connected Component Labeling
Binary Image with Background=0, Objects=1 x(1,:)=0; x(:,1)=0; imshow(x,[0 1]); K=1; cnt=2; for J=2:H for I=2:W if x(J,I)== %% Object found if (x(J-1,I)==0 && x(J,I-1)==0) x(J,I)=cnt; %% New Object cnt=cnt+1; else if x(J-1,I)~=0 x(J,I)=x(J-1,I); if (x(J,I-1)~=0) && (x(J,I-1)~=x(J-1,I)) eq(K,1)=x(J-1,I); eq(K,2)=x(J,I-1); K=K+1; end; x(J,I)=x(J,I-1); end

10 Basic Connected Component Labeling
eq = Basic Connected Component Labeling First Pass x =

11 Connected Component Labeling with Line Correction
Binary Image with Background=0, Objects=1 x =

12 Connected Component Labeling with Line Correction
Binary Image with Background=0, Objects=1 if (x(J-1,I)==0 && x(J,I-1)==0) x(J,I)=cnt; %% New Object cnt=cnt+1; S=I; else if x(J-1,I)~=0 x(J,I)=x(J-1,I); if (x(J,I-1)~=0) && (x(J,I-1)~=x(J-1,I)) if S>0 for R=I:-1:S x(J,R)=x(J-1,I); end; S=0; cnt=cnt-1; eq(K,1)=x(J-1,I); eq(K,2)=x(J,I-1); K=K+1; end x(J,I)=x(J,I-1); x(1,:)=0; x(:,1)=0; imshow(x,[0 1]); K=1; cnt=2; for J=2:H S=0; for I=2:W if x(J,I)== %% Object found

13 Connected Component Labeling with Line Correction
First Pass x =

14 Basic Connected Component Labeling
Binary Image with Background=0, Objects=1 x =

15 Basic Connected Component Labeling
First Pass x = eq =

16 Connected Component Labeling with Line Correction
Binary Image with Background=0, Objects=1 x =

17 Connected Component Labeling with Line Correction
First Pass x = eq =


Download ppt "IMAGE SEGMENTATION – CONNECTED COMPONENT LABELING"

Similar presentations


Ads by Google