CN-121985223-A - Histogram-based facula jitter elimination method and device, computing equipment and storage medium
Abstract
The invention discloses a facula anti-shake method, a facula anti-shake device, a computing device and a storage medium based on a histogram, wherein the method comprises the steps of obtaining an original image of a laser facula and generating the histogram; the method comprises the steps of determining a light spot area boundary according to a brightness threshold value, carrying out self-adaptive widening to define a light spot calculation range, calculating an original light spot centroid in the range, defining a background area at the left side and the right side of the light spot range, calculating a real-time background centroid, carrying out Kalman filtering on the historical background centroid to obtain a background reference standard, further calculating a global jitter offset, self-adaptively adjusting a jitter elimination coefficient according to a focusing motor motion state, calculating a jitter compensation value according to the jitter elimination coefficient, and finally adding the compensation value and the original light spot centroid to output the jitter elimination light spot centroid. The invention realizes zero delay compensation through background interval statistics and self-adaptive jitter elimination, has high calculation efficiency and stability and dynamic response, and is suitable for high-precision optical detection scenes.
Inventors
- Request for anonymity
- Request for anonymity
Assignees
- 江苏慕藤光精密光学仪器有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260128
Claims (10)
- 1. The facula anti-shake method based on the histogram is characterized by comprising the following steps: Step S1, acquiring an original image of a laser spot acquired by an image sensor; s2, generating a histogram for a specified direction based on the original image; Wherein the X axis of the histogram is the coordinate position in the appointed direction of the original image, and the Y axis is the arithmetic average value of the brightness of all pixels along a row or a column perpendicular to the appointed direction at the corresponding coordinate position; step S3, determining a start boundary coordinate and an end boundary coordinate of the light spot area in the appointed direction in the histogram according to a preset brightness threshold, wherein a section between the start boundary coordinate and the end boundary coordinate is an initial light spot area; step S4, according to the brightness of the initial light spot area, carrying out self-adaptive broadening on the initial boundary coordinate and the end boundary coordinate to obtain the stretched light spot boundary coordinate, and defining a light spot calculation range based on the stretched light spot boundary coordinate; s5, calculating the coordinates of the centroid of the original light spot of the current frame in the appointed direction in the light spot calculation range; step S6, respectively expanding the same preset width outwards at the left side and the right side of the light spot calculation range so as to define a left background area and a right background area; S7, calculating coordinates of a real-time background centroid of the current frame in the appointed direction in the left background area and the right background area; S8, carrying out Kalman filtering processing of a small time window on background centroid data of a history multiframe to obtain a background reference standard in the appointed direction; Step S9, calculating a difference value between the background reference standard and the real-time background centroid as a global jitter offset in the appointed direction; Step S10, adaptively adjusting the shake eliminating coefficient according to the motion state of the focusing motor; step S11, calculating a jitter compensation value according to the global jitter offset and the jitter elimination coefficient; And step S12, adding the jitter compensation value and the original light spot centroid, and outputting the coordinates of the light spot centroid after the jitter elimination in the appointed direction.
- 2. The spot shake eliminating method according to claim 1, wherein in the step S3, the determining a start boundary coordinate and an end boundary coordinate of the spot area in the specified direction specifically includes: scanning from two ends of the histogram to the center, and determining the coordinates which reach or exceed the preset brightness threshold for the first time as the starting boundary coordinates and the ending boundary coordinates respectively.
- 3. The spot dithering method according to claim 1, wherein in the step S4, the adaptive spreading is specifically: according to the average brightness of the initial facula area, adjusting the stretching, wherein the stretching amplitude is positively correlated with the average brightness; the range of the stretching amplitude is 0-64 pixels.
- 4. The spot dithering method according to claim 1, wherein in the step S5, a formula for calculating the centroid of the original spot is: ; Wherein: coordinates of the centroid of the original light spot in the appointed direction; And Respectively calculating a start coordinate and an end coordinate of the range for the light spot; an ith coordinate position on the X axis in the histogram; Is in the histogram The corresponding brightness value; Is the minimum luminance value in the histogram.
- 5. The spot dithering method according to claim 4, wherein in the step S7, a formula for calculating the real-time background centroid is: ; Wherein: Coordinates of the real-time background centroid in the specified direction; And The pixel widths are respectively widened leftwards and rightwards.
- 6. The spot dithering elimination method according to claim 5, wherein the calculation formula of the center of mass of the dithered spot is as follows: ; Wherein: the coordinates of the final facula centroid after the anti-shake processing in the appointed direction are obtained; is the jitter elimination coefficient; Referencing a background in the specified direction; i.e. the jitter compensation value.
- 7. The spot shake eliminating method according to claim 1, wherein in the step S10, the adaptively adjusting the shake eliminating coefficient according to the motion state of the focusing motor specifically includes: When the focusing motor is in a high-speed motion state, the anti-shake coefficient is adjusted to a first value; When the focusing motor is in a low-speed motion state, the anti-shake coefficient is adjusted to a second value; When the focusing motor is in a static state, the jitter elimination coefficient is adjusted to a third value; and the third value is greater than a second value, the second value being greater than the first value.
- 8. Facula anti-shake device based on histogram, its characterized in that includes: The image acquisition module is used for acquiring an original image of the laser spot acquired by the image sensor; a histogram generation module for generating a histogram for a specified direction based on the original image; Wherein the X axis of the histogram is the coordinate position in the appointed direction of the original image, and the Y axis is the arithmetic average value of the brightness of all pixels along a row or a column perpendicular to the appointed direction at the corresponding coordinate position; the initial light spot area determining module is used for determining initial boundary coordinates and end boundary coordinates of the light spot area in the appointed direction in the histogram according to a preset brightness threshold value, wherein a section between the initial boundary coordinates and the end boundary coordinates is an initial light spot area; The light spot calculation range determining module is used for adaptively widening the initial boundary coordinate and the end boundary coordinate according to the brightness of the initial light spot area to obtain the widened light spot boundary coordinate, and defining a light spot calculation range based on the widened light spot boundary coordinate; The original centroid calculation module is used for calculating the coordinates of the original facula centroid of the current frame in the appointed direction in the facula calculation range; The background area demarcation module is used for respectively expanding the same preset width outwards at the left side and the right side of the light spot calculation range so as to demarcate a left background area and a right background area; The real-time background centroid calculation module is used for calculating the coordinates of the real-time background centroid of the current frame in the appointed direction in the left background area and the right background area; The background reference standard generation module is used for carrying out Kalman filtering processing of a small time window on background centroid data of the historical multiframe to obtain a background reference standard in the appointed direction; The global jitter calculation module is used for calculating the difference between the background reference standard and the real-time background centroid as the global jitter offset in the appointed direction; the shake eliminating coefficient adjusting module is used for adaptively adjusting the shake eliminating coefficient according to the motion state of the focusing motor; The jitter compensation value calculation module is used for calculating a jitter compensation value according to the global jitter offset and the jitter elimination coefficient; And the jitter elimination centroid output module is used for adding the jitter compensation value with the original facula centroid and outputting the coordinates of the jitter elimination facula centroid in the appointed direction.
- 9. A computing device, comprising: One or more processors; A memory; And one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions of the histogram-based spot de-jitter method of any one of claims 1-7.
- 10. A storage medium, characterized in that the storage medium stores one or more computer readable programs, the one or more programs comprising instructions adapted to be loaded by a memory and to perform the histogram-based spot de-jitter method of any one of the preceding claims 1-7.
Description
Histogram-based facula jitter elimination method and device, computing equipment and storage medium Technical Field The invention belongs to the technical field of optical precision detection and automatic focusing, and particularly relates to a facula jitter elimination method, a facula jitter elimination device, a computing device and a storage medium based on a histogram. Background In semiconductor inspection, biological microscopy imaging, and high precision industrial measurements, laser Auto Focus (LAF) systems are central to ensuring imaging quality. The system feeds back the object distance change by detecting the centroid displacement of the laser spot on a photosensitive chip (such as CMOS). However, at high magnification (e.g., 20X and above) objectives, the system is extremely sensitive to vibration. The small mechanical vibration in the environment, the rotation of the fan and even the floor tremble caused by the walking of personnel can cause the acquired facula image to generate pixel-level displacement tremble. In order to solve the jitter problem, the prior art mainly adopts the following three modes: (1) And the threshold centroid algorithm is used for directly calculating the centroid of the light spot after the background noise is removed by setting a fixed threshold. (2) And carrying out full-graph Kalman filtering, and carrying out time domain smoothing on the calculated centroid coordinate sequence. (3) The hardware absorbs vibration and the vibration is isolated by physical means such as an air-floating optical platform. However, the prior art has obvious defects and shortcomings: Firstly, there is a contradiction between dynamic response and smoothness, and powerful filtering can inhibit jitter, but can cause barycenter data hysteresis, so that the focusing motor is overshot or the focusing searching time is prolonged. Secondly, neglecting global jitter interference, the existing algorithm focuses on the spot area, and spot jitter is often a global characteristic accompanying overall offset of background noise, so that jitter suppression is incomplete. Finally, there is a computational accuracy bottleneck, and under environmental interference, centroid fluctuation after processing in the prior art is generally greater than minimum resolution required by a system, so that focusing cannot be locked at an ideal position. Disclosure of Invention In order to solve the technical problems, the invention provides a facula jitter elimination method, a facula jitter elimination device, a facula jitter elimination computing device and a facula jitter elimination storage medium based on a histogram. In order to achieve the above purpose, the technical scheme of the invention is as follows: in a first aspect, the invention discloses a histogram-based facula jitter elimination method, which comprises the following steps: Step S1, acquiring an original image of a laser spot acquired by an image sensor; step S2, generating a histogram for a specified direction based on the original image; Wherein, the X axis of the histogram is the coordinate position in the appointed direction of the original image, and the Y axis is the arithmetic average value of the brightness of all pixels along a row or a column perpendicular to the appointed direction at the corresponding coordinate position; Step S3, determining a start boundary coordinate and an end boundary coordinate of the spot area in a designated direction in the histogram according to a preset brightness threshold, wherein an interval between the start boundary coordinate and the end boundary coordinate is an initial spot area; Step S4, adaptively widening the initial boundary coordinates and the end boundary coordinates according to the brightness of the initial light spot area to obtain widened light spot boundary coordinates, and defining a light spot calculation range based on the widened light spot boundary coordinates; S5, calculating the coordinates of the centroid of the original light spot of the current frame in the appointed direction in the light spot calculation range; Step S6, respectively expanding the same preset width outwards at the left side and the right side of the light spot calculation range so as to define a left background area and a right background area; S7, calculating coordinates of a real-time background centroid of the current frame in a designated direction in the left background area and the right background area; s8, carrying out Kalman filtering processing of a small time window on background centroid data of a history multiframe to obtain a background reference standard in a designated direction; step S9, calculating a difference value between a background reference standard and a real-time background centroid as a global jitter offset in a designated direction; Step S10, adaptively adjusting the shake eliminating coefficient according to the motion state of the focusing motor; step S11, calculating a jitter compe