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 first compose three gray-scale images into an RGB colored image and then decompose an RGB image to examine each color component individually.

Activities:

  1. Compose an RGB image from gray-scale components.

    1. Create three synthetic images of a circle, where each one has its center in a different position.

      1. Glyphs:Khoros 1:Generate Data:Circle Image
      2. Glyphs:Data Manip:Reorganize Data:Translate
      3. Open the Circle Image and set the following parameters:

               Rows        = 128
               Columns     = 128
               Diameter    = 80
               X of center = 64
               Y of center = 70
      4. Duplicate the Translate operator twice and connect their input to the Circle Image glyph. Use the following parameters to each Translate glyph:

               glyph #1: Width Offset =   0   Height Offset = -30
               glyph #2: Width Offset = -25   Height Offset =  15
               glyph #3: Width Offset =  25   Height Offset =  15
      5. Visualize each translated circle using the Display Image operator.

    2. Combine these three images into an RGB image and display it. You will see the final image with 8 colors which are the vertices of the RGB cube model. Use the following operators:

      1. Glyphs:Data Manip:Size & Region Operators:Append
      2. Glyphs:Data Manip:Object Attributes:Set Attribute
      3. Glyphs:Visualization:Non-Interactive Display:Display Image
      4. Connect the first three inputs of the Append glyph to the output of the three Translate glyphs.
      5. Open the Append glyph and set "Elements" as the dimension to stack the images.
      6. In order to make this image be interpreted as color, connect the input of the Set Attribute operator to the output of the Append glyph.
      7. Open the Set Attribute operator and at its very lower part of the pane set the "Colorspace" to RGB.
      8. Display the output of the Set Attribute glyph using the Display Image glyph.

  2. Decompose an RGB image in its individual components.

    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. Repeat the previous steps to extract the green component (element 1). You have to change the element region origin 1.
    5. Repeat similar steps to extract the blue component (element 2). You have the change the element region origin 2.


Exercises


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