Opencv之getStructuringElement

//函数原型

CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1));

1、函数功能
      returns a structuring element of the specified size and shape for morphological operations.
      返回用于形态学操作的指定大小和形状的结构元素。
2、函数参数
(1)shape:Element shape that could be one of #MorphShapes
    结构元素形状可以是MorphShapes中的一个。

//! shape of the structuring element
enum MorphShapes {
    MORPH_RECT    = 0, //结构元素是矩形的
    MORPH_CROSS   = 1, //结构元素是十字形的       
    MORPH_ELLIPSE = 2 //结构元素是椭圆形的
};

(2)ksize:Size of the structuring element.
         结构元素的大小。
(3)anchor:Anchor position within the element. The default value \f$(-1, -1)\f$ 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.
         结构元素内的锚点位置。默认值为Point(-1,-1)表示锚在结构元素的中央。对于其它形状的元素,锚点规定了形态学处理结果的偏移量
3、函数使用
     函数返回的参数可以在erode,dilate,morphologyEx函数中使用

另外还可以自己定义kernel:

Mat op1 = (Mat_(3, 3) << 1, 0, 0, 0, -1, 0, 0, 0, 0);//自定义核参数

 

 

 

你可能感兴趣的:(opencv)