Skip to content

dual_rankdual_rankDualRankDualRankdual_rankdual_rankπŸ”—

Short descriptionπŸ”—

dual_rankdual_rankDualRankDualRankdual_rankdual_rank β€” Opening, Median and Closing with circle or rectangle mask.

SignatureπŸ”—

dual_rank( image Image, out image ImageRank, string MaskType, integer Radius, integer ModePercent, string Margin )dual_rank( Image : ImageRank : MaskType, Radius, ModePercent, Margin : )void DualRank( const HObject& Image, HObject* ImageRank, const HTuple& MaskType, const HTuple& Radius, const HTuple& ModePercent, const HTuple& Margin )static void HOperatorSet.DualRank( HObject image, out HObject imageRank, HTuple maskType, HTuple radius, HTuple modePercent, HTuple margin )def dual_rank( image: HObject, mask_type: str, radius: int, mode_percent: int, margin: Union[int, float, str] ) -> HObject

Herror dual_rank( const Hobject Image, Hobject* ImageRank, const char* MaskType, const Hlong Radius, const Hlong ModePercent, const char* Margin )

Herror T_dual_rank( const Hobject Image, Hobject* ImageRank, const Htuple MaskType, const Htuple Radius, const Htuple ModePercent, const Htuple Margin )

HImage HImage::DualRank( const HString& MaskType, Hlong Radius, Hlong ModePercent, const HTuple& Margin ) const

HImage HImage::DualRank( const HString& MaskType, Hlong Radius, Hlong ModePercent, const HString& Margin ) const

HImage HImage::DualRank( const char* MaskType, Hlong Radius, Hlong ModePercent, const char* Margin ) const

HImage HImage::DualRank( const wchar_t* MaskType, Hlong Radius, Hlong ModePercent, const wchar_t* Margin ) const (Windows only)

HImage HImage.DualRank( string maskType, int radius, int modePercent, HTuple margin )

HImage HImage.DualRank( string maskType, int radius, int modePercent, string margin )

DescriptionπŸ”—

The operator dual_rankDualRank carries out a non-linear transformation of the gray values of all input images (Imageimageimage). Circles or squares can be used as structuring elements. The operator dual_rankDualRank effects two consecutive calls of rank_imageRankImage. At the first call the range gray value is calculated with the indicated range (ModePercentmodePercentmode_percent). The result of this calculation is the input of a further call of rank_imageRankImage, this time using the range value \(100-\)ModePercentmodePercentmode_percent.

When filtering different parameters for border treatment (Marginmarginmargin) can be chosen:

  • gray value Pixels outside of the image border are assumed to be constant (with the indicated gray value).

  • 'continued'"continued" Continuation of the gray values at the image border.

  • 'cyclic'"cyclic" Cyclic continuation at the image borders.

  • 'mirrored'"mirrored" 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, (= ModePercentmodePercentmode_percent, rank values between \(0...100\) in percent) is selected and set as result gray value in the corresponding result image.

If ModePercentmodePercentmode_percent is \(0\), then the operator equals to the gray value opening (gray_openingGrayOpening). If ModePercentmodePercentmode_percent is \(50\), the operator results in the median filter, which is applied twice (median_imageMedianImage). The ModePercentmodePercentmode_percent 100 in dual_rankDualRank means that it calculates the gray value closing (gray_closingGrayClosing). 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.

AttentionπŸ”—

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.

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.

  • Automatically parallelized on channel level.

  • Automatically parallelized on domain level.

ParametersπŸ”—

Imageimageimage (input_object) (multichannel-)image(-array) β†’ object (byte / int2 / uint2 / int4 / real)object (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)HImage (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)Hobject (byte / int2 / uint2 / int4 / real)

Image to be filtered.

ImageRankimageRankimage_rank (output_object) multichannel-image(-array) β†’ object (byte / int2 / uint2 / int4 / real)object (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)HImage (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)Hobject * (byte / int2 / uint2 / int4 / real)

Filtered Image.

MaskTypemaskTypemask_type (input_control) string β†’ (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Shape of the mask.

Default: 'circle'"circle"
List of values: 'circle', 'square'"circle", "square"

Radiusradiusradius (input_control) integer β†’ (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Radius of the filter mask.

Default: 11
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 15, 19, 25, 31, 39, 47, 591, 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

ModePercentmodePercentmode_percent (input_control) integer β†’ (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Filter Mode: 0 corresponds to a gray value opening , 50 corresponds to a median and 100 to a gray values closing.

Default: 1010
Suggested values: 0, 2, 5, 10, 15, 20, 40, 50, 60, 80, 85, 90, 95, 98, 1000, 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

Marginmarginmargin (input_control) string β†’ (string / integer / real)(string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Union[int, float, str]Htuple (char* / Hlong / double)

Border treatment.

Default: 'mirrored'"mirrored"
Suggested values: 'mirrored', 'cyclic', 'continued', 0, 30, 60, 90, 120, 150, 180, 210, 240, 255"mirrored", "cyclic", "continued", 0, 30, 60, 90, 120, 150, 180, 210, 240, 255

ExampleπŸ”—

(HDevelop)


read_image(Image,'fabrik')
dual_rank(Image,ImageOpening,'circle',10,10,'mirrored')
dev_display(ImageOpening)
(C)
read_image(&Image,"fabrik")\;
dual_rank(Image,&ImageOpening,"circle",10,10,"mirrored")\;
disp_image(ImageOpening,WindowHandle)\;

ComplexityπŸ”—

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

ResultπŸ”—

If the parameter values are correct the operator dual_rankDualRank 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.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

read_imageReadImage

Possible successors

thresholdThreshold, dyn_thresholdDynThreshold, sub_imageSubImage, regiongrowingRegiongrowing

Alternatives

rank_imageRankImage, gray_closingGrayClosing, gray_openingGrayOpening, median_imageMedianImage

See also

gen_circleGenCircle, gen_rectangle1GenRectangle1, gray_erosion_rectGrayErosionRect, gray_dilation_rectGrayDilationRect, sigma_imageSigmaImage

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πŸ”—

Foundation