VCLib Documentation  6.12.2

Rank Filter

Functions

I32 median3 (image *src, image *dst)
  3×3 Median Filter. More...
 
I32 pmed5x5 (image *src, image *dst)
  5×5 Pseudo Median Filter with Horizontal/Vertical Separation. More...
 
I32 pmed7x7 (image *src, image *dst)
  7×7 Pseudo Median Filter with Horizontal/Vertical Separation. More...
 
I32 median1xN (image *src, image *dst, I32 my)
  1×N Median Filter. More...
 
I32 medianNx1 (image *src, image *dst, I32 mx)
  N×1 Median Filter. More...
 
I32 vc_median_anisotropic_1x9 (image *vec, image *out)
 Anisotropic 1×9 Median Filter at a Vector Image. More...
 
I32 vc_median_anisotropic_1x9_padded (image *vec, image *out)
 Anisotropic 1×9 Median Filter at a Vector Image, padded with 0. More...
 
I32 maxMxN (image *src, image *dst, I32 mx, I32 my)
 Moving Maximum (Dilation) Filter. More...
 
I32 minMxN (image *src, image *dst, I32 mx, I32 my)
 Moving Minimum (Erosion) Filter. More...
 

Detailed Description

Function Documentation

◆ maxMxN()

I32 maxMxN ( image src,
image dst,
I32  mx,
I32  my 
)

The function calculates the moving maximum filter (grey value dilation) with a filter kernel of size (mx, my). It is possible to set either mx or my to one, in which case a linear horizontal or vertical structuring element is used. It is not possible to use this function in-place, i.e src and dst must be different. The execution time is independent of the mask size. The function returns the standard error code.

Parameters
srcSource Image.
dstDestination Image.
mx,myFilter Size.
Memory Consumption
dx Bytes of Heap Memory.
See also
minMxN().
Return values
ERR_TYPEif src or dst Image is no Grey Image.
ERR_PARAMif mx not in [1,dx] or my not in [1,dy].
ERR_PARAMif src->st = dst->st.
ERR_MEMORYif Memory Allocation Fails.
ERR_NONEon Success.
ERR_TYPEif src or dst Image is no Grey Image.
ERR_PARAMif mx not in [1,dx] or my not in [1,dy].
ERR_PARAMif src->st = dst->st.
ERR_MEMORYif Memory Allocation Fails.
ERR_NONEon Success.

◆ minMxN()

I32 minMxN ( image src,
image dst,
I32  mx,
I32  my 
)

The function calculates the moving minimum filter (grey value erosion) with a filter kernel of size (mx, my). It is possible to set either mx or my to one, in which case a linear horizontal or vertical structuring element is used. It is not possible to use this function in-place, i.e src and dst must be different. The exection time is independent of the mask size. The function returns the standard error code.

Parameters
srcSource Image.
dstDestination Image.
mx,myFilter Size.
Memory Consumption
dx Bytes of Heap Memory.
See also
maxMxN().
Return values
ERR_TYPEif src or dst Image is no Grey Image.
ERR_PARAMif mx not in [1,dx] or my not in [1,dy].
ERR_PARAMif src->st = dst->st.
ERR_MEMORYif Memory Allocation Fails.
ERR_NONEon Success.
ERR_TYPEif src or dst Image is no Grey Image.
ERR_PARAMif mx not in [1,dx] or my not in [1,dy].
ERR_PARAMif src->st = dst->st.
ERR_MEMORYif Memory Allocation Fails.
ERR_NONEon Success.

◆ median3()

I32 median3 ( image src,
image dst 
)
Parameters
aSource Image.
bDestination Image, May be Identical.
See also
median1xN(), medianNx1().

The median3() now fills the complete output image b instead of a previous version.

Note that the output pixel position is equal to the top left pixel position of the 3×3 matrix. The advantage of that positioning is the ability to use the input image as the output image. Also note that the last two columns and the last two rows of the image contain meaningless data. A simple approach to register the output pixel position to the center position and interpolation at the border comes with the following code, but at a cost of memory and processing time:

I32 median3_centered(image *a)
{
image sImgEdge = NULL_IMAGE;
if(ERR_NONE != ImageAllocateEdge(a, &sImgEdge, 1, 1))
{ return ERR_MEMORY; }
median3(&sImgEdge, a);
ImageFree(&sImgEdge);
}
Return values
ERR_TYPEif src or dst image is no grey compatible image.

◆ pmed5x5()

I32 pmed5x5 ( image src,
image dst 
)

The function performs a 5×5 median filter for an image variable src. The filter consists of a 1×5 and a 5×1 median which are executed in sequence. The result of the operation will be stored in image dst.

See also
pmed7x7().
Return values
ERR_TYPEif src or dst Image is no Grey Image.
ERR_NONEon Success.

◆ pmed7x7()

I32 pmed7x7 ( image src,
image dst 
)

The function performs a 7×7 median filter for an image variable src. The filter consists of a 1×7 and a 7×1 median which are executed in sequence. The result of the operation will be stored in image dst.

See also
pmed5x5().
Return values
ERR_TYPEif src or dst image is not grey compatible.
ERR_NONEon Success.

◆ median1xN()

I32 median1xN ( image src,
image dst,
I32  my 
)
Parameters
srcSource Image
dstDestination Image, May be identical.
myFilter Size

◆ medianNx1()

I32 medianNx1 ( image src,
image dst,
I32  mx 
)
Parameters
srcSource Image
dstDestination Image, May be identical.
mxFilter Size

◆ vc_median_anisotropic_1x9()

I32 vc_median_anisotropic_1x9 ( image vec,
image out 
)

The function makes it possible to calculate an anisotropic 1×9 median filter operation at a vector image. Therefore the direction at the center pixel of a 9×9 frame will define the angle of the 1×9 pixel line through that point which selects the points whose magnitudes will be medianized for that pixel, and the direction of the winning median pixel is copied to the output.

Note that the output pixel position is equal to the top left pixel position of the 9×9 matrix. The advantage of that positioning is the ability to use the input image as the output image. Also note that the last nine columns and the last nine rows of the image contain meaningless data.

Parameters
vecSource image of type IMAGE_VECTOR.
outDestination image of type IMAGE_VECTOR.
Returns
ERR_TYPE if any of the images is not of type IMAGE_VECTOR.
Memory Consumption
None.

◆ vc_median_anisotropic_1x9_padded()

I32 vc_median_anisotropic_1x9_padded ( image vec,
image out 
)

The function makes it possible to calculate an anisotropic 1×9 median filter operation at a vector image, see vc_median_anisotropic_1x9() for more information.

The input image is padded by a 4-pixel-border filled with 0 at the st channel, with 0x80 at the ccmp1 channel compatible to the gradient_3x3_thresh() meaning of direction. This is only relevant if the vector input is 0 at its border frame, so there may be dir 0x80s used for magnitude 0(!) at the border.

The result is as big as the input image.

Parameters
vecSource image of type IMAGE_VECTOR.
outDestination image of type IMAGE_VECTOR.
Returns
0 on success.