I have a watershed segmented image which I changed to a binary image to apply the connectedComponentsWithStats as given in this example. The image looks like .
Now, I want to find the number of components and label(color) only the first 3 largest objects. When I applied the connectedComponentsWithStats, I get a total connected components value of 2. What am I doing wrong? Is it possible to find the largest three objects from the already labelled result of watershed segmentation result(given below for reference).