Herror ::dual_rank (
    Hobject Image,
    Hobject *ImageRank,
    const HTuple &MaskType,
    const HTuple &Radius,
    const HTuple &ModePercent,
    const HTuple &Margin
)
HImage HImage::DualRank (
    const HTuple &MaskType,
    const HTuple &Radius,
    const HTuple &ModePercent,
    const HTuple &Margin
) const
HImageArray HImageArray::DualRank (
    const HTuple &MaskType,
    const HTuple &Radius,
    const HTuple &ModePercent,
    const HTuple &Margin
) const

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 margin control (Margin) can be chosen:

    0...255   pixels outside the image edges
              are assumed to be constant (with the indicated
              gray value).
    -1        Continuation of edge pixels.
    -2        cyclic continuation of image edges.
    -3        Reflection of pixels at image edges.
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 \dots 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.


Parameters

Image (input_object)
(multichannel-)image(-array) -> Hobject: HImage(Array) ( byte )
Image to be filtered.

ImageRank (output_object)
multichannel-image(-array) -> Hobject * : HImage(Array)
Filtered Image.

MaskType (input_control)
string -> HTuple.char *
Shape of the mask.
Default value: 'circle'
List of values: 'circle', 'rectangle'

Radius (input_control)
integer -> HTuple.long
Radius of the filter mask.
Default value: 1
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 15, 19, 25, 31, 39, 47, 59
Typical range of values: 1 <= Radius <= 101
Minimum increment: 1
Recommended increment: 2

ModePercent (input_control)
integer -> HTuple.long
Filter Mode: 0 corresponds to a gray value opening , 50 corresponds to a median and 100 to a gray values closing.
Default value: 10
Suggested values: 0, 2, 5, 10, 15, 20, 40, 50, 60, 80, 85, 90, 95, 98, 100
Typical range of values: 0 <= ModePercent <= 100
Minimum increment: 1
Recommended increment: 2

Margin (input_control)
integer -> HTuple.long
Margin control: 0...255 (constant), -1 (margin points continued), -2 (cyclic continuation), -3 (mirroring).
Default value: -3
Typical range of values: -3 <= Margin <= 255


Example
read_image(&Image,"fabrik");
dual_rank(Image,&ImageOpening,"circle",10,10,-3);
disp_image(ImageOpening,WindowHandle);

Complexity

For each pixel: O(sqrt(F) * 10) with F = area of the structuring element.


Result

If the parameter values are correct the operator ::dual_rank returns the value 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 handling is raised.


Possible Predecessors

::read_image


Possible Successors

::threshold, ::dyn_threshold, ::sub_image, ::regiongrowing


Alternatives

::rank_image, ::gray_closing, ::gray_opening, ::median_image


See also

::gen_circle, ::gen_rectangle1, ::gray_erosion_rect, ::gray_dilation_rect, ::sigma_image


References

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


Module

Image filters



Copyright © 1996-2002 MVTec Software GmbH