WO2020133046A1 - Defect detection method and device - Google Patents

Defect detection method and device Download PDF

Info

Publication number
WO2020133046A1
WO2020133046A1 PCT/CN2018/124287 CN2018124287W WO2020133046A1 WO 2020133046 A1 WO2020133046 A1 WO 2020133046A1 CN 2018124287 W CN2018124287 W CN 2018124287W WO 2020133046 A1 WO2020133046 A1 WO 2020133046A1
Authority
WO
WIPO (PCT)
Prior art keywords
caliper
vertical edge
defect
edge
area
Prior art date
Application number
PCT/CN2018/124287
Other languages
French (fr)
Chinese (zh)
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 深圳配天智能技术研究院有限公司
Priority to CN201880088392.8A priority Critical patent/CN111758024B/en
Priority to PCT/CN2018/124287 priority patent/WO2020133046A1/en
Publication of WO2020133046A1 publication Critical patent/WO2020133046A1/en

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Definitions

  • the present application relates to the technical field of image processing, and in particular to a defect detection method and device.
  • the inventor of the present application discovered in the long-term research and development that although there are many edge detection algorithms in the current image processing, such as the Canny algorithm, Sobel algorithm, and Laplacian, these detection algorithms can detect the edges in the image, and the effect is excellent; but these The algorithm can only extract the edge information, but cannot filter and decompose the extracted edges, and it is difficult to accurately and effectively implement defect detection. At the same time, the current defect detection is based on the entire area to be detected, and the calculation efficiency is low.
  • the main problem solved by this application is to provide a defect detection method and device, which can accurately and effectively realize defect detection and improve defect detection efficiency.
  • the technical solution adopted in this application is to provide a defect detection method, which includes: determining the region of interest in the image to be detected; dividing the region of interest into a plurality of independent caliper regions of the same size ; Perform vertical edge detection on each caliper area, and the vertical edge is a line segment in the caliper area perpendicular to the preset edge of the caliper area; based on the vertical edge, obtain defect information of the area of interest.
  • a defect detection device which includes an input unit, a processor, and an output unit connected in sequence; wherein, the input unit is used to acquire an image to be detected; the processor To determine the region of interest in the image to be detected; divide the region of interest into multiple independent caliper regions of the same size; perform vertical edge detection on each caliper region, the vertical edge is the preset side of the caliper region and the caliper region Vertical line segments; obtaining defect information of the region of interest based on vertical edges; output unit for outputting defect information.
  • the beneficial effect of the present application is: by extracting the region of interest in the image to be detected, and then dividing the region of interest into a plurality of caliper regions, the vertical edge detection is performed on the image in each caliper region, thereby obtaining multiple The vertical edge information in each caliper area, and then obtaining the defects of the image to be detected according to the vertical edge information in each caliper area, can accurately and effectively realize the defect detection, and reduce the amount of processing operations and improve the defect detection efficiency.
  • FIG. 1 is a schematic flowchart of an embodiment of a defect detection method provided by this application.
  • FIG. 2 is a schematic flowchart of another embodiment of a defect detection method provided by this application.
  • FIG. 3 is a schematic diagram of a region of interest having multiple calipers in another embodiment of a defect detection method provided by this application;
  • FIG. 4 is a schematic diagram of pixels corresponding to step 24 in another embodiment of the defect detection method provided by this application;
  • FIG. 5 is a schematic diagram of a first type of defect feature and a fitted line in another embodiment of the defect detection method provided by this application;
  • FIG. 6 is a schematic diagram of a second type of defect characteristics and a fitted line in another embodiment of the defect detection method provided by this application;
  • FIG. 7 is a schematic structural diagram of an embodiment of a defect detection device provided by the present application.
  • FIG. 1 is a schematic flowchart of an embodiment of a defect detection method provided by the present application. The method includes:
  • Step 11 Determine the region of interest in the image to be detected.
  • the target object to be detected is converted into a digital image by a camera device, that is, an image to be inspected.
  • the image to be inspected is an image with defects.
  • the image to be inspected is a projection image of the surface of the part
  • defects such as pits or protrusions on the projected image of the part surface
  • the image to be inspected can be a grayscale image, a color image or a depth image.
  • the color image or depth image can be converted into a grayscale image first.
  • ROI is the area to be processed, which The shape can be rectangular or fan-shaped.
  • a cross-border inspection of the ROI needs to be performed, that is, whether the ROI exceeds the boundary of the image to be detected, and if the ROI does not exceed the boundary of the image to be detected, step 12 is performed; if the ROI exceeds the image to be detected , The ROI can be redefined until the set ROI does not exceed the boundary.
  • Step 12 Divide the region of interest into multiple independent caliper regions of the same size.
  • the shape of the caliper area is similar to the ROI, for example, if the ROI is rectangular, the caliper area The shape is a high-narrow rectangle; if the ROI is fan-shaped, the caliper area is also high-narrow fan-shaped, and the information such as the position and size of the caliper area is marked.
  • Step 13 Perform vertical edge detection on each caliper area.
  • the vertical side is a line segment perpendicular to the preset side of the caliper area in the caliper area.
  • An edge is a geometric feature of a group of connected pixels. Usually, they are located where the pixel gray transitions between two different areas; the edge detection algorithm can be used to edge detect the image in each caliper area to obtain each caliper area The edge information within the edge; where the edge detection algorithm is realized by obtaining the first derivative, second derivative and gradient of the neighboring pixels.
  • the convolution operation method can be used to perform the convolution operation.
  • the edge The information includes the location of the edge and the pixel value.
  • Step 14 Obtain the defect information of the region of interest based on the vertical edges.
  • the obtained multiple edge information is screened to eliminate false defects and obtain true and real defect information.
  • defect detection on the image to be inspected In order to perform defect detection on the image to be inspected, first extract the area of interest in the image to be inspected, then divide the area of interest into multiple caliper areas, and perform vertical edge detection on the image in each caliper area to obtain multiple caliper areas In the vertical edge of the inside, the defect of the image to be detected is obtained according to the vertical edge in each caliper area, thereby accurately and effectively realizing defect detection, and reducing the amount of processing operations and improving the efficiency of defect detection.
  • FIG. 2 is a schematic flowchart of another embodiment of a defect detection method provided by the present application. The method includes:
  • Step 21 Determine the region of interest in the image to be detected.
  • Step 21 is similar to step 11 in the above embodiment, and will not be repeated here.
  • Step 22 Divide the region of interest into multiple caliper regions that are independent of each other and have the same size.
  • the width of the caliper area in the direction of the preset side is greater than the height in the direction of the vertical side; the user can set the width, height, initial offset, and repeat offset of the caliper area as needed, or set it as the default value; Move to the distance between the starting position of the first caliper area and the starting position of the area of interest in the direction of the vertical edge.
  • the first caliper area is the caliper area closest to the starting position of the area of interest, and the repeated offset is The distance of the starting position of the adjacent caliper region in the direction of the preset side; the width of the caliper region in the direction of the preset side is set equal to the width of the ROI in the direction of the preset side.
  • the ROI is a rectangular region
  • the direction of the vertical side is the direction of horizontal to the right, that is, the positive direction of the Y axis of the image
  • the direction of the preset side is vertically downward
  • the initial offset is 0, that is, the starting position of the first caliper area coincides with the starting position of the ROI
  • the repeated offset can be 5 pixels to achieve discrete sampling;
  • the height of the caliper area and the value of the repeated offset are automatically adjusted according to the parameters given by the user to adaptively adjust the size of the caliper area so that the caliper area can cover the entire area of interest.
  • the direction of the vertical side may be set as the circumferential direction of the fan-shaped region, and the direction of the preset side may be set as the radial direction of the fan-shaped region.
  • Step 23 Compress the pixel information in each caliper area in a direction perpendicular to the preset side to obtain a one-dimensional vector corresponding to each caliper area.
  • the gray value of each row of pixels in each caliper area is summed and averaged in the direction perpendicular to the preset side, and the pixel information includes the pixel value in the caliper area; Ground, as shown in FIG.
  • Step 24 Perform vertical edge detection on each one-dimensional vector to obtain edge points in each caliper area.
  • the line segment that passes through the edge point in the caliper area and is perpendicular to the preset edge is the vertical edge; for the compressed one-dimensional row vector, the edge detection algorithm is used for edge detection; specifically, the first-order derivation of each one-dimensional row vector or Perform convolution operation; when using convolution operation to process the one-dimensional row vector, the size of the convolution kernel can be 1*3 or 1*5; perform non-extreme suppression processing on the result after derivation or convolution , Screen out the non-edge points; then according to the contrast at the screened edge points, obtain the contrast at the screened edge points, threshold the obtained contrast, and preserve the edge points whose contrast meets the preset threshold conditions; Specifically, the preset threshold value ranges from 0 to 255, which is used as the basis for edge point screening. This parameter is used to threshold the image after vertical edge detection to filter out edge points with a contrast less than this threshold. In a specific embodiment, the preset threshold is 25.
  • Step 25 Select the best vertical edge from the vertical edges in the caliper area.
  • the line segment set in the direction perpendicular to the preset side in each caliper area with an edge point is taken as the vertical edge in the caliper area, for example, as shown in FIG. 4, if the position of the pixel value c2 is an edge point, the vertical The pixel value of the edge is [c1, c2, c3].
  • each vertical edge is scored according to the contrast and position degree of each vertical edge; specifically, the contrast score and the position degree score can be linearly combined to obtain a score value; Then select the vertical edge with the highest score as the best vertical edge.
  • Step 26 Take the point on the best vertical edge in the caliper area for line fitting to obtain a fitted line.
  • the least square method is used for straight line fitting or curve fitting to obtain a fitting line, which is an ideal defect-free edge.
  • the best vertical edge corresponding to the fitting point whose distance is greater than the first distance threshold is to filter out pixels farther away from the fitting line, so as not to affect the fitting effect.
  • the positions of these filtered pixels are generally defects.
  • the retained best vertical edge is used to re-fit the line, and the fitted line is replaced by the re-fitted line before re-fitting the line.
  • Step 27 Mark defects in the caliper area according to the relative positional relationship between the best vertical edge and the fitted line.
  • each caliper area can be traversed to determine whether the best vertical edge exists in each caliper area; if there is no vertical edge in the caliper area, the caliper area is marked as having the first type of defect characteristics; The best vertical edge exists in the caliper area, and the best vertical edge is selected from the vertical edges in the caliper area.
  • the caliper area is marked as having the second type of defect feature; otherwise, it is considered that this caliper area There are no defects, ie non-defective areas, with true edges.
  • the first type of defects may be gap features
  • the second type of defects may be other defect features that are not gap features.
  • defects for a standard surface, such as a flat surface and a round surface, due to various reasons, the surface appears convex or missing, these abnormal surface features are collectively referred to as defects; for larger defects, it is called the first
  • defects for larger defects, it is called the first
  • a type of defect feature can also be called a gap feature.
  • a gap feature is a special form of defect; for bumps and smaller defects, it is called a second type of defect feature.
  • the defect parameters in the defect area can be counted; specifically, the defect parameters of the first type of defect features and/or the second type of defect features can be calculated ,
  • the defect parameters include at least one of the width along the direction of the vertical edge, the height along the direction of the preset edge, and the area; where the width can be an integer multiple of the repeated offset, and the defect height is the furthest from the fitting line at the defect The distance from the fitting point to the fitting line, the gap height is set by the user or is the default value.
  • fitting points A, B, and C there are three fitting points A, B, and C. Since there are no fitting points in the third caliper area and the fourth caliper area, it is determined that these two areas have the first type Defect characteristics; or, as shown in FIG. 6, after screening, 5 fitting points AE are obtained, and based on these 5 points, the fitting line in the figure is obtained, according to the distance between the fitting point and the fitting line, thus It is determined that the fitting points C and D are defect points, the fitting points A, B and E are true edge points, and the second type of defect feature is an area composed of fitting points C, D and fitting edges.
  • this embodiment After acquiring the region of interest in the image to be detected, differentiate the region of interest along the direction perpendicular to the preset side, divide the region of interest into multiple caliper regions, and then pair the region along the direction perpendicular to the preset side
  • the pixels in the caliper area are compressed to obtain an edge row vector, and then the first-order derivation is performed to obtain the edges that meet the requirements in each caliper area.
  • this embodiment can reduce the complexity of the edges.
  • the detection is decomposed into simple one-dimensional line vector edge detection, which reduces the complexity of the algorithm and saves processing time.
  • this embodiment uses a non-extreme suppression algorithm and thresholding to perform the first screening to obtain an accurate edge, obtain the contrast at the edge, and obtain the edge pixel value corresponding to the contrast, and then analyze the obtained edge Score for the second screening, get the best vertical edge in the caliper area, get the fitted edge by fitting the points on the best vertical edge, and finally filter based on the distance from the fitted point to the fitted edge Identify the first type of defect characteristics and the second type of defect characteristics; use the "differential" concept to decompose the edge line segment to be detected into multiple small edge line segments in order to screen out the most reasonable small edge line segments for fitting and defect detection.
  • Scoring edges realizing the secondary screening of edge line segments, accurately and effectively detecting real defects, and reducing the amount of processing operations, improving defect detection efficiency; while ordinary edge detection can only find edge information, it cannot perform edge information Scoring and screening, unable to complete line fitting and defect detection.
  • FIG. 7 is a schematic structural diagram of an embodiment of a defect detection device provided by the present application.
  • the device includes an input unit 71, a processor 72, and an output unit 73 connected in sequence.
  • the input unit 71 is used to acquire the image to be detected; the processor 72 is used to determine the region of interest in the image to be detected; the region of interest is divided into a plurality of independent caliper regions of the same size; each caliper region is vertically For edge detection, the vertical edge is a line segment in the caliper area perpendicular to the preset edge of the caliper area; the defect information of the region of interest is acquired based on the vertical edge; and the output unit 73 is used to output defect information.
  • the disclosed method and device may be implemented in other ways.
  • the device implementations described above are only schematic.
  • the division of modules or units is only a division of logical functions.
  • there may be other divisions for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or software function unit.

Abstract

A defect detection method and device, the method comprising: determining an area of interest in an image to be detected (11); dividing the area of interest into multiple caliper areas which are independent from one another and which have the same size (12); performing perpendicular edge detection on each caliper area, a perpendicular edge being a line segment that is in a caliper area and that is perpendicular to a preset edge of the caliper area (13); and acquiring defect information of the area of interest on the basis of the perpendicular edge (14). By using the described method, defect detection may be accurately and effectively implemented, thus improving defect detection efficiency.

Description

一种缺陷检测方法及装置Defect detection method and device 【技术领域】【Technical field】
本申请涉及图像处理技术领域,具体涉及一种缺陷检测方法及装置。The present application relates to the technical field of image processing, and in particular to a defect detection method and device.
【背景技术】【Background technique】
在实际生产应用中,需要依靠机器视觉对物品的表面进行检测,以确认是否存在缺陷等,如:工件表面是否有凹坑、凸起以及破损等;因此,缺陷检测在生产应用中,尤其是产线作业中具有重大的使用价值。缺陷在视觉系统的成像中会出现与周围平面不协调的现象,视觉系统利用这种不协调进行位置定位,然后利用相关算法对这些特征进行度量,从而完成缺陷的定位与测量。In actual production applications, it is necessary to rely on machine vision to inspect the surface of the article to confirm whether there are defects, such as: whether there are pits, protrusions and damage on the surface of the workpiece; therefore, defect detection in production applications, especially It has significant use value in production line operation. Defects will appear inconsistent with the surrounding plane in the imaging of the visual system. The visual system uses this uncoordinated location to locate, and then uses relevant algorithms to measure these features to complete the location and measurement of the defect.
本申请的发明人在长期研发中发现,目前图像处理中虽然具有很多边缘检测算法,如Canny算法、Sobel算法和Laplacian等,这些检测算法能够对图像中的边缘进行检测,且效果优异;但是这些算法仅仅能将边缘信息提取出来,无法对提取出来的边缘筛选分解,难以准确有效地实现缺陷检测。同时,目前的缺陷检测均是基于整个待检测区域进行处理,运算效率低。The inventor of the present application discovered in the long-term research and development that although there are many edge detection algorithms in the current image processing, such as the Canny algorithm, Sobel algorithm, and Laplacian, these detection algorithms can detect the edges in the image, and the effect is excellent; but these The algorithm can only extract the edge information, but cannot filter and decompose the extracted edges, and it is difficult to accurately and effectively implement defect detection. At the same time, the current defect detection is based on the entire area to be detected, and the calculation efficiency is low.
【发明内容】[Invention content]
本申请主要解决的问题是提供一种缺陷检测方法及装置,能够准确有效地实现缺陷检测,提高缺陷检测效率。The main problem solved by this application is to provide a defect detection method and device, which can accurately and effectively realize defect detection and improve defect detection efficiency.
为解决上述技术问题,本申请采用的技术方案是提供一种缺陷检测方法,该方法包括:确定待检测图像中的感兴趣区域;将感兴趣区域分割成多个彼此独立且大小相同的卡尺区域;对各个卡尺区域进行垂直边检测,垂直边为卡尺区域中与卡尺区域的预设边垂直的线段;基于垂直边获取感兴趣区域的缺陷信息。In order to solve the above technical problems, the technical solution adopted in this application is to provide a defect detection method, which includes: determining the region of interest in the image to be detected; dividing the region of interest into a plurality of independent caliper regions of the same size ; Perform vertical edge detection on each caliper area, and the vertical edge is a line segment in the caliper area perpendicular to the preset edge of the caliper area; based on the vertical edge, obtain defect information of the area of interest.
为解决上述技术问题,本申请采用的另一技术方案是提供一种缺陷检测装置,该装置包括依次连接的输入单元、处理器和输出单元;其中, 输入单元用于获取待检测图像;处理器用于确定待检测图像中的感兴趣区域;将感兴趣区域分割成多个彼此独立且大小相同的卡尺区域;对各个卡尺区域进行垂直边检测,垂直边为卡尺区域中与卡尺区域的预设边垂直的线段;基于垂直边获取感兴趣区域的缺陷信息;输出单元用于输出缺陷信息。To solve the above technical problems, another technical solution adopted by the present application is to provide a defect detection device, which includes an input unit, a processor, and an output unit connected in sequence; wherein, the input unit is used to acquire an image to be detected; the processor To determine the region of interest in the image to be detected; divide the region of interest into multiple independent caliper regions of the same size; perform vertical edge detection on each caliper region, the vertical edge is the preset side of the caliper region and the caliper region Vertical line segments; obtaining defect information of the region of interest based on vertical edges; output unit for outputting defect information.
通过上述方案,本申请的有益效果是:通过提取待检测图像中的感兴趣区域,再将感兴趣区域分割成多个卡尺区域,对每个卡尺区域内的图像进行垂直边检测,从而获取多个卡尺区域内的垂直边信息,再根据每个卡尺区域内的垂直边信息获取待检测图像的缺陷,可准确有效地实现缺陷检测,并且降低了处理运算量,提高了缺陷检测效率。Through the above solution, the beneficial effect of the present application is: by extracting the region of interest in the image to be detected, and then dividing the region of interest into a plurality of caliper regions, the vertical edge detection is performed on the image in each caliper region, thereby obtaining multiple The vertical edge information in each caliper area, and then obtaining the defects of the image to be detected according to the vertical edge information in each caliper area, can accurately and effectively realize the defect detection, and reduce the amount of processing operations and improve the defect detection efficiency.
【附图说明】[Description of the drawings]
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。其中:In order to more clearly explain the technical solutions in the embodiments of the present invention, the drawings required in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For a person of ordinary skill in the art, without paying any creative work, other drawings can be obtained based on these drawings. among them:
图1是本申请提供的缺陷检测方法一实施例的流程示意图;1 is a schematic flowchart of an embodiment of a defect detection method provided by this application;
图2是本申请提供的缺陷检测方法另一实施例的流程示意图;2 is a schematic flowchart of another embodiment of a defect detection method provided by this application;
图3是本申请提供的缺陷检测方法另一实施例中具有多个卡尺的感兴趣区域的示意图;3 is a schematic diagram of a region of interest having multiple calipers in another embodiment of a defect detection method provided by this application;
图4是本申请提供的缺陷检测方法另一实施例中步骤24对应的像素示意图;4 is a schematic diagram of pixels corresponding to step 24 in another embodiment of the defect detection method provided by this application;
图5是本申请提供的缺陷检测方法另一实施例中第一类缺陷特征以及拟合线的示意图;5 is a schematic diagram of a first type of defect feature and a fitted line in another embodiment of the defect detection method provided by this application;
图6是本申请提供的缺陷检测方法另一实施例中第二类缺陷特征以及拟合线的示意图;6 is a schematic diagram of a second type of defect characteristics and a fitted line in another embodiment of the defect detection method provided by this application;
图7是本申请提供的缺陷检测装置一实施例的结构示意图。7 is a schematic structural diagram of an embodiment of a defect detection device provided by the present application.
【具体实施方式】【detailed description】
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案 进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性的劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative work fall within the scope of protection of the present application.
参阅图1,图1是本申请提供的缺陷检测方法一实施例的流程示意图,该方法包括:Referring to FIG. 1, FIG. 1 is a schematic flowchart of an embodiment of a defect detection method provided by the present application. The method includes:
步骤11:确定待检测图像中的感兴趣区域。Step 11: Determine the region of interest in the image to be detected.
通过摄像装置将待检测的目标物体转换成数字图像,即待检测图像,该待检测图像为具有缺陷的图像,例如,对于零件表面平整度检测来说,该待检测图像为零件表面的投影图像,零件表面投影图像上带有凹坑或凸起等缺陷;待检测图像可以为灰度图像、彩色图像或深度图像,为了方便处理,可以先将彩色图像或深度图像转化成灰度图像。The target object to be detected is converted into a digital image by a camera device, that is, an image to be inspected. The image to be inspected is an image with defects. For example, for the flatness inspection of a part surface, the image to be inspected is a projection image of the surface of the part There are defects such as pits or protrusions on the projected image of the part surface; the image to be inspected can be a grayscale image, a color image or a depth image. To facilitate processing, the color image or depth image can be converted into a grayscale image first.
在获取了待检测图像之后,为了获取待检测图像中的缺陷,在待检测图像中确定感兴趣区域(ROI,Region of Interest),以减少处理时间,增加精度;ROI为需要处理的区域,其形状可以为矩形或扇形等。After acquiring the image to be inspected, in order to obtain the defect in the image to be inspected, determine the region of interest (ROI, Region of Interest) in the image to be inspected to reduce the processing time and increase the accuracy; ROI is the area to be processed, which The shape can be rectangular or fan-shaped.
进一步地,为了判断ROI的设置是否合理,需要对ROI进行越界检查,即检验ROI是否超出待检测图像的边界,若ROI未超出待检测图像的边界,则执行步骤12;若ROI超出待检测图像的边界,则可以重新确定ROI,直至设置的ROI未超界为止。Further, in order to judge whether the setting of the ROI is reasonable, a cross-border inspection of the ROI needs to be performed, that is, whether the ROI exceeds the boundary of the image to be detected, and if the ROI does not exceed the boundary of the image to be detected, step 12 is performed; if the ROI exceeds the image to be detected , The ROI can be redefined until the set ROI does not exceed the boundary.
步骤12:将感兴趣区域分割成多个彼此独立且大小相同的卡尺区域。Step 12: Divide the region of interest into multiple independent caliper regions of the same size.
将感兴趣区域分割成多个卡尺区域,每个卡尺区域之间具有预设间隔或无间隔,且大小、形状相等,卡尺区域的形状与ROI相似,例如,如果ROI为矩形,则卡尺区域的形状为高窄矩形;如果ROI为扇形,卡尺区域也为高窄扇形,并标记卡尺区域的位置以及大小等信息。Divide the area of interest into multiple caliper areas, each with a preset interval or no interval, and the size and shape are equal, the shape of the caliper area is similar to the ROI, for example, if the ROI is rectangular, the caliper area The shape is a high-narrow rectangle; if the ROI is fan-shaped, the caliper area is also high-narrow fan-shaped, and the information such as the position and size of the caliper area is marked.
步骤13:对各个卡尺区域进行垂直边检测。Step 13: Perform vertical edge detection on each caliper area.
垂直边为卡尺区域中与卡尺区域的预设边垂直的线段。The vertical side is a line segment perpendicular to the preset side of the caliper area in the caliper area.
边缘是一组相连像素的几何特征,通常它们位于两个不同区域之间像素灰度跃变的地方;利用边缘检测算法可以对每个卡尺区域内的图像 进行边缘检测,以获得每个卡尺区域内的边缘信息;其中,边缘检测算法为通过对邻域像素求取一阶导数、二阶导数及梯度来实现,为了简化求导的过程可以采用卷积运算的方法进行卷积运算,该边缘信息包括边缘所在的位置以及像素值。An edge is a geometric feature of a group of connected pixels. Usually, they are located where the pixel gray transitions between two different areas; the edge detection algorithm can be used to edge detect the image in each caliper area to obtain each caliper area The edge information within the edge; where the edge detection algorithm is realized by obtaining the first derivative, second derivative and gradient of the neighboring pixels. In order to simplify the derivation process, the convolution operation method can be used to perform the convolution operation. The edge The information includes the location of the edge and the pixel value.
步骤14:基于垂直边获取感兴趣区域的缺陷信息。Step 14: Obtain the defect information of the region of interest based on the vertical edges.
对于获取到的多个边缘信息进行筛选,以剔除虚假的缺陷,获得真真实的缺陷信息。The obtained multiple edge information is screened to eliminate false defects and obtain true and real defect information.
为了对待检测图像进行缺陷检测,首先提取对待检测图像中的感兴趣区域,然后将感兴趣区域分割成多个卡尺区域,对每个卡尺区域内的图像进行垂直边检测,从而获取多个卡尺区域内的垂直边,再根据每个卡尺区域内的垂直边获取待检测图像的缺陷,从而准确有效地实现缺陷检测,并且降低了处理运算量,提高了缺陷检测效率。In order to perform defect detection on the image to be inspected, first extract the area of interest in the image to be inspected, then divide the area of interest into multiple caliper areas, and perform vertical edge detection on the image in each caliper area to obtain multiple caliper areas In the vertical edge of the inside, the defect of the image to be detected is obtained according to the vertical edge in each caliper area, thereby accurately and effectively realizing defect detection, and reducing the amount of processing operations and improving the efficiency of defect detection.
参阅图2,图2是本申请提供的缺陷检测方法另一实施例的流程示意图,该方法包括:Referring to FIG. 2, FIG. 2 is a schematic flowchart of another embodiment of a defect detection method provided by the present application. The method includes:
步骤21:确定待检测图像中的感兴趣区域。Step 21: Determine the region of interest in the image to be detected.
其中,步骤21与上述实施例中步骤11类似,在此不再赘述。 Step 21 is similar to step 11 in the above embodiment, and will not be repeated here.
步骤22:将感兴趣区域分割成多个彼此独立且大小相同的的卡尺区域。Step 22: Divide the region of interest into multiple caliper regions that are independent of each other and have the same size.
卡尺区域沿预设边的方向的宽度大于沿垂直边的方向的高度;用户可以根据需要设置卡尺区域的宽度、高度、初始偏移以及重复偏移,或者设置其为默认值;其中,初始偏移为第一个卡尺区域的起始位置在垂直边的方向上与感兴趣区域的起始位置的距离,第一个卡尺区域为最靠近感兴趣区域起始位置的卡尺区域,重复偏移为相邻的卡尺区域的起始位置在预设边的方向上的距离;将卡尺区域在预设边的方向上的宽度设置成等于ROI在预设边的方向上的宽度。The width of the caliper area in the direction of the preset side is greater than the height in the direction of the vertical side; the user can set the width, height, initial offset, and repeat offset of the caliper area as needed, or set it as the default value; Move to the distance between the starting position of the first caliper area and the starting position of the area of interest in the direction of the vertical edge. The first caliper area is the caliper area closest to the starting position of the area of interest, and the repeated offset is The distance of the starting position of the adjacent caliper region in the direction of the preset side; the width of the caliper region in the direction of the preset side is set equal to the width of the ROI in the direction of the preset side.
在一个具体的实施例中,如图3所示,ROI为矩形区域,垂直边的方向为水平向右的方向,即图像的Y轴的正方向,预设边的方向为竖直向下的方向,即图像的X轴的正方向,初始偏移为0,即第一个卡尺区域的起始位置与ROI的起始位置重合,重复偏移可以为5个像素,以实 现离散采样;可以根据用户给定的参数自动调整卡尺区域的高度和重复偏移的值来自适应调整卡尺区域的尺寸,使得卡尺区域可以覆盖整个感兴趣区域。在其他实施例中,例如,当ROI为扇形区域时,垂直边的方向可以设置为扇形区域的周向方向,预设边的方向可以设置为扇形区域的径向方向。In a specific embodiment, as shown in FIG. 3, the ROI is a rectangular region, the direction of the vertical side is the direction of horizontal to the right, that is, the positive direction of the Y axis of the image, and the direction of the preset side is vertically downward The direction, that is, the positive direction of the X axis of the image, the initial offset is 0, that is, the starting position of the first caliper area coincides with the starting position of the ROI, and the repeated offset can be 5 pixels to achieve discrete sampling; The height of the caliper area and the value of the repeated offset are automatically adjusted according to the parameters given by the user to adaptively adjust the size of the caliper area so that the caliper area can cover the entire area of interest. In other embodiments, for example, when the ROI is a fan-shaped region, the direction of the vertical side may be set as the circumferential direction of the fan-shaped region, and the direction of the preset side may be set as the radial direction of the fan-shaped region.
步骤23:沿与预设边垂直的方向对各卡尺区域内的像素信息进行压缩,得到各个卡尺区域对应的一维向量。Step 23: Compress the pixel information in each caliper area in a direction perpendicular to the preset side to obtain a one-dimensional vector corresponding to each caliper area.
为了获取各个卡尺区域对应的的一维向量,沿与预设边垂直的方向对各卡尺区域内的每行像素的灰度值进行求和平均,该像素信息包括卡尺区域内的像素值;具体地,如图4所示,对于具有4*3个像素的卡尺区域,对卡尺区域内像素值进行求和再平均,即像素值A=(a1+a2+a3)/3、B=(b1+b2+b3)/3、C=(c1+c2+c3)/3以及D=(d1+d2+d3)/3,通过对像素值进行沿预设边的方向上的求和平均,将卡尺区域内的像素值压缩成一维列向量;此外,为了方便处理,可以对该一维列向量进行转置,最终可以得到一维行向量。In order to obtain the one-dimensional vector corresponding to each caliper area, the gray value of each row of pixels in each caliper area is summed and averaged in the direction perpendicular to the preset side, and the pixel information includes the pixel value in the caliper area; Ground, as shown in FIG. 4, for the caliper area with 4*3 pixels, the pixel values in the caliper area are summed and averaged, that is, the pixel value A=(a1+a2+a3)/3, B=(b1 +b2+b3)/3, C=(c1+c2+c3)/3 and D=(d1+d2+d3)/3, by summing the pixel values along the direction of the preset edge, the The pixel values in the caliper area are compressed into a one-dimensional column vector; in addition, for convenience of processing, the one-dimensional column vector can be transposed, and finally a one-dimensional row vector can be obtained.
步骤24:对各个一维向量进行垂直边检测,以获得各个卡尺区域内的边缘点。Step 24: Perform vertical edge detection on each one-dimensional vector to obtain edge points in each caliper area.
卡尺区域内经过边缘点且与预设边垂直的线段为垂直边;对于压缩得到的一维行向量,利用边缘检测算法进行边缘检测;具体地,对各个一维行向量进行一阶求导或进行卷积运算;在利用卷积运算对该一维行向量进行处理时,卷积核的尺寸可以为1*3或1*5;对求导或卷积后的结果进行非极值抑制处理,将非边缘点筛除;然后根据筛选后的边缘点处的对比度,获取筛选后的边缘点处的对比度,对获取到的对比度进行阈值化处理,保留对比度符合预设阈值条件的边缘点;具体地,预设阈值的取值范围为0~255,用作边缘点筛选的依据,利用此参数对垂直边检测后的图像进行阈值化处理,将对比度小于此阈值的边缘点过滤掉,在一具体的实施例中,该预设阈值为25。The line segment that passes through the edge point in the caliper area and is perpendicular to the preset edge is the vertical edge; for the compressed one-dimensional row vector, the edge detection algorithm is used for edge detection; specifically, the first-order derivation of each one-dimensional row vector or Perform convolution operation; when using convolution operation to process the one-dimensional row vector, the size of the convolution kernel can be 1*3 or 1*5; perform non-extreme suppression processing on the result after derivation or convolution , Screen out the non-edge points; then according to the contrast at the screened edge points, obtain the contrast at the screened edge points, threshold the obtained contrast, and preserve the edge points whose contrast meets the preset threshold conditions; Specifically, the preset threshold value ranges from 0 to 255, which is used as the basis for edge point screening. This parameter is used to threshold the image after vertical edge detection to filter out edge points with a contrast less than this threshold. In a specific embodiment, the preset threshold is 25.
步骤25:从卡尺区域内的垂直边中筛选出最佳垂直边。Step 25: Select the best vertical edge from the vertical edges in the caliper area.
将每个具有边缘点的卡尺区域内沿与预设边垂直的方向设置的线 段作为卡尺区域内的垂直边,例如,如图4所示,若像素值c2所在的位置为边缘点,则垂直边的像素值为[c1,c2,c3]。The line segment set in the direction perpendicular to the preset side in each caliper area with an edge point is taken as the vertical edge in the caliper area, for example, as shown in FIG. 4, if the position of the pixel value c2 is an edge point, the vertical The pixel value of the edge is [c1, c2, c3].
在卡尺区域内进行完垂直边检测后,通过非极值抑制和阈值化处理过程,卡尺区域内的垂直边可能还剩若干条;如何对这些垂直边进行筛选是个很重要的过程,如果筛选不合理,对于理想垂直边的拟合以及缺陷检测的结果将产生极大影响,因此筛选的方法尤其重要。After the vertical edge detection in the caliper area, through the process of non-extreme suppression and thresholding, there may be several vertical edges left in the caliper area; how to filter these vertical edges is an important process. Reasonable, it will have a great influence on the fitting of ideal vertical edges and the results of defect detection, so the method of screening is particularly important.
本实施例中为了筛选出待检测图像的真实缺陷,根据各垂直边的对比度和位置度对各垂直边进行评分;具体地,可以将对比度得分和位置度得分进行线性组合,以得到评分值;然后选择评分最高的垂直边作为最佳垂直边。In this embodiment, in order to screen out the real defects of the image to be detected, each vertical edge is scored according to the contrast and position degree of each vertical edge; specifically, the contrast score and the position degree score can be linearly combined to obtain a score value; Then select the vertical edge with the highest score as the best vertical edge.
其中,对比度越高,评分越高,位置度为沿预设方向查找到垂直边的顺序值,且垂直边越先查找到,评分越高。Among them, the higher the contrast, the higher the score, the position is the order value of the vertical edges found in the preset direction, and the earlier the vertical edge is found, the higher the score.
步骤26:取卡尺区域内最佳垂直边上的点进行线拟合,以获得拟合线。Step 26: Take the point on the best vertical edge in the caliper area for line fitting to obtain a fitted line.
取最佳垂直边上的中点进行线拟合,具体地,选取最佳垂直边的中点作为拟合点,基于多个拟合点利用拟合算法进行拟合,在一实施例中可以利用最小二乘法进行直线拟合或者曲线拟合,以得到拟合线,该拟合线为理想的无缺陷边缘。在拟合过程中,可首先基于所有的最佳垂直边上的拟合点进行拟合,得到一条拟合线,然后计算每个拟合点与拟合线之间的最短距离,筛选掉最短距离大于第一距离阈值的拟合点对应的最佳垂直边,即将离拟合线较远的像素点筛选掉,以免影响拟合效果,这些被筛选掉的像素点所在的位置一般为缺陷。进一步,利用保留的最佳垂直边重新进行线拟合,以重新得到的拟合线替代重新进行线拟合前的拟合线。Take the midpoint on the best vertical edge for line fitting. Specifically, select the midpoint of the best vertical edge as the fitting point, and use a fitting algorithm to perform fitting based on multiple fitting points. In one embodiment, The least square method is used for straight line fitting or curve fitting to obtain a fitting line, which is an ideal defect-free edge. In the fitting process, you can first fit based on all the fitting points on the best vertical edge to get a fitting line, then calculate the shortest distance between each fitting point and the fitting line, and filter out the shortest The best vertical edge corresponding to the fitting point whose distance is greater than the first distance threshold is to filter out pixels farther away from the fitting line, so as not to affect the fitting effect. The positions of these filtered pixels are generally defects. Further, the retained best vertical edge is used to re-fit the line, and the fitted line is replaced by the re-fitted line before re-fitting the line.
步骤27:根据最佳垂直边与拟合线之间的相对位置关系对卡尺区域进行缺陷标记。Step 27: Mark defects in the caliper area according to the relative positional relationship between the best vertical edge and the fitted line.
为了进行缺陷的检测,可以遍历每个卡尺区域,判断每个卡尺区域内是否存在最佳垂直边;若卡尺区域内不存在垂直边,则将该卡尺区域标记为存在第一类缺陷特征;若卡尺区域内存在最佳垂直边,从卡尺区 域内的垂直边中筛选出最佳垂直边。In order to detect defects, each caliper area can be traversed to determine whether the best vertical edge exists in each caliper area; if there is no vertical edge in the caliper area, the caliper area is marked as having the first type of defect characteristics; The best vertical edge exists in the caliper area, and the best vertical edge is selected from the vertical edges in the caliper area.
进一步地,判断最佳垂直边上的拟合点与拟合线之间的最短距离是否大于预设的第二距离阈值。若最佳垂直边上的拟合点与拟合线之间的最短距离大于预设的第二距离阈值,则将该卡尺区域标记为存在第二类缺陷特征;否则,则认为此卡尺区域内不存在缺陷,即非缺陷区域,具有真实的边缘。Further, it is determined whether the shortest distance between the fitting point on the best vertical edge and the fitting line is greater than a preset second distance threshold. If the shortest distance between the fitting point on the best vertical edge and the fitting line is greater than the preset second distance threshold, the caliper area is marked as having the second type of defect feature; otherwise, it is considered that this caliper area There are no defects, ie non-defective areas, with true edges.
在一具体的实施例中,第一类缺陷可以为间隙特征,第二类缺陷可以为非间隙特征的其他缺陷特征。例如,对于标准的表面,如平面和圆面等,由于各种原因导致其表面出现凸起或者欠缺,这些非正常的表面特征统称为缺陷;对于较大的欠缺部分,将其称之为第一类缺陷特征,亦可称为间隙特征,间隙特征是缺陷的一种特殊形式;对于凸起及较小欠缺部分,将其称为第二类缺陷特征。In a specific embodiment, the first type of defects may be gap features, and the second type of defects may be other defect features that are not gap features. For example, for a standard surface, such as a flat surface and a round surface, due to various reasons, the surface appears convex or missing, these abnormal surface features are collectively referred to as defects; for larger defects, it is called the first A type of defect feature can also be called a gap feature. A gap feature is a special form of defect; for bumps and smaller defects, it is called a second type of defect feature.
此外,还可以在标记出第一类缺陷特征或第二类缺陷特征之后,统计缺陷区域内的缺陷参数;具体地,对第一类缺陷特征和/或第二类缺陷特征的缺陷参数进行计算,缺陷参数包括沿垂直边的方向的宽度、沿预设边的方向的高度以及面积中的至少一个;其中,宽度可以为重复偏移的整数倍,缺陷高度为缺陷处离拟合线最远的拟合点到拟合线的距离,间隙高度由用户设置或者为默认值。In addition, after marking the first type of defect features or the second type of defect features, the defect parameters in the defect area can be counted; specifically, the defect parameters of the first type of defect features and/or the second type of defect features can be calculated , The defect parameters include at least one of the width along the direction of the vertical edge, the height along the direction of the preset edge, and the area; where the width can be an integer multiple of the repeated offset, and the defect height is the furthest from the fitting line at the defect The distance from the fitting point to the fitting line, the gap height is set by the user or is the default value.
例如,如图5所示,有3个拟合点A、B和C,由于第三个卡尺区域和第四个卡尺区域内不存在拟合点,则判定这两个区域内具有第一类缺陷特征;或者,如图6所示,在筛选之后,得到5个拟合点A-E,基于这5个点,得到图中拟合线,根据拟合点与拟合线之间的距离,从而判定拟合点C和D为缺陷点,拟合点A、B和E为真实边缘点,第二类缺陷特征为由拟合点C、D以及拟合边缘构成的区域。For example, as shown in Figure 5, there are three fitting points A, B, and C. Since there are no fitting points in the third caliper area and the fourth caliper area, it is determined that these two areas have the first type Defect characteristics; or, as shown in FIG. 6, after screening, 5 fitting points AE are obtained, and based on these 5 points, the fitting line in the figure is obtained, according to the distance between the fitting point and the fitting line, thus It is determined that the fitting points C and D are defect points, the fitting points A, B and E are true edge points, and the second type of defect feature is an area composed of fitting points C, D and fitting edges.
在获取待检测图像中的感兴趣区域之后,沿着与预设边垂直的方向对感兴趣区域进行微分,将感兴趣区域分割成多个卡尺区域,然后沿着与预设边垂直的方向对卡尺区域内的像素进行压缩,以获取一个边缘行向量,然后对其进行一阶求导,获取每个卡尺区域内的满足要求的边缘,相比现有技术,本实施例能够将复杂的边缘检测分解成简单的一维行向 量边缘检测,减小算法的复杂度,节省处理时间。After acquiring the region of interest in the image to be detected, differentiate the region of interest along the direction perpendicular to the preset side, divide the region of interest into multiple caliper regions, and then pair the region along the direction perpendicular to the preset side The pixels in the caliper area are compressed to obtain an edge row vector, and then the first-order derivation is performed to obtain the edges that meet the requirements in each caliper area. Compared with the prior art, this embodiment can reduce the complexity of the edges. The detection is decomposed into simple one-dimensional line vector edge detection, which reduces the complexity of the algorithm and saves processing time.
此外,本实施例利用非极值抑制算法以及阈值化处理,进行第一次筛选以得到准确的边缘,获得该边缘处的对比度,并获取该对比度对应的边缘像素值,然后再对得到的边缘评分以进行第二次筛选,获取到卡尺区域内的最佳垂直边,通过对最佳垂直边上的点进行拟合,得到拟合边缘,根据拟合点到拟合边的距离,最终筛选出第一类缺陷特征和第二类缺陷特征;利用“微分”的理念将待检测边缘线段分解成多个小边缘线段,以便筛选出最合理的小边缘线段以便进行拟合和缺陷检测,通过对边缘评分,实现了对边缘线段的二次筛选,准确有效地检测出真实缺陷,并且降低了处理运算量,提高缺陷检测效率;而普通的边缘检测只能找到边缘信息,无法对边缘信息进行评分和筛选,无法完成线拟合以及缺陷检测。In addition, this embodiment uses a non-extreme suppression algorithm and thresholding to perform the first screening to obtain an accurate edge, obtain the contrast at the edge, and obtain the edge pixel value corresponding to the contrast, and then analyze the obtained edge Score for the second screening, get the best vertical edge in the caliper area, get the fitted edge by fitting the points on the best vertical edge, and finally filter based on the distance from the fitted point to the fitted edge Identify the first type of defect characteristics and the second type of defect characteristics; use the "differential" concept to decompose the edge line segment to be detected into multiple small edge line segments in order to screen out the most reasonable small edge line segments for fitting and defect detection. Scoring edges, realizing the secondary screening of edge line segments, accurately and effectively detecting real defects, and reducing the amount of processing operations, improving defect detection efficiency; while ordinary edge detection can only find edge information, it cannot perform edge information Scoring and screening, unable to complete line fitting and defect detection.
参阅图7,图7是本申请提供的缺陷检测装置一实施例的结构示意图,该装置包括依次连接的输入单元71、处理器72和输出单元73。Referring to FIG. 7, FIG. 7 is a schematic structural diagram of an embodiment of a defect detection device provided by the present application. The device includes an input unit 71, a processor 72, and an output unit 73 connected in sequence.
其中,输入单元71用于获取待检测图像;处理器72用于确定待检测图像中的感兴趣区域;将感兴趣区域分割成多个彼此独立且大小相同的卡尺区域;对各卡尺区域进行垂直边检测,垂直边为卡尺区域中与卡尺区域的预设边垂直的线段;基于垂直边获取感兴趣区域的缺陷信息;输出单元73用于输出缺陷信息。Among them, the input unit 71 is used to acquire the image to be detected; the processor 72 is used to determine the region of interest in the image to be detected; the region of interest is divided into a plurality of independent caliper regions of the same size; each caliper region is vertically For edge detection, the vertical edge is a line segment in the caliper area perpendicular to the preset edge of the caliper area; the defect information of the region of interest is acquired based on the vertical edge; and the output unit 73 is used to output defect information.
在本申请所提供的几个实施方式中,应该理解到,所揭露的方法以及设备,可以通过其它的方式实现。例如,以上所描述的设备实施方式仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。In the several embodiments provided in this application, it should be understood that the disclosed method and device may be implemented in other ways. For example, the device implementations described above are only schematic. For example, the division of modules or units is only a division of logical functions. In actual implementation, there may be other divisions, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施方式方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施方式中的各功能单元可以集成在一个处理 单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or software function unit.
以上仅为本申请的实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only examples of the present application, and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by the description and drawings of this application, or directly or indirectly used in other related technical fields, The same reason is included in the patent protection scope of this application.

Claims (15)

  1. 一种缺陷检测方法,其特征在于,包括:A defect detection method, which includes:
    确定待检测图像中的感兴趣区域;Determine the region of interest in the image to be detected;
    将所述感兴趣区域分割成多个彼此独立且大小相同的卡尺区域;Dividing the region of interest into a plurality of independent caliper regions of the same size;
    对各个所述卡尺区域进行垂直边检测,所述垂直边为所述卡尺区域中与所述卡尺区域的预设边垂直的线段;Performing vertical edge detection on each of the caliper areas, the vertical edge being a line segment in the caliper area that is perpendicular to the preset edge of the caliper area;
    基于所述垂直边获取所述感兴趣区域的缺陷信息。Obtain defect information of the region of interest based on the vertical edge.
  2. 根据权利要求1所述的缺陷检测方法,其特征在于,在所述确定待检测图像中的感兴趣区域之后,将所述感兴趣区域分割成多个彼此独立且大小相同的卡尺区域之前,还包括:The defect detection method according to claim 1, wherein after the region of interest in the image to be detected is determined, before the region of interest is divided into a plurality of independent caliper regions of the same size, include:
    检验所述感兴趣区域是否超出所述待检测图像的边界;Checking whether the region of interest exceeds the boundary of the image to be detected;
    若所述感兴趣区域未超出所述待检测图像的边界,则执行将所述感兴趣区域分割成多个彼此独立且大小相同的卡尺区域的步骤;If the region of interest does not exceed the boundary of the image to be detected, perform the step of dividing the region of interest into a plurality of independent caliper regions of the same size;
    若所述感兴趣区域超出所述待检测图像的边界,则重新确定所述感兴趣区域。If the region of interest exceeds the boundary of the image to be detected, the region of interest is determined again.
  3. 根据权利要求1所述的缺陷检测方法,其特征在于,The defect detection method according to claim 1, wherein
    所述卡尺区域沿预设边的方向的宽度大于沿所述垂直边的方向的高度。The width of the caliper area in the direction of the preset side is greater than the height in the direction of the vertical side.
  4. 根据权利要求1所述的缺陷检测方法,其特征在于,所述对各个所述卡尺区域进行垂直边检测,包括:The defect detection method according to claim 1, wherein the vertical edge detection of each caliper area includes:
    沿与所述预设边垂直的方向对各所述卡尺区域内的像素信息进行压缩,得到各个卡尺区域对应的一维向量;Compressing the pixel information in each caliper area in a direction perpendicular to the preset side to obtain a one-dimensional vector corresponding to each caliper area;
    对各个所述一维向量进行垂直边检测,以获得各个所述卡尺区域内的边缘点,所述卡尺区域内经过所述边缘点且与所述预设边垂直的线段为所述垂直边。Vertical edge detection is performed on each of the one-dimensional vectors to obtain edge points in each caliper area, and a line segment passing through the edge point and perpendicular to the preset edge in the caliper area is the vertical edge.
  5. 根据权利要求4所述的缺陷检测方法,其特征在于,所述沿与所述预设边垂直的方向对各所述卡尺区域内的像素信息进行压缩,得到各个卡尺区域对应的一维向量,包括:The defect detection method according to claim 4, wherein the pixel information in each caliper area is compressed in a direction perpendicular to the preset side to obtain a one-dimensional vector corresponding to each caliper area, include:
    对各个所述卡尺区域内在与所述预设边垂直的方向上的每行像素的灰度值进行求和平均。The gray value of each row of pixels in the direction perpendicular to the preset side in each caliper area is summed and averaged.
  6. 根据权利要求4所述的缺陷检测方法,其特征在于,所述对各个所述一维向量进行边缘检测,以获得各个所述卡尺区域内的边缘点,包括:The defect detection method according to claim 4, wherein the performing edge detection on each of the one-dimensional vectors to obtain edge points in each caliper area includes:
    对各个所述一维向量进行一阶求导;Perform a first-order derivation of each of the one-dimensional vectors;
    对求导结果进行非极值抑制,将非边缘点筛除;Carry out non-extreme value suppression on the derivative results and filter out non-edge points;
    获取筛选后的边缘点处的对比度,保留对比度符合预设阈值条件的边缘点。Obtain the contrast at the filtered edge points, and retain the edge points whose contrast meets the preset threshold condition.
  7. 根据权利要求1所述的缺陷检测方法,其特征在于,所述基于所述垂直边获取所述感兴趣区域的缺陷信息,包括:The defect detection method according to claim 1, wherein the acquiring defect information of the region of interest based on the vertical edge includes:
    从所述卡尺区域内的垂直边中筛选出最佳垂直边;Selecting the best vertical edge from the vertical edges in the caliper area;
    取所述卡尺区域内最佳垂直边上的点进行线拟合,以获得拟合线;Take a point on the best vertical edge in the caliper area for line fitting to obtain a fitted line;
    根据所述最佳垂直边与所述拟合线之间的相对位置关系对所述卡尺区域进行缺陷标记。Mark the defect area of the caliper area according to the relative positional relationship between the best vertical edge and the fitting line.
  8. 根据权利要求7所述的缺陷检测方法,其特征在于,所述从所述卡尺区域内的垂直边中筛选出最佳垂直边,包括:The defect detection method according to claim 7, wherein the selecting the best vertical edge from the vertical edges in the caliper area includes:
    根据各所述垂直边的对比度和位置度对各所述垂直边进行评分,所述位置度为沿预设方向查找到所述垂直边的顺序值;Scoring each vertical edge according to the contrast and position degree of each vertical edge, where the position degree is an order value of finding the vertical edges in a preset direction;
    选择评分最高的所述垂直边为所述最佳垂直边。The highest vertical edge is selected as the best vertical edge.
  9. 根据权利要求7所述的缺陷检测方法,其特征在于,取所述卡尺区域内最佳垂直边上的中点进行线拟合。The defect detection method according to claim 7, wherein the midpoint on the best vertical edge in the caliper area is taken for line fitting.
  10. 根据权利要求7所述的缺陷检测方法,其特征在于,在所述取所述卡尺区域内最佳垂直边上的点进行线拟合,以获得拟合线之后,还包括:The defect detection method according to claim 7, wherein after performing line fitting on the point on the best vertical edge in the caliper area to obtain a fitted line, the method further comprises:
    计算每个所述拟合点与所述拟合线之间的最短距离;Calculating the shortest distance between each fitting point and the fitting line;
    筛选掉所述最短距离大于第一距离阈值的所述拟合点对应的所述最佳垂直边;Filtering out the best vertical edge corresponding to the fitting point where the shortest distance is greater than the first distance threshold;
    利用保留的所述最佳垂直边重新进行线拟合,以重新得到的拟合线 替代重新进行线拟合前的拟合线。The line fitting is performed again using the retained best vertical edge, and the fitting line obtained before replacing the line fitting is replaced with the obtained fitting line.
  11. 根据权利要求7所述的缺陷检测方法,其特征在于,在从所述卡尺区域内的垂直边中筛选出最佳垂直边之前,还包括:The defect detection method according to claim 7, wherein before selecting the best vertical edge from the vertical edges in the caliper area, the method further comprises:
    判断每个所述卡尺区域内是否存在所述最佳垂直边,若不存在所述最佳垂直边,则将所述卡尺区域标记为存在第一类缺陷特征;Determine whether the best vertical edge exists in each caliper area, and if the best vertical edge does not exist, mark the caliper area as having the first type of defect feature;
    若存在所述最佳垂直边,从所述卡尺区域内的垂直边中筛选出最佳垂直边。If there is the best vertical edge, the best vertical edge is selected from the vertical edges in the caliper area.
  12. 根据权利要求11所述的缺陷检测方法,其特征在于,所述根据所述最佳垂直边与所述拟合线之间的相对位置关系对所述卡尺区域进行缺陷标记的步骤进一步包括:The defect detection method according to claim 11, wherein the step of defect marking the caliper area according to the relative positional relationship between the best vertical edge and the fitting line further comprises:
    判断所述最佳垂直边上的拟合点与所述拟合线之间的最短距离是否大于预设的第二距离阈值;Determine whether the shortest distance between the fitting point on the best vertical edge and the fitting line is greater than a preset second distance threshold;
    若大于预设的第二距离阈值,则将所述卡尺区域标记为存在第二类缺陷特征。If it is greater than the preset second distance threshold, the caliper area is marked as having a second type of defect feature.
  13. 根据权利要求12所述的缺陷检测方法,其特征在于,还包括:The defect detection method according to claim 12, further comprising:
    对所述第一类缺陷特征和/或第二类缺陷特征的缺陷参数进行计算。Calculate the defect parameters of the first-type defect feature and/or the second-type defect feature.
  14. 根据权利要求13所述的缺陷检测方法,其特征在于,所述缺陷参数包括沿所述垂直边的方向的缺陷宽度、沿所述预设边的方向的缺陷高度以及缺陷面积中的至少一个。The defect detection method according to claim 13, wherein the defect parameter includes at least one of a defect width in the direction of the vertical side, a defect height in the direction of the preset side, and a defect area.
  15. 一种缺陷检测装置,其特征在于,包括依次连接的输入单元、处理器和输出单元;A defect detection device, characterized in that it comprises an input unit, a processor and an output unit connected in sequence;
    其中,所述输入单元用于获取待检测图像;所述处理器用于确定所述待检测图像中的感兴趣区域;将所述感兴趣区域分割成多个彼此独立且大小相同的卡尺区域;对各个所述卡尺区域进行垂直边检测,垂直边为卡尺区域中与所述卡尺区域的预设边垂直的线段;基于所述垂直边获取所述感兴趣区域的缺陷信息;所述输出单元用于输出所述缺陷信息。Wherein, the input unit is used to acquire the image to be detected; the processor is used to determine the region of interest in the image to be detected; the region of interest is divided into a plurality of independent caliper regions of the same size; Each caliper area is subjected to vertical edge detection, and the vertical edge is a line segment in the caliper area perpendicular to the preset edge of the caliper area; based on the vertical edge, the defect information of the region of interest is obtained; the output unit is used to Output the defect information.
PCT/CN2018/124287 2018-12-27 2018-12-27 Defect detection method and device WO2020133046A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880088392.8A CN111758024B (en) 2018-12-27 2018-12-27 Defect detection method and device
PCT/CN2018/124287 WO2020133046A1 (en) 2018-12-27 2018-12-27 Defect detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/124287 WO2020133046A1 (en) 2018-12-27 2018-12-27 Defect detection method and device

Publications (1)

Publication Number Publication Date
WO2020133046A1 true WO2020133046A1 (en) 2020-07-02

Family

ID=71127540

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/124287 WO2020133046A1 (en) 2018-12-27 2018-12-27 Defect detection method and device

Country Status (2)

Country Link
CN (1) CN111758024B (en)
WO (1) WO2020133046A1 (en)

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111768407A (en) * 2020-09-01 2020-10-13 征图新视(江苏)科技股份有限公司 Defect detection algorithm based on quick positioning
CN111862055A (en) * 2020-07-23 2020-10-30 中国计量大学 Leveling bubble turning cavity defect detection method based on image processing
CN112651946A (en) * 2020-12-29 2021-04-13 昆山丘钛光电科技有限公司 Chip gold wire detection method and device, electronic equipment and medium
CN113327241A (en) * 2021-06-16 2021-08-31 南昌航空大学 Visual detection method and system for surface defects of bearing end face
CN113554667A (en) * 2021-07-27 2021-10-26 上海海瞩智能科技有限公司 Three-dimensional displacement detection method and device based on image recognition
CN113689420A (en) * 2021-09-03 2021-11-23 凌云光技术股份有限公司 Method and device for detecting welding spot defects of circuit board and detection equipment
CN113781424A (en) * 2021-09-03 2021-12-10 苏州凌云光工业智能技术有限公司 Surface defect detection method, device and equipment
CN113899278A (en) * 2021-09-29 2022-01-07 中国航发动力股份有限公司 Device and method for detecting position degrees of two side faces of fan-shaped outer ring
CN114324168A (en) * 2022-01-04 2022-04-12 广东奥普特科技股份有限公司 Surface defect detection method and system
CN116012384A (en) * 2023-03-28 2023-04-25 梁山水泊胶带股份有限公司 Method for detecting surface defects of whole-core flame-retardant conveying belt
CN116258713A (en) * 2023-05-11 2023-06-13 青岛穗禾信达金属制品有限公司 Welding processing detection method for metal cabinet
CN116452598A (en) * 2023-06-20 2023-07-18 曼德惟尔(山东)智能制造有限公司 Axle production quality rapid detection method and system based on computer vision
CN116863175A (en) * 2023-08-31 2023-10-10 中江立江电子有限公司 Right-angle connector defect identification method, device, equipment and medium
CN116935077A (en) * 2023-07-26 2023-10-24 湖南视比特机器人有限公司 Template matching optimization method and system based on encoding and decoding
CN117173177A (en) * 2023-11-02 2023-12-05 泰州市航宇电器有限公司 Image-based metal shell optical size detection method and system
CN117197133A (en) * 2023-11-06 2023-12-08 湖南睿图智能科技有限公司 Control system and method for vision robot in complex industrial environment
CN117437233A (en) * 2023-12-21 2024-01-23 山东润通齿轮集团有限公司 Gear defect detection method and system based on image processing
CN117474902A (en) * 2023-12-25 2024-01-30 山东明佳科技有限公司 Method, system, equipment and storage medium for detecting missing of barrel fabric package

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113658133B (en) * 2021-08-16 2022-06-21 江苏鑫丰源机电有限公司 Gear surface defect detection method and system based on image processing

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090202135A1 (en) * 2008-02-07 2009-08-13 Keyence Corporation Defect Detection Apparatus, Defect Detection Method and Computer Program
US20130188859A1 (en) * 2012-01-20 2013-07-25 Kla-Tencor Corporation Segmentation for Wafer Inspection
CN105335963A (en) * 2015-09-24 2016-02-17 凌云光技术集团有限责任公司 Edge defect detection method and apparatus
CN106339710A (en) * 2016-08-25 2017-01-18 凌云光技术集团有限责任公司 Edge width defect detection method and edge width defect detection device
CN106408583A (en) * 2016-08-25 2017-02-15 凌云光技术集团有限责任公司 Multi-edge defect detecting method and device
CN106447649A (en) * 2016-08-25 2017-02-22 凌云光技术集团有限责任公司 Detection method and device of bead body position defect

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105405142B (en) * 2015-11-12 2019-04-05 冯平 A kind of the side defect inspection method and system of glass panel
CN106251352B (en) * 2016-07-29 2019-01-18 武汉大学 A kind of cover defect inspection method based on image procossing
CN107945155B (en) * 2017-11-13 2021-05-25 佛山缔乐视觉科技有限公司 Toothpaste tube shoulder defect detection method based on Gabor filter
CN107808378B (en) * 2017-11-20 2020-08-25 浙江大学 Method for detecting potential defects of complex-structure casting based on vertical longitudinal and transverse line profile features
CN108921861A (en) * 2018-05-15 2018-11-30 佛山市南海区广工大数控装备协同创新研究院 A kind of portable computer touch tablet edge detection method based on machine vision

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090202135A1 (en) * 2008-02-07 2009-08-13 Keyence Corporation Defect Detection Apparatus, Defect Detection Method and Computer Program
US20130188859A1 (en) * 2012-01-20 2013-07-25 Kla-Tencor Corporation Segmentation for Wafer Inspection
CN105335963A (en) * 2015-09-24 2016-02-17 凌云光技术集团有限责任公司 Edge defect detection method and apparatus
CN106339710A (en) * 2016-08-25 2017-01-18 凌云光技术集团有限责任公司 Edge width defect detection method and edge width defect detection device
CN106408583A (en) * 2016-08-25 2017-02-15 凌云光技术集团有限责任公司 Multi-edge defect detecting method and device
CN106447649A (en) * 2016-08-25 2017-02-22 凌云光技术集团有限责任公司 Detection method and device of bead body position defect

Cited By (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111862055B (en) * 2020-07-23 2024-03-05 中国计量大学 Bubble turning cavity defect detection method based on image processing
CN111862055A (en) * 2020-07-23 2020-10-30 中国计量大学 Leveling bubble turning cavity defect detection method based on image processing
CN111768407A (en) * 2020-09-01 2020-10-13 征图新视(江苏)科技股份有限公司 Defect detection algorithm based on quick positioning
CN112651946A (en) * 2020-12-29 2021-04-13 昆山丘钛光电科技有限公司 Chip gold wire detection method and device, electronic equipment and medium
CN113327241A (en) * 2021-06-16 2021-08-31 南昌航空大学 Visual detection method and system for surface defects of bearing end face
CN113554667A (en) * 2021-07-27 2021-10-26 上海海瞩智能科技有限公司 Three-dimensional displacement detection method and device based on image recognition
CN113554667B (en) * 2021-07-27 2023-12-12 上海海瞩智能科技有限公司 Three-dimensional displacement detection method and device based on image recognition
CN113689420A (en) * 2021-09-03 2021-11-23 凌云光技术股份有限公司 Method and device for detecting welding spot defects of circuit board and detection equipment
CN113781424A (en) * 2021-09-03 2021-12-10 苏州凌云光工业智能技术有限公司 Surface defect detection method, device and equipment
CN113781424B (en) * 2021-09-03 2024-02-27 苏州凌云光工业智能技术有限公司 Surface defect detection method, device and equipment
CN113899278A (en) * 2021-09-29 2022-01-07 中国航发动力股份有限公司 Device and method for detecting position degrees of two side faces of fan-shaped outer ring
CN113899278B (en) * 2021-09-29 2023-11-21 中国航发动力股份有限公司 Device and method for detecting positions of two side surfaces of fan-shaped outer ring
CN114324168A (en) * 2022-01-04 2022-04-12 广东奥普特科技股份有限公司 Surface defect detection method and system
CN116012384A (en) * 2023-03-28 2023-04-25 梁山水泊胶带股份有限公司 Method for detecting surface defects of whole-core flame-retardant conveying belt
CN116258713A (en) * 2023-05-11 2023-06-13 青岛穗禾信达金属制品有限公司 Welding processing detection method for metal cabinet
CN116452598B (en) * 2023-06-20 2023-08-29 曼德惟尔(山东)智能制造有限公司 Axle production quality rapid detection method and system based on computer vision
CN116452598A (en) * 2023-06-20 2023-07-18 曼德惟尔(山东)智能制造有限公司 Axle production quality rapid detection method and system based on computer vision
CN116935077A (en) * 2023-07-26 2023-10-24 湖南视比特机器人有限公司 Template matching optimization method and system based on encoding and decoding
CN116935077B (en) * 2023-07-26 2024-03-26 湖南视比特机器人有限公司 Template matching optimization method and system based on encoding and decoding
CN116863175B (en) * 2023-08-31 2023-12-26 中江立江电子有限公司 Right-angle connector defect identification method, device, equipment and medium
CN116863175A (en) * 2023-08-31 2023-10-10 中江立江电子有限公司 Right-angle connector defect identification method, device, equipment and medium
CN117173177A (en) * 2023-11-02 2023-12-05 泰州市航宇电器有限公司 Image-based metal shell optical size detection method and system
CN117197133A (en) * 2023-11-06 2023-12-08 湖南睿图智能科技有限公司 Control system and method for vision robot in complex industrial environment
CN117197133B (en) * 2023-11-06 2024-01-30 湖南睿图智能科技有限公司 Control system and method for vision robot in complex industrial environment
CN117437233A (en) * 2023-12-21 2024-01-23 山东润通齿轮集团有限公司 Gear defect detection method and system based on image processing
CN117437233B (en) * 2023-12-21 2024-03-26 山东润通齿轮集团有限公司 Gear defect detection method and system based on image processing
CN117474902A (en) * 2023-12-25 2024-01-30 山东明佳科技有限公司 Method, system, equipment and storage medium for detecting missing of barrel fabric package
CN117474902B (en) * 2023-12-25 2024-03-12 山东明佳科技有限公司 Method, system, equipment and storage medium for detecting missing of barrel fabric package

Also Published As

Publication number Publication date
CN111758024A (en) 2020-10-09
CN111758024B (en) 2023-03-21

Similar Documents

Publication Publication Date Title
WO2020133046A1 (en) Defect detection method and device
CN108921176B (en) Pointer instrument positioning and identifying method based on machine vision
CN108460757B (en) Mobile phone TFT-LCD screen Mura defect online automatic detection method
CN109507192B (en) Magnetic core surface defect detection method based on machine vision
US10330608B2 (en) Systems and methods for wafer surface feature detection, classification and quantification with wafer geometry metrology tools
JP4528309B2 (en) Object detection method, object detection apparatus, and object detection program
Zhang et al. Novel accurate and fast optic disc detection in retinal images with vessel distribution and directional characteristics
WO2021109697A1 (en) Character segmentation method and apparatus, and computer-readable storage medium
WO2022088620A1 (en) State detection method and apparatus for camera lens, device and storage medium
WO2018209941A1 (en) High-density circuit board circular hole sub-pixel detection method based on gaussian fitting
CN115330784B (en) Cloth surface defect detection method
EP2743886B1 (en) System for detecting structured artifacts in video sequences
CN115100206B (en) Printing defect identification method for textile with periodic pattern
CN109544464A (en) A kind of fire video image analysis method based on contours extract
CN106780526A (en) A kind of ferrite wafer alligatoring recognition methods
CN105787912B (en) Classification-based step type edge sub-pixel positioning method
WO2023231262A1 (en) Hoisting wire rope tension measurement method based on visual vibration frequency identification
CN109064439B (en) Partition-based single-side light-entering type light guide plate shadow defect extraction method
CN114022503A (en) Detection method, detection system, device and storage medium
CN114972575A (en) Linear fitting algorithm based on contour edge
KR101195917B1 (en) Acquisition method of Tongue Diagnosis Region
WO2020114134A1 (en) Visual processing method for identifying emery particles
CN108269264B (en) Denoising and fractal method of bean kernel image
CN111290582B (en) Projection interaction area positioning method based on improved linear detection
CN113554688B (en) O-shaped sealing ring size measurement method based on monocular vision

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: 18944901

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18/11/2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18944901

Country of ref document: EP

Kind code of ref document: A1