WO2020019648A1 - 一种机器视觉定位方法 - Google Patents

一种机器视觉定位方法 Download PDF

Info

Publication number
WO2020019648A1
WO2020019648A1 PCT/CN2018/122225 CN2018122225W WO2020019648A1 WO 2020019648 A1 WO2020019648 A1 WO 2020019648A1 CN 2018122225 W CN2018122225 W CN 2018122225W WO 2020019648 A1 WO2020019648 A1 WO 2020019648A1
Authority
WO
WIPO (PCT)
Prior art keywords
mark
candidate
boundary contour
boundary
contour line
Prior art date
Application number
PCT/CN2018/122225
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 WO2020019648A1 publication Critical patent/WO2020019648A1/zh

Links

Images

Classifications

    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras

Definitions

  • the invention relates to the technical field of high-precision mark positioning, and in particular to a machine vision positioning method.
  • Machine vision positioning is essential for certain areas of industry and manufacturing.
  • high-precision lithography requires high-precision machine positioning technology.
  • the mask can be accurately lithographed only if the positioning accuracy on the table is not more than 7 micrometers (um).
  • the accuracy of a positioning algorithm in an image acquired by an industrial camera is required to reach 1 pixel.
  • Hough transform clusters pixels with a certain relationship on the image. Specifically, the pixels having a linear relationship or a circular relationship are clustered, and then the one with the most accumulated number of pixels in the category is taken as the detection result. Hough transform uses the boundary contour information of the Mark mark. Therefore, in machine recognition, the boundary contour on the image must first be obtained.
  • Template matching is a method of pattern recognition. The detection result is obtained by calculating the similarity relationship between the template and the elements on the target image. In the case where the image of the Mark mark is clear and the contrast is good, both positioning methods can obtain satisfactory accuracy.
  • Hough transform is used to locate the Mark mark, which is less affected by the discontinuity and incompleteness of the boundary contour; it is not affected by the rotation of the Mark mark. Marks can be correctly identified even if they are partially defective or contaminated.
  • the positioning accuracy of the Hough transform depends heavily on the boundary contours in the image. In actual production, it is difficult to accurately obtain the boundary contours in the images obtained by industrial cameras. For example, the aging of the drilling blade that generates the Mark mark causes the boundary contour A of the Mark mark to be blurred, as shown in FIG. 2.
  • the Mark logo does not correspond to sharp but slowly changing border contours, which will cause the border contours of the Mark logo to be not a curve but a region with a certain width, as shown in Figure 3,
  • the boundary contour B shown at 3 has a certain radial width.
  • the boundary contour of the Mark mark obtained by the boundary contour detection algorithm will not be exactly on the original contour line of the Mark mark, which will lead to the detection result of sharp jump. Therefore, it is difficult to locate the Mark mark using Hough transform.
  • Template matching is a common localization algorithm in machine vision. Before the algorithm is executed, first create a template for matching. If the similarity between the pixels in the template and the pixels in a certain area of the image exceeds a threshold, the matching is successful and a matching result is given. However, in the application, the matched objects in the image may be contaminated or incomplete. At this time, the template matching algorithm fails, such as the incomplete boundary contour C and the contaminated boundary contour D shown in FIG. 4a. Moreover, the similarity measure of template matching is sensitive to noise and is greatly affected by changes in illumination, which results in a jump in the accuracy of the detection results.
  • An object of the present invention is to provide a machine vision positioning method to overcome or at least mitigate at least one of the above-mentioned defects in the prior art.
  • the present invention provides a machine vision positioning method.
  • the machine vision positioning method includes:
  • C is the consistency of the pixels inside the Mark mark
  • a small value of C indicates that the degree of pixel consistency in the area inside the candidate boundary contour line is high
  • H d is the entropy of the pixel distribution in the Mark mark
  • p i is A proportion of pixels having an intensity i in the Mark mark to all the pixels in the Mark mark
  • S is the sharpness of all the border contour pixels
  • Sk is the inner product of the gradient of the two pixel points as the sharpness of the border contour pixels
  • G S is a pixel P r, c on the border contour on the standard Gl in the image
  • G l is the gradient of a pixel P r, c in the image to be positioned on the border contour
  • k is all pixels on the border contour
  • is a weight
  • S1 obtains the preliminary boundary contour line by using a feature selection method of roundness, area, and circumscribed radius.
  • S2 uses the circle center method of the Hough transform to obtain the center of the region where the preliminary boundary contour line is located.
  • S1 obtains the preliminary boundary contour line by using a straight line method of Hough transform.
  • S2 specifically includes:
  • the present invention uses positioning based on the internal consistency of Mark marks and sharpness of the border, compared with the traditional machine vision Mark positioning method, the present invention has better accuracy.
  • the method of the invention can optimize the algorithm and adopt the parallel computing method provided by the GPU, which can improve the operation efficiency and the overall processing speed.
  • FIG. 1 is a schematic diagram of various Mark marks commonly used in the prior art
  • FIG. 2 is a schematic diagram of the blurred outline of the Mark mark boundary caused by the aging of the drilling blade
  • FIG. 3 is a schematic diagram of a region where a boundary contour line is formed due to a slowly changing boundary contour line of the Mark mark.
  • the boundary contour line illustrated in the figure is not a curve;
  • FIG. 4a is a schematic diagram of an incomplete Mark mark
  • 4b is a schematic diagram of a polluted Mark mark
  • FIG. 5 is a schematic diagram of an internal consistency example of a Mark mark
  • FIGS. 6a and 6b are Mark marks taken by an industrial camera, and the circles shown in FIGS. 6a and 6b are the boundary contour lines of two different candidate centers under the same radius, respectively;
  • FIG. 7 is a schematic diagram of a gradient contour line of an ideal Mark mark
  • FIG. 8 is an enlarged schematic diagram of a boundary contour of an Mark obtained by an industrial camera
  • FIG. 9 is a schematic diagram of a machine vision positioning method provided by the present invention.
  • FIG. 10 is an image to be positioned
  • FIG. 11 is an approximate position of a Mark mark obtained by binarizing the image shown in FIG. 10 according to the present invention.
  • FIG. 12 is an f-value calculated using the method of the present invention.
  • Figure 13 is a schematic diagram of the experimental results.
  • the machine vision positioning method provided in this embodiment includes:
  • S1 Perform a binarization process on the image, and obtain a preliminary boundary contour line of the Mark mark to be located in the image.
  • S2 Determine the center of the area where the preliminary boundary contour line obtained by S1 is the initial center of the Mark mark.
  • the candidate center is the initial center.
  • the candidate center is the candidate center.
  • the candidate center is the geometric center.
  • a dynamic adjustment range of the center to the boundary is set, and a corresponding candidate distance from each of the candidate centers to the boundary is determined.
  • the standard distance is the standard radius, which is determined according to the actual size of the round Mark marks.
  • the corresponding candidate distance from each candidate center to the boundary is the candidate radius.
  • the standard distance from the center to the boundary is determined according to the actual size of the non-circular Mark mark.
  • the position of the candidate center and the candidate distance can be regarded as a three-dimensional discrete space, in fact, all possibilities are exhausted in the three-dimensional discrete space.
  • the circle is taken as an example to describe the method of determining the candidate center in S3 and the candidate radius and candidate boundary contour in S4.
  • the user can set the dynamic adjustment range of the candidate center, for example, set a range of 10 * 10 (pixels), then the candidate center can be (90, 90) ,, ... (91,90,),..., (91,91),..., (110,110).
  • the candidate radius can be 180, 181, 182, ..., 218, 219, 220.
  • a plurality of candidate circles are determined, and these candidate circles are candidate boundary contour lines.
  • C is the consistency of the pixels inside the Mark mark
  • a small value of C indicates that the degree of pixel consistency in the inner area of the candidate boundary contour line is high
  • H d is the entropy of the pixel distribution in the Mark mark
  • p i is A proportion of pixels having an intensity i in the Mark mark to all the pixels in the Mark mark
  • S is the sharpness of all boundary pixels of the contour lines
  • S K is a sharpness of a boundary pixel of said candidate contour
  • G S is the candidate boundary contour line of a pixel P r
  • G l is the gradient of a pixel P r
  • k is all pixels located on the candidate boundary contour line
  • k may be determined by one of ordinary skill in the art. Determined by common methods.
  • standard image refers to an image generated by drawing software. For example, the drawing software generates a standard circle with a radius of 200, and the inside of the contour line (including the edge part) of the circle is completely black (the gray value is 0). , The rest of the gray values are 255.
  • is a weight.
  • the weight ⁇ is selected through experiments. Mark marks under different circumstances, the choice of weight is different. This will go through experiments, then get regression equations based on experimental data, and finally get weights.
  • the range of the weight ⁇ in this embodiment is [0.05, 0.35].
  • S1 when the Mark mark is circular, S1 obtains the preliminary boundary contour line by using a feature selection method of roundness, area, and circumscribed radius.
  • the characteristics of roundness, area and circumscribed radius are determined by the present invention according to actual production.
  • S2 uses the circle center method of the Hough transform to obtain the center of the region where the preliminary boundary contour line is located.
  • S1 obtains the preliminary boundary contour line by using a straight line method of Hough transform.
  • S2 specifically includes:
  • An average value is obtained according to each of the intersection points obtained in S21 to obtain an initial center of the Mark mark. For example: for a triangle Mark mark, using the Hough transform's straight line method, three straight lines will be obtained, and then the three straight lines will intersect to form three intersection points. By averaging the three intersection points, the preliminary center of the triangle Mark position can be obtained.
  • the consistency of the internal pixels of the Mark mark and the sharpness of the pixels passing by the candidate boundary contour line are considered at the same time to achieve high-precision Mark mark positioning.
  • the precise positioning method of the present invention is applicable to the following Mark marks. Next, the method of the present invention will be explained using a solid circle as an example.
  • circle E solid line
  • the circle E is the boundary contour line to which the method of the present invention needs to be positioned.
  • circle E, circle F and circle in FIG. G Inside circle F (dashed line), most of them are black pixels, and a few are "motley" white pixels.
  • the image of the Mark mark captured by an industrial camera is a grayscale image.
  • the consistency of the pixels in the candidate curve can be used as a measure of the true position of the Mark mark.
  • Fig. 6a and Fig. 6b respectively show Mark marks taken by an industrial camera.
  • the candidate center of the candidate circle H is O1
  • the candidate center of the candidate circle I is O2
  • the radius of the candidate circle H and the candidate circle I are the same.
  • the internal pixels included in the candidate circle H in FIG. 6 a are all gray, while the internal pixels included in the candidate circle I in FIG. 6 b are mostly gray, and a part of them are white, and a darker gray.
  • the consistency of the internal pixels included in the candidate circle H in FIG. 6a is greater than that in FIG. 6b, so the center of the candidate circle H in FIG.
  • the internal consistency of the Mark mark can be used as a measure of the Mark mark.
  • S6 of the present invention uses the entropy obtained from the pixel distribution inside the Mark mark as a criterion for determining consistency.
  • the distribution of pixels inside the Mark mark at the real position tends to be consistent, and the corresponding entropy value is the smallest.
  • the index C of the entropy is used to represent the consistency of the pixels inside the Mark mark. If the value of C is smaller, the inner pixels included in the surface candidate curve are more consistent, and the candidate position is closer to the true position indicated by the Mark mark.
  • the consistency of the internal pixels represents the shape of the pixels that make up the Mark logo.
  • the border contour of the Mark logo that is, the sharpness of the border contour pixels.
  • the pixel gradient value represents whether the pixel is a boundary contour of the image.
  • the gradient value of a pixel is used to measure the sharpness of the border contour line pixel.
  • the circle E is an ideal boundary contour, and all pixels passing by it have a non-zero gradient.
  • FIG. 7 is an enlarged view of a boundary contour line in FIG. 5.
  • first derivatives which are first derivatives in the x-axis direction and y-axis direction
  • the x-axis is positive in the horizontal direction to the right in the figure
  • the y-axis is positive in the downward direction
  • the derivative values are -255.
  • the arrow G S in FIG. 7 indicates the direction of the gradient.
  • the circle F and the circle G are not the boundary contours of the Mark mark.
  • FIG. 8 is an enlarged view of a part of the boundary contour line in FIG. 6a. It can be seen from FIG. 8 that the boundary contour of the image of the Mark logo does not have the sudden change of the boundary contour in FIG. 7, but changes slowly. In FIG. 8, all pixels have gradient values except for the white pixels. For a candidate center, the pixels passing by its boundary contour have a certain gradient value. If the candidate center is the real position indicated by the Mark mark, the similarity between the pixels passing by the boundary contour line and the gradient of the pixel points in FIG. 7 is the highest. This similarity can be expressed using the inner product of two vectors, that is, the inner product of the G S vector in FIG. 8 and the vector G l in FIG. 7 at the corresponding position. The larger the inner product value, the higher the similarity between the two vectors.
  • the present invention uses the gradient inner product to measure the sharpness of the pixels of the border contour lines.
  • a standard black-and-white image (ideal Mark mark) which is the same as the outline of the mark mark to be determined is calculated, and the gradient on the pixels of the border outline is calculated, that is, the vector G l in FIG. 7.
  • calculate the gradient of the position of the boundary contour line of the mark to be determined in the image to be located that is, the G S vector in FIG. 8, and finally calculate the inner product of the two.
  • the gradient of a pixel P r, c on the boundary contour in the standard image and the image to be positioned is G S and G l
  • the inner product of the gradient of the two pixels is the sharpness of the boundary contour pixel:
  • a parallel algorithm can be designed to use the GPU's parallel calculation to quickly obtain the effect.
  • FIG. 11 is an approximate position of the Mark mark obtained after binarizing the image in FIG. 10, that is, a boundary contour line J and a circle center O3.
  • the boundary contour line K and the circle center O4 shown in FIG. 12 and the boundary contour line L and the circle center O5 shown in FIG. 13 are the candidate boundary contour lines and their corresponding circle centers, and the calculated f value.
  • This embodiment provides an example for precise positioning of a circular Mark by using the method of the present invention.
  • the image is from an industrial camera in the PCB Laser Direct Imaging Device of Xinnuo Technology Co., Ltd.
  • the first step is to use binarization, using the roundness, area, and circumscribed radius features to select the area where the Mark mark is located.
  • the center point of the area is obtained as the initial position of the position indicated by the Mark mark.
  • the second step is to set the area marked by the Mark mark near the initial position and set the dynamic adjustment range of the circle radius.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)
  • Length Measuring Devices By Optical Means (AREA)

Abstract

一种机器视觉定位方法,该方法包括:S1,对图像进行二值化处理,并获取待定位的Mark标志在图像中的初步边界轮廓线;S2,获取初步边界轮廓线所在区域的中心作为Mark标志的初始中心;S3,在初始中心的位置附近选择多个候选中心;S4,根据Mark标志的中心到边界的标准距离,设置中心到边界的动态调整范围,确定各候选中心到边界的相应候选距离;S5,获得多个候选边界轮廓线;S6,判断每一个候选边界轮廓线内部区域的像素一致性;S7,判断每一个候选边界轮廓线经过的像素点的锐利性;S8,定位Mark标志的边界轮廓线。由于该方法采用基于Mark标志位内部一致性和边界锐利性的进行定位,与传统的机器视觉Mark定位方法相比,该方法有更好的精度。

Description

一种机器视觉定位方法 技术领域
本发明涉及高精度标志定位技术领域,特别是涉及一种机器视觉定位方法。
背景技术
近年来,得益于大数据、云计算、深度学习等技术的进步和突破,人工智能得到了长足的发展。人工智能越来越多地应用在工业和制造业中。一般认为正在进行的工业4.0是依托在人工智能发展基础上的综合产业革命。机器视觉(Machine Vision)是人工智能的重要分支之一,它是利用摄像头代替人眼进行目标的判断、测量和定位等。基于Mark形状的定位是机器视觉中最为普遍的一种工业应用,也是很多工业和制造业中的一道必备工序。比如:PCB板检测时,需要通过PCB板上的圆形标志获取PCB板在工作台上的位置,从而进行扫描检测工序。
机器视觉定位,特别是高精度的定位方法对于工业和制造业的某些领域来说至关重要。在数字光刻中,高精度的光刻技术需要高精度的机器定位技术。例如,最小特征尺寸为100微米(um)的胶片掩模板,只有在工作台上的定位精度不超7微米(um),才可以准确对掩模板进行光刻。对应地,在工业相机获取的图像中的定位算法的精度要求达到1个像素。
人们设计了多种用于视觉定位的Mark标志。如图1所示,常见的Mark标志有:实心圆、三角形、菱形、方形和十字形等。最常用的是实心圆Mark标志。常用的Mark定位方法有两种:Hough变换和模板匹配。Hough变换是将图像上的具有一定关系的像素进行聚类。具体来说,是将具有直线关系,或者是圆关系的像素进行聚类,然后取类别中像素累加个数最多的作为检测结果。Hough变换使用的是Mark标志的边界轮廓线信息,因此在机器识别中,首先要获取图像上的边界轮廓线。模板匹配是一种模式识别方法。通过计算模板和目标图像上元素的相似关系,得到检测结果。在Mark标志所在图像清晰,对比度较好的情况下,两种定位方法都可以得到令人满意的精度。
使用Hough变换对Mark标志进行定位,受边界轮廓线间断、残缺影响小;不受Mark定位标志旋转影响等优点。即使Mark标志有部分缺损或污染也能被正确识别。但Hough变换的定位精度严重依赖图像中的边界轮廓线。在实际生产中,很难准确得到工业相机获取图像中边界轮廓线。比如:产生Mark标志的钻孔刀片的老化,导致Mark标志的边界轮廓线A模糊,如图2所示。在某些光照条件下,Mark标志对应的不是锐利、而是缓慢变化的边界轮廓线,这会导致Mark标志的边界轮廓线不是曲线,而是具有一定宽度的区域,如图3所示,图3示出的边界轮廓线B具有一定的径向宽度。
此外,因为光照,相机等设备的影响,边界轮廓线检测算法获取的Mark标志的边界轮廓线并不会准确处于原本Mark标志为的边界轮廓线上,这会导致出现剧烈跳动的检测结果。因此,使用Hough变换对Mark标志进行定位存在一定的难度。
模板匹配是目前机器视觉常见的定位算法。在算法执行前,首先要创建用于匹配的模板。如果模板内的像素点与图像某区域的像素点相似度超过阈值,则匹配成功,给出匹配结果。但在应用中,会出现图像中被匹配的对象被污染,或者残缺,此时模板匹配算法失效,如图4a示出的残缺的边界轮廓线C和被污染的边界轮廓线D。而且,模板匹配的相似性度量对噪声敏感,受光照变化的影响大,导致检测结果精度产生跳动。
还有部分研究者从机器学习中的对象检测角度来研究Mark标志的定位。他们认为Mark标志是图像中的一种语义对象,可以通过训练分类器一确定图像中是否存在Mark标志,以及Mark标志的位置。但以上这些方法都不能处理Mark标志边界轮廓线模糊,受污染,缺失等情况,使得现有的机器视觉Mark标志定位方法很难在实际复杂的生产环境中对Mark标志进行精确定位。
发明内容
本发明的目的在于提供一种机器视觉定位方法来克服或至少减轻现有技术的上述缺陷中的至少一个。
为实现上述目的,本发明提供一种机器视觉定位方法,机器视觉定位方法包括:
S1,对图像进行二值化处理,并获取待定位的Mark标志在所述图像中的初步边界轮廓线;
S2,获取所述初步边界轮廓线所在区域的中心作为所述Mark标志的初始中心;
S3,在所述初始中心的位置附近选择多个候选中心;
S4,根据所述Mark标志的中心到边界的标准距离,设置中心到边界的动态调整范围,确定各所述候选中心到边界的相应候选距离;
S5,依据S3选择的多个所述候选中心以及S4确定的所述候选距离,获得多个候选边界轮廓线;
S6,根据S5中的各所述候选边界轮廓线,通过如下的C的表达式,判断每一个所述候选边界轮廓线内部区域的像素一致性;
C=exp(H d);
Figure PCTCN2018122225-appb-000001
式中,C是所述Mark标志内部像素的一致性,C值小表示所述候选边界轮廓线内部区域的像素一致性程度高,H d是所述Mark标志内的像素分布熵,p i是所述Mark标志内部具有强度为i的像素点占所有Mark标志内部像素点的比例;
S7,根据S5中的各所述候选边界轮廓线,通过如下的S的表达式,判断每一个所述候选边界轮廓线经过的像素点的锐利性:
Figure PCTCN2018122225-appb-000002
S k=G S·G l
式中,S是所有边界轮廓线像素的锐利度,S k是两个像素点的梯度内积为边界轮廓线像素的锐利度,G S是边界轮廓线上某个像素P r,c在标准图像中的梯度,G l是边界轮廓线上某个像素P r,c在待定位图像中的梯度,k是位于边界轮廓线上的所有像素;
S8,使用如下的f表达式,计算S5中的各所述候选边界轮廓线的f值,并将f值最小对应的所述候选边界轮廓线定位为所述Mark标志的边界轮廓线;
f=αC+(1-α)S;
式中,α是权重。
进一步地,所述Mark标志为圆形时,S1利用圆度、面积和外接半径的特征选取方法获取所述初步边界轮廓线。
进一步地,S2使用Hough变换的圆心方法获取所述初步边界轮廓线所在区域的中心。
进一步地,所述Mark标志为非圆形时,S1利用Hough变换的直线方法获取所述初步边界轮廓线。
进一步地,S2具体包括:
S21,S1得到的所述初步边界轮廓线的多条轮廓线相交,形成多个交点;
S22,根据S21得到的各所述交点,取平均值,得到所述Mark标志的初始中心。
由于本发明采用基于Mark标志位内部一致性和边界锐利性的进行定位,与传统的机器视觉Mark定位方法相比,本发明有更好的精度。本发明方法在实际检测的过程中,可以对算法进行优化以及采用GPU提供的并行计算方法,可以提高运算效率与总体处理速度。
附图说明
图1是现有技术中常见的多种Mark标志示意图;
图2是钻孔刀片老化导致的Mark标志边界轮廓线模糊示意图;
图3是Mark标志边界轮廓线缓慢变化导致边界轮廓线形成区域示意图,图中示意的边界轮廓线不是曲线;
图4a是残缺的Mark标志示意图;
图4b是被污染的Mark标志示意图;
图5是Mark标志内部一致性示例示意图;
图6a和图6b是某工业相机拍摄的Mark标志,图6a和图6b中示出的圆分别是两个不同候选中心、在相同半径下的边界轮廓线;
图7是理想Mark标志边界轮廓线梯度示意图;
图8是工业相机获取Mark标志的边界轮廓线放大示意图;
图9是本发明所提供的机器视觉定位方法的框架示意图;
图10是待定位的图像;
图11是本发明在对图10所示的图像二值化后得到的Mark标志的大致位置;
图12是使用本发明方法计算得到的f值;
图13是实验结果示意图。
具体实施方式
在附图中,使用相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面结合附图对本发明的实施例进行详细说明。
在本发明的描述中,术语“中心”、“纵向”、“横向”、“前”、“后”、“左”、“右”、“竖直”、“水平”、“顶”、“底”“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明保护范围的限制。
如图9所示,本实施例所提供的机器视觉定位方法包括:
S1,对图像进行二值化处理,并获取待定位的Mark标志在所述图像中的初步边界轮廓线。
S2,将S1获取的所述初步边界轮廓线所在区域的中心确定为所述Mark标志的初始中心。对于圆形的Mark标志而言,候选中心即为初始中心。
S3,在S2确定的所述初始中心的位置附近选择多个候选中心。对于圆形的Mark标志而言,候选中心即为候选中心。对于非圆形的Mark标志而言,候选中心即为几何中心。
S4,根据所述Mark标志的中心到边界的标准距离,设置中心到边界的动态调整范围,确定各所述候选中心到边界的相应候选距离。对于圆形的Mark标志而言,标准距离即为标准半径,该标准半径根据圆形Mark标志的实际尺寸确定。各所述候选中心到边界的相应候选距离即为候选半径。对于非圆形的Mark标志而言,中心到边界的标准距离,该标准距离根据非圆形的Mark标志的实际尺寸确定。
需要说明的是,上述的S3和S4可以并列实施,也可以颠倒顺序实施。
S5,依据S3所选择的多个所述候选中心以及S4确定的所述候选距离,获得多个候选边界轮廓线。对于圆形的Mark标志而言,候选边界轮廓线即为候选圆圈。
具体地,可以将所述候选中心的位置和候选距离当成三维离散空间,实际上是要在该三维离散空间中穷举所有可能。以圆形为例说明S3中的候选中心以及S4中的候选半径和候选边界轮廓线的确定方法。
比如S3中:如果初始中心的位置为(100,100),用户可以设置候选中 心的动态调整范围,例如设置10*10(像素)的范围,那么,候选中心可以是(90,90),,…(91,90,),…,(91,91),…,(110,110)。
比如S4中:用户输入标准半径为200,例如设置中心到边界的动态调整范围最大为标准半径的10%,那么,候选半径可以是180,181,182,…,218,219,220。
S5中,首先,根据S3确定的候选中心和S4确定的候选半径,进行如下组合:
(90,90,180),(90,90,181),…(90,90,220),(91,90,180),(91,90,181),…,(91,90,220),(91,91,180),…,(110,110,220),一共有11*11*41个组合。
然后,根据上述组合,确定多个候选圆圈,这些候选圆圈即为候选边界轮廓线。
S6,根据S5中的各所述候选边界轮廓线,通过如下的C的表达式,判断每一个所述候选边界轮廓线内部区域的像素一致性;
C=exp(H d);
Figure PCTCN2018122225-appb-000003
式中,C是所述Mark标志内部像素的一致性,C值小表示所述候选边界轮廓线内部区域的像素一致性程度高,H d是所述Mark标志内的像素分布熵,p i是所述Mark标志内部具有强度为i的像素点占所有Mark标志内部像素点的比例;
S7,根据S5中的各所述候选边界轮廓线,通过如下的S的表达式,判断每一个所述候选边界轮廓线经过的像素点的锐利性:
Figure PCTCN2018122225-appb-000004
S k=G S·G l
式中,S是所有边界轮廓线像素的锐利度,S k是所述候选边界轮廓线的像素的锐利度,G S是所述候选边界轮廓线上某个像素P r,c在标准图像中的梯度,G l是所述候选边界轮廓线上某个像素P r,c在待定位图像中的梯度,k是位于所述候选边界轮廓线上的所有像素,k可以按照本领域普通技术人员常用的方法确定。其中,“标准图像”是指由绘图软件生成的图像,例如:绘图软件生成一个 标准的半径为200的圆,圆的边缘轮廓线内部(包括边缘部分)为全黑(灰度值为0),其余的部分灰度值均为255。
S8,根据S6得到的C值和S7得到的S值,使用如下的f表达式,计算S5中的各所述候选边界轮廓线的f值,并将f值最小对应的所述候选边界轮廓线定位为所述Mark标志的边界轮廓线;
f=αC+(1-α)S;
式中,α是权重。权重α是通过实验进行选取。不同情况下的Mark标志,权重的选取是不一样的。这个要经过实验,然后根据实验数据得到回归方程,最终会得到权重。本实施例的权重α的范围为[0.05,0.35]。
在一个实施例中,所述Mark标志为圆形时,S1利用圆度、面积和外接半径的特征选取方法获取所述初步边界轮廓线。圆度、面积和外接半径这些特征是本发明依据实际生产而定。
在一个实施例中,S2使用Hough变换的圆心方法获取所述初步边界轮廓线所在区域的中心。
在一个实施例中,所述Mark标志为非圆形时,S1利用Hough变换的直线方法获取所述初步边界轮廓线。
在一个实施例中,S2具体包括:
S21,S1得到的所述初步边界轮廓线的多条轮廓线相交,形成多个交点;
S22,根据S21得到的各所述交点,取平均值,得到所述Mark标志的初始中心。比如:对于三角形的Mark标志,使用Hough变换的直线方法,会得到三条直线,然后三条直线相交,会形成三个交点。三个交点求平均值,就可以得到三角形Mark位置的初步中心。
本实施例同时考虑Mark标志的内部像素点的一致性和候选边界轮廓线经过的像素点的锐利性,以达到高精度的Mark标志定位。通过选取f值最小对应的所述候选边界轮廓线定位为所述Mark标志的边界轮廓线,因此,不论何种情况下,Mark标志在图像中的内部像素具有最大程度的一致性,而对于候选边界轮廓线经过的像素点,则具有最大的锐利性。
本发明的精确定位方法适用于下面这些Mark标志。接下来会以实心圆作为实例,阐述本发明方法。
以实心圆Mark标志为例。如图5所示,图中的圆圈E(实线)给出的是理想的标准的实心圆Mark标志的边界轮廓线,在圆圈E中,其包含的像素均 为黑色,不包含“杂色”——白色,该圆圈E即为本发明方法需要定位到的边界轮廓线。而实际使用本发明方法的时候,需要确定依据S3选择的多个所述候选中心以及S4确定的所述候选半径,获得多个候选圆圈,例如确定了图5中的圆圈E、圆圈F和圆圈G。在圆圈F(虚线)内部,大部分为黑色像素,很少一部分为“杂色”白色像素;在圆圈G(虚线)内部,包含的区域内部,黑色像素比圆圈F内部区域的多,而白色像素比黑色曲线内部区域的少。显然,在圆圈E内部,圆心是黑色的Mark标志标识的真实位置,而圆圈F和圆圈G的圆心,与Mark标志标识的真实位置之间有一定偏差。待选的圆心所构成的圆圈内部,像素的一致性越高,则越接近真实位置。
在实际生产中,在工业相机拍摄的Mark标志的图像为灰度图像。待选曲线内部像素的一致性可以作为Mark标志标识真实位置的一种衡量标准。例如,图6a和图6b分别表示某工业相机拍摄的Mark标志,候选圆圈H的候选中心为O1,候选圆圈I的候选中心为O2,候选圆圈H和候选圆圈I的半径相同。
图6a中的候选圆圈H所包含的内部像素都是灰色,而图6b的候选圆圈I所包含的内部像素除了大部分为灰色,还有一部分为白色,以及颜色更深的灰色。显然,图6a中候选圆圈H包含的内部像素的一致性大于图6b,因此图6a中的候选圆圈H的圆心更接近Mark标志表示的真实位置。Mark标志内部一致性可以作为Mark标志的一种衡量标准。
本发明的S6使用Mark标志内部像素分布所得到的熵作为一致性的判断标准。真实位置上的Mark标志内部像素的分布趋于一致,对应的熵的值最小。在实际应用中,为了使得一致性更具区分性,使用熵的指数C表示Mark标志内部像素的一致性。如果C的值越小,则表面候选曲线包含的内部像素越一致,则该候选位置越接近Mark标志表示的真实位置。
工业相机得到的图像,内部像素的一致性表征的是构成Mark标志的像素所组成的形状。依据前面介绍的工业相机得到Mark标志图像中存在的问题,除了要考虑内部像素的一致性,还需要考虑Mark标志的边界轮廓线,也就是边界轮廓线像素的锐利性。图像中,像素梯度值表征该像素是否为图像的边界轮廓线。本发明使用像素的梯度值来衡量边界轮廓线像素的锐利性。对于图5给出的理想Mark标志而言,圆圈E是理想的边界轮廓线,其经过的所有像素都具有不为零的梯度。图7是图5中某边界轮廓线处的放大图,以一阶导数构成的梯度为例,图中箭头表示的是一阶导数,分别为x轴方向和y轴方向上的 一阶导数,图中示出的图像坐标系中,x轴在图中水平朝向右方为正方向,y轴是,朝向下方为正方向,导数值均为-255。图7中的箭头G S表示的是梯度的方向。图7中的G曲线和F曲线,除了与图7中的曲线E相交的像素点外,G曲线和F曲线上其余的像素点的梯度均为0。所以,在图5中,圆圈F和圆圈G不是Mark标志的边界轮廓线。
由工业相机获取到的Mark标志图像的边界轮廓线要比理想的Mark标志图像更为复杂。图8给出图6a中部分边界轮廓线的放大图。从图8中可以看到,Mark标志的图像边界轮廓线没有图7中的边界轮廓线突变,而是缓慢变化。图8中,除了白色像素,其余像素都具有梯度值。对于某个候选中心,其边界轮廓线经过的像素都具有一定的梯度值。如果候选中心是Mark标志表示的真实位置,那么其边界轮廓线经过的像素与图7中的像素点的梯度之间的相似度最高。这种相似度可以使用两个向量的内积表示,也就是可以使用对应位置上,图8中的G S向量和图7中向量G l的内积表示。内积值越大,则两个向量相似度越高。
本发明使用梯度内积衡量边界轮廓线像素的锐利度。首先生成与待判定Mark标志边界轮廓线相同的标准黑白图像(理想Mark标志),计算边界轮廓线像素上的梯度,也就是图7中的向量G l。然后计算待判定Mark标志在待定位图像中边界轮廓线位置的梯度,也就是图8中的G S向量,最后计算两者的内积。假设边界轮廓线上某个像素P r,c在标准图像中和待定位图像中的梯度分别为G S和G l,则两个像素点的梯度内积为边界轮廓线像素的锐利度:
S k=G S·G l
需要说明的是,对于向量而言存在符号,符号也能表征边界轮廓线的锐利度。符号相反,实际上说明的是边界轮廓线部分锐利度是相反的。比如:对于白底黑色为圆形前景色的图片(理想Mark标志)而言,圆的左上角部分边界轮廓线的梯度均为负数。而机器视觉中的定位孔,在成像中,同样Mark圆形是颜色较深的前景色,而背景色颜色较浅。所以,如果得到的实际图片中,左上角边界轮廓线像素的梯度是正的值,说明该边界轮廓线并不是从白色(背景色)到黑色(前景色)的过度,而是反过来由黑色到白色的。显然不应该是真正圆心和半径对应的边界轮廓线。
为了与像素内部一致性的取值一致,使用上面的式子S表示所有边界轮廓线像素的锐利度。
最终用下面的线性表达式给出的函数表示综合考虑Mark标志内部像素的一致性和边界轮廓线锐利度的结果:
f=αC+(1-α)S
计算不同位置的Mark位置的f值,取最小值作为最终结果。
因为不同位置和不同Mark标志参数的计算不会相互影响,所以可以设计并行算法,使用GPU的并行计算,快速得到效果。
图10给出了一张需要使用Mark标志进行定位的图像。图中的Mark标志因为表面有覆膜,因此造成边界轮廓线不清晰。这种情况下Hough给出的结果不准确。因为Mark标志对应的孔洞有被污染的情况,所以使用模板匹配无法检测到该Mark标志。图11将图10中的图像二值化后,得到的Mark标志的大致位置,即边界轮廓线J和圆心O3。图12示出的边界轮廓线K和圆心O4以及图13示出了边界轮廓线L和圆心O5是所述候选边界轮廓线及其对应的圆心,计算得到的f值。
本实施例提供一个采用本发明方法的用于圆形Mark精确定位的实例。
本实施例中,图像来自新诺公司科技股份有限公司PCB激光直接成像设备中的工业摄像机。
第一步,利用二值化,使用圆度、面积、外接半径特征,选中Mark标志所在区域。并求出区域的中心点作为Mark标志表示位置的初始位置。
第二步,在初始位置附近,设置Mark标志标识位置的区域,并设置圆形半径动态调整范围。使用f表达式,计算不同位置和不同半径下的f值。在所有结果中找出最小值,作为输出结果,即图14中示出的边界轮廓线M和圆心O6。
最后需要指出的是:以上实施例仅用以说明本发明的技术方案,而非对其限制。本领域的普通技术人员应当理解:可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (5)

  1. 一种机器视觉定位方法,其特征在于,包括:
    S1,对图像进行二值化处理,并获取待定位的Mark标志在所述图像中的初步边界轮廓线;
    S2,将S1获取的所述初步边界轮廓线所在区域的中心确定为所述Mark标志的初始中心;
    S3,在S2确定的所述初始中心的位置附近选择多个候选中心;
    S4,根据所述Mark标志的中心到边界的标准距离,设置中心到边界的动态调整范围,确定各所述候选中心到边界的相应候选距离;
    S5,依据S3所选择的多个所述候选中心以及S4确定的所述候选距离,获得多个候选边界轮廓线;
    S6,根据S5获得的各所述候选边界轮廓线,通过如下C的表达式,判断每一个所述候选边界轮廓线内部区域的像素一致性;
    C=exp(H d);
    Figure PCTCN2018122225-appb-100001
    式中,C是所述Mark标志内部像素的一致性,C值小表示所述候选边界轮廓线内部区域的像素一致性程度高,H d是所述Mark标志内的像素分布熵,p i是所述Mark标志内部具有强度为i的像素点占所有Mark标志内部像素点的比例;
    S7,根据S5获得的各所述候选边界轮廓线,通过如下S的表达式,判断每一个所述候选边界轮廓线经过的像素点的锐利性:
    Figure PCTCN2018122225-appb-100002
    S k=G S·G l
    式中,S是所有所述候选边界轮廓线像素的锐利度,S k是所述候选边界轮廓线像素的锐利度,G S是所述候选边界轮廓线上的某个像素P r,c在标准图像中的梯度,G l是所述候选边界轮廓线某个像素P r,c在待定位图像中的梯度,k是位于所述候选边界轮廓线上的所有像素;
    S8,使用如下f表达式,根据S6得到的C值和S7得到的S值,计算S5中的各所述候选边界轮廓线的f值,并将f值最小对应的所述候选边界轮廓线定位为所述Mark标志的边界轮廓线;
    f=αC+(1-α)S;
    式中,α是权重。
  2. 如权利要求1所述的机器视觉定位方法,其特征在于,所述Mark标志为圆形时,S1利用圆度、面积和外接半径的特征选取方法获取所述初步边界轮廓线。
  3. 如权利要求2所述的机器视觉定位方法,其特征在于,S2使用Hough变换的圆心方法获取所述初步边界轮廓线所在区域的中心。
  4. 如权利要求1所述的机器视觉定位方法,其特征在于,所述Mark标志为非圆形时,S1利用Hough变换的直线方法获取所述初步边界轮廓线。
  5. 如权利要求4所述的机器视觉定位方法,其特征在于,S2具体包括:
    S21,S1得到的所述初步边界轮廓线的多条轮廓线相交,形成多个交点;
    S22,根据S21得到的各所述交点,取平均值,得到所述Mark标志的初始中心。
PCT/CN2018/122225 2018-07-24 2018-12-20 一种机器视觉定位方法 WO2020019648A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810816432.8 2018-07-24
CN201810816432.8A CN109064481B (zh) 2018-07-24 2018-07-24 一种机器视觉定位方法

Publications (1)

Publication Number Publication Date
WO2020019648A1 true WO2020019648A1 (zh) 2020-01-30

Family

ID=64836249

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/122225 WO2020019648A1 (zh) 2018-07-24 2018-12-20 一种机器视觉定位方法

Country Status (2)

Country Link
CN (1) CN109064481B (zh)
WO (1) WO2020019648A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111861997A (zh) * 2020-06-24 2020-10-30 中山大学 一种花纹板材圆孔尺寸检测方法、系统及装置
CN113267502A (zh) * 2021-05-11 2021-08-17 江苏大学 一种基于机器视觉的微电机摩擦片残缺检测系统及检测方法
CN113344931A (zh) * 2021-08-09 2021-09-03 深圳智检慧通科技有限公司 一种插件视觉检测识别方法、可读存储介质及设备
CN116912250A (zh) * 2023-09-13 2023-10-20 山东众成菌业股份有限公司 基于机器视觉的菌包生产质量检测方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321190B (zh) * 2019-04-19 2022-04-29 珠海天燕科技有限公司 一种桌面中图标优化的方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090022406A1 (en) * 2007-07-20 2009-01-22 Asustek Computer Inc. Method for finding specific pattern and method for compensating image offset
CN102930266A (zh) * 2012-09-28 2013-02-13 廖怀宝 一种用轮廓重心法定位PCB板Mark点的方法
CN103425988A (zh) * 2013-07-03 2013-12-04 江南大学 一种具有圆弧几何基元的实时定位与匹配方法
CN104732207A (zh) * 2015-03-12 2015-06-24 广东工业大学 高精度与高抗干扰性定位PCB板Mark点的方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001100470A (ja) * 1999-09-13 2001-04-13 Agfa Corp 画像パラメータ検出
US20070239183A1 (en) * 2006-04-05 2007-10-11 Melki Toufic S Ophthalmic marker for surgical retinal vitreous
CN101296314A (zh) * 2008-05-30 2008-10-29 四川长虹电器股份有限公司 像素数据处理方法
CN101853510A (zh) * 2010-04-20 2010-10-06 上海大学 基于时空域的运动感知模型提取方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090022406A1 (en) * 2007-07-20 2009-01-22 Asustek Computer Inc. Method for finding specific pattern and method for compensating image offset
CN102930266A (zh) * 2012-09-28 2013-02-13 廖怀宝 一种用轮廓重心法定位PCB板Mark点的方法
CN103425988A (zh) * 2013-07-03 2013-12-04 江南大学 一种具有圆弧几何基元的实时定位与匹配方法
CN104732207A (zh) * 2015-03-12 2015-06-24 广东工业大学 高精度与高抗干扰性定位PCB板Mark点的方法及装置

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111861997A (zh) * 2020-06-24 2020-10-30 中山大学 一种花纹板材圆孔尺寸检测方法、系统及装置
CN111861997B (zh) * 2020-06-24 2023-09-29 中山大学 一种花纹板材圆孔尺寸检测方法、系统及装置
CN113267502A (zh) * 2021-05-11 2021-08-17 江苏大学 一种基于机器视觉的微电机摩擦片残缺检测系统及检测方法
CN113267502B (zh) * 2021-05-11 2022-07-22 江苏大学 一种基于机器视觉的微电机摩擦片残缺检测系统及检测方法
CN113344931A (zh) * 2021-08-09 2021-09-03 深圳智检慧通科技有限公司 一种插件视觉检测识别方法、可读存储介质及设备
CN116912250A (zh) * 2023-09-13 2023-10-20 山东众成菌业股份有限公司 基于机器视觉的菌包生产质量检测方法
CN116912250B (zh) * 2023-09-13 2023-11-28 山东众成菌业股份有限公司 基于机器视觉的菌包生产质量检测方法

Also Published As

Publication number Publication date
CN109064481A (zh) 2018-12-21
CN109064481B (zh) 2021-09-17

Similar Documents

Publication Publication Date Title
WO2020019648A1 (zh) 一种机器视觉定位方法
CN111243032B (zh) 一种棋盘格角点全自动检测方法
WO2021138990A1 (zh) 一种棋盘格亚像素级角点自适应检测的方法
JP5699788B2 (ja) スクリーン領域検知方法及びシステム
CN115791822A (zh) 晶圆表面缺陷的视觉检测算法及检测系统
CN107292869B (zh) 基于各向异性高斯核和梯度搜索的图像斑点检测方法
US20180225799A1 (en) System and method for scoring color candidate poses against a color image in a vision system
CN115170669B (zh) 基于边缘特征点集配准的识别定位方法及系统、存储介质
JP6317725B2 (ja) 取得された画像内のクラッタを決定するためのシステム及び方法
JP2021168143A (ja) ビジョンシステムで画像内のプローブを効率的に採点するためのシステム及び方法
CN115546170B (zh) 一种基于激光测距的风机叶片缺陷定位方法及系统
CN110363196B (zh) 一种倾斜文本的文字精准识别的方法
CN110348307B (zh) 一种起重机金属结构攀爬机器人的路径边缘识别方法及系统
CN113688846A (zh) 物体尺寸识别方法、可读存储介质及物体尺寸识别系统
CN111178210B (zh) 一种十字标记的图像识别及对准方法
CN117496401A (zh) 一种用于视频测量影像序列椭圆形目标点全自动识别与跟踪方法
CN116596987A (zh) 一种基于双目视觉的工件三维尺寸高精度测量方法
Smiatacz Normalization of face illumination using basic knowledge and information extracted from a single image
CN108615041B (zh) 一种角点检测方法
Wu et al. Accurate localization of defective circular PCB mark based on sub-pixel edge detection and least square fitting
CN115184362A (zh) 一种基于结构光投影的快速缺陷检测方法
JP4157507B2 (ja) 表面状態判定装置およびプログラム
CN108010087B (zh) 一种基于颜色恒常性的亚像素棋盘格角点检测方法
Hsiao et al. Automatic Detection and Location for The Fiducial Marks and Reference Fiducial Marks
Wang et al. A Casting Surface Dataset and Benchmark for Subtle and Confusable Defect Detection in Complex Contexts

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

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

Country of ref document: EP

Kind code of ref document: A1