[Exercises]
[Workspace]
Purpose:
The purpose of this lab is to explore techniques for
visually enhancing image features, or attributes, so that the results
of an analysis are more easily understood. This experiment describes a
procedure to generate an image where the visual appearance of each
connected region is associated with its area.
Activities:
-
Import a data set, label it, calculate its statistics, and plot
its histogram.
-
Select and display the image $DIP/data/blobs.kdf.
-
Glyphs:Input/Output:Data Files:User defined
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Label the image and display it. Use the Labeling (mmach) operator of
the MMACH toolbox.
-
Glyphs:MMACH:Connected Filters:Labeling (mmach)
-
Pseudocolor the labeled image with the Autocolor operator,
using the "random" colormap option. This enables better visualization
of the connected regions.
-
Glyphs:Visualization:Map Display & Manip:Autocolor
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Use the Statistics operator to find out the maximum pixel
value in the labeled image from Step B (open the operator and select
the "maximum" option). This gives the number of regions in the image.
-
Glyphs:Data Manip:Analysis & Information:Statistics
-
Glyphs:Input/Output:Information:File Viewer
-
Take the Histogram of the labeled image (from Step 2) with "Bin
width" set to 1 and "Number of bins" set to the number of regions
obtained in step D. Print the histogram contents using Print Data. This
table gives the area (number of pixels) of each region.
-
Glyphs:Data Manip:Histogram Operators:Histogram
-
Glyphs:Input/Output:Information:Print Data
-
Glyphs:Input/Output:Information:File Viewer
-
Use the table just built (output of Histogram) as a colormap to
the labeled image. The resultant image will have pixels representing
the area of each connected region. Remember that the background has a
large area and the histogram should be modified to have value 0 (black)
as the number of pixels with value 0 (background).
Perform the following steps:
-
Change the contents of the histogram at index 0 to 0, using the
operators Constant and Inset to put an image of a single pixel of
value 0 on the histogram vector at position 0.
-
Glyphs:Input/Output:Generate Data:Constant
-
Glyphs:Data Manip:Size & Region Operators:Inset
-
Transfer the "Value Segment" of the table to "Map Segment"
using the Copy from Value operator. Now the file becomes a colormap.
-
Glyphs:Data Manip:Segment Operators:Copy from Value
-
Insert the labeled image into the colormap using the
operator Insert Segments.
-
Glyphs:Data Manip:Segment Operators:Insert Segments
-
Map the colormap through the value data using the Map Data
operator.
-
Glyphs:Data Manip:Map Operators:Map Data
-
Finally display the image using the Display Image
operator. Passing the mouse over a region, the pixel value will
indicate its area.
-
Glyphs:Visualization:Non-Interactive Display:Display Image
Khoros Workspace
Execute the visual program c4s11label-display-area.wk
Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved