# What exactly is a connected componnent in an image?

The following is a paragraph from "Digital image processing, 4th edition, Gonzalez and Woods".

Let S represent a subset of pixels in an image. Two pixels p and q are said to be connected in S if there exists a path between them consisting entirely of pixels in S. For any pixel p in S, the set of pixels that are connected to it in S is called a connected component of S. If it only has one component, and that component is connected, then S is called a connected set.

I do not understand the last sentence: How can S have one component and that component is not connected??

Another question: In a binary image, can S be a connected component and have both 0 and 1 pixels?

By the way, the concept of component is not define precisely in the book.

Update:

In the book, a region is defined as a connected set. The following figure is an example of two adjacent regions (So, $$R_i$$ and $$R_j$$ are both connected sets.) Thanks.

• are there not any examples in the same book that show what is meant by the terms component, path and connectedness ? – Fat32 Apr 2 at 13:48

Let S represent a subset of pixels in an image.

This is typically a set of pixels with the same value, for example a group of pixels with the value 1, surrounded by pixels with a value 0.

Two pixels p and q are said to be connected in S if there exists a path between them consisting entirely of pixels in S.

A path is a set of steps that take you from pixel p to pixel q, and where each step is a jump from a pixel to a neighboring pixel. Thus, two pixels are connected if you can travel from neighbor to neighbor starting at p until you reach q.

If it only has one component, and that component is connected, then S is called a connected set.

If all pixels in the set S are connected to all other pixels through a path, then S is a connected component.

Thus a connected component is the very intuitive concept of a continuous region of equal-valued pixels.

• Thanks for reply. Actually, my main problem is the last sentence. How can S have only one component, and that component is not connected? If the "component" is not connected, then it is not one component. Any help? – user153245 Apr 5 at 13:30
• @user153245: S is a set. If all pixels in it are connected to each other it is a connected component, otherwise it is multiple connected components. – Cris Luengo Apr 5 at 13:56
• I update the question. In the book, the region is defined as a connected set. In the added figure, there are two regions, $R_i$ and $R_j$. As one can see in the figure, both regions, or connected sets, have 1s as well as 0s. – user153245 Apr 17 at 18:07
• @user153245 The zeros are not part of the sets in that figure, as you can see from the 1s being bold and blue font. In that example, Ri and Rj are connected to each other. – Cris Luengo Apr 17 at 18:52
• Thanks. Can you recommend another reference for this material? – user153245 Apr 18 at 7:30