1. Consider the connected component (cc) labeling algorithm involving a single pass of an operator propagating labels and keeping equivalences. Explain in the form of a table what happens in the algorithm for all possible states (There are 16 possible states for the 4 binary variables for the case of p=1). Also give examples on simple images.
2. Consider the CC labeling algorithm that uses memory after a single pass of the operator described in question 1. Develop and describe an algorithm that implements this idea, creating unique labels for each connected component by checking an equivalence table.
3. Write a computer program that applies the second connected component labeling algorithm that was discussed in class. Recall that this algorithm propagates the unique labels in a single top-down scan by checking the neighbors at positions "a" "b" "c" "d" for each pixel "p" considering the pattern shown above. It should complete the labeling using an equivalence table.
This program should:
- Use a threshold value of 128 to convert the image to a binary image
- Create unique labels for each foreground pixel position and store them in a 2D long int array
- Initialize a data structure to keep and manage an equivalence table
- Scan the image in a top-down pass and at every pixel position:
* Change the label of pixel "p" using the min label from the labels of "a" "b" "c" "d"
* Update the equivalence table using part 1 and 2
- When the top-down pass is complete, assign a single label for equivalent labels and:
* Print the number of components on the screen
* Assign discriminating gray values for each CC label and show the result on the screen. For example, if there are 10 distinct labels, the first label can be assigned as 25, which is (int)(255/10), and the other labels are 50, 75, 100, 125...