HALCON Reference Manual 10.0.2
Table of Contents / Regions / Transformations ClassesClassesClasses | | | Operators

rank_regionrank_regionrank_regionRankRegionRankRegion (Operator)

Name

rank_regionrank_regionrank_regionRankRegionRankRegion — Rank operator for regions.

Signature

rank_region(Region : RegionCount : Width, Height, Number : )

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)

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

void HOperatorSetX.RankRegion(
[in] IHUntypedObjectX* Region, [out] IHUntypedObjectX*RegionCount, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT Number)

IHRegionX* HRegionX.RankRegion(
[in] Hlong Width, [in] Hlong Height, [in] Hlong Number)

static void HOperatorSet.RankRegion(HObject region, out HObject regionCount, HTuple width, HTuple height, HTuple number)

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

Description

rank_regionrank_regionrank_regionRankRegionRankRegion calculates the binary rank operator. A filter mask of size HeightHeightHeightHeightheight x WidthWidthWidthWidthwidth) is used. In the process, for each point in the region the number of points of RegionRegionRegionRegionregion lying within the filter mask are counted. If this number is greater or equal to NumberNumberNumberNumbernumber, the current point is added to the output region. If

    Number = (Height x Width) / 2,

is chosen, the median operator is obtained.

Attention

For HeightHeightHeightHeightheight and WidthWidthWidthWidthwidth 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.

Parallelization

Parameters

RegionRegionRegionRegionregion (input_object)  region(-array) objectHRegionHRegionHRegionXHobject

Region(s) to be transformed.

RegionCountRegionCountRegionCountRegionCountregionCount (output_object)  region(-array) objectHRegionHRegionHRegionXHobject *

Resulting region(s).

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

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 Width Width Width width ≤ 511 (lin)

Minimum increment: 2

Recommended increment: 2

Restriction: (Width >= 3) && odd(Width)

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

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 Height Height Height height ≤ 511 (lin)

Minimum increment: 2

Recommended increment: 2

Restriction: (Height >= 3) && odd(Height)

NumberNumberNumberNumbernumber (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

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 Number Number Number 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)

Example (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) ;

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)

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)

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)

Complexity

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

Result

rank_regionrank_regionrank_regionRankRegionRankRegion returns 2 (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>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>) and the behavior in case of an empty input region via set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

thresholdthresholdthresholdThresholdThreshold, connectionconnectionconnectionConnectionConnection, regiongrowingregiongrowingregiongrowingRegiongrowingRegiongrowing, pouringpouringpouringPouringPouring, class_ndim_normclass_ndim_normclass_ndim_normClassNdimNormClassNdimNorm

Possible Successors

select_shapeselect_shapeselect_shapeSelectShapeSelectShape, disp_regiondisp_regiondisp_regionDispRegionDispRegion

Alternatives

closing_rectangle1closing_rectangle1closing_rectangle1ClosingRectangle1ClosingRectangle1, expand_regionexpand_regionexpand_regionExpandRegionExpandRegion

See also

rank_imagerank_imagerank_imageRankImageRankImage, mean_imagemean_imagemean_imageMeanImageMeanImage

Module

Foundation


Table of Contents / Regions / Transformations ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH