ClassesClassesClassesClasses | | | | Operators

rank_nrank_nRankNrank_nRankNRankN (Operator)


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


rank_n(Image : RankImage : RankIndex : )

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

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

Herror rank_n(Hobject Image, Hobject* RankImage, const HTuple& RankIndex)

HImage HImage::RankN(const HTuple& RankIndex) const

HImageArray HImageArray::RankN(const HTuple& RankIndex) const

void RankN(const HObject& Image, HObject* RankImage, const HTuple& RankIndex)

HImage HImage::RankN(Hlong RankIndex) const

void HOperatorSetX.RankN(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*RankImage, [in] VARIANT RankIndex)

IHImageX* HImageX.RankN([in] Hlong RankIndex)

static void HOperatorSet.RankN(HObject image, out HObject rankImage, HTuple rankIndex)

HImage HImage.RankN(int rankIndex)


The operator rank_nrank_nRankNrank_nRankNRankN 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 RankIndexRankIndexRankIndexRankIndexRankIndexrankIndex is selected and placed in the output image at the same position. The output image has one channel.

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

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



ImageImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHImageHImageXHobject (byte / int2 / uint2 / int4 / int8 / real)

Multichannel gray image.

RankImageRankImageRankImageRankImageRankImagerankImage (output_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject * (byte / int2 / uint2 / int4 / int8 / real)

Result of the rank function.

RankIndexRankIndexRankIndexRankIndexRankIndexrankIndex (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Rank of the gray value images to return.

Default value: 2

Suggested values: 1, 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)

Possible Predecessors

compose2compose2Compose2compose2Compose2Compose2, compose3compose3Compose3compose3Compose3Compose3, compose4compose4Compose4compose4Compose4Compose4, compose5compose5Compose5compose5Compose5Compose5, add_channelsadd_channelsAddChannelsadd_channelsAddChannelsAddChannels



See also

count_channelscount_channelsCountChannelscount_channelsCountChannelsCountChannels, rank_imagerank_imageRankImagerank_imageRankImageRankImage



ClassesClassesClassesClasses | | | | Operators