dual_rank
— Opening, Median and Closing with circle or rectangle mask.
The operator dual_rank
carries out a non-linear
transformation of the gray values of all input images
(Image
). Circles or squares can be used as structuring
elements. The operator dual_rank
effects two
consecutive calls of rank_image
. At the first call the
range gray value is calculated with the indicated range
(ModePercent
). The result of this calculation is the
input of a further call of rank_image
, this time using the
range value 100-ModePercent
.
When filtering different parameters for border treatment
(Margin
) can be chosen:
Pixels outside of the image border are assumed to be constant (with the indicated gray value).
Continuation of the gray values at the image border.
Cyclic continuation at the image borders.
Reflection of pixels at the image borders.
A range filtering is calculated according to the following scheme:
The indicated mask is put over the image to be filtered in such a
way that the center of the mask touches all pixels once. For each
of these pixels all neighboring pixels covered by the mask are
sorted in an ascending sequence corresponding to their gray values.
Each sorted sequence of gray values contains the same number of gray
values like the mask has image points. The n-th highest element, (=
ModePercent
, rank values between 0...100 in
percent) is selected and set as result gray value in the
corresponding result image.
If ModePercent
is 0, then the operator equals to the
gray value opening (gray_opening
). If
ModePercent
is 50, the operator results in the median
filter, which is applied twice (median_image
). The
ModePercent
100 in dual_rank
means that it
calculates the gray value closing (gray_closing
).
Choosing parameter values inside this range results in a smooth
transformation of these operators.
For an explanation of the concept of smoothing filters see the introduction of chapter Filters / Smoothing.
Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.
Image
(input_object) (multichannel-)image(-array) →
object (byte / int2 / uint2 / int4 / real)
Image to be filtered.
ImageRank
(output_object) multichannel-image(-array) →
object (byte / int2 / uint2 / int4 / real)
Filtered Image.
MaskType
(input_control) string →
(string)
Shape of the mask.
Default: 'circle'
List of values: 'circle' , 'square'
Radius
(input_control) integer →
(integer)
Radius of the filter mask.
Default: 1
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 15, 19, 25, 31, 39, 47, 59
Value range:
1
≤
Radius
≤
101
Minimum increment: 1
Recommended increment: 2
ModePercent
(input_control) integer →
(integer)
Filter Mode: 0 corresponds to a gray value opening , 50 corresponds to a median and 100 to a gray values closing.
Default: 10
Suggested values: 0, 2, 5, 10, 15, 20, 40, 50, 60, 80, 85, 90, 95, 98, 100
Value range:
0
≤
ModePercent
≤
100
Minimum increment: 1
Recommended increment: 2
Margin
(input_control) string →
(string / integer / real)
Border treatment.
Default: 'mirrored'
Suggested values: 'mirrored' , 'cyclic' , 'continued' , 0, 30, 60, 90, 120, 150, 180, 210, 240, 255
read_image(Image,'fabrik') dual_rank(Image,ImageOpening,'circle',10,10,'mirrored') dev_display(ImageOpening)
For each pixel: with F = area of the structuring element.
If the parameter values are correct the operator
dual_rank
returns the value 2 (
H_MSG_TRUE)
. The behavior in case
of empty input (no input images available) is set via the operator
set_system('no_object_result',<Result>)
.
If necessary an exception is raised.
threshold
,
dyn_threshold
,
sub_image
,
regiongrowing
rank_image
,
gray_closing
,
gray_opening
,
median_image
gen_circle
,
gen_rectangle1
,
gray_erosion_rect
,
gray_dilation_rect
,
sigma_image
W. Eckstein, O. Munkelt “Extracting Objects from Digital Terrain Model” Remote Sensing and Reconstruction for Threedimensional Objects and Scenes, SPIE Symposium on Optical Science, Engeneering, and Instrumentation, July 1995, San Diego
Foundation