WO2020151455A1 - 一种无纹理金属零件图像规整化直线段边缘检测方法 - Google Patents

一种无纹理金属零件图像规整化直线段边缘检测方法 Download PDF

Info

Publication number
WO2020151455A1
WO2020151455A1 PCT/CN2019/128937 CN2019128937W WO2020151455A1 WO 2020151455 A1 WO2020151455 A1 WO 2020151455A1 CN 2019128937 W CN2019128937 W CN 2019128937W WO 2020151455 A1 WO2020151455 A1 WO 2020151455A1
Authority
WO
WIPO (PCT)
Prior art keywords
straight line
gradient
pixel
connected domain
vector
Prior art date
Application number
PCT/CN2019/128937
Other languages
English (en)
French (fr)
Inventor
赵昕玥
何再兴
江智伟
张树有
谭建荣
Original Assignee
赵昕玥
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 赵昕玥 filed Critical 赵昕玥
Publication of WO2020151455A1 publication Critical patent/WO2020151455A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling

Definitions

  • the invention relates to the technical field of computer vision and industrial automation, in particular to an edge detection method for straight line segment image regularization of non-textured metal parts.
  • edge line detection of non-textured metal parts has always been an important research direction in the field of computer vision. In many application scenarios, it is necessary to detect straight lines at the edges of parts, such as recognizing and grabbing metal parts.
  • the Hough transform line detection method has two problems: First, because the Hough transform line detection method needs to transform the points in the image space into the Hough space for calculation, the calculation amount is relatively large, and the calculation time will be relatively long. . Second, when mapping from the Hough space back to the image space, it can only return the straight line where the straight line segment is located, and cannot return the separated straight line segment independently. When some applications require straight line segments as input, they can only traverse all pixels in the image space again to determine whether the straight line is continuous, which further increases the amount of calculation.
  • Gioi et al. proposed a linear detection method (Line Segment Detector, LSD) based on a growth algorithm. This method can complete the detection of straight line segments in the image in linear time, and the speed is greatly improved compared with the Hough transform straight line detection method, and the output result is a straight line segment.
  • the detected straight line segment may be discontinuous due to shadows, partial blurring or other reasons (as shown in Figure 1).
  • the present invention provides an edge detection method for regular straight line segments of a non-textured metal part image. Based on the LSD algorithm, the relationship between the straight line segments is used to detect discontinuous straight line segments. Connect to achieve the purpose of detecting a complete straight section. In this way, it not only retains the characteristics of the fast speed of the LSD algorithm, but also avoids the problem of breakage of the detected straight line segment, and meets the needs of practical applications.
  • the technical scheme of the present invention includes the following steps:
  • Step 1 Input the part image to be tested, calculate the gradient amplitude and gradient direction of each pixel in the part image;
  • Step 2 Calculate the direction line angle of all pixels: the direction line angle of each pixel point is the angle that the positive half axis of the x-axis is rotated in the counterclockwise direction to coincide with the direction line; the positive half-axis of the x-axis is from Left-to-right row direction;
  • the level-line of the pixel in the step 2 is a straight line passing through the pixel and perpendicular to the gradient direction of the pixel.
  • Step 3 Obtain each connected domain in the part image through the following steps:
  • Step 3.1 Select the pixel with the largest gradient amplitude in the part image as the connected domain, and proceed to step 3.2 to start region growth;
  • Step 3.2 Determine whether the pixels adjacent to the connected domain need to be included in the connected domain: Perform the judgment processing on whether each pixel adjacent to the connected domain needs to be included in the connected domain, and determine whether it is adjacent to the connected domain and judge as The pixels that need to be included in the connected domain are added to the connected domain, and continue to expand outward. The adjacent pixels are judged and added to the connected domain until all the pixels adjacent to the current connected domain are judged not to be included in the connected domain. In the domain, output the currently obtained connected domain, and then remove the currently obtained connected domain from the part image, and then return to step 3.1 iterative processing to obtain each connected domain;
  • the method for determining whether each pixel adjacent to the connected domain needs to be included in the connected domain in the step 3.2 is specifically: if the direction line angle of the pixel adjacent to the connected domain and the direction line angle of the connected domain If the difference is less than the growth threshold ⁇ , it is determined that the pixels adjacent to the connected domain are included in the connected domain;
  • the method for determining whether each pixel adjacent to the connected domain needs to be included in the connected domain in the step 3.2 is specifically: if the direction line angle of the pixel adjacent to the connected domain and the direction line angle of the connected domain If the difference is less than the growth threshold ⁇ , it is determined that the pixel points adjacent to the connected domain are included in the connected domain; the growth threshold ⁇ is a set parameter value.
  • Step 4 Fit each connected domain through the rectangle to obtain the corresponding fitted rectangle, connect the midpoints of the two short sides of the fitted rectangle to obtain the straight line segment corresponding to the connected domain, and establish a corresponding straight line in each connected domain Segment, and delete the short straight line segments whose length is less than the length control threshold t d , and output the straight line segments corresponding to all connected domains;
  • the threshold t d is a parameter that has been set.
  • Step 5 Pair all straight line segments in step 4 to form a straight line segment pair, and filter all straight line segment pairs according to restriction conditions 1 and 2:
  • the two straight line segments in the straight line segment pair are set as straight line segment A'A and straight line segment respectively BB', A', A are the two end points of the straight line segment A'A, B and B'are the two end points of the straight line segment BB' respectively, and A and B are the two closest points; the connection meets the restriction at the same time
  • the restriction conditions 1 and 2 are:
  • t ⁇ is the angle threshold
  • t ⁇ 2arctan(t d /w), where w is the edge pixel width of the detected part in the input part image.
  • ⁇ max is the connection control parameter of the straight line segment A'A and BB'; ⁇ is the vector Angle with vector t, vector t is a vector With vector The average direction vector.
  • restriction 2 when the value of angle ⁇ is small, The length can be changed appropriately, and vice versa.
  • Step 6 Output the complete straight line segment edge processed by step 5.
  • the non-textured metal part is a polyhedral metal part with a flat and smooth surface, without unevenness and texture.
  • the method of calculating the gradient amplitude and gradient direction of each pixel in the part image in step 1 is specifically: if the part image is a grayscale image, use the gradient difference operator to calculate the gradient amplitude and gradient of each pixel in the part image Direction; if the part image is an RGB image, use the gradient tensor T formed by the combination of three-channel gradients to calculate the gradient amplitude and gradient direction of each pixel of the part image: the gradient amplitude of each pixel of the RGB image is the gradient tensor The square root of the maximum eigenvalue of T, and the gradient direction is the direction of the eigenvector corresponding to the maximum eigenvalue of the gradient tensor T;
  • the array of the gradient tensor T is as follows:
  • u is the composite gradient of the pixel in the row direction of the part image
  • v is the composite gradient of the pixel in the column direction of the part image
  • r, g, b are the unit vectors of the red, green, and blue channels respectively
  • g xx is the pixel in the row The square value of the upward composite gradient
  • g xy is the product value of the composite gradient of the pixel in the row direction and the column direction
  • g yy is the square value of the composite gradient of the pixel in the column direction
  • x, y, z represent the values of the pixels on the red, green, and blue channels respectively;
  • r represents the row direction;
  • c represents the column direction; Respectively represent the derivative of the pixel in the row direction on the red, green, and blue channels, Respectively represent the derivative of the pixel in the column direction on the red, green, and blue channels;
  • the gradient amplitude of the RGB image obtained from the gradient tensor T is:
  • the gradient direction of the RGB image obtained from the gradient tensor T is
  • level-line-angle region is the direction line angle of the connected region
  • level-line-angle j is the direction line angle of the j-th pixel in the connected region
  • j is the ordinal number of the pixel
  • connection control parameter ⁇ max in the step 5 is calculated in the following way:
  • ⁇ max is the connection control parameter of the straight line segment A'A and BB'; ⁇ is the vector Angle with vector t, vector t is a vector With vector The average direction vector.
  • the angle ⁇ in the step 5 is calculated by the following formula:
  • Vector t represents vector With vector The average direction vector.
  • the present invention is improved based on the LSD algorithm and retains the characteristics of the fast speed of the LSD algorithm.
  • the present invention redefines the gradient of the RGB image, so that the method of the present invention is applicable to both RGB images and grayscale images.
  • the present invention does not detect the arc as a straight line.
  • the present invention addresses the problem of discontinuity of straight line segments detected by the LSD algorithm.
  • This method uses the relationship between straight line segments to connect discontinuous straight line segments that meet the conditions to achieve the purpose of detecting complete straight line segments. Describe the part through existing straight line segments. Compared with directly using incomplete straight segments to describe parts, the present invention can greatly improve the accuracy of part recognition, improve the efficiency of industrial parts sorting, and reduce the probability of classification errors.
  • Figure 1 is a schematic diagram of the results of applying the LSD algorithm on non-textured metal parts
  • FIG. 2 is a flowchart of the present invention
  • Figure 3 is a schematic diagram of the Level-Line direction
  • Figure 4 is a schematic diagram of the straight line connection
  • Figure 5 is a schematic diagram of the results of applying the present invention to non-textured metal parts.
  • the method for detecting the regular straight line segment edge of a non-textured metal part of the present invention includes the following steps (the flow chart shown in Fig. 2):
  • Step 1 Specific implementation takes industrial light source fixed block parts as non-textured metal parts, and calculates the gradient size and direction at each pixel position of the input image.
  • the gradient size and direction can be calculated by the gradient difference operator.
  • the gradient vector norm of pixels in the image is:
  • Step 2 Calculate the Level-Line angle of all pixels: As shown in Figure 3, the Level-Line of each pixel in the image is perpendicular to the gradient direction of the pixel, and the Level-Line angle of the pixel is the x-axis The positive semi-axis rotates in the counterclockwise direction to an angle that coincides with the level-line.
  • Step 3 Select the pixel with the largest gradient magnitude among all the pixels in the image that has not been visited, use this pixel as the starting point of the first connected domain, and calculate the Level-Line angle of the connected domain. Then visit the adjacent pixels of the connected domain, and determine in turn whether the difference between the Level-Line angle of these adjacent pixels and the Level-Line angle of the connected domain is less than the threshold ⁇ . If it is less than the threshold ⁇ , add it to the connected domain and update the Level- Line corner, until all adjacent pixels of the connected domain cannot join the connected domain, reselect the pixels with the largest gradient amplitude and have not been visited among the remaining pixels, and repeat the above steps until all pixels have been visited.
  • the Level-Line angle of the connected domain is:
  • level-line-angle region is the direction line angle of the connected region
  • level-line-angle j is the direction line angle of the j-th pixel in the connected region
  • j is the ordinal number of the pixel
  • Step 3 Use rectangles to fit each connected domain and output all straight line segments.
  • the center point of the rectangle can be obtained by the following formula:
  • G(j) is the gradient amplitude at the jth pixel
  • x(j) and y(j) They are the coordinates of the j-th pixel in the x direction and the y direction
  • j is the ordinal number of the pixel.
  • the inclination angle of the rectangle is determined by the eigenvalue corresponding to the smallest eigenvector of the matrix M in the following formula:
  • the midpoints of the two short sides of the rectangle are the two end points of the straight line segment
  • c x and c y are the coordinates of the center of the rectangle in the x and y directions
  • G(j) is the gradient at the jth pixel Amplitude
  • x(j) and y(j) are the coordinates of the j-th pixel in the x direction and y direction respectively
  • j is the ordinal number of the pixel.
  • Step 4 According to the threshold t d, delete short straight line segments with a length less than t d ;
  • Step 5 Connect incomplete straight segments. As shown in Figure 4, select a pair of unvisited straight line segments A'A and BB'. Among these four points, A and B are the two closest points; if and and and Then add the line segment AB to the line segment list, and delete A'A and BB', otherwise select the next set of line segments until all the line segments have been visited in pairs;
  • Step 6 As shown in Figure 5, finally output a complete straight line segment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

一种无纹理金属零件图像规整化直线段边缘检测方法。首先计算输入零件图像各像素点的梯度,之后利用LSD算法检测出初步的直线段,下一步利用直线段之间的距离和角度关系对不连续的直线段进行连接,达到检测完整直线段的目的,避免了检测出的直线段发生断裂的问题。该方法基于LSD算法进行改进,在保留了LSD算法速度快的基础上,又能输出完整的直线段,且同时适用RGB图像与灰度图像,可满足实际应用的需求。

Description

一种无纹理金属零件图像规整化直线段边缘检测方法 技术领域
本发明涉及计算机视觉及工业自动化技术领域,具体涉及一种无纹理金属零件图像规整化直线段边缘检测方法。
背景技术
无纹理金属零件的边缘直线检测一直以来都是计算机视觉领域的一个重要研究方向。在很多应用场景下都需要对零件边缘的直线进行检测,如对金属零件进行识别和抓取等。
目前最通用的直线检测方法均是在霍夫变换直线检测方法上进行改进得到的。但霍夫变换直线检测方法有两方面的问题:第一,由于霍夫变换直线检测方法需要将图像空间中的点变换到霍夫空间中进行计算,计算量比较大,运算时间就会比较长。第二,从霍夫空间映射回图像空间时,只能返回直线段所在的直线,并不能将分离的直线段独立返回。当某些应用需要以直线段作为输入时,只能在图像空间中再一次遍历所有像素,判断直线是否连续,这进一步增加了计算量。
Gioi等人在2012年提出了一种基于生长算法的直线检测方法(Line Segment Detector,LSD)。这种方法能够在线性时间内完成对图像内的直线段的检测,速度较霍夫变换直线检测方法有了大幅提升,并且输出的结果是直线段。但是,检测出的直线段可能会由于阴影、局部模糊或其他原因使得检测出的直线段不连续(如图1所示)。
发明内容
为了解决背景技术中的问题,本发明提供了一种无纹理金属零件图像规整化直线段边缘检测方法,在LSD算法的基础之上,利用直线段之间的相互关系,对不连续的直线段进行连接,达到检测完整直线段的目的。如此,既保留了LSD算法速度快的特点,又避免了检测出的直线段发生断裂的问题,满足实际应用的需求。
本发明的技术方案包括以下步骤:
步骤1:输入待测的零件图像,计算零件图像中每个像素点的梯度幅值和梯度方向;
步骤2:计算所有像素点的方向线角度:每个像素点的方向线角度是将x轴正半轴沿逆时针方向旋转至与方向线重合所转过的角度;x轴正半轴为从左到右 的行方向;
所述步骤2中像素点的方向线(Level-Line)为经过像素点且与像素点的梯度方向垂直的直线。
步骤3:通过以下步骤获得零件图像中各个连通域:
步骤3.1:选取零件图像中梯度幅值最大的像素点作为连通域,进行步骤3.2开始区域生长;
步骤3.2:判断与连通域相邻的像素点是否需要包含在连通域中:对与连通域相邻的各个像素点进行是否需要包含在连通域的判断处理,将与连通域相邻且判断为需要包含在连通域的像素点加入到连通域,并不断向外扩张将相邻的像素点判断后并加入连通域,直到与当前连通域相邻的所有像素点被判断为不需要包含在连通域中,则输出当前获得的连通域,再在零件图像中去除当前获得的连通域后回到步骤3.1迭代处理,获得各个连通域;
所述步骤3.2中对与连通域相邻的各个像素点进行是否需要包含在连通域的判断处理的方法具体是:若与连通域相邻的像素点的方向线角度与连通域的方向线角度之差小于生长阈值τ,则判定与连通域相邻的像素点包含在连通域中;
所述步骤3.2中对与连通域相邻的各个像素点进行是否需要包含在连通域的判断处理的方法具体是:若与连通域相邻的像素点的方向线角度与连通域的方向线角度之差小于生长阈值τ,则判定与连通域相邻的像素点包含在连通域中;所述生长阈值τ为已设定的参数值。
步骤4:通过矩形拟合各个连通域得到所对应的拟合矩形,连接拟合矩形的两条短边的中点即可获得连通域所对应的直线段,每个连通域中对应建立一条直线段,并删除长度小于长度控制阈值t d的短直线段,输出所有连通域所对应的直线段;
所述阈值t d为已设定的参数。
步骤5:将步骤4中所有直线段两两配对构成直线段对,根据限制条件1和2筛选所有直线段对:直线段对中的两条直线段分别设为直线段A'A和直线段BB',A'、A分别为直线段A'A的两个端点,B、B'分别为直线段BB'的两个端点,且A和B是距离最近的两个点;连接同时满足限制条件1和2的直线段A'A和直线段BB';
所述的限制条件1和2分别为:
限制条件1:两条直线段的斜率必须接近,同时两条直线段之间的最近端点 距离
Figure PCTCN2019128937-appb-000001
必须小于阈值t d,即满足下式:
Figure PCTCN2019128937-appb-000002
其中,t θ为角度阈值;
所述t θ定义为t θ=2arctan(t d/w),其中,w为输入的零件图像中所检测零件的边缘像素宽度。
限制条件2:两条直线段之间的最近端点距离
Figure PCTCN2019128937-appb-000003
和角度θ需要满足下式:
Figure PCTCN2019128937-appb-000004
其中,θ max为直线段A'A和BB'的连接控制参数;θ为向量
Figure PCTCN2019128937-appb-000005
与向量t之间的夹角,向量t为向量
Figure PCTCN2019128937-appb-000006
与向量
Figure PCTCN2019128937-appb-000007
的平均方向向量。
限制条件2的意义是:当角θ的值较小时,
Figure PCTCN2019128937-appb-000008
的长度可以适当变长,反之亦然。
步骤6:输出经步骤5处理后的完整的直线段边缘。
所述的无纹理金属零件是表面为平面且光滑、无凹凸和纹理的多面体金属零件。
所述步骤1中计算零件图像中每个像素点的梯度幅值和梯度方向的方法具体是:若零件图像为灰度图像,使用梯度差分算子计算零件图像每个像素的梯度幅值和梯度方向;若零件图像为RGB图像,使用由三通道梯度组合而成的梯度张量T计算零件图像每个像素的梯度幅值和梯度方向:RGB图像的每个像素的梯度幅值是梯度张量T最大特征值的平方根,梯度方向则是梯度张量T最大特征值所对应的特征向量的方向;
所述梯度张量T的阵列如下:
Figure PCTCN2019128937-appb-000009
其中,
Figure PCTCN2019128937-appb-000010
u为像素在零件图像行方向上的合成梯度,v为像素在零件图像列方向上的合成梯度,r、g、b分别表示红色、绿色、蓝色通道的单位向量;g xx为像素点在行方向上合成梯度的平方值;g xy为像素在行方向和列方向上合成梯度的乘积值;g yy为像素在列方向上合成梯度的平方值;
x,y,z表示像素点分别在红、绿、蓝通道上的值;r表示行方向;c表示列方向;
Figure PCTCN2019128937-appb-000011
分别表示在红、绿、蓝通道上像素点在行方向上的导数,
Figure PCTCN2019128937-appb-000012
Figure PCTCN2019128937-appb-000013
分别表示在红、绿、蓝通道上像素点在列方向上的导数;
由梯度张量T获得RGB图像的梯度幅值为:
Figure PCTCN2019128937-appb-000014
由梯度张量T获得RGB图像的梯度方向为
Figure PCTCN2019128937-appb-000015
根据以下公式计算连通域的方向线角度:
Figure PCTCN2019128937-appb-000016
其中,level-line-angle region是连通域的方向线角度,level-line-angle j是连通域中第j个像素点的方向线角度,j为像素点的序数。
所述步骤5中连接控制参数θ max的值通过以下方式计算:
取两条直线段之间的最近端点距离
Figure PCTCN2019128937-appb-000017
为2,角度θ的值为45°,将
Figure PCTCN2019128937-appb-000018
θ=45°代入以下公式求得连接控制参数θ max的值:
Figure PCTCN2019128937-appb-000019
其中,θ max为直线段A'A和BB'的连接控制参数;θ为向量
Figure PCTCN2019128937-appb-000020
与向量t之间的夹角,向量t为向量
Figure PCTCN2019128937-appb-000021
与向量
Figure PCTCN2019128937-appb-000022
的平均方向向量。
所述步骤5中角度θ由下式计算得到:
Figure PCTCN2019128937-appb-000023
其中:θ∈[0,π),
Figure PCTCN2019128937-appb-000024
向量t表示向量
Figure PCTCN2019128937-appb-000025
与向量
Figure PCTCN2019128937-appb-000026
的平均方向向量。
本发明的有益效果是:
1)本发明基于LSD算法进行改进,保留了LSD算法速度快的特点。
2)本发明针对LSD算法无法对RGB图像进行检测的问题,重新对RGB图像的梯度进行定义,使本发明方法同时适用RGB图像与灰度图像。
3)本发明与LSD算法相比不会将圆弧检测为直线。
4)本发明针对LSD算法检测出的直线段不连续的问题,本方法利用直线段之间的相互关系,对满足条件的不连续的直线段进行连接,达到检测完整直线段的目的,之后可以通过现有的直线段对零件进行描述。相比于直接利用不完整的直线段对零件进行描述,本发明可以大大提高零件识别的准确度,提升工业零件分拣的效率,降低分类错误的概率。
附图说明
图1为在无纹理金属零件上应用LSD算法的结果示意图;
图2为本发明的流程图;
图3为Level-Line方向示意图;
图4为直线段连接示意图;
图5为在无纹理金属零件上应用本发明的结果示意图。
具体实施方式
下面结合附图和实施例对本发明作进一步说明。
本发明的无纹理金属零件规整化直线段边缘检测方法包括以下步骤(如图2所示的流程图):
步骤1:具体实施以工业光源固定块零件为无纹理金属零件,计算输入图像每个像素位置上的梯度大小和方向。对于灰度图像,梯度大小和方向可以通过 梯度差分算子计算得到。对于RGB图像,图像中像素点的梯度向量norm为:
Figure PCTCN2019128937-appb-000027
其中:
Figure PCTCN2019128937-appb-000028
步骤2:计算所有像素点的Level-Line角:如图3所示,图像中每个像素点的Level-Line与该像素点的梯度方向垂直,该像素点的Level-Line角就是将x轴正半轴沿逆时针方向旋转至与Level-Line重合所转过的角度。
步骤3:选择图像中所有像素点中梯度幅值最大且未被访问过的像素,将该像素点作为第一个连通域的起始点,计算该连通域的Level-Line角。之后访问该连通域的邻接像素,依次判断这些邻接像素的Level-Line角与该连通域的Level-Line角之差是否小于阈值τ,小于则将其加入连通域,并更新连通域的Level-Line角,直至连通域的所有邻接像素均不能加入该连通域后,重新选择剩余像素中梯度幅值最大且未被访问过的像素,重复上述步骤,直至所有像素点均被访问完毕。
连通域的Level-Line角为:
Figure PCTCN2019128937-appb-000029
其中,level-line-angle region是连通域的方向线角度,level-line-angle j是连通域中第j个像素点的方向线角度,j为像素点的序数。
步骤3:使用矩形拟合每一个连通域,输出所有直线段。
使用矩形拟合连通域具体是:矩形的中心点可由下式得到:
Figure PCTCN2019128937-appb-000030
其中c x与c y分别是该连通域所拟合的矩形中心的x方向与y方向的坐标, G(j)是第j个像素处的梯度幅值,x(j)与y(j)分别是第j个像素的x方向与y方向的坐标,j为像素点的序数。
而该矩形的倾斜角度由下式中的矩阵M的最小特征向量所对应的特征值所决定:
Figure PCTCN2019128937-appb-000031
Figure PCTCN2019128937-appb-000032
Figure PCTCN2019128937-appb-000033
Figure PCTCN2019128937-appb-000034
此时矩形两条短边的中点即是直线段的两个端点,c x与c y分别是该矩形中心的x方向与y方向的坐标,G(j)是第j个像素处的梯度幅值,x(j)与y(j)分别是第j个像素的x方向与y方向的坐标,j为像素点的序数。
步骤4:依据阈值t d删去长度小于t d的短直线段;
步骤5:连接不完整直线段。如图4所示,选择一对未访问过的直线段A’A和BB’,这四个点中A和B是距离最近的两个点;如果
Figure PCTCN2019128937-appb-000035
并且
Figure PCTCN2019128937-appb-000036
并且
Figure PCTCN2019128937-appb-000037
则将线段AB加入线段列表,并删除A’A和BB’,否则选取下一组直线段,直至所有直线段之间都被两两访问过;
步骤6:如图5所示,最后输出完整的直线段。
虽然本发明已以较佳实施例揭露如上,然其并非用以限定本发明。本发明所属技术领域中具有通常知识者,在不脱离本发明的精神和范围内,当可作各种的更动与润饰。因此,本发明的保护范围当视权利要求书所界定者为准。

Claims (6)

  1. 一种无纹理金属零件图像规整化直线段边缘检测方法,其特征在于:
    步骤1:输入待测的零件图像,计算零件图像中每个像素点的梯度幅值和梯度方向;
    步骤2:计算所有像素点的方向线角度:每个像素点的方向线角度是将x轴正半轴沿逆时针方向旋转至与方向线重合所转过的角度;
    步骤3:通过以下步骤获得零件图像中各个连通域:
    步骤3.1:选取零件图像中梯度幅值最大的像素点作为连通域,进行步骤3.2开始区域生长;
    步骤3.2:判断与连通域相邻的像素点是否需要包含在连通域中:对与连通域相邻的各个像素点进行是否需要包含在连通域的判断处理,将与连通域相邻且判断为需要包含在连通域的像素点加入到连通域,并不断向外扩张将相邻的像素点判断后并加入连通域,直到与当前连通域相邻的所有像素点被判断为不需要包含在连通域中,则输出当前获得的连通域,再在零件图像中去除当前获得的连通域后回到步骤3.1迭代处理,获得各个连通域;
    所述步骤3.2中对与连通域相邻的各个像素点进行是否需要包含在连通域的判断处理的方法具体是:若与连通域相邻的像素点的方向线角度与连通域的方向线角度之差小于生长阈值τ,则判定与连通域相邻的像素点包含在连通域中;
    步骤4:通过矩形拟合各个连通域得到所对应的拟合矩形,连接拟合矩形的两条短边的中点即可获得连通域所对应的直线段,每个连通域中对应建立一条直线段,并删除长度小于长度控制阈值t d的直线段,输出所有连通域所对应的直线段;
    步骤5:将步骤4中所有直线段两两配对构成直线段对,根据限制条件1和2筛选所有直线段对:直线段对中的两条直线段分别设为直线段A'A和直线段BB',连接同时满足限制条件1和2的直线段A'A和直线段BB';
    所述的限制条件1和2分别为:
    限制条件1:两条直线段的斜率必须接近,同时两条直线段之间的最近端点距离
    Figure PCTCN2019128937-appb-100001
    必须小于阈值t d,即满足下式:
    Figure PCTCN2019128937-appb-100002
    其中,t θ为角度阈值;
    所述t θ定义为t θ=2arctan(t d/w),其中,w为输入的零件图像中所检测零件的边缘像素宽度;
    限制条件2:两条直线段之间的最近端点距离
    Figure PCTCN2019128937-appb-100003
    和角度θ需要满足下式:
    Figure PCTCN2019128937-appb-100004
    其中,θ max为直线段A'A和BB'的连接控制参数;θ为向量
    Figure PCTCN2019128937-appb-100005
    与向量t之间的夹角,向量t为向量
    Figure PCTCN2019128937-appb-100006
    与向量
    Figure PCTCN2019128937-appb-100007
    的平均方向向量;
    步骤6:输出经步骤5处理后的完整的直线段边缘。
  2. 根据权利要求1所述的一种无纹理金属零件图像规整化直线段边缘检测方法,其特征在于,所述步骤1中计算零件图像中每个像素点的梯度幅值和梯度方向的方法具体是:若零件图像为灰度图像,使用梯度差分算子计算零件图像每个像素的梯度幅值和梯度方向;若零件图像为RGB图像,使用由三通道梯度组合而成的梯度张量T计算零件图像每个像素的梯度幅值和梯度方向:RGB图像的每个像素的梯度幅值是梯度张量T最大特征值的平方根,梯度方向则是梯度张量T最大特征值所对应的特征向量的方向;
    所述梯度张量T的阵列如下:
    Figure PCTCN2019128937-appb-100008
    其中,
    Figure PCTCN2019128937-appb-100009
    u为像素在行方向上的合成梯度,v为像素在列方向上的合成梯度,r、g、b分别表示红色、绿色、蓝色通道的单位向量;g xx为像素点在行方向上合成梯度的平方值;g xy为像素在行方向和列方向上合成梯度的乘积值;g yy为像素在列方向上合成梯度的平方值;
    x,y,z表示像素点分别在红、绿、蓝通道上的值;r表示行方向;c表示列 方向;
    Figure PCTCN2019128937-appb-100010
    分别表示在红、绿、蓝通道上像素点在行方向上的导数,
    Figure PCTCN2019128937-appb-100011
    Figure PCTCN2019128937-appb-100012
    分别表示在红、绿、蓝通道上像素点在列方向上的导数;
    由梯度张量T获得RGB图像的梯度幅值为:
    Figure PCTCN2019128937-appb-100013
    由梯度张量T获得RGB图像的梯度方向为
    Figure PCTCN2019128937-appb-100014
  3. 根据权利要求1所述的一种无纹理金属零件图像规整化直线段边缘检测方法,其特征在于,根据以下公式计算连通域的方向线角度:
    Figure PCTCN2019128937-appb-100015
    其中,level-line-angle region是连通域的方向线角度,level-line-angle j是连通域中第j个像素点的方向线角度,j为像素点的序数。
  4. 根据权利要求1所述的一种无纹理金属零件图像规整化直线段边缘检测方法,其特征在于,所述步骤5中连接控制参数θ max的值通过以下方式计算:
    取两条直线段之间的最近端点距离
    Figure PCTCN2019128937-appb-100016
    为2,角度θ的值为45°,将
    Figure PCTCN2019128937-appb-100017
    θ=45°代入以下公式求得连接控制参数θ max的值:
    Figure PCTCN2019128937-appb-100018
    其中,θ max为直线段A'A和BB'的连接控制参数;θ为向量
    Figure PCTCN2019128937-appb-100019
    与向量t之间的夹角,向量t为向量
    Figure PCTCN2019128937-appb-100020
    与向量
    Figure PCTCN2019128937-appb-100021
    的平均方向向量。
  5. 根据权利要求4所述的一种无纹理金属零件图像规整化直线段边缘检测方法,其特征在于,所述步骤5中角度θ由下式计算得到:
    Figure PCTCN2019128937-appb-100022
    其中:θ∈[0,π),
    Figure PCTCN2019128937-appb-100023
    向量t表示向量
    Figure PCTCN2019128937-appb-100024
    与向量
    Figure PCTCN2019128937-appb-100025
    的平均 方向向量。
  6. 根据权利要求1所述的一种无纹理金属零件图像规整化直线段边缘检测方法,其特征在于,所述步骤2中像素点的方向线为经过像素点且与像素点的梯度方向垂直的直线。
PCT/CN2019/128937 2019-01-23 2019-12-27 一种无纹理金属零件图像规整化直线段边缘检测方法 WO2020151455A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910063585.4A CN109801281B (zh) 2019-01-23 2019-01-23 一种无纹理金属零件图像规整化直线段边缘检测方法
CN201910063585.4 2019-01-23

Publications (1)

Publication Number Publication Date
WO2020151455A1 true WO2020151455A1 (zh) 2020-07-30

Family

ID=66560002

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/128937 WO2020151455A1 (zh) 2019-01-23 2019-12-27 一种无纹理金属零件图像规整化直线段边缘检测方法

Country Status (2)

Country Link
CN (1) CN109801281B (zh)
WO (1) WO2020151455A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109801281B (zh) * 2019-01-23 2020-09-18 浙江大学 一种无纹理金属零件图像规整化直线段边缘检测方法
CN110288624A (zh) * 2019-06-28 2019-09-27 苏州大学 一种图像中直线段的检测方法、装置及相关设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150161473A1 (en) * 2013-12-09 2015-06-11 Fujitsu Limited Method and device for extracting distorted straight line from image
CN105740871A (zh) * 2016-02-01 2016-07-06 福建师范大学 一种利用线段空间关系检测多边行地物的方法
CN107392141A (zh) * 2017-07-19 2017-11-24 武汉大学 一种基于显著性检测和lsd直线检测的机场提取方法
CN107403435A (zh) * 2017-07-28 2017-11-28 江苏大学 一种基于rgb颜色空间的彩色图像边缘提取方法
CN109801281A (zh) * 2019-01-23 2019-05-24 浙江大学 一种无纹理金属零件图像规整化直线段边缘检测方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104063868B (zh) * 2014-06-30 2017-05-10 中国科学院自动化研究所 一种多边形工件检测定位方法
US9727802B2 (en) * 2014-10-23 2017-08-08 The Penn State Research Foundation Automatic, computer-based detection of triangular compositions in digital photographic images
CN105631857B (zh) * 2015-12-17 2018-02-09 中国科学院自动化研究所 一种光学元件表面的划痕检测方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150161473A1 (en) * 2013-12-09 2015-06-11 Fujitsu Limited Method and device for extracting distorted straight line from image
CN105740871A (zh) * 2016-02-01 2016-07-06 福建师范大学 一种利用线段空间关系检测多边行地物的方法
CN107392141A (zh) * 2017-07-19 2017-11-24 武汉大学 一种基于显著性检测和lsd直线检测的机场提取方法
CN107403435A (zh) * 2017-07-28 2017-11-28 江苏大学 一种基于rgb颜色空间的彩色图像边缘提取方法
CN109801281A (zh) * 2019-01-23 2019-05-24 浙江大学 一种无纹理金属零件图像规整化直线段边缘检测方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MENGMENG MA: "The Research on Edge Detection Algorithm of High Resolution for Color Images", CHINESE MASTER’S THESES FULL-TEXT DATABASE, INFORMATION SCIENCE & TECHNOLOGY, 30 June 2018 (2018-06-30), pages 1 - 62, XP055723657 *
XUEFENG_BUPT: "LSD (Line Segment Detector) straight line extraction algorithm", 25 September 2017 (2017-09-25), pages 1 - 9, XP055723655, Retrieved from the Internet <URL:https://blog.csdn.net/chishuideyu/article/details/78081643> *

Also Published As

Publication number Publication date
CN109801281B (zh) 2020-09-18
CN109801281A (zh) 2019-05-24

Similar Documents

Publication Publication Date Title
CN106960451B (zh) 一种提升图像弱纹理区域特征点数量的方法
US20190370943A1 (en) Image correction method and device
CN110490913B (zh) 基于角点与单线段编组的特征描述算子进行影像匹配方法
WO2020151455A1 (zh) 一种无纹理金属零件图像规整化直线段边缘检测方法
WO2021175180A1 (zh) 视线确定方法、装置、电子设备和计算机可读存储介质
CN105261014A (zh) 一种多传感器遥感影像匹配方法
CN109583365A (zh) 基于成像模型约束非均匀b样条曲线拟合车道线检测方法
CN109272521A (zh) 一种基于曲率分析的图像特征快速分割方法
CN110569857A (zh) 一种基于质心距离计算的图像轮廓角点检测方法
TW201516969A (zh) 視訊物件追蹤方法
CN111444948A (zh) 一种图像特征提取与匹配方法
Zhang et al. A new algorithm for accurate and automatic chessboard corner detection
CN107993193B (zh) 基于光照均衡化和改进surf算法的隧道衬砌图像拼接方法
CN115731254A (zh) 基于亚像素的图像求尺寸的方法
CN113095385A (zh) 一种基于全局和局部特征描述的多模图像匹配方法
CN112509033A (zh) 一种基于图像处理的铁塔倾斜自动检测方法和装置
US6697535B1 (en) Method for refining a parameter of a contour in an image
CN111598177A (zh) 面向低重叠图像匹配的自适应最大滑动窗口匹配方法
CN112233178B (zh) 基于机器视觉的复杂环境中动态物料测距方法
Zhang et al. Real-time Lane Detection Method Based On Region Of Interest
CN114964206A (zh) 一种单目视觉里程计目标位姿检测方法
Dobai et al. A document detection technique using convolutional neural networks for optical character recognition systems.
Xiao et al. An object perception and positioning method via deep perception learning object detection
Kong et al. Research on Canny Edge Feature Detection Technology of Color Image Based on Vector Properties
CN110648341B (zh) 一种基于尺度空间和子图的目标边界检测方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19911974

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19911974

Country of ref document: EP

Kind code of ref document: A1