Color Table
Building the Cantata Workspace
- Read and display the image $DIP/data/unicamp-logo.viff,
use operators
User defined and
Display Image.
- 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.
- Label the image using the
Labeling
operator of the MMACH toolbox with connectivity set to 4.
- Use the
Statistics operator to find out the total number of regions.
- 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.
- 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.
- Explore the three ways of representing/displaying the color image.
- 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.
- Put together in a single file the colormap (MAP segment) and the labeled
image logo using the operator
Insert Segments. Display the resultant image.
- 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
- Take the header contents of the following data:
- Labeled image
- Colortable data
- Labeled image together with the colortable
- 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
- Compare the size of the Mapped image and the image file with the
color table.
- Is it useful to have a color table with only a single column. What
are the advantages of using it?
DIP Feedback Form