home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
swCHIP 1991 January
/
swCHIP_95-1.bin
/
demo
/
wit4711
/
lib
/
help
/
segment
/
localthr.
/
localthr.bin
Wrap
Text File
|
1995-12-09
|
3KB
|
70 lines
OPERATOR
localThresh --- perform Poon's local thresholding
DESCRIPTION
The localThresh operator performs local thresholding for segmenting objects from
a greyscale image using Poon's method. The top input port is connected to an
8-bit input image and the bottom input port is connected to a set of seed
points from which region growing is to start. The seed input may be either
a binary image where the seed is a non-zero pixel value or a getData vector
of points where each seed is an (x,y) location. The algorithm goes through
the list of seeds, one by one, and attempts to grow the seed region by
examining the seed's 8 neighbours recursively. A neighbour is region grown if
its pixel value satisfies a threshold. The threshold is determined by the
parameters peakFraction and minContrast . The idea here is to grow seed values
into a region with pixels greater than a certain percentage of the seed
pixel value. The minContrast constraint is involved to ensure the result of
multiplying the seed value by the peakFraction to obtain a threshold will not
go below/above a minimum noise level. Each seed therefore is grown as
follows:
begin seed(x)
set threshold = seed pixel value * peakFraction/100.0
if(minContrast < 0) then
if threshold > minContrast
then threshold = minContrast
endif
if seed pixel value < threshold
then region_grow_lt(x)
endif
else
if threshold < minContrast
then threshold = minContrast
endif
if seed pixel value > threshold
then region_grow_gt(x)
endif
endif
end seed
begin region_grow_gt(x)
for each neighbour n
if n > threshold
then region_grow_gt(n)
end region_grow_gt
begin region_grow_lt(x)
for each neighbour n
if n < threshold
then region_grow_lt(n)
end region_grow_lt
Note how the sign of minContrast determines whether a region is considered
above or below a threshold. This technique for thresholding objects from a
scene is ideal if the scene's background is not uniform. In other words each
object to be segmented has a different background level. Global thresholding
would either isolate too few objects or too much of the scene as a result
of variation in the scene background.
This operator is often used after high-pass filtering an image, where there
is a definite base level with which to measure contrast. The seed points can
be generated by performing an edge detection followed by zero crossing
detection, and then using the zero crossing points as seeds.