Dilates an image by using a specific structuring element.
cv2.dilate(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) → dst
cv2.CV_8U
, cv2.CV_16U
, cv2.CV_16S
, cv2.CV_32F
or cv2.CV_64F
.kernel=Mat()
, a 3 x 3 rectangular structuring element is used. Kernels can be created using getStructuringElement
. These elements can have shape MORPH_RECT (a rectangular structuring element), MORPH_CROSS (a cross-shaped structuring element), or MORPH_ELLIPSE (a filled ellipse inscribed into the rectangle).src
.cv2.BORDER_*
): Pixel extrapolation method. Default is BORDER_CONSTANT. Choose from:
morphologyDefaultBorderValue
, has a special meaning. It is transformed to \(-\infty\) for the dilation, which means that the maximum is effectively computed only over the pixels that are inside the image.The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken: $$dst(x,y)=\max_{(x',y'): \text{ kernel}(x',y') \neq 0} src(x+x',y+y')$$ The function supports the in-place mode. Dilation can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently.