[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:
-
Compose an RGB image from gray-scale components.
-
Create three synthetic images of a circle, where each one has its
center in a different position.
-
Glyphs:Khoros 1:Generate Data:Circle Image
-
Glyphs:Data Manip:Reorganize Data:Translate
-
Open the Circle Image and set the following parameters:
Rows = 128
Columns = 128
Diameter = 80
X of center = 64
Y of center = 70
-
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
-
Visualize each translated circle using the Display Image operator.
-
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:
-
Glyphs:Data Manip:Size & Region Operators:Append
-
Glyphs:Data Manip:Object Attributes:Set Attribute
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Connect the first three inputs of the Append glyph to the output of
the three Translate glyphs.
-
Open the Append glyph and set "Elements" as the dimension to stack
the images.
-
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.
-
Open the Set Attribute operator and at its very lower part of the pane
set the "Colorspace" to RGB.
-
Display the output of the Set Attribute glyph using the Display Image
glyph.
-
Decompose an RGB image in its individual components.
-
Read the image $DIP/data/istec-map-color.kdf and display it
using cantata operators.
-
Glyphs:Input/Output:Data Files:User defined
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
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:
-
Glyphs:Input/Output:Information:Data Object Info
-
Glyphs:Input/Output:Information:File Viewer
-
Extract the red band (element 0) of the color image by using the
following operator:
-
Glyphs:Data Manip:Size & Region Operators:Extract
-
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.
-
Display this image. It is a grey-level image showing the
intensity of the red component of the RGB image.
-
Repeat the previous steps to extract the green component (element 1).
You have to change the element region origin 1.
-
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