图像处理-形态学操作--腐蚀
腐蚀:求局部最小值
erode()
void cv::erode ( InputArray src,
OutputArray dst,
InputArray kernel,
Point anchor = Point(-1,-1),
int iterations = 1,
int borderType = BORDER_CONSTANT,
const Scalar & borderValue = morphologyDefaultBorderValue()
)
Python:
dst = cv.erode( src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]] )
Erodes an image by using a specific structuring element.
The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:
The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.
Parameters
src input image; the number of channels can be arbitrary, but the depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
输入图像(要处理的图片);
dst output image of the same size and type as src.
输出图像(处理后的图片)
kernel structuring element used for erosion; if element=Mat(), a 3 x 3 rectangular structuring element is used. Kernel can be created using getStructuringElement.
用于腐蚀的结构元素;如果元素= mat(),则使用3×3矩形结构元素。可以使用getstructuringElement创建内核。
anchor position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.
锚的位置在元件内;默认值(-1,-1)表示锚点位于元素中心。
iterations number of times erosion is applied.
应用腐蚀的次数。
borderType pixel extrapolation method, see BorderTypes
像素外推/拓展方法(图像边缘的像素点)
borderValue border value in case of a constant border
恒定边界的边界值
See also
dilate, morphologyEx, getStructuringElement
Examples:
morphology2.cpp, Morphology_1.cpp, and segment_objects.cpp.
getStructuringElement()
Mat cv::getStructuringElement ( int shape,
Size ksize,
Point anchor = Point(-1,-1)
)
Python:
retval = cv.getStructuringElement( shape, ksize[, anchor] )
Returns a structuring element of the specified size and shape for morphological operations.
返回指定大小和形状的结构化元素以进行形态操作。
The function constructs and returns the structuring element that can be further passed to erode, dilate or morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as the structuring element.
函数构造并返回可以进一步传递给侵蚀,扩张或数量的结构元素。但您还可以自己构建任意二进制掩码并将其用作结构化元素。
Parameters
shape Element shape that could be one of MorphShapes
元素形状,可能是morphshapes之一
ksize Size of the structuring element.
结构元素的大小
anchor Anchor position within the element. The default value (−1,−1) means that the anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor position. In other cases the anchor just regulates how much the result of the morphological operation is shifted.
元素内的锚定位置。默认值(-1,-1)表示锚点位于中心。注意,仅横形元件的形状取决于锚定位置。在其他情况下,锚点只是调节形态操作的结果转变了多少。
参考链接:
https://docs.opencv.org/3.4.2/d4/d86/group__imgproc__filter.html#gaeb1e0c1033e3f6b891a25d0511362aeb
https://docs.opencv.org/3.4.2/d4/d86/group__imgproc__filter.html#gac342a1bb6eabf6f55c803b09268e36dc
浙公网安备 33010602011771号