Program: ENHANCE
Purpose: Enhance image (Local enhancement method)
Category: MANIPULATION
File: enhance.c
Author: M. Vogelaar
Keywords:
INSET= Input set (and subsets). Maximum number of subsets
is 2048. The subsets must be 2 dimensional.
BOX= Frame for input subsets. [entire subset]
SETOUT= Output set and subset(s) for the result.
The number of output subsets is the same as the
number of input subsets.
RANGE= Give range of levels to work on. [All levels]
Outside range data will be transferred.
INF and -INF are accepted as input.
EBOX= Give sizes of local enhancement box: [3,3]
Determine local two dimensional array in which the
local average and standard deviation is calculated.
WEIGHTS= Use calculated weights? [N]
To determine the average in a small box, data can
be weighted by a simple weighting function.
If WEIGHTS=N all weights are equal to 1.
REPLACE= Replace values outside box? Y/[N]
If selected box is smaller than the subset, you can
choose what to do with the values outside the box.
If REPLACE=N the original data will be substituted,
else the keyword BVAL= will be asked.
BVAL= Value to replace values outside box: [blank]
GRANGE= Give range for local [all values possible]
gain factor:
The first value must be less than or equal to the
second one. INF and -INF are accepted as input.
AVERAGE= Give average value of selected box: [calculated]
If an average is specified, its value will be used
as global mean in all subsets. If carriage return
is pressed, then for each subset the average will
be calculated.
Description: With keyword 'EBOX=' a n x m neighborhood is
defined and the center of this area is moved from
valid pixel to valid pixel in your input.
A valid pixel is a pixel with a non-blank value
within a user given range (RANGE=).
The range in EBOX sizes is limited. The values
must be odd, greater than or equal to 1 and
their product must be less than 400. The height of
the EBOX is limited to the maximum number of
complete lines that can be read in the buffer at
once.
For each point g(x,y) in a new set the following
transformation is applied:
g(x,y) = A(x,y)*[ f(x,y) - m(x,y) ] + m(x,y)
g(x,y) = New value at position x, y
A(x,y) = M / sig(x,y)
M = Global mean of f(x,y) calculated in
selected box.
sig(x,y) = Standard deviation of data in small
box centered around x,y.
f(x,y) = Old value at x,y.
m(x,y) = Average of data in small box around
x,y.
The local average can be a weighted or an un-
weighted average (WEIGHTS=N).
The global mean can be determined by the
application, but an user given value (AVERAGE=)
is accepted also.
The local gain factor A(x,y) amplifies local
variations. Since it is inversely proportional
to the standard deviation of the intensity, areas
with low contrast receive larger gain ( Gonzalez &
Wintz, Digital image processing, section 4.2.4,
2nd ed.). To restrict variations in the local gain
A(x,y), it is possible (GRANGE=) to select a range
in order to balance large areas of intensity
in isolated regions. The minimum and maximum value
of the gain can be obtained by running the program
without specifying GRANGE=
Example:
enhance
INSET=spiral
Set SPIRAL has 2 axes
RA from -207 to 207
DEC from -236 to 236
BOX=
BOX range for set SPIRAL :
RA from -207 to 207
DEC from -236 to 236
OUTSET=spiralout
Set SPIRALOUT has 2 axes
RA from -207 to 207
DEC from -236 to 236
RANGE=
EBOX=
WEIGHTS=y
AVERAGE=
Local enhancement in 3 x 3 neighborhood:
Subset index = 0
Name of input set = SPIRAL
Name of output set = SPIRALOUT
Average in selected box = 0.675860
Min. value new data = -0.248401
Max. value new data = 1.685447
Min. value gain = 1.564082
Max. value gain = 14.561221
enhance - +++ FINISHED +++
Updates: Apr 20, 1990: MV, Document created.