Skip to content

rank_nRankNRankNrank_nrank_n🔗

Short description🔗

rank_nRankNRankNrank_nrank_n — Return gray values with given rank from multiple channels.

Signature🔗

rank_n( image Image, out image RankImage, integer RankIndex )void RankN( const HObject& Image, HObject* RankImage, const HTuple& RankIndex )static void HOperatorSet.RankN( HObject image, out HObject rankImage, HTuple rankIndex )def rank_n( image: HObject, rank_index: int ) -> HObject

Herror rank_n( const Hobject Image, Hobject* RankImage, const Hlong RankIndex )

Herror T_rank_n( const Hobject Image, Hobject* RankImage, const Htuple RankIndex )

HImage HImage::RankN( Hlong RankIndex ) const

HImage HImage.RankN( int rankIndex )

Description🔗

The operator rank_nRankN returns pixel-by-pixel the result of the rank-function over all channels.

For every pixel in the input image the following is being done: The gray values of all channels at this position are sorted in ascending order. Then the pixel with index RankIndexrankIndexrank_index is selected and placed in the output image at the same position. The output image has one channel.

In the special cases RankIndexrankIndexrank_index = 11 and RankIndexrankIndexrank_index = '(Number of channels)'"(Number of channels)" the minimum and maximum are returned. RankIndexrankIndexrank_index = '(Number of channels + 1) / 2'"(Number of channels + 1) / 2" returns the median (here, / denotes integer division). Hence, for a five-channel image, 33 returns the median.

The operator rank_nRankN should not be confused with the operator rank_imageRankImage which computes the rank within a certain mask.

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 domain level.

Parameters🔗

Imageimageimage (input_object) (multichannel-)image(-array) → object (byte / int2 / uint2 / int4 / int8 / real)HObject (byte / int2 / uint2 / int4 / int8 / real)HImage (byte / int2 / uint2 / int4 / int8 / real)HObject (byte / int2 / uint2 / int4 / int8 / real)Hobject (byte / int2 / uint2 / int4 / int8 / real)

Multichannel gray image.

RankImagerankImagerank_image (output_object) singlechannelimage(-array) → object (byte / int2 / uint2 / int4 / int8 / real)HObject (byte / int2 / uint2 / int4 / int8 / real)HImage (byte / int2 / uint2 / int4 / int8 / real)HObject (byte / int2 / uint2 / int4 / int8 / real)Hobject * (byte / int2 / uint2 / int4 / int8 / real)

Result of the rank function.

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

Rank of the gray value images to return.

Default: 22
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 201, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20

Example🔗

(HDevelop)

compose5 (Image1, Image2, Image3, Image4, Image5, MultiChannelImage)
rank_n (MultiChannelImage, ImageMin, 1)
rank_n (MultiChannelImage, ImageMax, 5)
rank_n (MultiChannelImage, ImageMedian, 3)

Combinations with other operators🔗

Combinations

Possible predecessors

compose2Compose2, compose3Compose3, compose4Compose4, compose5Compose5, add_channelsAddChannels

Alternatives

mean_nMeanN

See also

count_channelsCountChannels, rank_imageRankImage

Module🔗

Foundation