Skip to content

rank_regionrank_regionRankRegionRankRegionrank_regionrank_region🔗

Short description🔗

rank_regionrank_regionRankRegionRankRegionrank_regionrank_region — Rank operator for regions.

Signature🔗

rank_region( region Region, out region RegionCount, extent.x Width, extent.y Height, integer Number )rank_region( Region : RegionCount : Width, Height, Number : )void RankRegion( const HObject& Region, HObject* RegionCount, const HTuple& Width, const HTuple& Height, const HTuple& Number )static void HOperatorSet.RankRegion( HObject region, out HObject regionCount, HTuple width, HTuple height, HTuple number )def rank_region( region: HObject, width: int, height: int, number: int ) -> HObject

Herror rank_region( const Hobject Region, Hobject* RegionCount, const Hlong Width, const Hlong Height, const Hlong Number )

Herror T_rank_region( const Hobject Region, Hobject* RegionCount, const Htuple Width, const Htuple Height, const Htuple Number )

HRegion HRegion::RankRegion( Hlong Width, Hlong Height, Hlong Number ) const

HRegion HRegion.RankRegion( int width, int height, int number )

Description🔗

rank_regionRankRegion calculates the binary rank operator. A filter mask of size Heightheightheight x Widthwidthwidth) is used. In the process, for each point in the region the number of points of Regionregionregion lying within the filter mask are counted. If this number is greater or equal to Numbernumbernumber, the current point is added to the output region. If

\[\begin{eqnarray*} \textrm{Number} = \frac{\textrm{Height} * \textrm{Width}}{2}, \end{eqnarray*}\]

is chosen, the median operator is obtained.

Attention🔗

For Heightheightheight and Widthwidthwidth only odd values \(>\) 3 are valid. If invalid parameters are chosen they are converted automatically (without raising an exception) to the next larger odd values.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters🔗

Regionregionregion (input_object) region(-array) → objectobjectHObjectHRegionHObjectHobject

Region(s) to be transformed.

RegionCountregionCountregion_count (output_object) region(-array) → objectobjectHObjectHRegionHObjectHobject *

Resulting region(s).

Widthwidthwidth (input_control) extent.x → (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the filter mask.

Default: 1515
Suggested values: 3, 5, 7, 9, 11, 13, 15, 17, 19, 213, 5, 7, 9, 11, 13, 15, 17, 19, 21
Value range: 3 ≤ Width ≤ 511 (lin)
Minimum increment: 2
Recommended increment: 2
Restriction: Width >= 3 && odd(Width)

Heightheightheight (input_control) extent.y → (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the filter mask.

Default: 1515
Suggested values: 3, 5, 7, 9, 11, 13, 15, 17, 19, 213, 5, 7, 9, 11, 13, 15, 17, 19, 21
Value range: 3 ≤ Height ≤ 511 (lin)
Minimum increment: 2
Recommended increment: 2
Restriction: Height >= 3 && odd(Height)

Numbernumbernumber (input_control) integer → (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Minimum number of points lying within the filter mask.

Default: 7070
Suggested values: 5, 10, 20, 40, 60, 80, 90, 120, 150, 2005, 10, 20, 40, 60, 80, 90, 120, 150, 200
Value range: 1 ≤ Number ≤ 1000 (lin)
Minimum increment: 1
Recommended increment: 10
Restriction: Number > 0

Example🔗

(HDevelop)


read_image(Image,'monkey')
mean_image(Image,Mean,5,5)
dyn_threshold(Image,Mean,Points,25,'light')
rank_region(Points,Textur,15,15,30)
gen_circle(Mask,10,10,3)
opening(Textur,Mask,Seg)
(C)
read_image(&Image,"monkey")\;
mean_image(Image,&Mean,5,5)\;
dyn_threshold(Image,Mean,&Points,25,"light")\;
rank_region(Points,Textur,15,15,30)\;
gen_circle(&Mask,10,10,3)\;
opening(Textur,Mask,&Seg)\;

Complexity🔗

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

Result🔗

rank_regionRankRegion returns 2 (H_MSG_TRUE) if all parameters are correct. The clipping according to the global image size is set via the operator set_system('clip_region',<'true'/'false'>). 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 is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, connectionConnection, regiongrowingRegiongrowing, pouringPouring, class_ndim_normClassNdimNorm

Possible successors

select_shapeSelectShape, disp_regionDispRegion

Alternatives

closing_rectangle1ClosingRectangle1, expand_regionExpandRegion

See also

rank_imageRankImage, mean_imageMeanImage

Module🔗

Foundation