Disclosure of Invention
The invention provides an image-based spot diffraction ring analysis method, a storage medium and a chip, which solve the technical problems that a method and a tool for analyzing relevant parameters of a single diffraction ring are not available at present.
The invention provides an image-based facula 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 distributed on the periphery of the central light spot in a surrounding manner from inside to outside, and setting the minimum step length d of the two-axis direction according to the central point coordinate, the rotation angle and the ellipticity of the central light spot x And d y ;
S2, taking the minimum step length as a step length, obtaining a central grid ring according to the central point coordinate, the rotation angle and the ellipticity of the central light spot, and repeating the steps by adding one step length each time to extract all grid rings of the 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 an ordinate and the grid ring size as an abscissa;
s4, in the ring mean curve, grids corresponding to the boundaries of the diffraction rings are found out according to the threshold value to separate out the grid rings, and data and images of the grid rings are extracted for analysis.
Optionally, the minimum step d x And d y Is equal to or a multiple of 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;
grid rings corresponding to the diffraction rings are respectively obtained according to the S2 method, wherein elliptical images corresponding to the first diffraction ring P1, the second diffraction ring P2, the third diffraction ring P3 and the N diffraction ring PN one to one are first peripheral ellipse S1, second peripheral ellipse S2, third peripheral ellipse S3 and N 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 the MASK_b are respectively larger than the MASK_a by one step, the internal pixel values of the elliptical images are filled with 1, the external pixel values are all 0, and performing exclusive OR on the elliptical images MASK_a and MASK_b to obtain a MASK image of a center grid ring;
s22, extracting gray values of pixels with the same coordinates of the input image according to whether the gray level of each pixel in the mask image is 0, extracting if the gray values are not 0, obtaining data of all pixels on the grid ring, averaging the data to obtain an average value of the grid ring, and simultaneously calculating the size of the grid ring and meeting the requirements
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 grid ring images are extracted.
Optionally, the step S23 further includes:
s24, directly multiplying the corresponding mask image with the original image to extract the image information of the corresponding grid.
Optionally, the distance between the grid rings is a fixed value.
Optionally, the threshold is a given constant, a ratio of the peak of the spot image multiplied by less than 1, the ratio taking 0.135 or 1/e 2, to define the effective range of the spot image.
Optionally, S5 is further included after S4:
when the laser is analyzed, the processing effect of the laser is combined, and the relation between the distribution condition of the grid ring and the processing quality is analyzed to help to improve the laser processing technology;
in optical studies, the optical path is aided by quantitatively observing the mesh 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 loop analysis method.
The invention also provides a chip, comprising: a processor for calling and running a computer program from a memory, the computer program comprising: instructions for performing an image-based spot diffraction loop analysis method.
The beneficial effects are that: the invention provides an image-based spot diffraction ring analysis method, a storage medium and a chip, which are characterized in that spot images with diffraction rings are firstly 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 a central spot, and the steps are repeated by adding one step length each time to extract all grid rings of the spot images; then, drawing the obtained grid ring mean value by taking the grid ring mean value as an ordinate and the grid ring size as an abscissa to obtain a ring mean value curve; and finally, in the ring mean curve, finding out grids corresponding to the boundaries of each diffraction ring according to a threshold value to separate each grid ring, and extracting data and images of each grid ring for analysis. And obtaining a grid intensity mean value-ring size relation curve of the facula image by adopting a ring grid calculation method with a set step length. And finding out the boundary of the diffraction ring according to the curve and the set threshold value, and separating each diffraction ring from the light spot image, thereby realizing the purpose of analyzing the diffraction rings of each level of the light spot.
The proposal can realize the extraction and measurement of the light beam diffraction ring based on image analysis, does not need an extra measuring device except a camera, is plug and play, has the characteristics of intuitiveness, 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 present invention, and is intended to provide a better understanding of the present invention, as it is embodied in the following description, with reference to the preferred embodiments of the present invention and the accompanying drawings. Specific embodiments of the present invention are given in detail by the following examples and the accompanying drawings.
Detailed Description
The principles and features of the present invention are described below with reference to the drawings, the examples are illustrated for the purpose of illustrating the invention and are not to be construed as limiting the scope of the invention. The invention is more particularly described by way of example in the following paragraphs with reference to the drawings. Advantages and features of the invention will become more apparent from the following description and from the claims. It should be noted that the drawings are in a very simplified form and are all to a non-precise scale, merely for convenience and clarity in aiding in the description of embodiments of the invention.
It will be understood that when an element is referred to as being "fixed to" another element, it can be directly on the other element or intervening elements may also be present. When a component is considered to be "connected" to another component, it can be directly connected to the other component or intervening components may also be present. When an element is referred to as being "disposed on" another element, it can be directly on the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like are used herein 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 herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and/or" as used herein 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, comprising the steps of:
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 distributed on the periphery of the central light spot in a surrounding manner from inside to outside, and setting the minimum step length d of the two-axis direction according to the central point coordinate, the rotation angle and the ellipticity of the central light spot x And d y The method comprises the steps of carrying out a first treatment on the surface of the The minimum step size is obtained by a parameter acquisition method in automatic calculation, and the parameters of automatic calculation include a center point coordinate, a rotation angle, an ellipticity and a step size. All the parameters mentioned above can also be set manually according to the test requirements.
S2, taking the minimum step length as a step length, obtaining a central grid ring according to the central point coordinate, the rotation angle and the ellipticity of the central light spot, and repeating the steps by adding one step length each time to extract all grid rings of the 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 an ordinate and the grid ring size as an abscissa;
s4, in the ring mean curve, grids corresponding to the boundaries of the diffraction rings are found out according to the threshold value to separate out the grid rings, and data and images of the grid rings are extracted for analysis.
The specific operation process is as follows:
step one, inputting a light spot image, as shown in fig. 2, and determining the center point coordinate, the rotation angle and the ellipticity of the light spot by a method of manually inputting or automatically analyzing the light spot by a computer. Setting the minimum step length d of two-axis direction x And d y The ratio should be equal to the ellipticity.
Step two, extracting grids:
1. two images mask_a and mask_b are generated, which contain ellipticities with the same center and rotation angle, wherein the two axes of mask_b are respectively one step larger than mask_a, the inner pixel values of the ellipses are filled with 1, and the outer pixel values are all 0. And xoring the two images, namely the image MASK_a and the image MASK_b to obtain the 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 level of each pixel in the mask image is 0, extracting if the gray value is not 0, obtaining the data of all the pixels on the grid ring, and then averaging the data to obtain the average value of the grid ring. At the same time, the size of the grid ring is calculated and meets
At this time, the first grid loop and the nth grid loop are calculated by multiplying the first grid loop and the nth grid loop by a coefficient N, and represent the magnitude of SN, namely the independent variable of the mean curve.
3. Taking the original MASK_b as a new MASK_a, generating an image with an ellipse larger than one step length 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 grid image is to be extracted, the corresponding mask image is directly multiplied with the original image.
And thirdly, drawing the obtained grid ring mean value into a ring mean value curve by taking the grid ring mean value as an ordinate and the grid ring size as an abscissa, as shown in fig. 7.
Step four, in the ring mean curve, the grids corresponding to the diffraction ring boundaries are found according to the threshold value, as shown in fig. 6, then images mask_a and mask_b are generated according to the coverage range of the grids corresponding to the inner and outer boundaries, and the data and images of the diffraction rings are extracted according to the same method as that when the grids are extracted in the step two, wherein the separated diffraction ring images are shown in fig. 9.
And fifthly, analyzing and calculating through the data of all the pixels on the ring.
When the laser is analyzed, the processing effect of the laser is combined, and the relation between the distribution condition of the grid ring and the processing quality is analyzed to help to improve the laser processing technology;
in optical studies, the optical path is aided by quantitatively observing the mesh ring changes.
In one specific implementation scenario, the method comprises the following steps:
firstly, acquiring a light spot image (shown in fig. 2) with diffraction rings by using imaging equipment (such as a high-definition camera and the like), wherein the light spot image is provided with a central light spot O1 and a plurality of diffraction rings which are distributed around the central light spot O1 from inside to outside in sequence, the plurality of diffraction rings comprise a first diffraction ring P1, a second diffraction ring P2 and a third diffraction ring P3, wherein the first diffraction ring P1, the second diffraction ring P2 and the third diffraction ring P3 are distributed from inside to outside in sequence, 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 according to the diffraction properties of the light beam, and all ellipses have the same center.
Step two, as shown in fig. 3, acquiring the center, rotation angle and ellipticity of a central light spot O1 of the light spot image, fitting a central ellipse O2 according to the center, rotation angle and ellipticity of the central light spot O1, wherein the long half axis dx and the short half axis dy of the central ellipse O2 are matched with the ellipticity; the long half shaft dx and the short half shaft dy can be determined according to the accuracy requirement of the subsequent recognition of the diffraction ring boundary, and the smaller the long half shaft dx and the short half shaft dy, the higher the accuracy of the subsequent recognition of the diffraction ring boundary.
A third step, as shown in fig. 3, of determining, according to the central ellipse O2, a plurality of peripheral ellipses distributed in turn from inside to outside, namely, a first peripheral ellipse S1, a second peripheral ellipse S2, a third peripheral ellipse S3..nth peripheral ellipse SN, wherein the central ellipse O2 and each peripheral ellipse have the same center, and from inside to outside, the long half axis of each peripheral ellipse corresponds in turn to M x dx, the short half axis corresponds in turn to M x dy, wherein M is a positive integer greater than or equal to 2, and M corresponds in turn to 2,3, 4..for example, from inside to outside, the long half axis of the first peripheral ellipse S1 is 2dx, the short half axis is 2dy, the long half axis of the second peripheral ellipse S2 is 3dx, and the short half axis is 3 dy; wherein, the center ellipse O2 is different from the first peripheral ellipse S1, the long half shafts of the two adjacent peripheral ellipses are different from dx, and the short half shafts are different from dy. .
As described above, since the center ellipse O2 and each of the peripheral ellipses are concentric ellipses, after determining the parameter information (including the center, the rotation angle, the ellipticity, the long half axis dx, and the short half axis dy) of the center ellipse O2, the position of each of the peripheral ellipses can be calculated by increasing the long half axis dx and the short half axis dy.
Fourth, as shown in fig. 4a-4B, a center ellipse image A1 is generated according to the center ellipse O2, and a corresponding peripheral ellipse image is generated according to each peripheral ellipse, that is, a first peripheral ellipse image B1 is generated according to the first peripheral ellipse S1, a second peripheral ellipse image B2 is generated according to the second peripheral ellipse S2, and a third peripheral ellipse image B3 is generated according to the third peripheral ellipse S3.
And determining a plurality of grid rings which are distributed between every two adjacent elliptical image boundaries (namely, between the boundaries of the central 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 grid rings comprise a first grid ring L1 and a second grid ring L2.
d σx (z)=2*dx*N (2);
d σy (z)=z*y*N (3);
DN=dσ(Z) (4);
Wherein dσ (Z) is the beam diameter corresponding to the outer boundary of the nth mesh ring, the derivation of which is referred to as "ISO 11145-2018 optics and photonics-laser and laser related devices-vocabulary and symbol", dσx (Z) is the component of dσ (Z) in the X-direction, dσy (Z) is the component of dσ (Z) in the y-direction; thereby, the size of the first mesh ring L1 is obtained
The size of the second mesh loop L2 +.>
Size of N-th mesh Loop LN +.>
Specifically, as shown in fig. 5, the fourth step specifically includes:
s41, filling a first pixel value inside the center ellipse O2 and filling a second pixel value outside the center ellipse O2 to generate a center ellipse image A1; filling the first pixel value inside the first peripheral ellipse S1 and filling the second pixel value outside the first peripheral ellipse S1 to generate a first peripheral ellipse image B1; the first pixel value is 1, and the second pixel value is 0.
S42, xoring the central oval image A1 and the first peripheral oval image B1 to obtain a first grid ring L1 therebetween.
S43, filling the first pixel value inside the second peripheral ellipse S2 and filling the second pixel value outside the second peripheral ellipse S2 to generate a second peripheral ellipse image B2.
S44, exclusive-or the first peripheral elliptic image B1 and the second peripheral elliptic image B2 to obtain a second grid ring L2 therebetween.
S45, repeating the steps S43-S44 to determine a plurality of grid rings which are arranged between every two adjacent elliptical image boundaries and are distributed from inside to outside in sequence.
Fifthly, corresponding grid ring pixel points in the current grid ring to the spot image O, extracting image pixel points corresponding to the grid ring pixel points from the spot image O, and calculating the pixel average value of all the image pixel points to serve as the image pixel point ring average value of the spot image O corresponding to the current grid ring; and sequentially repeating the steps to obtain the image pixel point ring average value of the corresponding facula image O of 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 loops to obtain a array containing all pixel values in the ring grid image;
s52, the implementation process of the annular area corresponding to the original image point is to create an empty number column and then traverse all pixel values of the original image. The pixel value of the same coordinate in the binary image L1 is also indexed while indexing a certain pixel during traversal. If the pixel value of the index L1 is equal to 1, adding the pixel value indexed in the original image into a number column; if equal to 0, the present pixel is skipped and the next is indexed until all pixels of both graphs have been traversed. (the resolution of the original and L1 are the same).
For example, when the pixel value in the first annular area 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 the average is obtained as an annular average value;
step six, as shown in fig. 7, a curve is established according to the size dN of each annular region image and the annular mean value of each annular region image, wherein the annular mean value of each annular region image is taken as an ordinate, and the size dN of each annular region image is taken as an abscissa; and determining a diffraction ring boundary decision threshold in the curve;
a seventh step of determining the boundary of the diffraction ring according to the determination threshold, and extracting an image of the diffraction ring according to the boundary; the threshold ratio of the lateral distribution in fig. 7 is that the peak is the determination threshold curve, and the graph is correspondingly embedded in fig. 8 for comparison analysis. Fig. 8 shows the correspondence from ring grid to diffraction ring, the analysis process of which is a ring mean curve. The vertical arrows represent the correspondence of the grid rings to the boundaries of the diffraction rings, i.e. which grid rings were last determined as boundaries of the diffraction rings, which correspond exactly to the points in fig. 7 where the intensity mean curve intersects both curves of the determination threshold curve. The vertical arrow also passes just past these intersections. The annular region is extracted from the diffraction ring boundary to obtain an image of the diffraction ring as shown in fig. 9.
Eighth, the extracted diffraction ring image is analyzed to obtain diffraction ring data, which includes ring energy.
Whether to extract the pixel points with the same coordinates of the original image is determined by whether the pixel value of the mask image is equal to 1, wherein L1 to LN are the mask images.
The specific working process principle is as follows: the calculation of the ring mean is done by a computer program, the calculation content comprising pixels in the image within the area marked by the mask image, the mean of the intensities of all these pixels being calculated.
The marking method comprises the following steps: and judging whether the original image pixels are marked according to whether the pixel intensity in the mask image is 0 or not, wherein the mask image has the same resolution as the original image. If the pixel is 0, the pixels with the same coordinates of the original image are regarded as unlabeled pixels, and the unlabeled pixels are not included in the pixel points for calculating the average value; pixels with the same coordinates in the original image are considered as marked pixels if they are not 0, and the marked pixels are included in the pixel points for calculating the average value, and even if the intensity is 0, the marked pixels should be included. .
The embodiment of the invention also provides a storage medium for storing a computer program, the computer program comprising: instructions for performing an image-based spot diffraction loop analysis method as described above.
The invention also provides a chip, comprising: a processor for calling and running a computer program from a memory, the computer program comprising: instructions for performing an image-based spot diffraction loop analysis method as described above.
The proposal can realize the extraction and measurement of the light beam diffraction ring based on image analysis, does not need an extra measuring device except a camera, is plug and play, has the characteristics of intuitiveness, simplicity, portability and high efficiency, and can realize the measurement of light spots with different circularities and angles.
It will be appreciated by those skilled in the art that 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 aspects of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the above embodiments, it should be understood by those of ordinary skill in the art that: modifications and equivalents may be made to the specific embodiments of the invention without departing from the spirit and scope of the invention, which is intended to be covered by the claims.