关于CROSS

1.形态学运算与结构元素
形态学运算是针对二值图像依据数学形态学(Mathematical Morphology)的集合论方法发展起来的图像处理方法。数学形态学起源于岩相学对岩石结构的定量描述工作,近年来在数字图像处理和机器视觉领域中得到了广泛的应用,形成了一种独特的数字图像分析方法和理论。

结构元素可以简单的定义为像素的组合,在对应的像素上定义了原点(也称锚点)。形态学滤波器的应用过程就是利用这个结构元素探测图像中每个像素的操作过程。把某个像素设为结构元素的锚点后,结构元素和图像重叠部分的像素集合就是特定形态学运算的应用对象。结构元素原则上可以是任何形状,但通常是一个简单形状,如正方形、圆形、菱形等,且把中心点作为原点。

1. Morphological operations and structural elements

Morphological operation is an image processing method developed by means of Mathematical Morphology based on binary images.Mathematical morphology originated from the quantitative description of rock structure in petrography, and has been widely applied in the field of digital image processing and machine vision in recent years, forming a unique digital image analysis method and theory.

A structural element can simply be defined as a combination of pixels, with an origin (also known as an anchor point) defined on the corresponding pixel.The application process of morphological filter is to use this structural element to detect the operation process of each pixel in the image.When a pixel is set as the anchor point of the structural element, the pixel set of the overlapping part of the structural element and the image is the application object of the specific morphological operation.The structural element can be of any shape in principle, but is usually a simple shape, such as a square, circle, diamond, etc., with the center point as the origin.

2.自定义结构元素

十字形结构元素:cross

2. Customize structural elements

Cross structural element: Cross

定义:

define:

cross(5, 5, CV_8U, Scalar(0));
//创建十字形元素
for (int i = 0; i < 5; i++)
{
    cross.at<uchar>(2, i) = 1;
    cross.at<uchar>(i, 2) = 1;
}
use to test:

Mat result;
//十字形膨胀
dilate(image, result, cross);
//十字形腐蚀
erode(result, result, cross);
 
imwrite("./cross.jpg",result);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值