Keywords: front-page

## Lab: Labeling

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with two widely used square grid topologies for Labeling objects belonging to the same connected regions. Different results can be obtained, depending on the definition of a "connected region". This lab experiments with the 4-con- nected and 8-connected neighbor connectivity grids.

Activities:

1. Label the $DIP/data/drawing.kdf image using the 4- and 8-neighborhood grids and compare the results. Use pseudo coloring to better visualize the results.

   1. Select the file $DIP/data/drawing.kdf using the User defined operator.

      1. Glyphs:Input/Output:Data Files:User defined

   2. To be able to properly visualize this small image, use the operator Expand with a zoom factor of 4 or more, and display it using the Display Image operator.

      1. Glyphs:Data Manip:Size & Region Operators:Expand
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

   3. Use the Labeling (mmach) operator of the MMACH toolbox.

      1. Glyphs:MMACH:Connected Filters:Labeling (mmach) (get 2 of these)
      2. Process the original image using the 4- and 8-neighborhood grids.

   4. Expand and display both labeled images using a random colormap. Use the Autocolor operator.

      1. Glyphs:Visualization:Map Display & Manip:Autocolor
      2. Open the Autocolor pane and select the "Random" colormap.
      3. Duplicate the Autocolor operator.
      4. Connect the outputs of the Labeling (mmach) (mmach) operators to the inputs of the Autocolor operators.
      5. Select the Expand and Display Image" operators from step B and duplicate twice.
      6. Connect the outputs of the Autocolor operators to the inputs of the new Expand operators
      7. Run the workspace and compare the results of using 4 and 8 neighbor connectivity grids.

Exercises

1. How can you determine the number of regions in the labeled image?

Khoros Workspace
Execute the visual program c2s12labeling.wk