CN105913415A - Image sub-pixel edge extraction method having extensive adaptability - Google Patents
Image sub-pixel edge extraction method having extensive adaptability Download PDFInfo
- Publication number
- CN105913415A CN105913415A CN201610209158.9A CN201610209158A CN105913415A CN 105913415 A CN105913415 A CN 105913415A CN 201610209158 A CN201610209158 A CN 201610209158A CN 105913415 A CN105913415 A CN 105913415A
- Authority
- CN
- China
- Prior art keywords
- point
- edge
- image
- pixel
- gradient
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000605 extraction Methods 0.000 title claims abstract description 40
- 238000000034 method Methods 0.000 claims abstract description 71
- 238000004364 calculation method Methods 0.000 claims abstract description 17
- 239000011159 matrix material Substances 0.000 claims abstract description 17
- 230000003044 adaptive effect Effects 0.000 claims abstract description 7
- 238000004422 calculation algorithm Methods 0.000 claims description 15
- 238000001514 detection method Methods 0.000 claims description 15
- 238000007781 pre-processing Methods 0.000 claims description 9
- 230000008569 process Effects 0.000 claims description 9
- 230000000694 effects Effects 0.000 claims description 6
- 238000009499 grossing Methods 0.000 claims description 4
- 230000001186 cumulative effect Effects 0.000 claims description 3
- 230000009977 dual effect Effects 0.000 claims description 3
- 238000003708 edge detection Methods 0.000 description 14
- 230000006870 function Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 7
- 230000014509 gene expression Effects 0.000 description 6
- 230000006872 improvement Effects 0.000 description 6
- 238000005259 measurement Methods 0.000 description 6
- 230000008859 change Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000015572 biosynthetic process Effects 0.000 description 2
- 230000000295 complement effect Effects 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 238000005286 illumination Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 238000006073 displacement reaction Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000000877 morphologic effect Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012601 sigmoid curve-fitting method Methods 0.000 description 1
- 230000001629 suppression Effects 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012549 training Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- 238000011179 visual inspection Methods 0.000 description 1
Landscapes
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
本发明提出了一种具有广泛适应性的图像亚像素边缘提取方法,采用自适应高低阈值计算方法,在得到梯度图像后,结合像素点的梯度方向信息对梯度图像执行局部极大中心值选择操作,以任意像素位置为原点,建立相对坐标,取该点周围八邻域像素为局部极大中心值选择数据样本,根据梯度方向得到邻域的比较结果,确定当前像素位置是否为边界点候选位置。局部梯度幅值的极值是否为边缘点,需要结合特定阈值来判断,大于某给定阈值的标记为边缘点,小于某给定阈值判定为噪声点或背景点;采用基于Steger曲面拟合方法的Hessian矩阵法求取边缘点的亚像素位置;最后将将边缘点连接成曲线,构成一组有向连续点的集合。本发明方法具有极好的实时性。
The present invention proposes an image sub-pixel edge extraction method with wide adaptability, adopts an adaptive high and low threshold value calculation method, and performs a local maximum central value selection operation on the gradient image in combination with the gradient direction information of the pixel point after obtaining the gradient image , take any pixel position as the origin, establish relative coordinates, take the eight neighborhood pixels around the point as the local maximum center value to select the data sample, obtain the comparison result of the neighborhood according to the gradient direction, and determine whether the current pixel position is a candidate position of the boundary point . Whether the extremum of the local gradient amplitude is an edge point needs to be judged in conjunction with a specific threshold. Marks greater than a given threshold are marked as edge points, and those smaller than a given threshold are judged as noise points or background points; using a Steger-based surface fitting method The Hessian matrix method to obtain the sub-pixel position of the edge points; finally, the edge points will be connected into a curve to form a set of directed continuous points. The method of the invention has excellent real-time performance.
Description
技术领域technical field
本发明涉及图像识别技术领域,尤其涉及一种图像亚像素边缘提取方法。The invention relates to the technical field of image recognition, in particular to an image sub-pixel edge extraction method.
背景技术Background technique
在机器视觉中,为进行目标定位、测量、检测或几何特征提取等都需要对目标进行亚像素精度的边缘提取。例如在目标定位中采用几何特征的模板匹配方法需要对模板和目标进行亚像素精度的边缘提取;在测量应用中需要精确检测到物体的边缘才能进行准确地测量;在检测应用中,如光学字符验证OCV、边缘缺陷检测等都需要稳定地检测到物体的亚像素边缘。In machine vision, in order to perform target positioning, measurement, detection or geometric feature extraction, etc., it is necessary to extract the edge of the target with sub-pixel precision. For example, the template matching method using geometric features in target positioning requires sub-pixel edge extraction for templates and targets; in measurement applications, it is necessary to accurately detect the edges of objects to perform accurate measurements; in detection applications, such as optical characters Verification of OCV, edge defect detection, etc. all require stable detection of sub-pixel edges of objects.
常用的边缘提取算法有Roberts算子、Sobel算子、Prewitt算子、拉普拉斯算子及Canny算子等。亚像素精度的边缘提取算法有空间矩法、灰度矩法、Zernike矩法及数字相关法等。其它亚像素精度的边缘提取算法还包括多项式拟合法、椭圆拟合法、高斯曲面拟合法、Sigmoid曲线拟合法等,李帅等提出了一种基于高斯曲面拟合的亚像素检测算法,孙成秋等在《一种亚像素精度的边缘检测方法》中提出采用贝塞尔边缘模型进行亚像素边缘提取,张舞杰等提出了一种基于Sigmoid函数拟合的亚像素边缘检测的方法。专利文献1(中国专利公开号CN10465002A)公开了一种基于Sobel边缘提取的椭圆目标亚像素边缘定位方法,通过像素边缘计算椭圆几何参数,通过像素边缘计算出亚像素边缘。Commonly used edge extraction algorithms include Roberts operator, Sobel operator, Prewitt operator, Laplacian operator and Canny operator, etc. Edge extraction algorithms with sub-pixel accuracy include spatial moment method, gray moment method, Zernike moment method and digital correlation method. Other edge extraction algorithms with sub-pixel accuracy include polynomial fitting method, ellipse fitting method, Gaussian surface fitting method, Sigmoid curve fitting method, etc. Li Shuai et al. proposed a sub-pixel detection algorithm based on Gaussian surface fitting. Sun Chengqiu et al. In "A Method of Edge Detection with Sub-pixel Accuracy", it is proposed to use the Bessel edge model for sub-pixel edge extraction. Zhang Wujie et al. proposed a method of sub-pixel edge detection based on Sigmoid function fitting. Patent Document 1 (Chinese Patent Publication No. CN10465002A) discloses a sub-pixel edge location method for an ellipse object based on Sobel edge extraction, which calculates ellipse geometric parameters from pixel edges and calculates sub-pixel edges from pixel edges.
专利文献2(中国专利公开号CN102737377A)公开了一种改进的亚像素边缘提取算法,先进行像素精度的粗定位,利用边缘图像裁剪目标图像缩小查找范围,然后在缩小后的范围内提取亚像素边缘。专利文献3(中国专利公开号CN103530878A)公开了一种基于融合策略的边缘提取方法,采用三种传统的边缘提取算法的结果获得反映属于边缘可能程度的投票权重,然后分析像素点与邻域的最大亮度差和最小亮度差的差值,获取描述亮度突变程度的差值权重;统计去中心邻域方差分布,获取所有像素点的边缘分布权重,进行边缘决策,输出边缘图像。专利文献4(中国专利公开号CN103886589A)公开了一种面向目标的自动化高精度边缘提取方法,包括模型训练阶段和边缘提取阶段。专利文献5(中国专利公开号CN103955911A)公开了一种基于相对变分的边缘检测方法,包括图像预处理及基于神经网络方法的边缘检测。专利文献6(中国专利公开号CN104268857A)公开了一种快速亚像素边缘检测和定位方法,基本思路是首先获得像素级边缘位置,然后采用余弦查表法计算亚像素边缘点。专利文献7(中国专利公开号CN104268872A)公开了一种基于一致性的边缘检测方法。专利文献8(中国专利公开号CN104732536A)公开了一种基于改进形态学的亚像素边缘检测方法,采用改进的形态学边缘检测算子平滑图像边缘信息,在物体边缘轮廓中利用Canny算子获得像素级的边缘,然后将像素级边缘拟合为产品的亚像素边缘。专利文献9(中国专利公开号CN105005981A公)开了一种的亚像素精度的激光光条中心提取方法,通过在平滑后的图像中定位初始光条中心,然后利用高斯函数拟合获得光条宽度,再利用拟合高斯函数的方差及高斯卷积核等参数计算Hessian矩阵,依据Hessian矩阵计算出激光光条的亚像素中心位置。在Hessian矩阵方法的使用上与本发明相同,但在像素精度位置计算方面存在本质的区别,也导致两个方法的适用性完全不同。Patent Document 2 (Chinese Patent Publication No. CN102737377A) discloses an improved sub-pixel edge extraction algorithm, which first performs rough positioning of pixel accuracy, uses the edge image to crop the target image to narrow the search range, and then extracts sub-pixels within the reduced range edge. Patent Document 3 (Chinese Patent Publication No. CN103530878A) discloses an edge extraction method based on a fusion strategy. The results of three traditional edge extraction algorithms are used to obtain voting weights reflecting the possibility of belonging to an edge, and then the relationship between pixels and neighborhoods is analyzed. The difference between the maximum luminance difference and the minimum luminance difference is used to obtain the weight of the difference that describes the degree of sudden change in brightness; the variance distribution of the decentralized neighborhood is calculated to obtain the edge distribution weights of all pixels, and the edge decision is made to output the edge image. Patent Document 4 (Chinese Patent Publication No. CN103886589A) discloses a target-oriented automatic high-precision edge extraction method, including a model training stage and an edge extraction stage. Patent Document 5 (Chinese Patent Publication No. CN103955911A) discloses an edge detection method based on relative variation, including image preprocessing and edge detection based on a neural network method. Patent Document 6 (Chinese Patent Publication No. CN104268857A) discloses a fast sub-pixel edge detection and positioning method. The basic idea is to first obtain the pixel-level edge position, and then use the cosine look-up table method to calculate the sub-pixel edge point. Patent Document 7 (Chinese Patent Publication No. CN104268872A) discloses a consistency-based edge detection method. Patent Document 8 (Chinese Patent Publication No. CN104732536A) discloses a sub-pixel edge detection method based on improved morphology, which uses an improved morphological edge detection operator to smooth image edge information, and uses Canny operator to obtain pixels in object edge contours Level edges, and then fit the pixel-level edges to the sub-pixel edges of the product. Patent Document 9 (Chinese Patent Publication No. CN105005981A) discloses a method for extracting the center of the laser light stripe with sub-pixel precision, by locating the center of the initial light stripe in the smoothed image, and then using Gaussian function fitting to obtain the width of the light stripe , and then use the variance of the fitted Gaussian function and the parameters of the Gaussian convolution kernel to calculate the Hessian matrix, and calculate the sub-pixel center position of the laser light bar according to the Hessian matrix. The use of the Hessian matrix method is the same as that of the present invention, but there is an essential difference in pixel precision position calculation, which also leads to completely different applicability of the two methods.
然而在工业环境应用中,图像受到各类因素的干扰导致图像质量降低,包括强噪声、边缘模糊等,如何在低质量的图像中稳定地检测出亚像素精度的边缘特征并没有很好地解决。传统的像素精度的边缘提取算法在工业自动化应用如3C自动化装备、电子制造、工业机器人视觉等应用中并不能满足精度要求。空间矩法、灰度矩法、Zernike矩法及数字相关法等亚像素边缘提取算法在检测精度、计算速度和抗噪声能力方面均存在各自的不足,很难适应工业环境中严苛的检测工况。However, in industrial environment applications, images are disturbed by various factors, resulting in reduced image quality, including strong noise, edge blur, etc. How to stably detect sub-pixel-accurate edge features in low-quality images has not been well resolved. . Traditional pixel-accurate edge extraction algorithms cannot meet the accuracy requirements in industrial automation applications such as 3C automation equipment, electronic manufacturing, and industrial robot vision. Sub-pixel edge extraction algorithms such as spatial moment method, gray moment method, Zernike moment method and digital correlation method have their own shortcomings in detection accuracy, calculation speed and anti-noise ability, and it is difficult to adapt to the harsh detection work in industrial environments. condition.
专利文献1只能提取椭圆目标的亚像素位置,通用性不足,且不能处理模糊目标的边缘提取问题。专利文献3公开的方法中分布利用了Sobel、Canny和LoG算子进行边缘检测,然后将三种算子检测的结果进行加权投票统计,根据投票的权重矩阵得到亚像素坐标,该方法存在的问题是速度慢、精度依赖于权重矩阵、不能解决强噪声、模糊等图像的边缘提取问题。专利文献4和专利文献5公开的方法采用Canny和相对变分的结果,采用机器学习的方法进行边缘提取,其方法速度较慢、不能在低质量图像中进行稳定的边缘提取。专利文献6公开的方法在像素坐标粗定位的基础上,在8个梯度方向上进行亚像素边缘检测,该方法具有很好的计算速度,但没有考虑强噪声和模糊图像的处理。专利文献7和专利文献8也存在计算效率不高,不能处理强噪声、模糊图像的边缘提取问题。专利文献9公开的方法采用多级高斯卷积运算,算法复杂度高,对光照变化等原因形成的不同区域非线性阴影变化无法实现鲁棒的光条中心线提取,该方法只适用于激光光条中心线提取,无法实现通用的图像边缘特征提取。Patent Document 1 can only extract the sub-pixel position of an elliptical object, which has insufficient versatility, and cannot deal with the edge extraction problem of blurry objects. In the method disclosed in Patent Document 3, Sobel, Canny and LoG operators are used for edge detection, and then the results of the three operators are used for weighted voting statistics, and the sub-pixel coordinates are obtained according to the voting weight matrix. The problems of this method It is slow, the accuracy depends on the weight matrix, and it cannot solve the edge extraction problems of images such as strong noise and blur. The methods disclosed in Patent Document 4 and Patent Document 5 use the results of Canny and relative variation, and use machine learning methods for edge extraction, which are slow and cannot perform stable edge extraction in low-quality images. The method disclosed in Patent Document 6 performs sub-pixel edge detection in 8 gradient directions on the basis of coarse positioning of pixel coordinates. This method has a good calculation speed, but does not consider the processing of strong noise and blurred images. Patent Document 7 and Patent Document 8 also have low computational efficiency and cannot handle edge extraction of strong noise and blurred images. The method disclosed in Patent Document 9 adopts multi-level Gaussian convolution operation, and the algorithm complexity is high. It cannot realize the robust extraction of the centerline of the light bar for the non-linear shadow changes in different areas caused by illumination changes and other reasons. This method is only applicable to laser light. The extraction of centerlines cannot achieve general image edge feature extraction.
发明内容Contents of the invention
本发明的目的在于提供一种基于图像边缘信息的高速、高精度模板匹配定位方法,该方法能同时输出模板图像在目标图像中亚像素精度的位置、旋转角度和缩放比例因子,针对目标图像出现位移、旋转、缩放、部分遮挡、光照明暗变化,光照不均匀、杂乱背景等都能实现快速、稳定、高精度的定位和识别。本发明可以应用于需要通过机器视觉进行目标定位和识别的场合:如机器人引导、半导体封装、电子制造、自动化装配、产品视觉检测、视觉测量、视频跟踪等领域。The purpose of the present invention is to provide a high-speed, high-precision template matching and positioning method based on image edge information, which can simultaneously output the position, rotation angle and scaling factor of the template image in the target image with sub-pixel accuracy, and aim at the appearance of the target image. Displacement, rotation, scaling, partial occlusion, light and dark changes, uneven illumination, messy background, etc. can all achieve fast, stable, and high-precision positioning and recognition. The present invention can be applied to occasions requiring target positioning and identification through machine vision: such as robot guidance, semiconductor packaging, electronic manufacturing, automatic assembly, product visual inspection, visual measurement, video tracking and other fields.
本发明公开的方法能够在低质量图像中稳定地检测出亚像素精度的边缘特性。The method disclosed in the invention can stably detect the edge characteristics of sub-pixel precision in low-quality images.
为达上述目的,本发明通过以下技术方案实现:For reaching above-mentioned object, the present invention realizes by following technical scheme:
一种具有广泛适应性的图像亚像素边缘提取方法,包括以下步骤:步骤1:采用可变尺度图像模糊平滑滤波对图像预处理;步骤2:对预处理后的图像计算一阶导数,首先确保得到的梯度幅值满足该点错误率小于设定值αp,图像一阶导数通过目标核卷积图像空间得到;图像的边缘线在图像一阶导数的脊线处,其中,脊线是梯度图像内相邻连续的局部极大值的集合;步骤3:在边缘候选点筛选过程中应用到链式阈值的边缘提取及选择原理,实现像素级边界位置提取,高低阈值采用两种方式获得:外部参数输入或者自适应阈值计算;步骤4:在得到梯度图像后,为方便并快速找到脊线的单像素宽位置,结合像素点的梯度方向信息对梯度图像执行局部极大中心值选择操作;步骤5:局部梯度幅值的极值是否为边缘点,需要结合特定阈值来判断,大于某给定阈值的标记为边缘点,小于某给定阈值判定为噪声点或背景点;步骤6:计算亚像素精度的边缘位置;步骤7:将边缘点连接成曲线,构成一组有向连续点的集合。An image sub-pixel edge extraction method with wide adaptability, comprising the following steps: Step 1: Preprocessing the image using variable-scale image blur smoothing filter; Step 2: Computing the first-order derivative of the preprocessed image, first ensuring that The obtained gradient amplitude satisfies that the error rate of this point is less than the set value α p , and the first derivative of the image is obtained by convolving the image space with the target kernel; the edge line of the image is at the ridge line of the first derivative of the image, where the ridge line is the gradient A collection of adjacent continuous local maxima in the image; Step 3: Apply the chain threshold edge extraction and selection principle in the edge candidate point selection process to realize pixel-level boundary position extraction. The high and low thresholds are obtained in two ways: External parameter input or adaptive threshold calculation; Step 4: After obtaining the gradient image, in order to find the single-pixel width position of the ridge conveniently and quickly, combine the gradient direction information of the pixel to perform a local maximum central value selection operation on the gradient image; Step 5: Whether the extremum of the local gradient amplitude is an edge point needs to be judged in conjunction with a specific threshold. Markings greater than a given threshold are edge points, and smaller than a given threshold are judged as noise points or background points; Step 6: Calculation Edge position with sub-pixel accuracy; Step 7: Connect the edge points into a curve to form a set of directed continuous points.
作为本发明的进一步改进所述步骤2中,设图像I(x,y)被执行边缘提取操作后得到边界点错误率为αI,图像大小为n=w×h,则单点检测错误的概率为αp=1-(1-αI)1 /n,其中αI范围在0到1.0间,图像I(x,y)只有高斯噪声且噪声信号方差为sn;利用卷积的分步特性,有如下等式:As a further improvement of the present invention in step 2, assume that the image I (x, y) is subjected to an edge extraction operation to obtain a boundary point error rate α I , and the image size is n=w×h, then the single point detection error The probability is α p =1-(1-α I ) 1 /n , where α I ranges from 0 to 1.0, the image I(x, y) has only Gaussian noise and the noise signal variance is s n ; The step characteristic has the following equation:
得到各点的梯度幅值为使得各点梯度幅值的错误率低于设定值αp,即满足等式:M(x,y,σ)≥c(σ),其中,The gradient amplitude of each point is obtained as Make the error rate of the gradient amplitude of each point lower than the set value α p , which satisfies the equation: M(x, y, σ)≥c(σ), where,
上式中的变量为尺度变量σ,其它变量为全局设定参数。The variables in the above formula are scale variables σ, and other variables are global setting parameters.
作为本发明的进一步改进,所述步骤3中计算高低阈值具体为:首先找到直方图曲线的峰值点(i,Hi)、最后一个直方图中非零累积值坐标点为(j,Hj),0≤i<j≤255且0≤Hj<Hj<1.0,将上述两点连接起来,得到一条直线ax+by+c=0;在i到j间查找直方图曲线坐标点到直线的最大距离位置dmax,即满足dma x=arg maxk|ak+bHk+c|,该点坐标(k,Hk)的横坐标即为第一个阈值Tlow=k;接着从该点出发,至直线末端点(j,Hj)再连接成一条直线αx+βy+λ=0,在直方图曲线的区间k到j上,查找曲线到直线(α,β,λ)的最大距离位置Dmax,同样满足Dmax=arg maxt|αt+βHt+λ|,该点坐标(t,Ht)的横坐标标记为第二个阈值Thigh=t。As a further improvement of the present invention, the calculation of the high and low thresholds in the step 3 is specifically: first find the peak point (i, H i ) of the histogram curve, and the non-zero cumulative value coordinate point in the last histogram is (j, H j ), 0≤i<j≤255 and 0≤H j <Hj<1.0, connect the above two points to get a straight line ax+by+c=0; find the histogram curve coordinate point from i to j to the straight line The maximum distance position d max , which satisfies d max x =arg max k |ak+bH k +c|, the abscissa of the point coordinate (k, H k ) is the first threshold T low =k; then from Starting from this point, connect to the end point (j, H j ) of the straight line to form a straight line αx+βy+λ=0, and find the relationship between the curve and the straight line (α, β, λ) on the interval k to j of the histogram curve The maximum distance position D max also satisfies D max =arg max t |α t +βH t +λ|, and the abscissa of the point coordinate (t, H t ) is marked as the second threshold T high =t.
作为本发明的进一步改进,所述步骤4具体为:任意像素位置的梯度方向为θ=tan-1(fy/fx),相切与脊线的走势方向;以任意像素位置为原点,建立一个相对坐标,取该点周围八邻域像素为局部极大中心值选择数据样本,根据梯度方向得到邻域的比较结果,确定当前像素位置是否为边界点候选位置。As a further improvement of the present invention, the step 4 is specifically: the gradient direction of any pixel position is θ=tan -1 (f y /f x ), tangent to the trend direction of the ridge line; taking any pixel position as the origin, Establish a relative coordinate, take the eight neighboring pixels around the point as the local maximum center value to select data samples, and obtain the comparison result of the neighborhood according to the gradient direction to determine whether the current pixel position is a candidate position of the boundary point.
作为本发明的进一步改进,所述步骤5采用Canny的双阈值设定(Tlow,Thigh);当局部极值G0高于Thigh时,点p0是边缘点;G0低于阈值Tlow表示当前点为非边界点属性;当G0介于高低阈值之间时,链式效应发生作用,即p0点的八邻域中存在边界点,则当前位置确认为边界点。As a further improvement of the present invention, said step 5 adopts Canny's dual threshold setting (T low , T high ); when the local extremum G 0 is higher than T high , the point p 0 is an edge point; G 0 is lower than the threshold T low indicates that the current point is a non-boundary point attribute; when G 0 is between the high and low thresholds, the chain effect takes effect, that is, there are boundary points in the eight neighborhoods of point p 0 , and the current position is confirmed as a boundary point.
作为本发明的进一步改进,所述步骤6采用基于Steger曲面拟合方法的Hessian矩阵法求取边缘点的亚像素位置,在像素级边缘点的小区域内执行曲面拟合的内插值算法f(r,c)=k0+k1r+k2c+k3r2+k4rc+k5c2;对曲面方程的各未知数求取一阶及二阶导数,组合成Hessian矩阵;求解Hessian矩阵的特征值及各自的特征向量,其中最大绝对特征值所对应的特征向量即为边缘点的法线方向(nx,ny);利用法线方向及曲面方程的泰勒展开,计算边缘点的亚像素位置。As a further improvement of the present invention, said step 6 uses the Hessian matrix method based on the Steger surface fitting method to obtain the sub-pixel position of the edge point, and performs the interpolation algorithm f(r of the surface fitting in the small area of the pixel-level edge point , c)=k 0 +k 1 r+k 2 c+k 3 r 2 +k 4 rc+k 5 c 2 ; calculate the first and second derivatives of the unknowns of the surface equation and combine them into a Hessian matrix; solve The eigenvalues of the Hessian matrix and their respective eigenvectors, the eigenvector corresponding to the largest absolute eigenvalue is the normal direction (n x , n y ) of the edge point; using the normal direction and the Taylor expansion of the surface equation, the edge is calculated The subpixel location of the point.
作为本发明的进一步改进,所述步骤7的边缘连接过程中需要注意的边界连接要保持的一个原则是选择最近且尽可能形成直线或光滑曲线的走势,同时还要避免形成互相连接的两条曲线,对于波浪曲线有且只能存在唯一的一条曲线。As a further improvement of the present invention, one of the principles that need to be paid attention to in the edge connection process of step 7 is to select the nearest trend that forms a straight line or a smooth curve as much as possible, while also avoiding the formation of two interconnected lines. Curve, there is and can only be one and only one curve for the wave curve.
附图说明Description of drawings
图1是本发明的方法流程图;Fig. 1 is method flowchart of the present invention;
图2是在一维图像数据及对应导数结果的示意图;Fig. 2 is a schematic diagram of one-dimensional image data and corresponding derivative results;
图3是固定尺度高斯滤波配合Canny算法边缘提取结果的示意图;Figure 3 is a schematic diagram of the edge extraction results of the fixed-scale Gaussian filter combined with the Canny algorithm;
图4是图像区域拟合及脊线走势图;Fig. 4 is an image area fitting and ridge trend chart;
图5是阈值分割示意图;Fig. 5 is a schematic diagram of threshold segmentation;
图6(a)是中心点像素及八邻域表示示意图;Figure 6(a) is a schematic representation of the center point pixel and eight neighborhoods;
图6(b)是八邻域坐标表示示意图;Figure 6(b) is a schematic representation of the eight-neighborhood coordinates;
图7是当前点后续点为搜索方向及次序示意图;Fig. 7 is a schematic diagram of the search direction and order of the subsequent points of the current point;
图8是带有强噪声的图像亚像素边缘提取实例示意图;Fig. 8 is a schematic diagram of an example of image sub-pixel edge extraction with strong noise;
图9是图像变尺度模糊图像检测结果示意图;Fig. 9 is a schematic diagram of the detection result of the image variable-scale blurred image;
图10是本发明的方法和商业化软件得到的检测结果对比示意图。Fig. 10 is a schematic diagram of comparison of detection results obtained by the method of the present invention and commercial software.
具体实施方案specific implementation plan
下面通过具体实施方式结合附图对本发明作进一步详细说明。The present invention will be further described in detail below through specific embodiments in conjunction with the accompanying drawings.
边缘检测是图像处理中被广泛使用的算法,机器视觉技术中非常多算子都需要基于良好的边缘提取结果,如几何模板匹配、直线检测、圆检测、字符识别、缺陷检测、尺寸测量等。本发明提供了一种能稳定检测强噪声图像或模糊尺度变化强烈图像边缘的方法,该方法能给出亚像素精度的边缘位置、边缘点的连接关系、边缘点的长度信息。边缘检测效率极为高效,非常适于在机器视觉实时系统中应用。本发明能为机器视觉中的定位、测量技术提供重要基础。Edge detection is a widely used algorithm in image processing. Many operators in machine vision technology need to be based on good edge extraction results, such as geometric template matching, line detection, circle detection, character recognition, defect detection, size measurement, etc. The invention provides a method capable of stably detecting edges of strong noise images or images with strong fuzzy scale changes, and the method can provide subpixel-accurate edge positions, connection relations of edge points, and length information of edge points. The edge detection efficiency is extremely efficient, which is very suitable for application in machine vision real-time systems. The invention can provide an important basis for the positioning and measurement technology in machine vision.
本发明的方法流程图如附图1所示,包括以下步骤:步骤1:图像预处理,对图像平滑滤波;步骤2:尺度状态一阶离散核卷积图像;步骤3:自适应高低阈值计算;步骤4:近似梯度方向计算并局部极大中心值选择;步骤5:像素边界点判定选择;步骤6:计算亚像素精度的边缘位置;步骤7:相同属性边界点次序连接。The flow chart of the method of the present invention is shown in Figure 1, including the following steps: Step 1: Image preprocessing, smoothing and filtering the image; Step 2: Scale state first-order discrete kernel convolution image; Step 3: Adaptive high and low threshold calculation ; Step 4: Calculation of approximate gradient direction and selection of local maximum center value; Step 5: Judgment and selection of pixel boundary points; Step 6: Calculation of edge positions with sub-pixel accuracy; Step 7: Sequential connection of boundary points with the same attribute.
下面对各步骤进行具体说明。Each step is described in detail below.
1.图像预处理1. Image preprocessing
在查找边缘点之前,需建立一个满足特定条件的边缘模型。绝大多数边缘检测算法,如Marr、Hildreth、Poggio、Canny等,定义的边缘位置在图像灰度突变的位置,即一阶导数幅值数据高于一定阈值的位置或是二阶导数等于零同时不是平坦拐点(flat inflection point),满足条件g′(x,y)gm(x,y)<0。附图2中g(s)为一维灰度分布,图中g′(s)为一维灰度分布的一阶导数曲线,g″(s)为一维灰度分布的二阶导数曲线。一阶、二阶导数都能表示图像边缘特征,但一阶导数具有计算速度快、抗噪能力强的优点,本发明中采用一阶导数作为判断边缘的依据。Before finding edge points, it is necessary to establish an edge model that satisfies certain conditions. Most edge detection algorithms, such as Marr, Hildreth, Poggio, Canny, etc., define the edge position at the position where the gray level of the image changes suddenly, that is, the position where the first-order derivative amplitude data is higher than a certain threshold or the second-order derivative is equal to zero and not A flat inflection point satisfies the condition g′(x,y)g m (x,y)<0. In accompanying drawing 2, g(s) is a one-dimensional grayscale distribution, in the figure g′(s) is the first-order derivative curve of one-dimensional grayscale distribution, and g″(s) is the second-order derivative curve of one-dimensional grayscale distribution Both the first-order and second-order derivatives can represent image edge features, but the first-order derivative has the advantages of fast calculation speed and strong anti-noise ability, and the first-order derivative is used as the basis for judging the edge in the present invention.
附图2显示的曲线g(s)表示原始数据,由该图可以假定阶跃边缘模型为ku(x)+h,其中k为未知的梯度幅值,h表示背景图像的灰度数值,u(x)是灰度分布曲线方程。在边缘提取中使用预处理的目的是将所有可能的边缘位置都处理后接近附图2的边缘模型g(s),也是方法流程中步骤①的处理要求。图像预处理通过高斯滤波完成,而处理的对象包括:不确定类型噪声干扰图像、不同原因及程度的模糊图像、非阶跃边缘模型。二维图像的高斯模糊核定义如下:The curve g(s) shown in Figure 2 represents the original data. From this figure, it can be assumed that the step edge model is ku(x)+h, where k is the unknown gradient magnitude, h represents the gray value of the background image, and u (x) is the gray distribution curve equation. The purpose of using preprocessing in edge extraction is to process all possible edge positions close to the edge model g(s) in Fig. 2, which is also the processing requirement of step ① in the method flow. Image preprocessing is completed through Gaussian filtering, and the processed objects include: uncertain types of noise interference images, blurred images of different reasons and degrees, and non-step edge models. The Gaussian blur kernel for a 2D image is defined as follows:
其中的未知可变尺度信息是曲线方差σ参数。为适应于不同类型的图像,保证可以解决附图3中遇到的问题,可变尺度图像模糊平滑滤波被用来做图像的预处理手段。需要解决的即是在满足部分区域边缘点性能时,另外部分边缘点被检测出非单像素宽边界点。The unknown variable scale information is the curve variance σ parameter. In order to adapt to different types of images and ensure that the problems encountered in Fig. 3 can be solved, the variable-scale image blur smoothing filter is used as an image preprocessing means. What needs to be solved is that when the performance of edge points in some areas is satisfied, other edge points are detected as non-single-pixel wide boundary points.
2.一阶尺度高斯核求导图像边缘梯度2. First-order scale Gaussian kernel derivation image edge gradient
在图像预处理操作后,根据边缘点存在于图像灰度值突变处的定义,同时边缘线也是在图像一阶导数的脊线(ridge)处,如附图4所示。脊线是梯度图像内相邻连续的局部极大值的集合,同时也是边缘曲线的所在。After the image preprocessing operation, according to the definition that the edge point exists at the sudden change of the gray value of the image, the edge line is also at the ridge line (ridge) of the first derivative of the image, as shown in Figure 4. The ridge is a collection of adjacent continuous local maxima in the gradient image, and it is also the location of the edge curve.
图像在生成时,由于各种原因会造成边界模糊(如镜头透镜对光的不同折射、非平行光线于边界处形成阴影、边缘自身过渡模糊等)或是引入噪声信号(如高斯噪声),本发明能克服上述问题获得单像素宽边缘点。设定图像I(x,y)被执行边缘提取操作后得到边界点错误率为αI,图像大小为n=w×h,则单点检测错误的概率为αp=1-(1-αI)1/ n;其中αI范围在0到1.0间。在计算图像一阶导数时,首先确保得到的梯度幅值满足该点错误率小于设定值αp。图像一阶导数通过目标核卷积图像空间得到,利用卷积的分步特性,有如下等式:When the image is generated, the boundary may be blurred due to various reasons (such as different refraction of light by the lens lens, shadows formed by non-parallel rays at the boundary, blurring of the edge itself, etc.) or the introduction of noise signals (such as Gaussian noise). The invention can overcome the above-mentioned problems and obtain single-pixel wide edge points. Assuming that the image I(x, y) is subjected to the edge extraction operation, the boundary point error rate is α I , and the image size is n=w×h, then the single point detection error probability is α p =1-(1-α I ) 1/ n ; where α I ranges from 0 to 1.0. When calculating the first derivative of the image, firstly ensure that the obtained gradient amplitude satisfies that the error rate at this point is less than the set value α p . The first derivative of the image is obtained by convolving the image space with the target kernel, and using the step-by-step nature of convolution, the following equation is obtained:
各点的梯度幅值为 The magnitude of the gradient at each point is
设图像I(x,y)只有高斯噪声且噪声信号方差为sn,函数U表示高斯函数的正区间半函数,其偏导数表达式为:Assuming that the image I(x, y) has only Gaussian noise and the variance of the noise signal is s n , the function U represents the positive interval semifunction of the Gaussian function, and its partial derivative expression is:
其中图像信号方差和滤波信号方差的关系为s=||G′(x,y,σ)||2sn,函数f是微分同胚映射(diffeomorphism),且有V=f(U),则函数V的偏导数为:The relationship between image signal variance and filter signal variance is s=||G′(x,y,σ)|| 2 s n , function f is diffeomorphism, and V=f(U), Then the partial derivative of the function V is:
构造函数f(u)=u2,联合(2)式和(3)式,得到如下式子:The constructor f(u)=u 2 , combined with formula (2) and formula (3), obtains the following formula:
结合式(1)中各轴的梯度,并代入函数(4),有如下表达式:Combining the gradient of each axis in formula (1) and substituting it into function (4), the following expression is obtained:
求解(5)式,得到v∈[0,∞)。保证各点的边缘位置发生错误的概率不超过αp,对概率密度函数(5)式做积分处理得到概率值。设定关键参数变量为c,有如下表达式:Solving formula (5), we get v ∈ [0, ∞). To ensure that the error probability of the edge position of each point does not exceed α p , the probability value is obtained by integrating the probability density function (5). Set the key parameter variable as c, which has the following expression:
高斯函数一阶导数的L2距离为:结合上述相关表达式,参数c的表达式为: The L2 distance of the first derivative of the Gaussian function is: Combining the above related expressions, the expression of the parameter c is:
其中式(7)的变量为σ,即是尺度变量,其它变量是全局设定参数。由(5)(6)两式可得,变尺度算法关键在于使得各点梯度幅值的错误率低于设定值αp,即满足等式:M(x,y,σ)≥c(σ)。The variable in formula (7) is σ, which is a scale variable, and other variables are global setting parameters. From (5) (6), it can be obtained that the key of the variable scaling algorithm is to make the error rate of the gradient amplitude of each point lower than the set value α p , that is, to satisfy the equation: M(x,y,σ)≥c( σ).
3.自适应高低阈值计算3. Adaptive high and low threshold calculation
本发明在边缘候选点筛选过程中应用到链式阈值的边缘提取及选择原理,实现像素级边界位置提取,即流程中步骤③。本发明采用两种方式设定高低阈值:外部参数输入及自适应阈值计算。图像梯度信息合成的直方图曲线存在一个明显的峰值点,并在峰值点之后直方图的数值急剧减少直至降到零值。The present invention applies the chain threshold edge extraction and selection principle in the edge candidate point selection process to realize pixel-level boundary position extraction, that is, step ③ in the process. The present invention adopts two ways to set high and low thresholds: external parameter input and adaptive threshold calculation. There is an obvious peak point in the histogram curve of image gradient information synthesis, and after the peak point, the value of the histogram decreases sharply until it drops to zero.
本发明公开了一种简单快速的查找高低阈值方法。首先找到直方图曲线的峰值点(i,Hi),另外是最后一个直方图中非零累积值坐标点为(j,Hj)(0≤i<j≤255)且0≤Hj<Hi<1.0),将上述两点连接起来,得到一条直线ax+by+c=0。在i到j间查找直方图曲线坐标点到直线的最大距离位置,即满足dmax=arg maxk|ak+bHk+c|。该点坐标(k,Hk)的横坐标即为第一个阈值Tlow=k。接着从该点出发,至直线末端点(j,Hj)再连接成一条直线αx+βy+λ=0,在直方图曲线的区间k到j上,查找曲线到直线(α,β,λ)的最大距离位置,同样满足Dmax=arg maxt|αt+βHt+λ|。该点坐标(t,Ht)的横坐标标记为第二个阈值Thigh=t。计算方式的简易表现如附图5所示。The invention discloses a simple and fast method for finding high and low thresholds. First find the peak point (i, H i ) of the histogram curve, and the coordinate point of the non-zero cumulative value in the last histogram is (j, H j ) (0≤i<j≤255) and 0≤H j < H i <1.0), connect the above two points to get a straight line ax+by+c=0. Find the maximum distance between the histogram curve coordinate point and the straight line between i and j, that is, satisfy d max =arg max k |ak+bH k +c|. The abscissa of the point coordinates (k, H k ) is the first threshold T low =k. Then start from this point to the end point of the straight line (j, H j ) and then connect to a straight line αx+βy+λ=0, on the interval k to j of the histogram curve, find the curve to the straight line (α, β, λ ), also satisfy D max =arg max t |αt+βH t +λ|. The abscissa of the point coordinate (t, H t ) is marked as the second threshold T high =t. A simple representation of the calculation method is shown in Figure 5.
4.近似梯度方向计算及局部极大中心值选择4. Calculation of approximate gradient direction and selection of local maximum central value
在得到梯度图像后,为方便并快速找到脊线的单像素宽位置,结合像素点的梯度方向信息对梯度图像执行局部极大中心值选择操作,即为流程图步骤④。任意像素位置的梯度方向为θ=tan-1(fy/fx),相切与脊线的走势方向。以任意像素位置为原点,建立一个相对坐标,取该点周围八邻域像素为局部极大中心值选择数据样本,根据梯度方向得到邻域的比较结果,确定当前像素位置是否为边界点候选位置。After obtaining the gradient image, in order to conveniently and quickly find the single-pixel width position of the ridge line, the local maximum center value selection operation is performed on the gradient image in combination with the gradient direction information of the pixel point, which is step ④ of the flowchart. The gradient direction of any pixel position is θ=tan -1 (f y /f x ), tangent to the trend direction of the ridge. Take any pixel position as the origin, establish a relative coordinate, take the eight neighboring pixels around the point as the local maximum center value to select the data sample, obtain the comparison result of the neighborhood according to the gradient direction, and determine whether the current pixel position is a candidate position of the boundary point .
在边缘提取过程中,非极大值抑制是快速选取局部极大值的有效手段。首先是将梯度方向(0°~180°)以22.5°为步长,分割成若干区域,如图6(a)所示。其中A及A′两者角度互补视为同一组。本发明提供了一种快速梯度方向估计算法,简洁方便的判断出当前点梯度方向在八邻域方向中的朝向。若当前点p0的梯度方向θ为其中变量即为各自梯度导数数值,且角度范围设定在0°到90°间,即只考虑参数为正值的状态。当θ小于22.5°时,ny<nx tan(22.5°),梯度方向坐落在图6(a)的A范围,则p0的八邻域方向为图6(b)中的GR;当θ大于67.5°时,ny>nx tan(67.5°),梯度方向坐落在图6(a)的C范围,则p0的八邻域方向为图6(b)中的GT;当θ范围在22.5°与67.5°间时,ny≥nxtan(22.5°)且ny≤nx tan(67.5°),梯度方向坐落在图6(a)的D范围,则p0的八邻域方向为图6(b)中的GTR。若p0点的梯度方向G0落在图6(a)的A范围内,则将八邻域方向中的GR与GL两个互补方向分别标记为G+和G-。局部极大值的判断标准为:G0>G+且G0≥G-或者是G0≥G+且G0>G-,即当前点p0是一个局部梯度幅值最大值位置。在比较判断中,若两个比较符号都为“>”号,则在相等梯度幅值处,会出现没有极值的情况;若都为“≥”号时,则所有幅值相等的位置都会被确认为极值。In the process of edge extraction, non-maximum suppression is an effective means to quickly select local maxima. First, the gradient direction (0°-180°) is divided into several regions with a step size of 22.5°, as shown in Figure 6(a). Among them, A and A' are regarded as the same group when the two angles are complementary. The invention provides a fast gradient direction estimation algorithm, which can simply and conveniently determine the orientation of the gradient direction of the current point in the eight neighborhood directions. If the gradient direction θ of the current point p 0 is The variables are the respective gradient derivative values, and the angle range is set between 0° and 90°, that is, only the states where the parameters are positive values are considered. When θ is less than 22.5°, n y <n x tan(22.5°), the gradient direction is located in the A range of Figure 6(a), then the eight-neighborhood direction of p 0 is G R in Figure 6(b); When θ is greater than 67.5°, n y >n x tan(67.5°), and the gradient direction is located in the C range of Figure 6(a), then the eight-neighborhood direction of p 0 is GT in Figure 6(b); When the range of θ is between 22.5° and 67.5°, n y ≥n x tan(22.5°) and n y ≤n x tan(67.5°), the gradient direction is located in the D range of Figure 6(a), then p 0 The eight-neighborhood direction of is G TR in Fig. 6(b). If the gradient direction G 0 of point p 0 falls within the range of A in Figure 6(a), then the two complementary directions of G R and GL in the eight neighborhood directions are marked as G + and G - respectively. The criteria for judging the local maximum value are: G 0 >G + and G 0 ≥G - or G 0 ≥G + and G 0 >G - , that is, the current point p 0 is a maximum value of the local gradient amplitude. In the comparison judgment, if the two comparison symbols are both ">", then there will be no extreme value at the equal gradient amplitude; if both are "≥", then all positions with equal amplitude will be recognized as an extreme value.
5.像素边界点判定选择5. Pixel boundary point judgment selection
局部梯度幅值的极值是否为边缘点,需要结合特定阈值来判断,大于某给定阈值的标记为边缘点,小于某给定阈值判定为噪声点或背景点,即流程图步骤⑤。Canny的双阈值设定(Tlow,Thigh)在本发明中被采用。当局部极值G0高于Thigh时,点p0是边缘点;G0低于阈值Tlow表示当前点为非边界点属性;当G0介于高低阈值之间时,链式效应发生作用,即p0点的八邻域中存在边界点,则当前位置确认为边界点。Whether the extremum of the local gradient amplitude is an edge point needs to be judged in conjunction with a specific threshold. Marks greater than a given threshold are marked as edge points, and those smaller than a given threshold are judged as noise points or background points, that is, step ⑤ of the flowchart. Canny's dual threshold setting (T low , T high ) is adopted in the present invention. When the local extremum G 0 is higher than T high , the point p 0 is an edge point; G 0 is lower than the threshold T low , indicating that the current point is a non-boundary point attribute; when G 0 is between the high and low thresholds, a chain effect occurs Function, that is, there are boundary points in the eight neighborhoods of point p 0 , then the current position is confirmed as the boundary point.
6.计算亚像素精度的边缘位置6. Calculate the edge position with sub-pixel accuracy
一般应用中,像素级的边界点位置精度能满足需求,但是在某些应用中需要更高的边缘精度位置,即亚像素边缘位置,流程图的步骤⑥。采用基于Steger曲面拟合方法的Hessian矩阵法求取边缘点的亚像素位置,在像素级边缘点的小区域内执行曲面拟合的内插值算法f(r,c)=k0+k1r+k2c+k3r2+k4rc+k5c2;对曲面方程的各未知数求取一阶及二阶导数,组合成Hessian矩阵;求解Hessian矩阵的特征值及各自的特征向量,其中最大绝对特征值所对应的特征向量即为边缘点的法线方向(nx,ny);利用法线方向及曲面方程的泰勒展开,计算边缘点的亚像素位置。曲面方程系数的矩阵表达式如下。In general applications, the pixel-level boundary point position accuracy can meet the requirements, but in some applications, higher edge precision positions are required, that is, sub-pixel edge positions, step ⑥ of the flowchart. Use the Hessian matrix method based on the Steger surface fitting method to obtain the sub-pixel position of the edge point, and perform the surface fitting interpolation algorithm f(r, c)=k 0 +k 1 r+ in the small area of the pixel-level edge point k 2 c+k 3 r 2 +k 4 rc+k 5 c 2 ; Calculate the first-order and second-order derivatives of the unknowns of the surface equation, and combine them into a Hessian matrix; solve the eigenvalues and their respective eigenvectors of the Hessian matrix, The eigenvector corresponding to the largest absolute eigenvalue is the normal direction (n x , ny ) of the edge point; the sub-pixel position of the edge point is calculated by using the normal direction and the Taylor expansion of the surface equation. The matrix expression of the surface equation coefficients is as follows.
7.相同属性边界点顺序连接7. Sequential connection of boundary points with the same attribute
直至目前为止,检测到的边缘信息是离散、无序、孤立点,但是很多后期应用需要的是有连续性的边界点集合(曲线),流程图步骤⑦。将边缘点连接成曲线,构成一组有向连续点的集合。边缘连接过程中需要注意的是边界连接要保持的一个原则是选择最近且尽可能形成直线或光滑曲线的走势。同时还要避免形成互相连接的两条曲线,对于波浪曲线有且只能存在唯一的一条曲线。So far, the detected edge information is discrete, disordered, and isolated points, but many later applications need a continuous set of boundary points (curves), flowchart step ⑦. Connect the edge points into a curve to form a set of directed continuous points. What needs to be noted in the process of edge connection is that one of the principles to be maintained in boundary connection is to choose the closest trend that forms a straight line or a smooth curve as much as possible. At the same time, it is also necessary to avoid forming two interconnected curves. There is only one and only one curve for the wavy curve.
边缘连接的可用条件为图像空间的边缘点位置及该点八邻域边界点存在与否。曲线起始点从左上角开始搜索,检测到首个边缘点即定义为开始位置。该点搜索方向的次序为优先查找正方向(即如附图7的GR,GB,GL,GT)上是否有满足条件的边界点,否则查找偏方向(附图7中的其它方向)。同类方向(正方向,偏方向)中,候选点的挑选的按照逆时针的次序。设P0是当前点,{Pi}i=R,B,T,BR,RT是候选点,各点的亚像素坐标及梯度方向为已知条件。给定一个评价函数选择分值最小的邻域点视为下一个相邻点。循环更改并替换当前点,直至遇到非边缘点或是其它边缘曲线上的边缘点才结束当前曲线的搜索。当前方向搜索完成后,再从曲线起点开始反方向查找,直至终点。The available conditions of edge connection are the edge point position in the image space and the presence or absence of the eight-neighborhood boundary point of the point. The starting point of the curve is searched from the upper left corner, and the first detected edge point is defined as the starting position. The order of the search direction of this point is to first search whether there is a boundary point satisfying the condition on the positive direction (ie, G R , G B , GL , G T as shown in the accompanying drawing 7), otherwise look for the bias direction (the other in the accompanying drawing 7) direction). In the same direction (forward direction, partial direction), the candidate points are selected in counterclockwise order. Let P 0 be the current point, {P i } i=R, B, T, BR, RT are candidate points, and the sub-pixel coordinates of each point and gradient direction is a known condition. Given an evaluation function Select the neighbor point with the smallest score as the next neighbor point. Change and replace the current point cyclically until it encounters a non-edge point or an edge point on another edge curve before ending the search of the current curve. After the search in the current direction is completed, search in the reverse direction from the starting point of the curve until the end point.
为了验证本发明公开方法的有效性,分布采用强噪声(参见附图8左侧部分)和模糊图像(参见附图9左侧部分)进行边缘提取测试,附图8和附图9的中间部分为传统的边缘检测的结果,右侧部分为本发明检测结果,可以看出本发明公开的方法能够在强噪声和模糊图像中稳定地检测边缘特征。附图10为本发明的方法得到的边缘检测结果与德国商业化机器视觉软件得到的边缘检测结果的对比效果,图中“+”为本发明检测的边缘结果,“ο”为国外商业软件检测结果,从图中可以看出本发明中的方法能够多地检测出图像的边缘信息。In order to verify the effectiveness of the disclosed method of the present invention, the distribution adopts strong noise (see the left part of accompanying drawing 8) and fuzzy image (seeing the left part of accompanying drawing 9) to carry out the edge extraction test, the middle part of accompanying drawing 8 and accompanying drawing 9 It is the result of traditional edge detection, and the right part is the detection result of the present invention. It can be seen that the method disclosed in the present invention can stably detect edge features in strong noise and blurred images. Accompanying drawing 10 is the contrast effect that the edge detection result that method of the present invention obtains and the edge detection result that German commercialization machine vision software obtains, among the figure "+" is the edge result that the present invention detects, and "o" is foreign commercial software detection As a result, it can be seen from the figure that the method of the present invention can detect more edge information of the image.
本发明提出了一种在恶劣环境中稳定地提取图像亚像素边缘特征的方法,采用自适应高低阈值计算方法,在得到梯度图像后,为方便并快速找到脊线的单像素宽位置,结合像素点的梯度方向信息对梯度图像执行局部极大中心值选择操作,以任意像素位置为原点,建立相对坐标,取该点周围八邻域像素为局部极大中心值选择数据样本,根据梯度方向得到邻域的比较结果,确定当前像素位置是否为边界点候选位置。局部梯度幅值的极值是否为边缘点,需要结合特定阈值来判断,大于某给定阈值的标记为边缘点,小于某给定阈值判定为噪声点或背景点。采用基于Steger曲面拟合方法的Hessian矩阵法求取边缘点的亚像素位置。最后将将边缘点连接成曲线,构成一组有向连续点的集合。实现了在强噪声和模糊图像中提取亚像素精度的有序边缘特征信息。本发明方法具有极好的实时性,能够应用到机器视觉系统的实时应用中。The present invention proposes a method for stably extracting image sub-pixel edge features in a harsh environment, using an adaptive high and low threshold calculation method, after obtaining the gradient image, in order to find the single-pixel wide position of the ridge conveniently and quickly, combined with the pixel The gradient direction information of the point performs the selection operation of the local maximum central value on the gradient image, takes any pixel position as the origin, establishes the relative coordinates, takes the eight neighboring pixels around the point as the local maximum central value to select the data sample, and obtains according to the gradient direction The comparison result of the neighborhood determines whether the current pixel position is a candidate position of the boundary point. Whether the extremum of the local gradient amplitude is an edge point needs to be judged in conjunction with a specific threshold. Marks greater than a given threshold are edge points, and smaller than a given threshold are judged as noise points or background points. Using the Hessian matrix method based on the Steger surface fitting method to obtain the sub-pixel position of the edge point. Finally, the edge points will be connected into a curve to form a set of directed continuous points. It realizes the extraction of ordered edge feature information with sub-pixel accuracy in strong noise and blurred images. The method of the invention has excellent real-time performance and can be applied to the real-time application of machine vision systems.
以上内容是结合具体的优选实施方式对本发明所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above content is a further detailed description of the present invention in conjunction with specific preferred embodiments, and it cannot be assumed that the specific implementation of the present invention is limited to these descriptions. For those of ordinary skill in the technical field of the present invention, without departing from the concept of the present invention, some simple deduction or replacement can be made, which should be regarded as belonging to the protection scope of the present invention.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610209158.9A CN105913415B (en) | 2016-04-06 | 2016-04-06 | A kind of image sub-pixel edge extracting method with extensive adaptability |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610209158.9A CN105913415B (en) | 2016-04-06 | 2016-04-06 | A kind of image sub-pixel edge extracting method with extensive adaptability |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105913415A true CN105913415A (en) | 2016-08-31 |
CN105913415B CN105913415B (en) | 2018-11-30 |
Family
ID=56744630
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610209158.9A Active CN105913415B (en) | 2016-04-06 | 2016-04-06 | A kind of image sub-pixel edge extracting method with extensive adaptability |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105913415B (en) |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107507208A (en) * | 2017-07-12 | 2017-12-22 | 天津大学 | A kind of characteristics of image point extracting method based on Curvature Estimation on profile |
CN107967690A (en) * | 2016-10-19 | 2018-04-27 | 中国石油天然气股份有限公司 | Self-adaptive ferrographic abrasive particle image binarization processing method |
CN108389215A (en) * | 2018-03-15 | 2018-08-10 | 京东方科技集团股份有限公司 | A kind of edge detection method, device, computer storage media and terminal |
CN109102516A (en) * | 2017-06-20 | 2018-12-28 | 成都飞机工业(集团)有限责任公司 | A kind of bend pipe center line extraction method of robust |
CN109325930A (en) * | 2018-09-12 | 2019-02-12 | 苏州优纳科技有限公司 | Detection method, device and the detection device of boundary defect |
CN109741356A (en) * | 2019-01-10 | 2019-05-10 | 哈尔滨工业大学(深圳) | Subpixel edge detection method and system |
CN109863536A (en) * | 2017-03-24 | 2019-06-07 | 株式会社斯库林集团 | Image processing method and image processing apparatus |
CN110147716A (en) * | 2019-04-02 | 2019-08-20 | 北京理工雷科电子信息技术有限公司 | Wave method for detecting area in a kind of SAR image combined based on frequency domain with airspace |
CN111539907A (en) * | 2019-07-25 | 2020-08-14 | 长城汽车股份有限公司 | Image processing method and device for target detection |
CN111640154A (en) * | 2020-05-24 | 2020-09-08 | 西安交通大学 | Vertical needle micro-plane sub-pixel level positioning method based on micro-vision |
CN111685788A (en) * | 2020-06-09 | 2020-09-22 | 广东明峰医疗科技有限公司 | Method for improving signal-to-noise ratio of PET |
CN112792450A (en) * | 2021-02-01 | 2021-05-14 | 深圳大学 | Optical fiber automatic focusing method and automatic focusing system for laser processing |
CN112816120A (en) * | 2021-01-08 | 2021-05-18 | 中铁大桥科学研究院有限公司 | Cable force measuring method |
CN113643272A (en) * | 2021-08-24 | 2021-11-12 | 凌云光技术股份有限公司 | Target positioning modeling method |
CN113658153A (en) * | 2021-08-24 | 2021-11-16 | 凌云光技术股份有限公司 | Contour data feature point detection method and device |
CN114187267A (en) * | 2021-12-13 | 2022-03-15 | 沭阳县苏鑫冲压件有限公司 | Stamping part defect detection method based on machine vision |
CN114677303A (en) * | 2022-03-28 | 2022-06-28 | 中国人民解放军国防科技大学 | A sub-pixel edge detection method based on integrated edge data enhancement |
CN116385448A (en) * | 2023-06-07 | 2023-07-04 | 深圳市华伟精密陶瓷有限公司 | Alumina ceramic surface machining defect detection method based on machine vision |
CN117078678A (en) * | 2023-10-16 | 2023-11-17 | 厘壮信息科技(苏州)有限公司 | Waste silicon wafer shape detection method based on image recognition |
CN117455800A (en) * | 2023-12-22 | 2024-01-26 | 肥城新查庄地质勘查有限公司 | Coal mine drilling positioning method based on computer vision |
CN119151926A (en) * | 2024-11-18 | 2024-12-17 | 山东银广印务科技有限公司 | Real-time monitoring method for packaging printing quality |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6408109B1 (en) * | 1996-10-07 | 2002-06-18 | Cognex Corporation | Apparatus and method for detecting and sub-pixel location of edges in a digital image |
US7430303B2 (en) * | 2002-03-29 | 2008-09-30 | Lockheed Martin Corporation | Target detection method and system |
US20090046930A1 (en) * | 2007-08-14 | 2009-02-19 | Electronics And Telecommunications Research Institute | Method and apparatus for extracting line segments from image using incremental pixel extension |
CN104268857A (en) * | 2014-09-16 | 2015-01-07 | 湖南大学 | Rapid sub pixel edge detection and locating method based on machine vision |
CN104680506A (en) * | 2013-11-28 | 2015-06-03 | 方正国际软件(北京)有限公司 | Method and system for detecting boundary line along different directions |
CN105354843A (en) * | 2015-10-30 | 2016-02-24 | 北京奇艺世纪科技有限公司 | Image boundary extraction method and system |
-
2016
- 2016-04-06 CN CN201610209158.9A patent/CN105913415B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6408109B1 (en) * | 1996-10-07 | 2002-06-18 | Cognex Corporation | Apparatus and method for detecting and sub-pixel location of edges in a digital image |
US7430303B2 (en) * | 2002-03-29 | 2008-09-30 | Lockheed Martin Corporation | Target detection method and system |
US20090046930A1 (en) * | 2007-08-14 | 2009-02-19 | Electronics And Telecommunications Research Institute | Method and apparatus for extracting line segments from image using incremental pixel extension |
CN104680506A (en) * | 2013-11-28 | 2015-06-03 | 方正国际软件(北京)有限公司 | Method and system for detecting boundary line along different directions |
CN104268857A (en) * | 2014-09-16 | 2015-01-07 | 湖南大学 | Rapid sub pixel edge detection and locating method based on machine vision |
CN105354843A (en) * | 2015-10-30 | 2016-02-24 | 北京奇艺世纪科技有限公司 | Image boundary extraction method and system |
Non-Patent Citations (1)
Title |
---|
孙根云 等: "图像的模糊边缘检测算法", 《光电工程》 * |
Cited By (34)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107967690A (en) * | 2016-10-19 | 2018-04-27 | 中国石油天然气股份有限公司 | Self-adaptive ferrographic abrasive particle image binarization processing method |
CN107967690B (en) * | 2016-10-19 | 2020-06-09 | 中国石油天然气股份有限公司 | Self-adaptive ferrographic abrasive particle image binarization processing method |
CN109863536A (en) * | 2017-03-24 | 2019-06-07 | 株式会社斯库林集团 | Image processing method and image processing apparatus |
CN109102516A (en) * | 2017-06-20 | 2018-12-28 | 成都飞机工业(集团)有限责任公司 | A kind of bend pipe center line extraction method of robust |
CN107507208A (en) * | 2017-07-12 | 2017-12-22 | 天津大学 | A kind of characteristics of image point extracting method based on Curvature Estimation on profile |
CN108389215B (en) * | 2018-03-15 | 2021-04-23 | 京东方科技集团股份有限公司 | Edge detection method and device, computer storage medium and terminal |
CN108389215A (en) * | 2018-03-15 | 2018-08-10 | 京东方科技集团股份有限公司 | A kind of edge detection method, device, computer storage media and terminal |
CN109325930A (en) * | 2018-09-12 | 2019-02-12 | 苏州优纳科技有限公司 | Detection method, device and the detection device of boundary defect |
CN109741356A (en) * | 2019-01-10 | 2019-05-10 | 哈尔滨工业大学(深圳) | Subpixel edge detection method and system |
CN110147716A (en) * | 2019-04-02 | 2019-08-20 | 北京理工雷科电子信息技术有限公司 | Wave method for detecting area in a kind of SAR image combined based on frequency domain with airspace |
CN110147716B (en) * | 2019-04-02 | 2021-02-19 | 北京理工雷科电子信息技术有限公司 | SAR image internal wave region detection method based on combination of frequency domain and airspace |
CN111539907A (en) * | 2019-07-25 | 2020-08-14 | 长城汽车股份有限公司 | Image processing method and device for target detection |
CN111539907B (en) * | 2019-07-25 | 2023-09-12 | 毫末智行科技有限公司 | Image processing method and device for target detection |
CN111640154A (en) * | 2020-05-24 | 2020-09-08 | 西安交通大学 | Vertical needle micro-plane sub-pixel level positioning method based on micro-vision |
CN111640154B (en) * | 2020-05-24 | 2022-04-05 | 西安交通大学 | A sub-pixel-level positioning method of vertical needle microplane based on microscopic vision |
CN111685788A (en) * | 2020-06-09 | 2020-09-22 | 广东明峰医疗科技有限公司 | Method for improving signal-to-noise ratio of PET |
CN111685788B (en) * | 2020-06-09 | 2022-07-29 | 广东明峰医疗科技有限公司 | Method for improving signal-to-noise ratio of PET |
CN112816120A (en) * | 2021-01-08 | 2021-05-18 | 中铁大桥科学研究院有限公司 | Cable force measuring method |
CN112792450A (en) * | 2021-02-01 | 2021-05-14 | 深圳大学 | Optical fiber automatic focusing method and automatic focusing system for laser processing |
CN112792450B (en) * | 2021-02-01 | 2021-12-07 | 深圳大学 | Optical fiber automatic focusing method and automatic focusing system for laser processing |
CN113643272A (en) * | 2021-08-24 | 2021-11-12 | 凌云光技术股份有限公司 | Target positioning modeling method |
CN113658153A (en) * | 2021-08-24 | 2021-11-16 | 凌云光技术股份有限公司 | Contour data feature point detection method and device |
CN113658153B (en) * | 2021-08-24 | 2024-01-26 | 凌云光技术股份有限公司 | Contour data feature point detection method and device |
CN114187267A (en) * | 2021-12-13 | 2022-03-15 | 沭阳县苏鑫冲压件有限公司 | Stamping part defect detection method based on machine vision |
CN114187267B (en) * | 2021-12-13 | 2023-07-21 | 沭阳县苏鑫冲压件有限公司 | Stamping part defect detection method based on machine vision |
CN114677303B (en) * | 2022-03-28 | 2024-02-02 | 中国人民解放军国防科技大学 | A sub-pixel edge detection method based on integrated edge data enhancement |
CN114677303A (en) * | 2022-03-28 | 2022-06-28 | 中国人民解放军国防科技大学 | A sub-pixel edge detection method based on integrated edge data enhancement |
CN116385448A (en) * | 2023-06-07 | 2023-07-04 | 深圳市华伟精密陶瓷有限公司 | Alumina ceramic surface machining defect detection method based on machine vision |
CN116385448B (en) * | 2023-06-07 | 2023-08-25 | 深圳市华伟精密陶瓷有限公司 | Alumina ceramic surface machining defect detection method based on machine vision |
CN117078678A (en) * | 2023-10-16 | 2023-11-17 | 厘壮信息科技(苏州)有限公司 | Waste silicon wafer shape detection method based on image recognition |
CN117078678B (en) * | 2023-10-16 | 2024-01-26 | 厘壮信息科技(苏州)有限公司 | Waste silicon wafer shape detection method based on image recognition |
CN117455800A (en) * | 2023-12-22 | 2024-01-26 | 肥城新查庄地质勘查有限公司 | Coal mine drilling positioning method based on computer vision |
CN117455800B (en) * | 2023-12-22 | 2024-03-15 | 肥城新查庄地质勘查有限公司 | Coal mine drilling positioning method based on computer vision |
CN119151926A (en) * | 2024-11-18 | 2024-12-17 | 山东银广印务科技有限公司 | Real-time monitoring method for packaging printing quality |
Also Published As
Publication number | Publication date |
---|---|
CN105913415B (en) | 2018-11-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105913415B (en) | A kind of image sub-pixel edge extracting method with extensive adaptability | |
US11620735B2 (en) | Method for restoring video data of pipe based on computer vision | |
Chen He et al. | Corner detector based on global and local curvature properties | |
CN104359403B (en) | Planar part dimension measurement method based on sub-pixel edge algorithm | |
CN109903313B (en) | A Real-time Pose Tracking Method Based on 3D Model of Target | |
CN110866924A (en) | A kind of linear structured light centerline extraction method and storage medium | |
CN107301661A (en) | High-resolution remote sensing image method for registering based on edge point feature | |
JP6899189B2 (en) | Systems and methods for efficiently scoring probes in images with a vision system | |
CN108122256A (en) | It is a kind of to approach under state the method for rotating object pose measurement | |
CN110021024A (en) | A kind of image partition method based on LBP and chain code technology | |
CN104112269A (en) | Solar cell laser-marking parameter detection method based on machine vision and system thereof | |
CN108345881A (en) | A kind of document quality detection method based on computer vision | |
CN115096206B (en) | High-precision part size measurement method based on machine vision | |
CN112734761B (en) | Industrial product image boundary contour extraction method | |
CN103955950B (en) | Image tracking method utilizing key point feature matching | |
CN110298344A (en) | A kind of positioning of instrument knob and detection method based on machine vision | |
CN111402330A (en) | Laser line key point extraction method based on plane target | |
CN112629409A (en) | Method for extracting line structure light stripe center | |
CN114331879A (en) | Visible light and infrared image registration method for equalized second-order gradient histogram descriptor | |
CN110427979A (en) | Road puddle recognition methods based on K-Means clustering algorithm | |
CN106340010A (en) | Corner detection method based on second-order contour difference | |
CN115731257A (en) | Image-based Leaf Shape Information Extraction Method | |
CN110222661A (en) | It is a kind of for motion estimate and the feature extracting method of tracking | |
CN113674218A (en) | Weld characteristic point extraction method and device, electronic equipment and storage medium | |
CN106529548A (en) | Sub-pixel level multi-scale Harris corner detection algorithm |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C41 | Transfer of patent application or patent right or utility model | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20160819 Address after: The 215200 West Jiangsu city of Suzhou province Wujiang economic and Technological Development Zone No. 666 Applicant after: BOZHONG (SUZHOU) PRECISION INDUSTRY TECHNOLOGY Co.,Ltd. Address before: 518000 building C, Innovation Research Institute, Nanshan District hi tech Zone, Guangdong, Shenzhen 1-6 Applicant before: Wu Xiaojun |
|
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 215200 No. 666 Hu Xin Road, Wujiang economic and Technological Development Zone, Suzhou, Jiangsu Applicant after: BOZHON PRECISION INDUSTRY TECHNOLOGY Co.,Ltd. Address before: 215200 No. 666 Hu Xin Road, Wujiang economic and Technological Development Zone, Suzhou, Jiangsu Applicant before: BOZHONG (SUZHOU) PRECISION INDUSTRY TECHNOLOGY Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20241231 Address after: 215000 NO.666, Huxin West Road, Wujiang Economic and Technological Development Zone, Wujiang District, Suzhou City, Jiangsu Province Patentee after: BOZHON PRECISION INDUSTRY TECHNOLOGY Co.,Ltd. Country or region after: China Patentee after: SUZHOU LINKHOU ROBOT CO.,LTD. Address before: 215200 No. 666 Hu Xin Road, Wujiang economic and Technological Development Zone, Suzhou, Jiangsu Patentee before: BOZHON PRECISION INDUSTRY TECHNOLOGY Co.,Ltd. Country or region before: China |