[Exercises]
[Workspace]
Purpose:
The purpose of this lab is to experiment with a technique
of image contrast enhancement achieved by first scaling the image and
then applying logarithmic functions.
Activities:
-
First demonstrate the scaling problem using a 1D signal. Follow
the steps outlined below:
-
Create a 1D ramp signal of width 100 (Number Cols = 100) and
values ranging from 0 to 21. Use the Piecewise Linear
operator. Plot the output using Display 2D Plot to verify that the desired
ramp signal was generated.
-
Glyphs:Khoros 1:Generate Data:Piecewise Linear
-
Glyphs:Visualization:Plot Display:Display 2D Plot
-
Take the logarithm of the ramp signal and plot it using the
operators Logarithm and Display 2D Plot.
-
Glyphs:Arithmetic:NonLinear Functions:Logarithm
-
Glyphs:Visualization:Plot Display:Display 2D Plot
-
Repeat the last step, but first multiply the ramp signal by a
factor of 255, using the Multiply operator.
-
Glyphs:Arithmetic:Two Operand Arithmetic:Multiply
-
Glyphs:Arithmetic:NonLinear Functions:Logarithm
-
Glyphs:Visualization:Plot Display:Display 2D Plot
-
Now show the same scaling problem applied to an image, following
the steps outlined below:
-
Use the image $DIP/data/log-enhance-problem.kdf for this
experiment. Read and display the image using operators User defined
and Display Image. Calculate and plot the histogram of this image
using the Histogram and Display 2D Plot operators.
-
Glyphs:Input/Output:Data Files:User defined
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Glyphs:Data Manip:Histogram Operators:Histogram
-
Glyphs:Visualization:Plot Display:Display 2D Plot
The following steps are a repeat of steps B and C from Part 1, but
are now applied to an image instead of a signal.
-
Take the logarithm of the image and display it using the Logarithm
and Display Image operators. Calculate the histogram and
plot it using the operators Histogram and Display 2D Plot. Since the
result of computing the logarithm is floating point, normalize the
output between 0 and 255 before calculating the histogram so that you
can better see the distribution of pixel values.
-
Glyphs:Arithmetic:NonLinear Functions:Logarithm
-
Glyphs:Visualization:Plot Display:Display 2D Plot
-
Glyphs:Data Manip:Data Conversion:Normalize
-
Glyphs:Data Manip:Histogram Operators:Histogram
-
Glyphs:Visualization:Plot Display:Display 2D Plot
-
Repeat the last step, except first multiply the image by a
factor of 255. Use the Multiply operator.
-
Glyphs:Arithmetic:Two Operand Arithmetic:Multiply
-
Glyphs:Arithmetic:NonLinear Functions:Logarithm
-
Glyphs:Visualization:Plot Display:Display 2D Plot
-
Glyphs:Data Manip:Data Conversion:Normalize
-
Glyphs:Data Manip:Histogram Operators:Histogram
-
Glyphs:Visualization:Plot Display:Display 2D Plot
-
Implement one simple solution to overcome this scaling problem
by multiplying by a factor of 50 before taking the logarithm. Apply
this technique to both the original $DIP/data/log-enhance-problem.kdf
image and the one scaled by 255. Compare the results.
Exercises
-
Can you propose a better way of using a contrast enhancement
table that would not have this effect?
Khoros Workspace
Execute the visual program c4s7contrast-log-scaling.wk
Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved