In order to better see the result, we now would like to assign a color to each component. The problem here is that we cannot find 163 colors where each of them is different enough from all others to be distinguished by the human eye. We can now easily distinguish two different components, provided that they were not assign the same color. We can assign a different color to each grayvalue, many of them being quite similar. Although, we sometimes cannot tell the border between two components when they are very close to each other, we do not lose any information.
More sophisticated techniques combine both methods.
They make sure that two nearby components always have distinct colors by taking into account the colors of the neighbors of the component which is going to be assigned a color. If we compare the above color-labeled images with the original, we can see that the number of components is quite close to the number of dead cells in the image. However, we obtain a small difference since some cells merge together into one component or dead cells are suppressed by the threshold. We encounter greater problems when trying to count the number of turkeys in Labeling the thresholded image yields as a graylevel or as a color labeled version. The two last examples showed that the connected component labeling is the easy part of the automated analysis process, whereas the major task is to obtain a good binary image which separates the objects from the background.