CN110232697B - A method for fitting edge of light spot - Google Patents
A method for fitting edge of light spot Download PDFInfo
- Publication number
- CN110232697B CN110232697B CN201910462696.2A CN201910462696A CN110232697B CN 110232697 B CN110232697 B CN 110232697B CN 201910462696 A CN201910462696 A CN 201910462696A CN 110232697 B CN110232697 B CN 110232697B
- Authority
- CN
- China
- Prior art keywords
- circle
- fitting
- spot
- edge
- squares
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 239000000284 extract Substances 0.000 claims abstract description 6
- 238000000605 extraction Methods 0.000 claims description 8
- 230000009466 transformation Effects 0.000 claims description 3
- 230000008569 process Effects 0.000 abstract description 7
- 230000000694 effects Effects 0.000 abstract description 6
- 230000001131 transforming effect Effects 0.000 abstract 1
- 238000005259 measurement Methods 0.000 description 7
- 230000011218 segmentation Effects 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 230000000007 visual effect Effects 0.000 description 3
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 2
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 2
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 2
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 2
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000009826 distribution Methods 0.000 description 2
- 230000001788 irregular Effects 0.000 description 2
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000004069 differentiation Effects 0.000 description 1
- 238000006073 displacement reaction Methods 0.000 description 1
- 238000013467 fragmentation Methods 0.000 description 1
- 238000006062 fragmentation reaction Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000001629 suppression Effects 0.000 description 1
- 238000009827 uniform distribution Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/181—Segmentation; Edge detection involving edge growing; involving edge linking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
Abstract
本发明提供一种光斑边缘拟合方法,本发明提取激光光斑边缘图像;过边缘像素点以拟合圆圆心作同心圆;找到一圆外点引出到同心圆的两条切线并做其割线;求出圆外点到割线的残差平方和并将其形式转换为极坐标形式;求出当残差平方和最小时对应参数的值即为圆心值。该方法为基于改进最小二乘法的光斑边缘拟合方法,将代数与几何方法相结合,利用几何原理构造最小二乘圆拟合方法中的残差平方项,从而提高光斑中心位置拟合精度,解决了传统最小二乘圆拟合方法将拟合参数求解转化为线性代数问题,缺乏从几何角度考虑光斑边缘拟合过程,考虑不全面,光斑拟合效果较差,准确性与确定性难以评估的问题。
The invention provides a light spot edge fitting method. The invention extracts the laser spot edge image; passes through the edge pixel points to form a concentric circle with the center of the fitted circle; finds two tangent lines drawn from a point outside the circle to the concentric circle and makes the secant line ;Find the residual sum of squares from the point outside the circle to the secant line and convert it into polar coordinates; find the value of the corresponding parameter when the residual squared sum is the smallest, which is the circle center value. This method is a spot edge fitting method based on the improved least squares method, which combines algebraic and geometric methods, and uses geometric principles to construct the residual square term in the least squares circle fitting method, thereby improving the fitting accuracy of the center position of the spot. It solves the problem of transforming the solution of fitting parameters into linear algebra by the traditional least squares circle fitting method, and lacks consideration of the spot edge fitting process from a geometric point of view. The consideration is not comprehensive, the fitting effect of the spot is poor, and the accuracy and certainty are difficult to evaluate The problem.
Description
技术领域Technical Field
本发明属于机器视觉测量领域,具体涉及一种光斑边缘拟合方法。The invention belongs to the field of machine vision measurement, and in particular relates to a light spot edge fitting method.
背景技术Background Art
一些视觉测量系统,通过采集激光光斑图像,识别光斑位置移动,测量位移、长度等物理量,其主要过程为分割光斑图像,提取与拟合光斑边缘,得到光斑中心位置,实现光斑位置检测。其中,光斑边缘拟合准确性是保障视觉测量系统精度的关键因素。Some visual measurement systems collect laser spot images, identify the movement of the spot position, and measure physical quantities such as displacement and length. The main process is to segment the spot image, extract and fit the spot edge, obtain the spot center position, and realize spot position detection. Among them, the accuracy of spot edge fitting is the key factor to ensure the accuracy of the visual measurement system.
目前光斑拟合算法中,具有代表性的研究主要为:At present, the representative studies on spot fitting algorithms are mainly:
其一,基于几何原理的光斑边缘拟合算法:2011年张海庄等人提出《基于圆定位算法的远场激光光斑中心测量》,取三个不共线点确定边界圆方程,进而求得边界圆中心坐标。此方法能够适应野外测量环境,但是由于远场光束经过远距离传播,光斑易发生破碎、变形现象,实际采集到的光斑图像不规则,取三点确定光斑中心不确定度较大,并且未考虑图像噪声的影响,抗干扰性较低,光斑图像不呈现标准圆形时,其拟合误差较大;2017年郭玉静等人提出《一种基于亮度阈值的激光光斑中心定位算法》,确定亮度阈值并将光斑图像进行二值化处理,得到一幅仅有激光光斑的图像,根据圆上平行弦的中点连线通过圆心的原理,通过求弦的中点确定圆心。此方法原理简单,计算量小,计算速度快,适用于光斑图像分布均匀的图像。当光斑面积占图像面积比例过小时,很难选择一个合适的阈值实现较好的分割。First, the spot edge fitting algorithm based on geometric principles: In 2011, Zhang Haizhuang et al. proposed "Far-field laser spot center measurement based on circle positioning algorithm", taking three non-collinear points to determine the boundary circle equation, and then obtaining the boundary circle center coordinates. This method can adapt to the field measurement environment, but because the far-field light beam propagates over a long distance, the spot is prone to fragmentation and deformation. The actual collected spot image is irregular, and the uncertainty of taking three points to determine the spot center is large. In addition, the influence of image noise is not considered, and the anti-interference ability is low. When the spot image does not present a standard circle, the fitting error is large; in 2017, Guo Yujing et al. proposed "A laser spot center positioning algorithm based on brightness threshold", determined the brightness threshold and binarized the spot image to obtain an image with only the laser spot. According to the principle that the midpoint line of the parallel chord on the circle passes through the center of the circle, the center of the circle is determined by finding the midpoint of the chord. This method has a simple principle, small calculation amount, fast calculation speed, and is suitable for images with uniform distribution of spot images. When the spot area accounts for too small a proportion of the image area, it is difficult to select a suitable threshold to achieve better segmentation.
其二,基于代数原理的光斑边缘拟合算法:2013年Song等人提出《Research onsub-pixel location of the laser spot center》,对光斑图像进行连续采集,利用平均背景模型分离图像前景与背景,首先在图像前景中计算光斑重心位置,其次在灰度重心水平、垂直方向对图像灰度分布进行二次曲线拟合,利用拟合结果得到修正过后的光斑中心位置。此方法光斑位置精确拟合,但对噪声敏感,适用于光斑图像质量较高,光斑边缘不含噪声的场合;2016年,吴泽楷等人提出《基于改进圆拟合算法的激光光斑中心检测》,采用最小二乘圆拟合方法,利用最小二乘原理从代数角度拟合激光光斑轮廓,从而得到光斑中心位置及其半径,速度快、定位精度高,而且可用于实时光学测量。此方法仅利用代数方法求拟合圆方程,拟合结果缺乏确定性,由于最小二乘拟合的平方项对离群点非常敏感,该方法仅适用于边缘像素点分布密集的场合。Second, the spot edge fitting algorithm based on algebraic principles: In 2013, Song et al. proposed "Research on sub-pixel location of the laser spot center", which continuously collected spot images and used the average background model to separate the image foreground and background. First, the spot center position was calculated in the image foreground, and then the grayscale distribution of the image was fitted with a quadratic curve in the horizontal and vertical directions of the grayscale center. The fitting result was used to obtain the corrected spot center position. This method accurately fits the spot position, but is sensitive to noise. It is suitable for occasions with high quality spot images and noise-free spot edges. In 2016, Wu Zekai et al. proposed "Laser spot center detection based on improved circle fitting algorithm", which uses the least squares circle fitting method and the least squares principle to fit the laser spot contour from an algebraic perspective to obtain the spot center position and its radius. It is fast, has high positioning accuracy, and can be used for real-time optical measurement. This method only uses algebraic methods to find the fitting circle equation, and the fitting result lacks certainty. Since the square term of the least squares fitting is very sensitive to outliers, this method is only suitable for occasions with dense distribution of edge pixels.
综上所述,传统的光斑边缘拟合算法仅从代数或几何角度来进行拟合,其适用性存在一定局限。最小二乘圆拟合为目前使用最广泛的拟合方法,该方法将边缘像素点到圆心的距离与拟合圆半径的平方直接相减构造残差平方和,而光斑边缘圆拟合为几何过程,仅从代数的角度考虑几何过程,可能导致残差平方和存在偏差,拟合结果的准确性与确定性难以评估。In summary, the traditional spot edge fitting algorithm only fits from an algebraic or geometric perspective, and its applicability has certain limitations. Least squares circle fitting is the most widely used fitting method. This method directly subtracts the distance from the edge pixel to the center of the circle from the square of the radius of the fitting circle to construct the residual sum of squares. However, spot edge circle fitting is a geometric process. Considering the geometric process only from an algebraic perspective may lead to deviations in the residual sum of squares, and the accuracy and certainty of the fitting results are difficult to evaluate.
发明内容Summary of the invention
针对上述问题,本发明提供一种光斑边缘拟合方法,该方法为基于改进最小二乘法的光斑边缘拟合方法,将代数与几何方法相结合,利用几何原理构造最小二乘圆拟合方法中的残差平方项,从而提高边缘拟合精度,解决了传统最小二乘圆拟合方法将拟合参数求解转化为线性代数问题,缺乏从几何角度考虑光斑边缘拟合过程,考虑不全面,光斑拟合效果较差,准确性与确定性难以评估的问题。In view of the above problems, the present invention provides a spot edge fitting method, which is a spot edge fitting method based on the improved least squares method, combines algebraic and geometric methods, and utilizes geometric principles to construct the residual square term in the least squares circle fitting method, thereby improving the edge fitting accuracy. It solves the problem that the traditional least squares circle fitting method converts the solution of fitting parameters into a linear algebra problem, lacks consideration of the spot edge fitting process from a geometric perspective, is incomplete, has poor spot fitting effect, and is difficult to evaluate in terms of accuracy and certainty.
本发明解决其技术问题所采用的技术方案是:一种光斑边缘拟合方法,包括以下步骤:The technical solution adopted by the present invention to solve the technical problem is: a light spot edge fitting method, comprising the following steps:
光斑边缘提取:提取激光光斑边缘图像;Spot edge extraction: extract the laser spot edge image;
作拟合圆的同心圆和同心圆的割线:假设O为拟合圆的圆心,其坐标为(a,b),光斑边缘像素点集合为{x1,x2,…,xi},Ri为每个边缘像素点到圆心的距离,即半径,其中i为1、2、3…n,n为像素点的总数,边缘像素点xi的坐标为(xi,yi);对x1以O为圆心作同心圆C1,在直角坐标系中圆外一点做关于同心圆C1的两条切线,圆外一点的坐标为(xV,yV),连接两切点得同心圆C1的割线L1,作光斑边缘中每个像素点相应圆的割线,记为Li;Draw concentric circles and secants of the fitting circle: Assume that O is the center of the fitting circle, and its coordinates are (a, b). The set of pixel points at the edge of the light spot is {x 1 ,x 2 ,…, xi }, and Ri is the distance from each edge pixel point to the center of the circle, that is, the radius, where i is 1, 2, 3…n, n is the total number of pixels, and the coordinates of the edge pixel pointxi are ( xi , yi ); draw concentric circles C1 with O as the center of x1, and draw two tangent lines about the concentric circles C1 at a point outside the circle in the rectangular coordinate system. The coordinates of the point outside the circle are ( xV , yV ), and the secant line L1 of the concentric circles C1 is obtained by connecting the two tangent points. Draw the secant line of the corresponding circle of each pixel point in the edge of the light spot, and record it as Li ;
将残差平方和进行坐标转换:求出圆外点到割线的残差平方和并将其形式转换为极坐标形式;Transform the residual sum of squares into coordinates: Calculate the residual sum of squares from the point outside the circle to the secant line and transform it into polar coordinates;
解得残差平方和最小时的圆心值:求出当残差平方和最小时对应的拟合圆中心坐标和半径,即为圆心值,实现光斑中心定位。Solve to get the center value when the residual square sum is the smallest: find the center coordinates and radius of the fitting circle corresponding to the minimum residual square sum, which is the center value, to achieve the center positioning of the light spot.
上述方案中,所述步骤光斑边缘提取步骤中采用Canny算子提取光斑边缘。In the above solution, the Canny operator is used to extract the edge of the light spot in the light spot edge extraction step.
上述方案中,所述割线Li方程为:In the above scheme, the equation of the secant line Li is:
上述方案中,所述残差平方和Q进行坐标转换的步骤具体为:In the above scheme, the step of coordinate transformation of the residual square sum Q is specifically as follows:
求得圆外一点到割线的距离f1,随后对光斑边缘中的每个像素点作拟合圆的同心圆和同心圆的割线,分别求得圆外点到相应割线Li的距离fi;Obtain the distance f 1 from a point outside the circle to the secant line, then make concentric circles of the fitting circle and the secant lines of the concentric circles for each pixel point on the edge of the light spot, and respectively obtain the distance fi from the point outside the circle to the corresponding secant line Li ;
设圆外一点到拟合圆相应割线L的距离为f,根据最小二乘原理,构造fi与f的残差平方和Q;Assume that the distance from a point outside the circle to the corresponding secant line L of the fitting circle is f, and construct the residual sum of squares Q between fi and f according to the least squares principle;
将残差平方和形式转化为极坐标形式。Convert the residual sum of squares form to polar coordinate form.
进一步的,直角坐标系下,所述fi方程为:Furthermore, in a rectangular coordinate system, the fi equation is:
进一步的,直角坐标系下,所述残差平方和Q形式为:Furthermore, in a rectangular coordinate system, the residual sum of squares Q is in the form of:
进一步的,将残差平方和形式转化为极坐标形式具体为:Furthermore, the residual sum of squares is converted into polar coordinate form as follows:
将直角坐标系下的参数转化为极坐标形式:Convert the rectangular coordinate system parameters into polar coordinates:
极坐标系下,所述fi方程转化为:In the polar coordinate system, the fi equation is transformed into:
极坐标系下,fi的残差平方和的形式转化为:In the polar coordinate system, the residual sum of squares of fi is transformed into:
进一步的,所述解得残差平方和Q最小时的圆心值的步骤具体为:Furthermore, the step of solving the center value of the circle when the residual square sum Q is minimized is specifically as follows:
为对残差平方和的三个变量ρ,θ,f求偏导,令偏导为零,解方程组即可求得拟合圆中心坐标(a,b)与半径R;解得a,b,R分别为:To find the partial derivatives of the three variables ρ, θ, and f of the residual sum of squares, set the partial derivatives to zero, and solve the system of equations to obtain the center coordinates (a, b) and radius R of the fitting circle; the solutions of a, b, and R are:
与现有技术相比,本发明的有益效果是:本发明为基于改进最小二乘法的光斑边缘拟合方法,通过构造过光斑边缘像素点的同心圆与平行割线,利用圆外点到平行割线的距离构造残差平方和,由几何原理改进传统最小二乘圆拟合方法,增加最小二乘圆拟合结果的确定性与准确性,提高光斑中心位置拟合精度。Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention is a spot edge fitting method based on the improved least squares method, which constructs concentric circles and parallel secants passing through the pixel points of the spot edge, and constructs the residual sum of squares using the distance from the outer point of the circle to the parallel secants, improves the traditional least squares circle fitting method based on geometric principles, increases the certainty and accuracy of the least squares circle fitting results, and improves the fitting accuracy of the center position of the spot.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
本发明的上述和/或附加的方面和优点从结合下面附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
图1为本发明所述光斑边缘拟合方法流程图;FIG1 is a flow chart of the spot edge fitting method of the present invention;
图2为本发明所述光斑边缘拟合方法操作示意图;FIG2 is a schematic diagram of the operation of the light spot edge fitting method of the present invention;
图3为本发明所述光斑边缘拟合方法实施中一激光光斑二值分割图像;FIG3 is a binary segmentation image of a laser spot in the implementation of the spot edge fitting method of the present invention;
图4为本发明所述光斑边缘拟合方法实施中一Canny算子边缘提取图像;FIG4 is a Canny operator edge extraction image in the implementation of the spot edge fitting method of the present invention;
图5为本发明所述光斑边缘拟合方法实施中一激光光斑边缘拟合后的图像;FIG5 is an image after edge fitting of a laser spot in the implementation of the spot edge fitting method of the present invention;
图6为现有技术中基于圆定位算法的拟合效果图像。FIG. 6 is an image showing the fitting effect based on the circle positioning algorithm in the prior art.
图中,1、圆外点;2、切点;3、割线;4、割线;5、割线;6、切点;7、拟合圆心点;8、边缘像素点;9、边缘像素点;10、圆;11、拟合圆;12、同心圆。In the figure, 1. point outside the circle; 2. tangent point; 3. secant line; 4. secant line; 5. secant line; 6. tangent point; 7. fitted circle center point; 8. edge pixel point; 9. edge pixel point; 10. circle; 11. fitted circle; 12. concentric circles.
具体实施方式DETAILED DESCRIPTION
下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本发明,而不能理解为对本发明的限制。Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
如图1所示为本发明所述光斑边缘拟合方法的较佳实施例,所述光斑边缘拟合方法包括以下步骤:FIG1 is a preferred embodiment of the light spot edge fitting method of the present invention, and the light spot edge fitting method comprises the following steps:
光斑边缘提取:提取激光光斑边缘图像,优选的,采用Canny算子提取光斑边缘。Spot edge extraction: extract the laser spot edge image, preferably, use the Canny operator to extract the spot edge.
作拟合圆的同心圆和同心圆的割线:设拟合圆圆心坐标为(a,b),对光斑边缘中的任意一个像素点,引该圆两条切线,连接两个切点形成割线L1。具体的:Draw concentric circles and secant lines of the fitting circle: Assume the coordinates of the center of the fitting circle to be (a, b), draw two tangent lines of the circle for any pixel point on the edge of the light spot, and connect the two tangent points to form a secant line L 1 . Specifically:
假设O为拟合圆的圆心,其坐标为(a,b),光斑边缘像素点集合为{x1,x2,…,xi},Ri为每个边缘像素点到圆心的距离,即半径,其中i为1、2、3…n,n为像素点的总数,对x1以O为圆心作圆C1,在直角坐标系中圆外一点做关于圆C1的两条切线,圆外点坐标为(xv,yv),连接两切点得C1的割线L1。重复上述步骤,作光斑边缘中每个像素点相应圆的割线,记为Li。Assume that O is the center of the fitting circle, and its coordinates are (a, b). The set of pixels at the edge of the spot is {x 1 ,x 2 ,…, xi }, and Ri is the distance from each edge pixel to the center of the circle, i.e., the radius, where i is 1, 2, 3…n, and n is the total number of pixels. Draw a circle C 1 with O as the center for x 1 , and draw two tangent lines about the circle C 1 at a point outside the circle in the rectangular coordinate system. The coordinates of the point outside the circle are (x v ,y v ), and connect the two tangent points to get the secant line L 1 of C 1. Repeat the above steps to draw the secant line of the circle corresponding to each pixel point at the edge of the spot, denoted by Li .
割线Li方程为:The equation of the secant line Li is:
将残差平方和进行坐标转换:求得圆外一点到割线的距离f1,随后对光斑边缘中的每个像素点重复上述操作,即对每一个像素点作拟合圆的同心圆和同心圆的割线,分别求得圆外点到相应割线Li的距离fi;设圆外一点到拟合圆相应割线L的距离为f,根据最小二乘原理,构造fi与f的残差平方和Q;将残差平方和Q的直角坐标形式转化为极坐标形式。具体的:The residual sum of squares is transformed into coordinates: the distance f 1 from a point outside the circle to the secant line is obtained, and then the above operation is repeated for each pixel point on the edge of the light spot, that is, concentric circles and secants of the concentric circles of the fitting circle are made for each pixel point, and the distance fi from the point outside the circle to the corresponding secant line Li is obtained respectively; let the distance from a point outside the circle to the corresponding secant line L of the fitting circle be f, and according to the least squares principle, the residual sum of squares Q of fi and f is constructed; the rectangular coordinate form of the residual sum of squares Q is converted into the polar coordinate form. Specifically:
为方便计算将圆外点移至原点,将原点到L1距离记为f1。对以O为圆心构造C1的同心圆C2,重复上述操作得出f2,f3,…,fi。For the convenience of calculation, move the point outside the circle to the origin, and record the distance from the origin to L 1 as f 1. Construct a concentric circle C 2 with O as the center of C 1 , and repeat the above operation to obtain f 2 ,f 3 ,…, fi .
fi方程为:The equation for fi is:
假设拟合圆C割线L距圆外点距离为f,根据最小二乘原理,取残差平方和:Assuming that the distance between the secant line L of the fitting circle C and the outer point of the circle is f, according to the least squares principle, the residual sum of squares is taken:
上述过程中的割线L已变换为:The secant line L in the above process has been transformed into:
(xi-a)a+(yi-b)b+Ri 2=0 公式四(x i -a)a+(y i -b)b+R i 2 =0 Formula 4
重复以上步骤,求Q1,Q2,…,Qi。Repeat the above steps to find Q 1 ,Q 2 ,…,Q i .
将直角坐标系下的参数转化为极坐标形式:Convert the rectangular coordinate system parameters into polar coordinates:
将残差平方和的直角坐标形式也转化为极坐标方程,极坐标系下,所述fi方程转化为:The rectangular coordinate form of the residual sum of squares is also converted into a polar coordinate equation. In the polar coordinate system, the fi equation is converted into:
得到极坐标系下的fi的残差平方和的形式为:The residual sum of squares of fi in the polar coordinate system is obtained as follows:
解得残差平方和最小时的圆心值:令Q最小,即可解得拟合圆中心坐标(a,b)与半径R。具体的:Solve to get the center value of the circle when the residual square sum is the smallest: Let Q be the smallest, and you can solve for the center coordinates (a, b) and radius R of the fitting circle. Specifically:
求Q最小值的方法为对残差平方和的三个变量ρ,θ,f求偏导,令偏导为零,解方程组即可求得拟合圆中心与半径。The method to find the minimum value of Q is to find the partial derivatives of the three variables ρ, θ, and f of the residual sum of squares, set the partial derivatives to zero, and solve the system of equations to obtain the center and radius of the fitting circle.
对f求偏导并令其为零即:Find the partial derivative of f and set it to zero:
解得:The solution is:
对ρ求偏导并令其为零即:Find the partial derivative of ρ and set it to zero:
解得:The solution is:
对θ求偏导并令其为零,即:Take the partial derivative of θ and set it to zero, that is:
解得:The solution is:
其中K1为:Where K1 is:
K2为: K2 is:
最后联立上述各式,解得a,b,R分别为:Finally, combine the above equations to obtain a, b, and R respectively:
如图2所示,本发明所述光斑边缘拟合方法,的具体步骤:As shown in FIG2 , the spot edge fitting method of the present invention includes the following specific steps:
首先,假设拟合圆心点7(a,b)为光斑拟合圆的圆心,以拟合圆心点7(a,b)为圆心过边缘像素点8(x1,y1)作圆10,其半径为R1;点1(xa,ya)为直角坐标系中圆外一点,过圆外点1作关于圆10的两条切线,切点分别为2,6;连接切点2和6形成一条割线5,根据上述式一得到割线5方程,割线5方程为:First, assume that the fitting center point 7 (a, b) is the center of the spot fitting circle, and draw a
重复上述步骤,过边缘像素点9(x2,y2)作圆10的同心圆12,其半径为R2,同样从圆外点1引切点,形成割线3,割线3方程为:Repeat the above steps to draw a
对光斑图像边缘中每一个像素点作同心圆,拟合圆边缘像素点为(xi,yi)从而拟合圆11的割线4方程为:Draw concentric circles for each pixel point on the edge of the spot image, and fit the edge pixel points of the circle to (x i , y i ). The equation of the secant line 4 of the fitted
其次,将圆外点1(xa,ya)移动至坐标原点,得到圆外点1(0,0)到割线5距离记为f1;f1由上述式二计算得出。Next, move the outer point 1 (x a , y a ) to the origin of the coordinate system, and record the distance from the outer point 1 (0,0) to the secant line 5 as f 1 ; f 1 is calculated using the
则圆外点1(0,0)到割线3距离为f2。Then the distance from the outer point 1 (0,0) to the
重复上述操作得出f3,f4…,fi,得出圆外点1到拟合圆割线4的距离fi。Repeat the above operation to obtain f 3 , f 4 …, fi , and obtain the distance fi from the
对应点的变化,上述过程中的每一条割线方程已变换为:With the change of corresponding points, each secant equation in the above process has been transformed into:
(xi-a)a+(yi-b)b+Ri 2=0(x i -a)a+(y i -b)b+R i 2 =0
根据最小二乘原理,设拟合圆C割线L距圆外点距离为f,根据上述式三得到f1残差平方的形式Q1,Q2,…,Qi。According to the least squares principle, let the distance between the secant line L of the fitting circle C and the outer point of the circle be f, and the square of the residual of f 1 is obtained in the form of Q 1 ,Q 2 ,…,Q i according to the
Q1=(f1-f)2 Q 1 =(f 1 -f ) 2
Q2=(f2-f)2 Q2 =( f2 -f) 2
Qi=(fi-f)2 Qi =( fi -f) 2
整合得出其残差平方和形式:Integration gives the residual sum of squares in the form:
然后,进行极坐标变换,将拟合圆心点7的参数转换为极坐标形式,参数转换为式五的形式:Then, polar coordinate transformation is performed to convert the parameters of the
则距离公式变为上述式六的形式:Then the distance formula becomes the form of the above formula 6:
进一步得到极坐标系下,fi的残差平方和的形式转化为:Further, in the polar coordinate system, the residual sum of squares of fi is converted into:
运用代数方法,求出Q的最小值,即令式七中三个变量求偏导为0。通过式八对f进行求偏导为0解得:Using algebraic methods, we can find the minimum value of Q, that is, let the partial derivatives of the three variables in
通过式十对ρ进行求偏为0解得:By using
通过式十二对θ进行求偏导为0解得:By using
k1,k2分别为上述式十四和十五所示。k 1 and k 2 are shown in the above formulas 14 and 15 respectively.
最后,联立上述各式,解得a,b,R分别为:Finally, combining the above equations, we can solve a, b, and R as follows:
上述a,b,R即为拟合圆心点7(a,b)的参数。The above a, b, and R are the parameters of the fitting center point 7 (a, b).
如图3所示,本发明所述光斑边缘拟合方法实施中二值分割图像。将激光光斑区域与图像背景区域计算阈值使两类区域所包含的像素区分度最大,即方差达到最大值,此时阈值为图像最佳阈值,从而达到二值分割的效果。As shown in Figure 3, in the implementation of the spot edge fitting method of the present invention, the binary segmentation image is implemented. The threshold of the laser spot area and the image background area is calculated to maximize the pixel differentiation contained in the two types of areas, that is, the variance reaches the maximum value. At this time, the threshold is the optimal threshold of the image, thereby achieving the effect of binary segmentation.
如图4所示,本发明所述光斑边缘拟合方法实施中Canny算子边缘提取图像。光斑进行二值化后,边缘区域仍不平滑,存在一定毛刺噪声或孤立像素点。对其进行边缘提取后,Canny算子提取得到光斑边缘最为准确、平滑,噪声抑制效果较好,且边缘轮廓闭合。As shown in FIG4 , the Canny operator edge extraction image in the implementation of the spot edge fitting method of the present invention. After the spot is binarized, the edge area is still not smooth, and there are certain burr noises or isolated pixels. After edge extraction, the Canny operator extracts the spot edge most accurately and smoothly, has a good noise suppression effect, and the edge contour is closed.
如图5所示,本发明所述光斑边缘拟合方法实施中激光光斑图像边缘拟合结果。拟合圆基本贴合光斑边缘,较为完整地反应了光斑边缘形状。光斑边缘右侧存在部分不规则区域,虽然部分边缘像素点不与拟合圆完全重合,但边缘点在拟合圆外部与内部均有分布,其拟合误差具有一定抵偿性,光斑边缘拟合结果可靠、准确。As shown in Figure 5, the edge fitting result of the laser spot image in the implementation of the spot edge fitting method of the present invention. The fitting circle basically fits the spot edge and reflects the spot edge shape more completely. There are some irregular areas on the right side of the spot edge. Although some edge pixels do not completely overlap with the fitting circle, the edge points are distributed both outside and inside the fitting circle. The fitting error has a certain compensation, and the spot edge fitting result is reliable and accurate.
如图6所示,为现有技术中基于圆定位算法的拟合效果图像,此方法相对于本发明所述光斑边缘拟合方法,明显拟合效果较差,与光斑边缘的贴合度不高,受噪声影响很大。As shown in FIG6 , it is an image of the fitting effect based on the circle positioning algorithm in the prior art. Compared with the light spot edge fitting method described in the present invention, this method has obviously poorer fitting effect, has a low fit with the light spot edge, and is greatly affected by noise.
本发明将激光光斑图像进行二值化处理;利用Canny算子提取激光光斑边缘图像;过边缘像素点以拟合圆圆心作同心圆;找到一圆外点引出到同心圆的两条切线并做其割线;求出圆外点到割线的残差平方和并将其形式转换为极坐标形式;求出当残差平方和最小时对应参数的值即为圆心值。由几何原理改进传统最小二乘圆拟合方法,增加其拟合结果的确定性与准确性,提高光斑中心位置拟合精度,对保障视觉测量系统可靠性具有重要意义。The present invention performs binarization processing on the laser spot image; uses the Canny operator to extract the edge image of the laser spot; draws concentric circles with the center of the fitting circle through the edge pixel point; finds two tangent lines from a point outside the circle to the concentric circles and makes their secants; calculates the residual sum of squares from the point outside the circle to the secant and converts it into polar coordinate form; calculates the value of the corresponding parameter when the residual sum of squares is the minimum, which is the center value of the circle. The traditional least squares circle fitting method is improved by geometric principles, the certainty and accuracy of its fitting results are increased, and the fitting accuracy of the center position of the spot is improved, which is of great significance to ensure the reliability of the visual measurement system.
应当理解,虽然本说明书是按照各个实施例描述的,但并非每个实施例仅包含一个独立的技术方案,说明书的这种叙述方式仅仅是为清楚起见,本领域技术人员应当将说明书作为一个整体,各实施例中的技术方案也可以经适当组合,形成本领域技术人员可以理解的其他实施方式。It should be understood that although this specification is described according to various embodiments, not every embodiment contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
上文所列出的一系列的详细说明仅仅是针对本发明的可行性实施例的具体说明,它们并非用以限制本发明的保护范围,凡未脱离本发明技艺精神所作的等效实施例或变更均应包含在本发明的保护范围之内。The series of detailed descriptions listed above are only specific descriptions of feasible embodiments of the present invention. They are not intended to limit the scope of protection of the present invention. All equivalent embodiments or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910462696.2A CN110232697B (en) | 2019-05-30 | 2019-05-30 | A method for fitting edge of light spot |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910462696.2A CN110232697B (en) | 2019-05-30 | 2019-05-30 | A method for fitting edge of light spot |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110232697A CN110232697A (en) | 2019-09-13 |
CN110232697B true CN110232697B (en) | 2023-05-09 |
Family
ID=67858200
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910462696.2A Active CN110232697B (en) | 2019-05-30 | 2019-05-30 | A method for fitting edge of light spot |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110232697B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110717502B (en) * | 2019-10-22 | 2023-09-05 | 大连大学 | A Melt Pool Recognition Method in Pulse Laser Tailored Welding Image |
CN114659627B (en) * | 2022-05-16 | 2022-08-19 | 广东工业大学 | A method, system and device for laser spot monitoring based on ring filter |
CN116109555B (en) * | 2022-11-16 | 2023-09-29 | 南京博视医疗科技有限公司 | Wavefront facula lattice optimization method and device |
CN118537357B (en) * | 2024-05-21 | 2025-03-25 | 河北省农林科学院昌黎果树研究所 | Efficient grape quality assessment method based on machine vision |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101246544B (en) * | 2008-01-24 | 2010-06-16 | 电子科技大学中山学院 | Iris positioning method based on boundary point search and minimum kernel value similarity region edge detection |
CN104501720B (en) * | 2014-12-24 | 2017-07-14 | 河海大学常州校区 | Non-contact object size and range image measuring instrument |
-
2019
- 2019-05-30 CN CN201910462696.2A patent/CN110232697B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN110232697A (en) | 2019-09-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110232697B (en) | A method for fitting edge of light spot | |
CN103411553B (en) | The quick calibrating method of multi-linear structured light vision sensors | |
CN101882313B (en) | Calibration method of correlation between single line laser radar and CCD (Charge Coupled Device) camera | |
Kim et al. | Adaptive smoothness constraints for efficient stereo matching using texture and edge information | |
CN113112496B (en) | Sub-pixel shaft part size measurement method based on self-adaptive threshold | |
CN111178150B (en) | Lane marking detection method, system and storage medium | |
CN103324936B (en) | A kind of vehicle lower boundary detection method based on Multi-sensor Fusion | |
CN107561087A (en) | A kind of mouse logo positioning and defect inspection method based on machine vision | |
CN112950650B (en) | Deep learning distorted light spot center extraction method suitable for high-precision morphology measurement | |
CN110298840A (en) | A kind of yarn faults detection method based on image | |
CN107687819A (en) | A fast and high-precision method for extracting sub-pixels in the center of light bars | |
CN107478176A (en) | A kind of pantograph loss detection method and system | |
CN106296694A (en) | Shaft tower tilts intelligent image identification measuring method | |
CN109359604B (en) | Method for identifying instrument under shadow interference facing inspection robot | |
CN104899609A (en) | Image registration-based mechanical meter identification method | |
CN105740829A (en) | Scanning line processing based automatic reading method for pointer instrument | |
CN106996748A (en) | Wheel diameter measuring method based on binocular vision | |
CN111260708A (en) | A method and system for center extraction of line structured light | |
CN111523547B (en) | 3D semantic segmentation method and terminal | |
CN110288571A (en) | An abnormal detection method for high-speed railway catenary insulators based on image processing | |
CN105242568B (en) | Tobacco leaf based on Digital Image Processing accurately rejects control method | |
CN110763306A (en) | Monocular vision-based liquid level measurement system and method | |
CN107374638A (en) | A kind of height measuring system and method based on binocular vision module | |
WO2024060284A1 (en) | Identification method and device for temperature distribution of blast furnace top burden surface, and storage medium | |
CN110211178A (en) | A kind of pointer instrument recognition methods calculated using projection |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |