Back to Adaptive Vision Library Lite website

You are here: Start » Image Local Transforms » ErodeImage


Header: AVL.h
Namespace: avl

Replaces each pixel with the minimum of pixels within a kernel.


void avl::ErodeImage
	const avl::Image& inImage,
	atl::Optional<const avl::Region&> inRoi,
	atl::Optional<const avl::Region&> inSourceRoi,
	atl::Optional<avl::Pixel> inBorderColor,
	avl::KernelShape::Type inKernel,
	int inRadiusX,
	atl::Optional<int> inRadiusY,
	avl::Image& outImage,
	avl::Region& diagKernel


Name Type Range Default Description
inImage const Image& Input image
inRoi Optional<const Region&> NIL Range of outImage pixels to be computed
inSourceRoi Optional<const Region&> NIL Range of inImage pixels to be considered in computations
inBorderColor Optional<Pixel> NIL Color of the imaginary pixels outside the image boundaries
inKernel KernelShape::Type Kernel shape
inRadiusX int 0 - 1 Nearly half of the kernel's width (2*R+1)
inRadiusY Optional<int> 0 - NIL Nearly half of the kernel's height (2*R+1), or same as inRadiusX
outImage Image& Output image
diagKernel Region& Kernel shape


The operation replaces each pixel with the darkest pixel in its neighbourhood, thus shrinking bright areas in inImage and expanding the dark ones.


ErodeImage performed on the sample image with inKernel = Box, inRadiusX = 1, inRadiusY = 1.

Hardware Acceleration

This operation is optimized for SSE2 technology for pixels of types: all formats (when inSourceRoi = NIL and inBorderColor = NIL).

This operation supports automatic parallelization for multicore and multiprocessor systems.


List of possible exceptions:

Error type Description
DomainError inBorderColor is relevant only when inSourceRoi is set to Auto (NIL) in ErodeImage.
DomainError Not supported kernel on input in ErodeImage.
DomainError Region exceeds an input image in ErodeImage.

See Also

  • DilateImage – Replaces each pixel with the maximum of pixels within a kernel.