Color Table

Building the Cantata Workspace


  1. Read and display the image $DIP/data/unicamp-logo.viff, use operators User defined and Display Image.
  2. Swap the background and foreground pixel values by subtracting all pixel values from 255. Use the operator Subtract From. Why is this necessary? Look at the Labeling lesson.
  3. Label the image using the Labeling operator of the MMACH toolbox with connectivity set to 4.
  4. Use the Statistics operator to find out the total number of regions.
  5. Build an ASCII color table with 3 columns (RGB) and the same number of rows as the number of regions in the labeled image. Choose the color you want for each region. You can use the ASCII editor available in the operator Editor to create this table. For convenience, there is an RGB color table for you to use, the file is unicamp-lut.ascii.
  6. Convert the ASCII color table to a viff colormap using the operator ASCII to Map using the proper parameters. You can select the data type as unsigned byte. Display the color table using the operator Display_Palette.
  7. Explore the three ways of representing/displaying the color image.
    1. Use the Display Image operator. In the first input connect the labeled image and in the last input (colormap image) connect the color table. Verify that although the image is colored the pixel value under the cursor shows the VALUE data.
    2. Put together in a single file the colormap (MAP segment) and the labeled image logo using the operator Insert Segments. Display the resultant image.
    3. Map the value data through the colortable (map) by using the operator Map Data, and set the data object color attribute to colorspce RGB before displaying it. Use the operator Set Attribute
  8. Take the header contents of the following data:
    1. Labeled image
    2. Colortable data
    3. Labeled image together with the colortable
    4. Mapped image
    and interpret its contents with respect to the dimensions of the segments VALUE and DATA. Use operator Data Object Info and File Viewer.

Exercises


DIP Feedback Form

Copyright © 1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved.