Lab: RGB Image Manipulation

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with how RGB images are represented and stored. You will decompose an RGB image, and examine each color component individually.

Activities:

  1. Experiment with the RGB color model.

    1. Read the image $DIP/data/istec-map-color.kdf and display it using cantata operators.

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

      2. Glyphs:Visualization:Non-Interactive Display: Display Image

    2. Read the header information of the color image and verify that it has three elements and RGB as its color model. Use the following operators:

      1. Glyphs:Input/Output:Information: Data Object Info

      2. Glyphs:Input/Output:Information: File Viewer

    3. Extract the red band (element 0) of the color image by using the following operator:

      1. Glyphs:Data Manip:Size & Region Operators: Extract

      2. Set the "Element Origin" to 0. Remember that you don't need to specify any width or height dimensions as you are only extracting in the elements dimension. So, unselect Width and Height and under "Specifying Region Size:" click on "Elements" but leave it at 1. Under "Specifying Region Origin:" click on "Elements" but leave it at 0.
      3. Display this image. It is a grey-level image showing the intensity of the red component of the RGB image.

    4. To display this image as shades of red, you need to create an RGB image (3 elements) with elements 1 (Green) and 2 (Blue) with value zero. Use the Pad operator to do this.

      1. Glyphs:Data Manip:Size & Region Operators: Pad

      2. Set the "Padded Elements Size" to 3. Unselect all other fields.
      3. Display the "Red" image.

    5. Repeat steps c) and d) for the green component (element 1). You have the change the element region origin 1.

      1. When using the Pad operator, setting the "Element Offset" to 1 and the "Padded Element Size" to 3 will result in an image with elements 0 and 2 being zero.

    6. Repeat steps c) and d) for the blue component (element 2). You have the change the element region origin 2.
    7. Add different color bands and display the results. Use the following operator:

      1. Glyphs:Arithmetic:Two Operand Arithmetic: Add


Exercises

  1. Create three synthetic images of a circle, where each one has its center in a different position. Combine these three images into an RGB image and display it. You will see the 8 colors which are the vertices of the RGB cube model.

    Hint. Use the following operators:

    1. Glyphs:Khoros 1:Generate Data: Circle Image

    2. Glyphs:Data Manip:Size & Region Operators: Append

    3. Glyphs:Data Manip:Object Attributes: Set Attribute


Khoros Workspace
Execute the visual program c2s8rgb-built.wk



Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved