How many 4-connected and 8-connected components are present in the binary image below?
Using definition of connectivities from the same textbook
"A connected component is a group of pixels that are connected in the sense that there is a connected path between any two pixels in the component. 4-connected means that the path comprises only horizontal or vertical neighbours (i.e. NSEW directions). In 8- connected regions the path may include diagonal neighbours as well (i.e. NW, SW, NE, SE directions)."
I get four 4-connected groups and three 8-connected groups.
The answer though is four 4-connected regions and one 8-connected region and it comes with the following diagram.
I realise I might be double counting some of the clusters, but I don't see how does the author get his/her answer from the above picture. Looking at it I get two 4-connected groups and one 8-connected groups. Unless the correct groups are grouped like this.