Herror ::rank_region (
    Hobject Region,
    Hobject *RegionCount,
    const HTuple &Width,
    const HTuple &Height,
    const HTuple &Number
)
HRegion HRegion::RankRegion (
    const HTuple &Width,
    const HTuple &Height,
    const HTuple &Number
) const
HRegionArray HRegionArray::RankRegion (
    const HTuple &Width,
    const HTuple &Height,
    const HTuple &Number
) const

Rank operator for regions.

::rank_region calculates the binary rank operator. A filter mask of size Height x Width) is used. In the process, for each point in the region the number of points of Region lying within the filter mask are counted. If this number is greater or equal to Number, the current point is added to the output region. If

    Number = (Height x Width) / 2,
is chosen, the median operator is obtained.


Attention

For Height and Width only odd values > 3 are valid. If invalid parameters are chosen they are converted automatically (without raising an exception handling) to the next larger even values.


Parameters

Region (input_object)
region(-array) -> Hobject: HRegion(Array)
Region(s) to be transformed.

RegionCount (output_object)
region(-array) -> Hobject * : HRegion(Array)
Resulting region(s).

Width (input_control)
extent.x -> HTuple.long
Width of the filter mask.
Default value: 15
Suggested values: 3, 5, 7, 9, 11, 13, 15, 17, 19, 21
Typical range of values: 3 <= Width <= 511 (lin)
Minimum increment: 2
Recommended increment: 2
Restriction: (Width >= 3) && odd(Width)

Height (input_control)
extent.y -> HTuple.long
Height of the filter mask.
Default value: 15
Suggested values: 3, 5, 7, 9, 11, 13, 15, 17, 19, 21
Typical range of values: 3 <= Height <= 511 (lin)
Minimum increment: 2
Recommended increment: 2
Restriction: (Height >= 3) && odd(Height)

Number (input_control)
integer -> HTuple.long
Minimum number of points lying within the filter mask.
Default value: 70
Suggested values: 5, 10, 20, 40, 60, 80, 90, 120, 150, 200
Typical range of values: 1 <= Number <= 1000 (lin)
Minimum increment: 1
Recommended increment: 10
Restriction: Number > 0


Example
read_image(&Image,"affe") ;
mean_image(Image,&Mean,5,5) ;
dyn_threshold(Mean,&Points,25) ;
rank_region(Points,Textur,15,15,30) ;
gen_circle(&Mask,10,10,3) ;
opening1(Textur,Mask,&Seg) ;

Complexity

Let F be the area of the input region. Then the runtime complexity is O(F * 8).


Result

::rank_region returns H_MSG_TRUE if all parameters are correct. The behavior in case of empty input (no regions given) can be set via ::set_system('no_object_result',<Result>) and the behavior in case of an empty input region via ::set_system('empty_region_result',<Result>). If necessary, an exception handling is raised.


Possible Predecessors

::threshold, ::connection, ::regiongrowing, ::pouring, ::class_ndim_norm


Possible Successors

::select_shape, ::disp_region


Alternatives

::closing_rectangle1, ::expand_region


See also

::rank_image, ::mean_image


Module

Region processing



Copyright © 1996-2002 MVTec Software GmbH