A method for measuring center deviation of optical components based on Newton ring detection
Through multi-angle segmentation measurement and adaptive binarization processing, combined with mask calculation and circular fitting, predicted circles are generated, which solves the problems of low efficiency and low accuracy of Newton's ring center positioning, and achieves more efficient and accurate position.
Patent Information
- Application Number
- CN202411606776.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-11-12
AI Technical Summary
The prior art is inefficient and difficult to ensure positioning accuracy and stability when positioning in the center of the Newtonian ring, especially when processing images with complex backgrounds or noise.
By measuring the grayscale and grayscale peak point coordinates of the image in multiple angles, calculating uniform distance points, performing adaptive binarization, applying mask calculations, circular fitting and iteration to generate predicted circles that characterize Newton's rings.
It effectively improves the accuracy and processing speed of Newton's ring center positioning, is suitable for laboratory and industrial testing, and has a wide range of application prospects.
Smart Images

Figure CN119131031B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a method for measuring center deviation of an optical component based on Newton ring detection. Background Art
[0002] Newton's rings are an optical phenomenon that usually appears as an interference pattern between a convex lens and a flat glass. As light waves reflect and interfere at the interface of the two media, a series of concentric light and dark ring patterns are formed. The center of Newton's rings is an important feature for observing these interference rings. Accurately locating the center of Newton's rings is of great significance for measuring the flatness of optical components and adjusting the optical center.
[0003] Precisely locating the center of Newton's rings is widely used in optical measurement, lens calibration and material research. In the process of assembling optical components, the center position of the lens can be detected by analyzing Newton's rings to see if it matches the calibration center. In specific measurements, due to the adjustment error of optical components, different special cases of the distribution of Newton's rings may occur, and even Newton's rings may be distorted; at the same time, the texture and light and dark distribution in the same image may be extremely uneven. In order to overcome the above technical problems as much as possible, in the process of locating the center of Newton's rings, methods such as full-image edge detection and Hough circle detection are usually used. These methods not only increase the requirements for image quality, but also reduce efficiency, resulting in the inability to feedback results immediately. In addition, these methods are often difficult to guarantee positioning accuracy and stability when processing images with complex backgrounds or more noise.
[0004] It can be seen that at this stage, a method that can effectively improve the positioning accuracy of the center of Newton's rings is urgently needed. Summary of the invention
[0005] In order to avoid and overcome the technical problems existing in the prior art, the present invention provides a method for measuring the center deviation of an optical component based on Newton's ring detection. The present invention can effectively improve the accuracy of Newton's ring center positioning.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A method for measuring center deviation of an optical component based on Newton ring detection includes the following measuring steps:
[0008] S1. Obtain the original Newton ring image of the optical component by measuring with a center deviation measuring instrument, mark the calibration center of the optical component on the original Newton ring image, and bring the calibration center coordinates of the optical component into the subsequent calculation steps as original data;
[0009] S2, taking the origin of the image coordinate system of the original image of the Newton rings as the starting point to draw rays, setting the angles between each adjacent ray to a predetermined angle, and sequentially obtaining the grayscale peak point on each ray and the image coordinates of the grayscale peak point according to the peak finding algorithm;
[0010] S3, according to the obtained image coordinates, calculate the peak distance between each adjacent grayscale peak point on each ray, and obtain the minimum value of all peak distances; divide the Newton rings original image into a grid, and use the minimum value as the length of the square grid unit; perform binarization processing on the Newton rings original image after grid division to convert the Newton rings original image into a Newton rings binary image;
[0011] S4, based on the principle of generating uniform distance points, obtaining uniform distance points on each ray in the original image of the Newton rings;
[0012] S5. Based on the distance uniform point, a prediction circle representing Newton's rings is generated on the Newton's rings binary image using the prediction circle generation principle, and the distance between the center of the prediction circle and the calibration center on the Newton's rings binary image is calculated. The distance is the center deviation of the optical component.
[0013] As a further solution of the present invention: the specific content of step S2 is as follows:
[0014] S21, taking the center of the original image of Newton's rings as the origin of the image coordinate system O-XY;
[0015] S22, take the origin of the image coordinate system in the original image of Newton's rings as the starting point N rays, and N The rays start from the positive direction of the X-axis in the image coordinate system and are evenly arranged in the counterclockwise or clockwise direction. The angles between adjacent rays are all predetermined angles. α =360° / N ;
[0016] S23, use the peak search algorithm to obtain N The grayscale peak point on the ray and the image coordinates of the grayscale peak point in the image coordinate system.
[0017] As a further solution of the present invention: the peak finding algorithm is specifically expressed as follows:
[0018] S231, traversing the grayscale value of each pixel on the current ray in the original Newton ring image;
[0019] S232, check whether the grayscale value of each pixel on the current ray is greater than the grayscale value of its adjacent pixels before and after; if so, the pixel is a grayscale peak point; otherwise, it is a grayscale valley point; and for the starting pixel and the ending pixel on the ray, only the grayscale value of one adjacent pixel needs to be compared;
[0020] S233, after determining all the grayscale peak points and all the grayscale valley points on the current ray, store all the grayscale peak points and all the grayscale valley points in the grayscale peak and valley point list of the current ray in sequence according to the direction of the current ray; store all the grayscale peak points in the grayscale peak point list of the current ray in sequence according to the direction of the current ray, and at the same time obtain the image coordinates of all the grayscale peak points in the image coordinate system and store them in the image coordinate list; the image coordinate list is expressed as follows:
[0021] ;
[0022] in, Indicates n The image coordinates of each grayscale peak point on a ray are arranged in sequence along the direction of the ray to form an image coordinate list. ; N Indicates the total number of rays; express The image coordinates of the first grayscale peak point in the image coordinate system; express Middle i The image coordinates of the grayscale peak points in the image coordinate system.
[0023] As a further solution of the present invention: the specific content of step S3 is as follows:
[0024] S31, based on the obtained grayscale peak point list and the corresponding image coordinate list, respectively calculate N The distance between the image coordinates of each adjacent grayscale peak point on the ray is recorded as the peak distance; the peak distance is expressed as ; Indicates n On the ray i The distance between the image coordinates of the i+1th grayscale peak point and the image coordinates of the i+1th grayscale peak point;
[0025] S32. Calculate the peak spacing of all rays and obtain the minimum value, which is recorded as d min ;
[0026] S33, d minis the length of a square grid unit, a grid is constructed, and the grid is overlaid on the original Newton rings image;
[0027] S34, perform Gaussian weighted sum processing on all pixels in each square grid unit, and use the Gaussian weighted sum obtained by the processing as the binarization threshold of the current square grid unit, change the pixels in the square grid unit that are greater than or equal to the binarization threshold to 255, and change the pixels in the square grid unit that are less than the binarization threshold to 0, so that the Newton rings original image has only two grayscale values, and then convert the Newton rings original image into a Newton rings binary image.
[0028] As a further solution of the present invention, the specific content of the uniform distance point generation principle in step S4 is as follows:
[0029] S41, counting the number of grayscale peak points and the number of grayscale valley points in the grayscale peak-valley value point list of the current ray, if the numbers are the same, no processing is performed; if the numbers are different, deleting them from both ends of the grayscale peak-valley value point list to the middle in sequence, so that the number of grayscale peak points and the number of grayscale valley points in the grayscale peak-valley value point list are the same;
[0030] S42. In the grayscale peak-valley value point list processed by step S41, along the direction of the current ray, the adjacent grayscale peak points and grayscale valley points are matched to form grayscale peak-valley value point pairs, and each grayscale peak-valley value point pair is stored in the grayscale peak-valley value point pair list of the current ray, and each grayscale peak-valley value point pair does not interfere with each other; at the same time, the peak spacing between adjacent grayscale peak points in the grayscale peak-valley value point list processed by step S41 and the average value of the peak spacing in the grayscale peak-valley value point list are calculated; then the standard deviation of the peak spacing in the grayscale peak-valley value point list is calculated, and then the grayscale peak points in the grayscale peak-valley value point list whose peak spacing and the average value of the peak spacing exceed three times the standard deviation of the peak spacing are counted, and the grayscale peak-valley value point pairs corresponding to these grayscale peak points are deleted from the grayscale peak-valley value point pair list;
[0031] S43, based on the grayscale peak-valley value point pair list after deleting the corresponding grayscale peak point in step S42, calculate the slope of each grayscale peak-valley value point pair in the grayscale peak-valley value point pair list, and select the grayscale peak-valley value point pairs whose slopes are within the set slope range; then record the selected grayscale peak-valley value points as valid peak points of the current ray, and store each valid peak point in the valid peak point list in order according to the direction of the current ray, so as to obtain all valid peak points of the current ray;
[0032] S44, according to the contents of step S41 to step S43, a list of valid peak points of all rays can be obtained;
[0033] S45, set a sliding window that gradually slides from the head to the tail of the effective peak point list along the ray direction, and the sliding window can only frame the consecutively arranged points in the effective peak point list at a time. k The sliding window only slides one valid peak point each time; the sliding window is framed after each sliding k The valid peak points are recorded as valid peak point units, and all valid peak point units of the current ray are stored in the valid peak point unit list;
[0034] S46, calculating the peak distances between adjacent valid peak points in each valid peak point unit in the valid peak point unit list of the current ray, and storing the calculated peak distances in the valid peak point peak distance units corresponding to the valid peak point units in sequence along the direction of the current ray; thereby, all valid peak point peak distance units of the current ray are stored in the valid peak point peak distance unit list of the current ray;
[0035] S47, sliding the sliding window set in steps S45 to S46 in the effective peak point list of each ray, so as to obtain a peak distance unit list of effective peak points of each ray;
[0036] S48, select any two rays, and make the effective peak point peak spacing units in the effective peak point peak spacing unit list corresponding to the two rays be combined in pairs to form an effective peak point peak spacing unit pair; each effective peak point peak spacing unit in each effective peak point peak spacing unit pair contains k-1 peak spacings; therefore, the peak spacings in the current effective peak point peak spacing unit are numbered in sequence from 1 to k-1;
[0037] S49, calculate the absolute value of the difference between the two peak spacings with the same sequence number in each valid peak point peak spacing unit pair, and then sum them up to obtain the peak spacing threshold of the current valid peak point peak spacing unit pair, and the minimum value of the peak spacing thresholds of the two rays; obtain all valid peak points in the valid peak point peak spacing unit pair corresponding to the minimum value, and record them as uniform distance points;
[0038] S410. Operate according to the contents of step S48 to step S49 to obtain all the uniform distance points between any two rays.
[0039] As a further solution of the present invention, the specific steps of generating a prediction circle representing Newton's rings on a Newton's rings binary image using the prediction circle generation principle are as follows:
[0040] S51, acquiring four rays in sequence along a clockwise direction or a counterclockwise direction on the Newton ring binary image, with a difference of 90° between adjacent rays;
[0041] S52, respectively calculating the image coordinate mean values corresponding to all the evenly spaced points of the four rays, and recording the pixel point where the image coordinate mean value is located as the best point, thereby obtaining four best points corresponding to the four rays;
[0042] S53, based on the obtained four best points, the least squares method is used to fit the centers of the predicted circles corresponding to the four best points O 1 and radius R 1;
[0043] S54. Construct a black image of the same size as the binary image of Newton's rings and place the center of the circle O 1 is marked in the black image according to its coordinate mapping in the binary image of Newton's rings; then O 1. Radius R 1Draw an outer circle on the black image, and then O 1. Radius R 1- d min / 2 Draw an inner circle on the black image; a ring band is formed between the inner circle and the outer edge, and the ring band is set to white, and the image at this time is recorded as the mask image M 0;
[0044] S55, the mask image M 0 is overlaid on the Newton rings binary image, and the borders of the two are completely aligned; at this time, the Newton rings binary image and the mask image are obtained M The grayscale value of the white pixels at the intersection of the rings of 0 is 255, and the collection of each white pixel forms the masked image. D 1;
[0045] S56, the masked image is evaluated by the evaluation function D 1. Calculate the concentricity error between the Newton's ring and the outer circle. If the concentricity error is less than the error threshold, the outer circle generated at this time is the predicted circle that can characterize the Newton's ring. Otherwise, it is necessary to perform the operations of step S57 to step S58 until the concentricity error is less than the error threshold.
[0046] S57, calculating the masked image in step S55 D 1, then connect the centroid and the center of the circle O 1, and push the mask image M 0 Along the center of mass and the center of the circle O 1 moves the line toward the center of mass by a set distance, and counts the Newton rings binary image and the mask image at this time M The pixels intersecting the outer circle of the ring with a value of 0 are white pixels with a value of 255. The collection of white pixels forms the masked image. D 2;
[0047] S58, the masked image D 2 is brought into the least squares method, and the contents of step S53 to step S54 are used to fit and generate a new center O 1. New radius R 1, and the new mask image M 0; then calculate the new mask image according to the contents of step S55 to step S56 M 0 and the masked image D 1, and judge whether the concentricity error is less than the error threshold.
[0048] As a further solution of the present invention: the process of calculating the concentricity error by the evaluation function is as follows:
[0049] S561, masked image D 1Fitting to get the center of the outer circle O The coordinates of 1 in the Newton ring binary grayscale image are ( h , g ), the outer radius is R 1; Construct a circumscribed rectangle outside the outer circle. The circumscribed rectangle is ( h , g ) as the center; and ( h , g ) is the origin, and the image after masking D 1, a plane rectangular coordinate system is constructed, and the plane rectangular coordinate system divides the circumscribed rectangle into four equal parts;
[0050] S562, respectively counting the images after masking D 1 is the number of pixels in each quadrant of the plane rectangular coordinate system, and then the corresponding number of pixels is input into the evaluation function to calculate the concentricity error; the evaluation function is expressed as follows:
[0051] ;
[0052] ;
[0053] In the formula, Loss Indicates concentricity error; N 1 indicates the image after masking D 1 is the number of pixels in the first quadrant of the rectangular coordinate system; N 2 represents the image after masking D 1 is the number of pixels in the second quadrant of the plane rectangular coordinate system; N 3 represents the image after masking D 1 is the number of pixels in the third quadrant of the plane rectangular coordinate system; N 4 represents the image after masking D1 is the number of pixels in the fourth quadrant of the rectangular coordinate system; N i Represents the image after masking D 1 is located in the plane rectangular coordinate system i The number of pixels in the quadrant; N 0 means the image after masking D 1 is the number of all pixels in the rectangular coordinate system.
[0054] As a further solution of the present invention: the image after masking D The centroid calculation process of 1 is as follows:
[0055] S571, obtaining the masked image D The grayscale value of all pixels in 1;
[0056] S572, input each gray value into the centroid calculation formula to calculate the masked image D 1's centroid; the centroid calculation formula is as follows:
[0057] ;
[0058] ;
[0059] In the formula, Represents the image after masking D 1The horizontal coordinate of the center of mass in the binary grayscale image of Newton's rings; Represents the image after masking D 1 The vertical coordinate of the center of mass in the binary grayscale image of Newton's rings; W Represents the width of the Newton rings binary grayscale image; H Represents the height of the Newton rings binary grayscale image; I ( x , y ) represents the masked image D 1 pixel ( x , y )’s grayscale value.
[0060] As a further solution of the present invention: in step S561, the equation of the straight line at the left boundary of the circumscribed rectangle is: x=h-R1, the equation of the straight line at the right boundary is: x=h+R1, the equation of the straight line at the upper boundary is: y=g+R1, and the equation of the straight line at the lower boundary is: y=g-R1.
[0061] As a further solution of the present invention: the four rays used in step S51 are four rays that coincide with the coordinate axes of the image coordinate system.
[0062] Compared with the prior art, the present invention has the following beneficial effects:
[0063] The present invention can effectively improve the accuracy and processing speed of Newton ring center positioning by measuring the grayscale and grayscale peak point coordinates of the image in multi-angle segments, calculating the uniform distance points, adaptively binarizing the Newton ring image, applying mask calculation, circular fitting and iteration to the binarized image. This method is not only suitable for laboratory environments, but also can be applied to industrial detection and field measurement, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is the main flow chart of the present invention.
[0065] Figure 2 This is a binarized image of Newton's rings in an embodiment of the present invention.
[0066] Figure 3 This is a binary image of Newton's rings after marking uniform distance points in an embodiment of the present invention.
[0067] Figure 4 This is a binary image of Newton's rings after marking the optimal point in an embodiment of the present invention.
[0068] Figure 5 It is a mask image used as a reference in the embodiment of the present invention.
[0069] Figure 6 It is the masked image used as a reference in the embodiment of the present invention.
[0070] Figure 7 The mask image after the first iteration in the embodiment of the present invention .
[0071] Figure 8 The masked image after the first iteration in the embodiment of the present invention is D 1.
[0072] Fig. 9 The mask image after the second iteration in the embodiment of the present invention .
[0073] Fig.10 The masked image after the second iteration in the embodiment of the present invention is D 2.
[0074] Fig.11 4 is a center deviation diagram in an embodiment of the present invention. DETAILED DESCRIPTION
[0075] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0076] See also Figure 1 , the present invention mainly includes the following contents.
[0077] 1. Get the original image of Newton's rings.
[0078] The original Newton ring image of the optical component is obtained by measuring with a center deviation measuring instrument, the calibration center of the optical component is marked on the original Newton ring image, and the calibration center coordinates of the optical component are taken as original data into the subsequent calculation steps.
[0079] The specific process is as follows:
[0080] S11. Use a center deviation measuring instrument to provide a required environment for component measurement, and use a camera to collect data from the instrument.
[0081] S12. The center deviation measuring instrument controls the motor to adjust the base posture and the plano-concave mirror angle through the USB interface, and then re-measures the angle to obtain the flat base posture and plano-concave mirror angle, and gives the center of the optical component through calibration.
[0082] The original image of Newton's rings taken by the camera in the best measurement state is used as the data input of the algorithm, and the N Grayscale and coordinate data in each direction, and obtain K Grayscale peak point, and K Should be an even number, and should contain at least one pair of alternating light and dark.
[0083] here N The directions should be an even number greater than or equal to 4, and the entire circle is evenly divided by rotating counterclockwise or clockwise according to the image coordinate system of the original Newton ring image.
[0084] 2. Get the grayscale peak point.
[0085] Rays are drawn starting from the origin of the image coordinate system of the original image of the Newton rings, and the angles between adjacent rays are set to predetermined angles. The grayscale peak points on each ray and the image coordinates of the grayscale peak points are obtained in sequence according to the peak finding algorithm.
[0086] The specific process is as follows:
[0087] S21. Take the center of the original image of Newton's rings as the origin of the image coordinate system O-XY.
[0088] S22, take the origin of the image coordinate system in the original image of Newton's rings as the starting point N rays, and N The rays start from the positive direction of the X-axis in the image coordinate system and are evenly arranged in the counterclockwise or clockwise direction. The angles between adjacent rays are all predetermined angles. α =360° / N .
[0089] S23, use the peak search algorithm to obtain N The grayscale peak point on the ray and the image coordinates of the grayscale peak point in the image coordinate system.
[0090] The peak finding algorithm is specifically expressed as follows:
[0091] S231, traverse the gray value of each pixel point on the current ray in the original Newton ring image.
[0092] S232, check whether the grayscale value of each pixel on the current ray is greater than the grayscale value of its adjacent pixels before and after; if so, the pixel is a grayscale peak point; otherwise, it is a grayscale valley point; and for the starting pixel and the ending pixel on the ray, only the grayscale value of one adjacent pixel needs to be compared.
[0093] S233, after determining that all grayscale peak points and all grayscale valley points on the current ray are completed, all grayscale peak points and all grayscale valley points are stored in the grayscale peak and valley point list of the current ray in sequence according to the direction of the current ray; all grayscale peak points are stored in the grayscale peak point list of the current ray in sequence according to the direction of the current ray, and at the same time, the image coordinates of all grayscale peak points in the image coordinate system are obtained and stored in the image coordinate list; the image coordinate list is shown in formula (1):
[0094] (1);
[0095] 3. Obtain the binary image of Newton's rings.
[0096] According to the obtained image coordinates, the peak distance between each adjacent grayscale peak point on each ray is calculated, and the minimum value of all peak distances is obtained; a grid is divided on the Newton rings original image, and the minimum value is used as the length of the square grid unit; the Newton rings original image after grid division is binarized to convert the Newton rings original image into a Newton rings binary image.
[0097] The specific process is as follows:
[0098] S31, based on the obtained grayscale peak point list and the corresponding image coordinate list, respectively calculateN The distance between the image coordinates of each adjacent grayscale peak point on the ray is recorded as the peak distance; the peak distance is expressed as ; Indicates n On the ray i The distance between the image coordinates of the i+1th grayscale peak point and the image coordinates of the i+1th grayscale peak point.
[0099] S32. Calculate the peak spacing of all rays and obtain the minimum value, which is recorded as .
[0100] S33, A grid is constructed with the length of a square grid unit, and the grid is overlaid on the original Newton rings image.
[0101] S34, perform Gaussian weighted sum processing on all pixels in each square grid unit, and use the Gaussian weighted sum obtained by the processing as the binarization threshold of the current square grid unit, change the pixels in the square grid unit that are greater than or equal to the binarization threshold to 255, and change the pixels in the square grid unit that are less than the binarization threshold to 0, so that the Newton rings original image has only two grayscale values, and then convert the Newton rings original image into a Newton rings binary image.
[0102] 4. Get the uniform distance point.
[0103] Based on the principle of uniform distance point generation, the uniform distance points on each ray in the original image of Newton's rings are obtained.
[0104] The specific steps are as follows:
[0105] S41. Count the number of grayscale peak points and the number of grayscale valley points in the grayscale peak-valley value point list of the current ray. If the numbers are the same, no processing is performed. If the numbers are different, delete them from both ends of the grayscale peak-valley value point list to the middle in sequence, so that the number of grayscale peak points and the number of grayscale valley points in the grayscale peak-valley value point list are the same.
[0106] S42. In the grayscale peak-valley value point list processed by step S41, along the direction of the current ray, the adjacent grayscale peak points and grayscale valley points are matched to form grayscale peak-valley value point pairs, and each grayscale peak-valley value point pair is stored in the grayscale peak-valley value point pair list of the current ray, and each grayscale peak-valley value point pair does not interfere with each other; at the same time, the peak spacing between adjacent grayscale peak points in the grayscale peak-valley value point list processed by step S41 and the average value of the peak spacing in the grayscale peak-valley value point list are calculated; then the standard deviation of the peak spacing in the grayscale peak-valley value point list is calculated, and then the grayscale peak points in the grayscale peak-valley value point list whose peak spacing and the average value of the peak spacing exceed three times the standard deviation of the peak spacing are counted, and the grayscale peak-valley value point pairs corresponding to these grayscale peak points are deleted from the grayscale peak-valley value point pair list.
[0107] S43. Based on the grayscale peak-valley value point pair list after deleting the corresponding grayscale peak point in step S42, calculate the slope of each grayscale peak-valley value point pair in the grayscale peak-valley value point pair list, and select the grayscale peak-valley value point pairs whose slopes are within the set slope range; then record the selected grayscale peak-valley value points as valid peak points of the current ray, and store each valid peak point in the valid peak point list in sequence according to the direction of the current ray, so as to obtain all valid peak points of the current ray.
[0108] S44. According to the contents of step S41 to step S43, a list of valid peak points of all rays can be obtained.
[0109] S45, set a sliding window that gradually slides from the head to the tail of the effective peak point list along the ray direction, and the sliding window can only frame the consecutively arranged points in the effective peak point list at a time. k The sliding window only slides one valid peak point each time; the sliding window is framed after each sliding k The valid peak points are recorded as valid peak point units, and all valid peak point units of the current ray are stored in the valid peak point unit list.
[0110] S46. Calculate the peak spacing between adjacent valid peak points in each valid peak point unit in the valid peak point unit list of the current ray, and store the calculated peak spacing in the valid peak point peak spacing unit corresponding to the valid peak point unit in sequence along the direction of the current ray; in this way, all valid peak point peak spacing units of the current ray are stored in the valid peak point peak spacing unit list of the current ray.
[0111] S47. Slide the sliding window set in steps S45 to S46 in the effective peak point list of each ray, so as to obtain a peak distance unit list of effective peak points of each ray.
[0112] S48. Select any two rays, and combine the effective peak point peak spacing units in the effective peak point peak spacing unit list corresponding to the two rays in pairs to form an effective peak point peak spacing unit pair; each effective peak point peak spacing unit in each effective peak point peak spacing unit pair contains k-1 peak spacings, so each peak spacing in the current effective peak point peak spacing unit is numbered in sequence from 1 to k-1.
[0113] S49. Calculate the absolute value of the difference between the two peak spacings with the same sequence number in each valid peak point peak spacing unit pair, and then sum them up to obtain the peak spacing threshold of the current valid peak point peak spacing unit pair and the minimum value of the peak spacing thresholds of the two rays; obtain all valid peak points in the valid peak point peak spacing unit pair corresponding to the minimum value, and record them as uniform distance points.
[0114] S410. Operate according to the contents of step S48 to step S49 to obtain all the uniform distance points between any two rays.
[0115] Now consider obtaining the uniform distance point ,in, Indicates n The first i Evenly spaced points, k The minimum value is 4.
[0116] Starting from the positive direction of the X-axis of the image coordinate system, rotate counterclockwise and select the angles and The corresponding distance uniform point sets are and ,Pick .
[0117] in The angle of the ray contains the effective peak point . The angle of the ray contains the effective peak point .
[0118] The first step is to take The effective peak point in the ray of angle ,have ; Pick The effective peak point in the ray of angle ,have ; According to the formula: - .
[0119] The second step is to take The effective peak point in the ray of angle ,have , similarly .
[0120] Similarly, traverse the entire The effective peak point in the ray of angle is obtained: .
[0121] The third step is to take The effective peak point in the ray of angle, , Repeat the above steps to get Finally, take The effective peak point in the ray of angle ,have Repeat the above steps to get According to the measured , the minimum value is recorded as ,according to Get The distance uniform point corresponding to the angle is recorded as .
[0122] 5. Calculate the center deviation of the optical component.
[0123] According to the uniform distance point, a predicted circle representing Newton's rings is generated on the Newton's rings binary image using the predicted circle generation principle, and the distance between the center of the predicted circle and the calibration center on the Newton's rings binary image is calculated. This distance is the center deviation of the optical component.
[0124] The specific steps are as follows:
[0125] S51, in Figure 2 In the Newton ring binary image shown, four rays are sequentially acquired in a clockwise or counterclockwise direction, and the difference between adjacent rays is 90°. For example, the four rays used are four rays that coincide with the coordinate axes of the image coordinate system.
[0126] S52, respectively calculate the image coordinate mean values corresponding to all the uniform distance points of the four rays, such as Figure 3 As shown, the pixel point where the image coordinate mean is located is recorded as the optimal point, thereby obtaining the four optimal points corresponding to the four rays, as shown in Figure 4 shown.
[0127] S53, based on the obtained four best points, the least squares method is used to fit the centers of the predicted circles corresponding to the four best points O 1 and radius R 1.
[0128] S54. Construct a black image of the same size as the binary image of Newton's rings and place the center of the circle O1 is marked in the black image according to its coordinate mapping in the Newton ring binary image; then O 1. Radius R 1Draw an outer circle on the black image, and then O 1. Radius R 1- d min / 2 Draw an inner circle on the black image; a ring is formed between the inner circle and the outer edge, and the ring is set to white, and the black image at this time is recorded as the mask image M 0, such as Figure 5 shown.
[0129] S55, the mask image M 0 is overlaid on the Newton rings binary image, and the borders of the two are completely aligned; at this time, the Newton rings binary image and the mask image are obtained M The pixels intersecting the outer circle of the ring with a value of 0 are white pixels with a value of 255. The collection of white pixels forms the masked image. D 1. Such as Figure 6 shown.
[0130] S56, the masked image is evaluated by the evaluation function D 1 calculates the concentricity error with the Newton rings. If the concentricity error is less than the error threshold, the outer circle generated at this time is the predicted circle that can characterize the Newton rings. Otherwise, it is necessary to perform the operations of step S57 to step S58 until the concentricity error is less than the error threshold.
[0131] The process of calculating the concentricity error through the evaluation function is as follows:
[0132] S561, masked image D 1Fitting to get the center of the outer circle O The coordinates of 1 in the Newton ring binary grayscale image are ( h , g ), the outer radius is R 1; Construct a circumscribed rectangle outside the outer circle. The circumscribed rectangle is ( h , g ) as the center; and ( h , g ) is the origin, and a plane rectangular coordinate system is constructed in the binary grayscale image of Newton's rings, and the plane rectangular coordinate system divides the circumscribed rectangle into four equal parts. The equation of the line where the left boundary of the circumscribed rectangle is: x=h-R1, the equation of the line where the right boundary is: x=h+R1, the equation of the line where the upper boundary is: y=g+R1, and the equation of the line where the lower boundary is: y=g-R1.
[0133] S562, respectively counting the masked images D1 is the number of pixels in each quadrant of the plane rectangular coordinate system, and then the corresponding number of pixels is input into the evaluation function to calculate the concentricity error; the evaluation function is shown in formula (2) and formula (3):
[0134] (2);
[0135] (3);
[0136] S57, calculating the masked image in step S55 D 1, then connect the centroid and the center of the circle O 1, and the mask image M 0 Along the center of mass and the center of the circle O 1 moves the line toward the center of mass by a set distance, and counts the Newton rings binary image and the mask image at this time M The pixels where the outer circle of the 0 ring intersects are 255 white pixels, and the collection of each white pixel forms the masked image D 2.
[0137] Masked image D The centroid calculation process of 1 is as follows:
[0138] S571, obtaining the masked image D 1 is the gray value of all pixels.
[0139] S572, input each gray value into the centroid calculation formula to calculate the masked image D 1; the centroid calculation formula is shown in formula (4) and formula (5):
[0140] (4);
[0141] (5);
[0142] S58, the masked image D 2 is brought into the least squares method, and the contents of step S53 to step S54 are used to fit and generate a new center O 1. New radius R 1, and the new mask image M 0, respectively, as the center of the circle ,radius , and the mask image , superscript i Indicates i The result of the first iteration. i The result of the iteration is recorded as D i , use subscript i express.
[0143] Then calculate the mask image according to the contents of step S55 to step S56 and the masked image D i The corresponding concentricity error is determined, and whether the concentricity error is less than the error threshold is determined.
[0144] Iterate once and get Figure 7 New mask image shown He Ru Figure 8 The new masked image shown D 1.
[0145] Iterate twice and get Fig. 9 New mask image shown He Ru Fig.10 The new masked image shown D 2.
[0146] like Fig.11 As shown in the figure, the red dot is the predicted center of Newton's rings, with coordinates (1201,937). The blue dot is the calibration center, with coordinates (1220,956); the difference between the predicted center of Newton's rings and the calibration center is (1220-1201,955-937)=(19,18).
[0147] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for measuring the center deviation of an optical component based on Newton ring detection, characterized in that: The measurement steps include: S1. Obtain the original Newton ring image of the optical component by measuring with a center deviation measuring instrument, mark the calibration center of the optical component on the original Newton ring image, and bring the calibration center coordinates of the optical component into the subsequent calculation steps as original data; S2, taking the origin of the image coordinate system of the original image of the Newton rings as the starting point to draw rays, setting the angles between each adjacent ray to a predetermined angle, and sequentially obtaining the grayscale peak point on each ray and the image coordinates of the grayscale peak point according to the peak finding algorithm; S3, according to the obtained image coordinates, calculate the peak distance between each adjacent grayscale peak point on each ray, and obtain the minimum value of all peak distances; Divide the original Newton ring image into a grid and use the minimum value as the length of the square grid unit; Binarization is performed on the grid-divided Newton rings original image to convert the Newton rings original image into a Newton rings binary image; S4, based on the principle of generating uniform distance points, obtaining uniform distance points on each ray in the original image of the Newton rings; S5. Based on the distance uniform point, a prediction circle representing Newton's rings is generated on the Newton's rings binary image using the prediction circle generation principle, and the distance between the center of the prediction circle and the calibration center on the Newton's rings binary image is calculated, and the distance is the center deviation of the optical component; The specific content of the uniform distance point generation principle in step S4 is as follows: S41, counting the number of grayscale peak points and the number of grayscale valley points in the grayscale peak-valley value point list of the current ray, if the numbers are the same, no processing is performed; If the number is different, delete from both ends of the grayscale peak-valley value point list to the middle in sequence, so that the number of grayscale peak points and the number of grayscale valley value points in the grayscale peak-valley value point list are the same; S42. In the grayscale peak-valley value point list processed by step S41, along the direction of the current ray, the adjacent grayscale peak points and grayscale valley points are matched to form grayscale peak-valley value point pairs, and each grayscale peak-valley value point pair is stored in the grayscale peak-valley value point pair list of the current ray, and each grayscale peak-valley value point pair does not interfere with each other; at the same time, the peak spacing between adjacent grayscale peak points in the grayscale peak-valley value point list processed by step S41 and the average value of the peak spacing in the grayscale peak-valley value point list are calculated; then the standard deviation of the peak spacing in the grayscale peak-valley value point list is calculated, and then the grayscale peak points in the grayscale peak-valley value point list whose peak spacing and the average value of the peak spacing exceed three times the standard deviation of the peak spacing are counted, and the grayscale peak-valley value point pairs corresponding to these grayscale peak points are deleted from the grayscale peak-valley value point pair list; S43, based on the grayscale peak-valley value point pair list after deleting the corresponding grayscale peak point in step S42, calculate the slope of each grayscale peak-valley value point pair in the grayscale peak-valley value point pair list, and select the grayscale peak-valley value point pairs whose slopes are within the set slope range; then record the selected grayscale peak-valley value points as valid peak points of the current ray, and store each valid peak point in the valid peak point list in order according to the direction of the current ray, so as to obtain all valid peak points of the current ray; S44, according to the contents of step S41 to step S43, a list of valid peak points of all rays can be obtained; S45, set a sliding window that gradually slides from the head to the tail of the effective peak point list along the ray direction, and the sliding window can only frame the consecutively arranged points in the effective peak point list at a time. k The sliding window only slides one valid peak point each time; the sliding window is framed after each sliding k The valid peak points are recorded as valid peak point units, and all valid peak point units of the current ray are stored in the valid peak point unit list; S46, calculating the peak distances between adjacent valid peak points in each valid peak point unit in the valid peak point unit list of the current ray, and storing the calculated peak distances in the valid peak point peak distance units corresponding to the valid peak point units in sequence along the direction of the current ray; thereby, all valid peak point peak distance units of the current ray are stored in the valid peak point peak distance unit list of the current ray; S47, sliding the sliding window set in steps S45 to S46 in the effective peak point list of each ray, so as to obtain a peak distance unit list of effective peak points of each ray; S48, select any two rays, and make the effective peak point peak spacing units in the effective peak point peak spacing unit list corresponding to the two rays be combined in pairs to form an effective peak point peak spacing unit pair; each effective peak point peak spacing unit in each effective peak point peak spacing unit pair contains k-1 peak spacings; therefore, the peak spacings in the current effective peak point peak spacing unit are numbered in sequence from 1 to k-1; S49, calculating the absolute value of the difference between two peak spacings with the same sequence number in each valid peak point peak spacing unit pair, and then summing them up to obtain the peak spacing threshold of the current valid peak point peak spacing unit pair, and the minimum value of the peak spacing thresholds of the two rays; Obtain all valid peak points in the valid peak point peak distance unit pair corresponding to the minimum value, and record them as uniform distance points; S410. Operate according to the contents of step S48 to step S49 to obtain all the uniform distance points between any two rays.
2. The method for measuring center deviation of an optical component based on Newton ring detection according to claim 1, characterized in that: The specific content of step S2 is as follows: S21, taking the center of the original image of Newton's rings as the origin of the image coordinate system O-XY; S22, take the origin of the image coordinate system in the original image of Newton's rings as the starting point N rays, and make N The rays start from the positive direction of the X-axis in the image coordinate system and are evenly arranged in the counterclockwise or clockwise direction. The angles between adjacent rays are all predetermined angles. α =360° / N ; S23, use the peak search algorithm to obtain N The grayscale peak point on the ray and the image coordinates of the grayscale peak point in the image coordinate system.
3. The method for measuring center deviation of an optical component based on Newton ring detection according to claim 2, characterized in that: The peak finding algorithm is specifically expressed as follows: S231, traversing the grayscale value of each pixel on the current ray in the original Newton ring image; S232, check whether the grayscale value of each pixel on the current ray is greater than the grayscale value of its adjacent pixels before and after; if so, the pixel is a grayscale peak point; otherwise, it is a grayscale valley point; and for the starting pixel and the ending pixel on the ray, only the grayscale value of one adjacent pixel needs to be compared; S233, after determining all the grayscale peak points and all the grayscale valley points on the current ray, store all the grayscale peak points and all the grayscale valley points in the grayscale peak and valley point list of the current ray in order according to the direction of the current ray; All grayscale peak points are stored in the grayscale peak point list of the current ray in order according to the direction of the current ray. At the same time, the image coordinates of all grayscale peak points in the image coordinate system are obtained and stored in the image coordinate list; the image coordinate list is expressed as follows: ; in, P n Indicates n The image coordinates of each grayscale peak point on a ray are arranged in sequence along the direction of the ray to form an image coordinate list. , Indicates the total number of rays; express P n The image coordinates of the first grayscale peak point in the image coordinate system; express P n Middle i The image coordinates of the grayscale peak points in the image coordinate system.
4. The method for measuring center deviation of an optical component based on Newton ring detection according to claim 3, characterized in that: The specific content of step S3 is as follows: S31, based on the obtained grayscale peak point list and the corresponding image coordinate list, respectively calculate N The distance between the image coordinates of each adjacent grayscale peak point on the ray is recorded as the peak distance; The peak spacing is expressed as: ; Indicates n On the ray i The distance between the image coordinates of the i+1th grayscale peak point and the image coordinates of the i+1th grayscale peak point; S32. Calculate the peak spacing of all rays and obtain the minimum value, which is recorded as d min ; S33, will d min As the length of the square grid unit, a grid is constructed and the grid is overlaid on the original image of Newton's rings; S34, perform Gaussian weighted sum processing on all pixels in each square grid unit, and use the Gaussian weighted sum obtained by the processing as the binarization threshold of the current square grid unit, change the pixels in the square grid unit that are greater than or equal to the binarization threshold to 255, and change the pixels in the square grid unit that are less than the binarization threshold to 0, so that the Newton rings original image has only two grayscale values, and then convert the Newton rings original image into a Newton rings binary image.
5. The method for measuring center deviation of an optical component based on Newton ring detection according to claim 4, characterized in that: The specific steps of generating a prediction circle representing Newton's rings on a Newton's ring binary image using the prediction circle generation principle are as follows: S51, acquiring four rays in sequence along a clockwise direction or a counterclockwise direction on the Newton ring binary image, with a difference of 90° between adjacent rays; S52, respectively calculating the image coordinate mean values corresponding to all the evenly spaced points of the four rays, and recording the pixel point where the image coordinate mean value is located as the best point, thereby obtaining four best points corresponding to the four rays; S53, based on the obtained four best points, the least squares method is used to fit the centers of the predicted circles corresponding to the four best points O 1 and radius R 1; S54. Construct a black image of the same size as the binary image of Newton's rings and place the center of the circle O 1 is marked in the black image according to its coordinate mapping in the Newton ring binary image; then O 1. Radius R 1Draw an outer circle on the black image, and then O 1. Radius R 1- d min / 2 Draw an inner circle on the black image; a ring band is formed between the inner circle and the outer edge, and the ring band is set to white, and the image at this time is recorded as the mask image M 0; S55, the mask image M 0 is overlaid on the Newton rings binary image, and the borders of the two are completely aligned; at this time, the Newton rings binary image and the mask image are obtained M The grayscale value of the white pixels at the intersection of the rings of 0 is 255, and the collection of each white pixel forms the masked image. D 1; S56, the masked image is evaluated by the evaluation function D 1. Calculate the concentricity error between the Newton's ring and the outer circle. If the concentricity error is less than the error threshold, the outer circle generated at this time is the predicted circle that can characterize the Newton's ring. Otherwise, it is necessary to perform the operations of step S57 to step S58 until the concentricity error is less than the error threshold. S57, calculating the masked image in step S55 D 1, then connect the centroid and the center of the circle O 1, and push the mask image M 0 Along the center of mass and the center of the circle O 1 moves the line toward the center of mass by a set distance, and counts the Newton rings binary image and the mask image at this time M The pixels intersecting the outer circle of the ring with a value of 0 are white pixels with a value of 255. The collection of white pixels forms the masked image. D 2; S58, the masked image D 2 is brought into the least squares method, and the contents of step S53 to step S54 are used to fit and generate a new center O 1. New radius R 1, and the new mask image M 0; then calculate the new mask image according to the contents of step S55 to step S56 M 0 and the masked image D 1, and judge whether the concentricity error is less than the error threshold.
6. The method for measuring center deviation of an optical component based on Newton ring detection according to claim 5, characterized in that: The process of calculating the concentricity error through the evaluation function is as follows: S561, masked image D 1Fitting to get the center of the outer circle O The coordinates of 1 in the Newton ring binary grayscale image are ( h , g ), the outer radius is R 1; Construct a circumscribed rectangle outside the outer circle. The circumscribed rectangle is ( h , g ) as the center; and ( h , g ) is the origin, and the image after masking D 1, a plane rectangular coordinate system is constructed, and the plane rectangular coordinate system divides the circumscribed rectangle into four equal parts; S562, respectively counting the masked images D 1 is the number of pixels in each quadrant of the plane rectangular coordinate system, and then the corresponding number of pixels is input into the evaluation function to calculate the concentricity error; the evaluation function is expressed as follows: ; ; In the formula, Loss Indicates concentricity error; N 1 indicates the image after masking D 1 is the number of pixels in the first quadrant of the rectangular coordinate system; N 2 represents the image after masking D 1 is the number of pixels in the second quadrant of the plane rectangular coordinate system; N 3 represents the image after masking D 1 is the number of pixels in the third quadrant of the plane rectangular coordinate system; N 4 represents the image after masking D 1 is the number of pixels in the fourth quadrant of the rectangular coordinate system; N i Represents the image after masking D 1 is located in the plane rectangular coordinate system i The number of pixels in the quadrant; N 0 means the image after masking D 1 is the number of all pixels in the rectangular coordinate system.
7. The method for measuring center deviation of an optical component based on Newton ring detection according to claim 6, characterized in that: Masked image D The centroid calculation process of 1 is as follows: S571, obtain the masked image D The grayscale value of all pixels in 1; S572, input each gray value into the centroid calculation formula to calculate the masked image D 1's centroid; The centroid calculation formula is as follows: ; ; In the formula, Represents the image after masking D 1The horizontal coordinate of the center of mass in the binary grayscale image of Newton's rings; Represents the image after masking D 1 The vertical coordinate of the center of mass in the binary grayscale image of Newton's rings; W Represents the width of the Newton rings binary grayscale image; H Represents the height of the Newton rings binary grayscale image; I ( x , y ) represents the masked image D 1 pixel ( x , y )’s grayscale value.
8. The method for measuring center deviation of an optical component based on Newton ring detection according to claim 6 or 7, characterized in that: In step S561, the equation of the line at the left boundary of the circumscribed rectangle is: x=h-R1, the equation of the line at the right boundary is: x=h+R1, the equation of the line at the upper boundary is: y=g+R1, and the equation of the line at the lower boundary is: y=gR 1。 9. A method for measuring center deviation of an optical component based on Newton ring detection according to claim 5, 6 or 7, characterized in that: The four rays used in step S51 are four rays that coincide with the coordinate axes of the image coordinate system.
Citation Information
Patent Citations
DataMatrix two-dimensional code identification method and system based on image coarse positioning
CN116842976A
Physical parameter estimating method, physical parameter estimating device, and electronic apparatus
US20190376783A1