Disclosure of Invention
The invention provides an image-based facula diffraction ring analysis method, a storage medium and a chip, which solve the technical problem that no method and tool for analyzing related parameters of a single diffraction ring exist at present.
The invention provides an image-based light spot diffraction ring analysis method for solving the technical problems, which comprises the following steps:
s1, acquiring a light spot image with diffraction rings, wherein the light spot image comprises a central light spot and a plurality of diffraction rings which are sequentially distributed around the periphery of the central light spot from inside to outside, and the central point coordinate, the rotation angle and the diffraction rings of the central light spot are obtained according toEllipticity, setting minimum step Sehr beam in two-axis directions
And
;
s2, obtaining a central grid ring according to the central point coordinate, the rotation angle and the ellipticity of the central light spot by taking the minimum step length as the step length, and repeating the steps by adding one step length each time to extract all grid rings of the obtained light spot image;
s3, drawing the obtained grid ring mean value to obtain a ring mean value curve by taking the grid ring mean value as a vertical coordinate and the size of the grid ring as a horizontal coordinate;
and S4, finding out the grids corresponding to the boundaries of the diffraction rings according to the threshold value in the ring mean curve to separate out the grid rings, and extracting the data and images of the grid rings for analysis.
Optionally, the minimum step Sehr beam
And
the size of (A) is equal to or multiplied by the ellipticity.
Optionally, the plurality of diffraction rings includes a first diffraction ring P1, a second diffraction ring P2, a third diffraction ring P3.. and an nth diffraction ring PN;
respectively obtaining the grid rings corresponding to the diffraction rings according to an S2 method, wherein the ellipse images corresponding to the first diffraction ring P1, the second diffraction ring P2, the third diffraction ring P3.. and the Nth diffraction ring PN in a one-to-one manner are a first peripheral ellipse S1, a second peripheral ellipse S2, a third peripheral ellipse S3.. and an Nth peripheral ellipse SN, and N is a positive integer greater than or equal to 1.
Optionally, the S2 specifically includes:
s21, generating two elliptical images MASK _ a and MASK _ b with the same center, rotation angle and ellipticity, wherein two axes of MASK _ b are respectively larger than MASK _ a by one step length, the internal pixel values of the elliptical images are filled with 1, the external pixel values are all 0, and the elliptical images MASK _ a and MASK _ b are subjected to XOR to obtain a MASK image of a central grid ring;
s22, extracting the gray value of the pixel with the same coordinate of the input image according to whether the gray value of each pixel in the mask image is 0, extracting if the gray value is not 0, not extracting if the gray value is 0, obtaining the data of all pixels on the grid ring, averaging the data to obtain the average value of the grid ring, and meanwhile, calculating the size of the grid ring and meeting the requirement of the size of the grid ring
;
S23, taking the original elliptical image MASK _ b as a new elliptical image MASK _ a, generating an elliptical image with one step size as a new elliptical image MASK _ b, and repeating the steps S21-S22 until all the grid ring images are extracted.
Optionally, the step S23 is followed by:
and S24, directly multiplying the corresponding msak image with the original image to extract the image information of the corresponding grid.
Optionally, the distance between each grid ring is a fixed value.
Optionally, the threshold is a given constant value, which is the peak value of the spot image multiplied by a ratio smaller than 1, and the ratio is 0.135 or 1/e ^2, which is used to define the effective range of the spot image.
Optionally, the S4 is followed by S5:
when the laser is analyzed, the relation between the distribution condition of the grid rings and the processing quality is analyzed in combination with the processing effect of the laser, so that the laser processing technology is improved;
in optical studies, the optical path was adjusted by quantitatively observing the grid ring changes.
The present invention also provides a storage medium for storing a computer program, the computer program comprising: instructions for performing an image-based spot diffraction ring analysis method.
The invention also provides a chip comprising: a processor for invoking and running a computer program from a memory, the computer program comprising: instructions for performing an image-based spot diffraction ring analysis method.
Has the advantages that: the invention provides an image-based light spot diffraction ring analysis method, a storage medium and a chip.A light spot image with a diffraction ring is obtained, a minimum step length is taken as a step length, a central grid ring is obtained according to the central point coordinate, the rotation angle and the ellipticity of the central light spot, and all grid rings of the light spot image are extracted by adding one step length each time; then drawing the obtained grid ring mean value to obtain a ring mean value curve by taking the grid ring mean value as a vertical coordinate and the size of the grid ring as a horizontal coordinate; and finally, in the ring mean curve, finding out grids corresponding to the boundaries of the diffraction rings according to the threshold value to separate out the grid rings, and extracting data and images of the grid rings for analysis. By adopting a method of annular grid calculation with a set step length, a grid intensity mean value-ring size relation curve of the light spot image is obtained. And finding out the boundary of the diffraction rings according to the curve and a set threshold value, and separating each diffraction ring from the light spot image, thereby realizing the purpose of analyzing each level of diffraction rings of the light spots.
The scheme can realize the extraction and measurement of the light beam diffraction ring only based on image analysis, does not need an additional measuring device except one camera, is plug and play, has the characteristics of intuition, simplicity, portability and high efficiency, and can realize the measurement of light spots with different circularities and angles.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical solutions of the present invention more clearly understood and to implement them in accordance with the contents of the description, the following detailed description is given with reference to the preferred embodiments of the present invention and the accompanying drawings. The detailed description of the present invention is given in detail by the following examples and the accompanying drawings.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention. The invention is described in more detail in the following paragraphs by way of example with reference to the accompanying drawings. Advantages and features of the present invention will become apparent from the following description and from the claims. It is to be noted that the drawings are in a very simplified form and are not to precise scale, which is merely for the purpose of facilitating and distinctly claiming the embodiments of the present invention.
It will be understood that when an element is referred to as being "secured to" another element, it can be directly on the other element or intervening elements may also be present. When a component is referred to as being "connected" to another component, it can be directly connected to the other component or intervening components may also be present. When a component is referred to as being "disposed on" another component, it can be directly on the other component or intervening components may also be present. The terms "vertical," "horizontal," "left," "right," and the like as used herein are for illustrative purposes only.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
As shown in fig. 1 to 9, the present invention provides an image-based spot diffraction ring analysis method, including the following steps:
s1, acquiring a light spot image with diffraction rings, wherein the light spot image comprises a central light spot and a plurality of diffraction rings which are sequentially distributed around the periphery of the central light spot from inside to outside, and setting the minimum step Seal light beams in the two-axis directions according to the central point coordinate, the rotation angle and the ellipticity of the central light spot
And
(ii) a The minimum step size is obtained by a parameter acquisition method in automatic calculation, and the automatically calculated parameters include a center point coordinate, a rotation angle, an ellipticity, and a step size. All the parameters can be set manually according to the test requirement.
S2, obtaining a central grid ring according to the central point coordinate, the rotation angle and the ellipticity of the central light spot by taking the minimum step length as the step length, and repeating the steps by adding one step length each time to extract all grid rings of the obtained light spot image;
s3, drawing the obtained grid ring mean value to obtain a ring mean value curve by taking the grid ring mean value as a vertical coordinate and the size of the grid ring as a horizontal coordinate;
and S4, finding out the grids corresponding to the boundaries of the diffraction rings according to the threshold value in the ring mean curve to separate out the grid rings, and extracting the data and images of the grid rings for analysis.
The specific operation process is as follows:
step one, inputting a light spot image, and determining the coordinates of the central point, the rotation angle and the ellipticity of the light spot through a method of manually inputting or automatically analyzing the light spot by a computer as shown in fig. 2. Setting minimum step Sehr beam in two-axis direction
And
the ratio should be equal to the ellipticity.
Step two, extracting grids:
1. two images MASK _ a and MASK _ b of the same size are generated, which contain ellipticity having the same center, rotation angle, wherein two axes of MASK _ b are respectively one step larger than MASK _ a, the inner pixel value of the ellipse is filled with 1, and the outer pixel values are all 0. And performing exclusive OR on the two images, namely the image MASK _ a and the image MASK _ b to obtain a MASK image of the grid ring.
2. And extracting the gray value of the pixel with the same coordinate of the input image according to whether the gray value of each pixel in the mask image is 0 or not, extracting if the gray value is not 0 or not 0, obtaining the data of all pixels on the grid ring, and averaging the data to obtain the average value of the grid ring. At the same time, the size of the mesh ring is calculated and satisfied
When the first mesh ring and the Nth mesh ring are calculatedAnd multiplying the value by a coefficient N to represent the magnitude of SN, namely the independent variable of the mean value curve.
3. And taking the original MASK _ b as a new MASK _ a, generating an image with an ellipse with one step size as a new MASK _ b, and repeating the steps until all grid ring images are extracted. All mesh ring images are shown in the example of fig. 3.
4. If the image of the grid is to be extracted, the corresponding mask image may be directly multiplied by the original image.
And step three, drawing the obtained grid ring mean value into a ring mean value curve by taking the grid ring mean value as a vertical coordinate and the size of the grid ring as a horizontal coordinate, as shown in fig. 7.
Step four, finding out the grids corresponding to the boundaries of each diffraction ring according to the threshold in the ring mean curve, as shown in fig. 6, then generating images MASK _ a and MASK _ b within the coverage range of each grid corresponding to the inner and outer boundaries, and extracting the data and images of each diffraction ring according to the same method as that used for extracting the grids in the step two, wherein the separated diffraction ring images are shown in fig. 9.
And step five, analyzing and calculating through the data of all the pixels on the ring.
When the laser is analyzed, the relation between the distribution condition of the grid rings and the processing quality is analyzed in combination with the processing effect of the laser, so that the laser processing technology is improved;
in optical studies, the optical path was adjusted by quantitatively observing the grid ring changes.
In a specific implementation scenario, the method includes the following steps:
firstly, acquiring a light spot image (shown in fig. 2) with diffraction rings by using an imaging device (such as a high-definition camera and the like), wherein the light spot image has a central light spot O1 and a plurality of diffraction rings which are sequentially distributed from inside to outside around the central light spot O1, and the plurality of diffraction rings comprise a first diffraction ring P1, a second diffraction ring P2 and a third diffraction ring P3.. the nth diffraction ring PN which are sequentially distributed from inside to outside, and N is a positive integer greater than or equal to 1; the boundary of the central spot O and each diffraction ring are elliptical, all ellipses having the same center, depending on the diffractive properties of the beam.
Secondly, as shown in fig. 3, the center, the rotation angle and the ellipticity of the central spot O1 of the spot image are obtained, a central ellipse O2 is fitted according to the center, the rotation angle and the ellipticity of the central spot O1, the major semi-axis of the central ellipse O2 is dx, the minor semi-axis is dy, and the major semi-axis dx and the minor semi-axis dy are matched with the ellipticity; the major semi-axis dx and the minor semi-axis dy can be determined according to the precision requirement of the subsequent diffraction ring boundary identification, and the smaller the major semi-axis dx and the minor semi-axis dy, the higher the precision of the subsequent diffraction ring boundary identification is.
Thirdly, as shown in fig. 3, determining a plurality of peripheral ellipses sequentially distributed from inside to outside according to the central ellipse O2, that is, a first peripheral ellipse S1, a second peripheral ellipse S2, and a third peripheral ellipse S3.. nth peripheral ellipse SN, where the central ellipse O2 and each peripheral ellipse have the same center, and from inside to outside, the major half axis of each peripheral ellipse sequentially corresponds to M × dx, and the minor half axis sequentially corresponds to M × dy, where M is a positive integer greater than or equal to 2, and M sequentially corresponds to 2,3,4.., for example, from inside to outside, the major half axis of the first peripheral ellipse S1 is 2dx, the minor half axis is 2dy, and the major half axis of the second peripheral ellipse S2 is 3dx, and the minor half axis is 3 dy.; the central ellipse O2 is different from the first peripheral ellipse S1 in terms of dx in the major half axis and dy in the minor half axis. .
As described above, since the central ellipse O2 and each peripheral ellipse are concentric ellipses, when the parameter information (including the center, the rotation angle, the ellipticity, the semi-major axis dx, and the semi-minor axis dy) of the central ellipse O2 is determined, the position of each peripheral ellipse can be estimated by increasing the semi-major axis dx and the semi-minor axis dy.
A fourth step, as shown in fig. 4a-4B, of generating a central elliptical image a1 from said central ellipse O2 and a corresponding peripheral elliptical image from each peripheral ellipse, i.e. a first peripheral elliptical image B1 from the first peripheral ellipse S1, a second peripheral elliptical image B2 from the second peripheral ellipse S2, a third peripheral elliptical image B3 from the third peripheral ellipse S3, an nth peripheral elliptical image BN from the nth peripheral ellipse SN.
Determining a plurality of grid loops which are distributed between every two adjacent elliptical image boundaries (namely between the center elliptical image A1 and the first peripheral elliptical image B1 and between the boundaries of the two adjacent peripheral elliptical images) from inside to outside in sequence, wherein the plurality of grid loops comprise a first grid loop L1, a second grid loop L2.. an Nth grid loop LN, and further, correspondingly determining the size D1, D2... DN of each grid loop according to the formulas (1) - (4);
wherein d σ (Z) is the beam diameter of the beam corresponding to the outer boundary of the Nth mesh ring, and the derivation process is described in ISO 11145-2018 optics and photonics-laser and laser related equipment-vocabulary and symbols-, "d σ X (Z) is the component of d σ (Z) in the X direction, and d σ y (Z) is the component of d σ (Z) in the y direction; thus, the size of the first mesh ring L1 is obtained
Size of the second mesh ring L2
.. size of Nth mesh Ring LN
。
Specifically, as shown in fig. 5, the fourth step specifically includes:
s41 filling the central ellipse O2 with first pixel values inside and second pixel values outside to generate a central ellipse image a 1; and filling the first peripheral ellipse S1 with first pixel values inside and second pixel values outside to generate a first peripheral ellipse image B1; the first pixel value is 1, and the second pixel value is 0.
S42, exclusive-or the central elliptical image a1 and the first peripheral elliptical image B1 to obtain a first grid ring L1 therebetween.
S43, filling the first pixel values inside and the second pixel values outside the second peripheral ellipse S2 to generate a second peripheral ellipse image B2.
S44, exclusive-oring the first peripheral elliptical image B1 and the second peripheral elliptical image B2 to obtain a second mesh ring L2 therebetween.
And S45, repeating the steps S43-S44 to determine a plurality of grid loops of the dry network between the boundaries of every two adjacent elliptical images and distributed in sequence from inside to outside.
Fifthly, corresponding grid ring pixel points in the current grid ring to the light spot image O, extracting image pixel points corresponding to the grid ring pixel points from the light spot image O, and calculating pixel average values of all the image pixel points to serve as image pixel point ring average values of the light spot image O corresponding to the current grid ring; and repeating the steps in sequence to obtain the image pixel point ring mean value of the light spot image O corresponding to each grid ring.
Specifically, the fifth step specifically includes:
s51, converting a ring grid image into a ring grid image two-dimensional array formed by pixel values through a function, and indexing each pixel value in the ring grid image two-dimensional array through two for-cycles to obtain an array containing all the pixel values in the ring grid image;
s52, the realization process of corresponding the annular area and the original image point is to create a null number sequence and then traverse all the pixel values of the original image. While a certain pixel is indexed in the traversal process, the pixel value of the same coordinate in the binary image L1 is also indexed. If the pixel value of the indexed L1 is equal to 1, adding the pixel value indexed in the original image into the array; if equal to 0, skip this pixel, index the next one, until all pixels of both graphs have been traversed. (the resolution of the artwork is the same as that of L1).
For example, when the pixel value in the first annular region image L1 is 1, points with the same coordinates are found in the original image (as shown in fig. 6), all the points in the original image are extracted, and then averaged to be used as the annular mean value;
sixthly, as shown in fig. 7, a curve is established according to the size dN of each ring region image and the ring mean value of each ring region image, wherein the ring mean value of each ring region image is taken as a vertical coordinate, and the size dN of each ring region image is taken as a horizontal coordinate; and determining a diffraction ring boundary decision threshold in the curve;
a seventh step, as shown in fig. 7 to 9, determining the boundary of the diffraction ring according to the determination threshold, and extracting the image of the diffraction ring according to the boundary; the threshold ratio of the lateral distribution in fig. 7 is the peak lateral, i.e., the decision threshold curve, and this graph is correspondingly embedded in fig. 8 for comparative analysis. Fig. 8 shows the correspondence from the ring lattice to the diffraction ring, and the analysis process is a ring mean curve. The vertical arrows indicate the correspondence of the grid rings to the boundaries of the diffraction rings, i.e. which grid rings were finally determined as the boundaries of the diffraction rings, which correspond to the points where the two curves of the intensity-mean curve and the decision threshold curve in fig. 7 intersect. The vertical arrows also pass right through these intersections. An image of the diffraction ring can be obtained by extracting the annular region from the diffraction ring boundary as shown in fig. 9.
And step eight, analyzing the extracted diffraction ring image to obtain diffraction ring data, wherein the diffraction ring data comprise ring energy.
Whether pixel points with the same coordinates of the original image are extracted or not is determined by whether the pixel values of the mask images are equal to 1 or not, and L1 to LN in the text are each mask image.
The principle of the specific working process is as follows: the calculation of the mean value is done by a computer program, the calculation content comprises the pixels in the area marked by the mask image in the image, the mean value of the intensities of all these pixels is calculated.
The marking method comprises the following steps: the resolution of the mask image is the same as that of the original image, and whether the original image pixel is marked is judged according to whether the pixel intensity in the mask image is 0 or not. If the value is 0, the pixels with the same coordinates of the original image are considered as unmarked pixels and are not included in the pixels for calculating the average value; if not, the pixels with the same coordinate in the original image are considered as marked pixels and included in the pixel points for calculating the average value, and even if the intensity is 0, the marked pixels should be included.
An embodiment of the present invention further provides a storage medium, where the storage medium is used to store a computer program, and the computer program includes: instructions for performing the image-based spot diffraction ring analysis method as previously described.
The invention also provides a chip comprising: a processor for invoking and running a computer program from a memory, the computer program comprising: instructions for performing the image-based spot diffraction ring analysis method as previously described.
The scheme can realize the extraction and measurement of the light beam diffraction ring only based on image analysis, does not need an additional measuring device except one camera, is plug and play, has the characteristics of intuition, simplicity, portability and high efficiency, and can realize the measurement of light spots with different circularities and angles.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting the same, and although the present invention is described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications and equivalents may be made to the embodiments of the invention without departing from the spirit and scope of the invention, which is to be covered by the claims.