Light spot jitter elimination method and device based on histogram, computing equipment and storage medium
By using a histogram-based spot stabilization method, adaptively adjusting the stabilization coefficient and global jitter compensation, the problem of spot jitter caused by environmental vibration in laser autofocus systems under high magnification objectives is solved, achieving high stability and fast response focusing accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGSU MUTENGGUANG PRECISION OPTICAL INSTR CO LTD
- Filing Date
- 2026-01-28
- Publication Date
- 2026-05-05
AI Technical Summary
Existing laser autofocus systems are extremely sensitive to environmental vibrations under high-magnification objectives, resulting in pixel-level jitter in the spot image. Existing technologies suffer from the contradiction between dynamic response and smoothness, the lack of consideration for global jitter interference, and limitations in computational accuracy.
A histogram-based spot de-jitter method is adopted, which determines the spot region by generating a histogram, adaptively widens the boundary, calculates the background centroid, combines Kalman filtering to process global jitter, dynamically adjusts the de-jitter coefficient, and compensates for the spot centroid in real time.
It achieves high stability and high precision focusing of the spot centroid under high vibration environment, fast dynamic response, and reduces system resource consumption and development cycle.
Smart Images

Figure CN121985223A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of optical precision detection and autofocus technology, specifically relating to a histogram-based spot shaking reduction method, device, computing equipment, and storage medium. Background Technology
[0002] In semiconductor inspection, biological microscopy imaging, and high-precision industrial measurement, laser autofocus (LAF) systems are crucial for ensuring image quality. These systems detect changes in object distance by detecting the displacement of the laser spot's center of mass on a photosensitive chip (such as a CMOS sensor). However, at high magnification (e.g., 20X and above), the system is extremely sensitive to vibration. Even minute mechanical vibrations in the environment, fan rotation, or ground tremors caused by people walking can lead to pixel-level displacement and jitter in the acquired laser spot image.
[0003] To solve the aforementioned jitter problem, existing technologies mainly employ the following three methods:
[0004] (1) Threshold centroid algorithm: After removing background noise by setting a fixed threshold, the centroid of the spot is directly calculated.
[0005] (2) Full-map Kalman filtering is used to smooth the calculated centroid coordinate sequence in the time domain.
[0006] (3) Hardware vibration reduction relies on physical means such as air-bearing optical platforms to isolate vibration.
[0007] However, the aforementioned existing technologies have obvious defects and shortcomings:
[0008] First, there is a contradiction between dynamic response and smoothness. Although strong filtering can suppress jitter, it will cause the centroid data to "lag", resulting in overshoot of the focus motor or extended focus search time.
[0009] Secondly, ignoring global jitter interference, existing algorithms mostly focus on the spot area itself, without considering that spot jitter is often a "global feature" that is accompanied by the overall shift of background noise, resulting in incomplete jitter suppression.
[0010] Finally, there is a bottleneck in computational accuracy. Under environmental interference, the centroid fluctuation after processing by existing technology is usually greater than the minimum resolution required by the system, making it impossible to lock the focus at the ideal position. Summary of the Invention
[0011] To address the aforementioned technical problems, this invention proposes a histogram-based method, apparatus, computing device, and storage medium for denoising light spots.
[0012] To achieve the above objectives, the technical solution of the present invention is as follows:
[0013] In a first aspect, the present invention discloses a histogram-based spot de-jitter method, comprising:
[0014] Step S1: Acquire the original image of the laser spot captured by the image sensor;
[0015] Step S2: Based on the original image, generate a histogram for a specified direction;
[0016] The histogram's X-axis represents the coordinate position of the original image in a specified direction, and its Y-axis represents the arithmetic mean of the brightness of all pixels in a row or column perpendicular to the specified direction at the corresponding coordinate position.
[0017] Step S3: Based on the preset brightness threshold, determine the starting boundary coordinates and ending boundary coordinates of the spot area in the specified direction in the histogram. The interval between the starting boundary coordinates and the ending boundary coordinates is the initial spot area.
[0018] Step S4: Based on the brightness of the initial spot area, adaptively expand the starting boundary coordinates and the ending boundary coordinates to obtain the expanded spot boundary coordinates, and define the spot calculation range based on the expanded spot boundary coordinates;
[0019] Step S5: Within the range of the light spot calculation, calculate the coordinates of the original light spot centroid in the specified direction for the current frame;
[0020] Step S6: Extend the light spot calculation range outward by the same preset width on the left and right sides respectively to define the left background area and the right background area;
[0021] Step S7: Within the left and right background regions, calculate the coordinates of the real-time background centroid of the current frame in the specified direction;
[0022] Step S8: Perform Kalman filtering on the background centroid data of historical multiple frames with a small time window to obtain the background reference benchmark in the specified direction;
[0023] Step S9: Calculate the difference between the background reference and the real-time background centroid as the global jitter offset in the specified direction;
[0024] Step S10: Adaptively adjust the anti-shake coefficient according to the motion state of the focusing motor;
[0025] Step S11: Calculate the jitter compensation value based on the global jitter offset and the anti-jitter coefficient;
[0026] Step S12: Add the jitter compensation value to the original spot centroid and output the coordinates of the de-jittered spot centroid in the specified direction. Based on the above technical solution, the following improvements can be made:
[0027] As a preferred embodiment, in step S3, determining the starting and ending boundary coordinates of the light spot region in the specified direction specifically includes:
[0028] Scanning from both ends of the histogram toward the center, the coordinates of the first time the brightness reaches or exceeds the preset brightness threshold are determined as the starting boundary coordinates and the ending boundary coordinates, respectively.
[0029] As a preferred embodiment, in step S4, the adaptive broadening specifically involves:
[0030] The widening is adjusted according to the average brightness of the initial spot area, and the widening range is positively correlated with the average brightness.
[0031] The width range is 0 to 64 pixels.
[0032] As a preferred embodiment, in step S5, the formula for calculating the original spot centroid is:
[0033] ;
[0034] in:
[0035] The coordinates of the original spot centroid in the specified direction;
[0036] and These are the starting and ending coordinates of the light spot calculation range, respectively;
[0037] This represents the i-th coordinate position on the X-axis of the histogram;
[0038] For histogram The corresponding brightness value;
[0039] This represents the minimum brightness value in the histogram.
[0040] As a preferred embodiment, in step S7, the formula for calculating the real-time background centroid is:
[0041] ;
[0042] in:
[0043] The coordinates of the real-time background centroid in the specified direction;
[0044] and These are the pixel widths that expand to the left and right, respectively.
[0045] As a preferred solution, the formula for calculating the centroid of the de-jittered spot is as follows:
[0046] ;
[0047] in:
[0048] The coordinates of the centroid of the final spot after jitter reduction in the specified direction;
[0049] This is the anti-jitter factor;
[0050] Used as a background reference point in the specified direction;
[0051] This is the jitter compensation value.
[0052] As a preferred embodiment, in step S10, the adaptive adjustment of the anti-shake coefficient based on the motion state of the focusing motor specifically includes:
[0053] When the focusing motor is in high-speed operation, the anti-shake coefficient is adjusted to the first value;
[0054] When the focusing motor is in a low-speed operation state, adjust the anti-shake coefficient to the second value;
[0055] When the focusing motor is stationary, adjust the anti-shake factor to the third value;
[0056] Furthermore, the third value is greater than the second value, and the second value is greater than the first value.
[0057] Secondly, the present invention discloses a histogram-based spot stabilization device, comprising:
[0058] The image acquisition module is used to acquire the original image of the laser spot captured by the image sensor;
[0059] The histogram generation module is used to generate a histogram based on the original image, targeting a specified direction.
[0060] The histogram's X-axis represents the coordinate position of the original image in a specified direction, and its Y-axis represents the arithmetic mean of the brightness of all pixels in a row or column perpendicular to the specified direction at the corresponding coordinate position.
[0061] The initial spot region determination module is used to determine the starting boundary coordinates and ending boundary coordinates of the spot region in a specified direction in a histogram based on a preset brightness threshold. The interval between the starting boundary coordinates and the ending boundary coordinates is the initial spot region.
[0062] The spot calculation range determination module is used to adaptively expand the starting boundary coordinates and ending boundary coordinates according to the brightness of the initial spot area, obtain the expanded spot boundary coordinates, and define the spot calculation range based on the expanded spot boundary coordinates.
[0063] The original centroid calculation module is used to calculate the coordinates of the original centroid of the current frame in a specified direction within the spot calculation range;
[0064] The background area delineation module is used to extend outward by the same preset width on the left and right sides of the spot calculation range to delineate the left and right background areas, respectively.
[0065] The real-time background centroid calculation module is used to calculate the coordinates of the real-time background centroid of the current frame in a specified direction within the left and right background regions.
[0066] The background reference benchmark generation module is used to perform small time window Kalman filtering on the background centroid data of multiple historical frames to obtain the background reference benchmark in the specified direction.
[0067] The global jitter calculation module is used to calculate the difference between the background reference base and the real-time background centroid, which is used as the global jitter offset in the specified direction.
[0068] The anti-shake coefficient adjustment module is used to adaptively adjust the anti-shake coefficient according to the motion state of the focusing motor;
[0069] The jitter compensation value calculation module is used to calculate the jitter compensation value based on the global jitter offset and the anti-jitter coefficient.
[0070] The de-jitter centroid output module is used to add the jitter compensation value to the original spot centroid and output the coordinates of the de-jittered spot centroid in a specified direction.
[0071] Thirdly, the present invention discloses a computing device, comprising:
[0072] One or more processors;
[0073] Memory;
[0074] And one or more programs, wherein the one or more programs are stored in memory and configured to be executed by one or more processors, and the one or more programs include instructions for any of the above-described histogram-based spot de-jitter methods.
[0075] Fourthly, the present invention discloses a storage medium storing one or more computer-readable programs, the one or more programs including instructions adapted to be loaded by a memory and executed any of the above-described histogram-based spot de-jitter methods.
[0076] This invention discloses a histogram-based spot denoising method, apparatus, computing device, and storage medium, which have the following beneficial effects:
[0077] First, it exhibits high stability and strong anti-interference capability. By introducing a global jitter estimation and compensation mechanism based on the background region, it can effectively compensate for interference caused by environmental vibrations at the algorithm level.
[0078] Second, it offers excellent real-time performance with no lag compensation. Unlike traditional time-domain filtering methods that rely on multiple frames of data, the jitter reduction compensation of this invention is calculated and completed in real time based on the spatial domain information (background centroid offset) of the current frame image. This compensation process is completed within a single frame, eliminating the processing delay inherent in filtering and smoothing, thus ensuring the system's fast dynamic response characteristics.
[0079] Third, it has strong adaptability and intelligent adjustment. By associating the motion state of the focusing motor with the dynamic adjustment of the anti-shake coefficient, it effectively solves the contradiction between "sluggish response due to excessive filtering during movement" and "continuous oscillation due to insufficient filtering when stationary". This allows the system to achieve extremely high steady-state accuracy when stationary while pursuing high tracking speed.
[0080] Fourth, it boasts high computational efficiency and ease of implementation. Based on one-dimensional histogram statistics and weighted average calculation, this invention features simple operational logic and low data throughput. This makes it highly suitable for real-time operation on embedded hardware platforms such as FPGAs and high-speed DSPs, reducing system resource overhead and shortening development and deployment cycles, thus demonstrating significant engineering practical value. Attached Figure Description
[0081] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0082] Figure 1 A flowchart of a spot stabilization method provided in an embodiment of the present invention.
[0083] Figure 2 This is a schematic diagram of a histogram provided in an embodiment of the present invention. Detailed Implementation
[0084] The preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0085] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0086] Using ordinal numbers such as “first,” “second,” “third,” etc. to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, sequence, or any other way.
[0087] Furthermore, the expression "includes" is an "open-ended" expression, which means only that there is a corresponding component or step, and should not be interpreted as excluding additional components or steps.
[0088] In order to achieve the purpose of this invention, in some embodiments of the histogram-based spot shaking reduction method, the method is particularly suitable for laser autofocus (LAF) systems under high magnification objectives, aiming to solve the problem of spot image jitter caused by environmental micro-vibrations, thereby improving focusing accuracy and system response speed.
[0089] like Figure 1 As shown, the methods for reducing beam shake include:
[0090] Step S101: Acquire the original image of the laser spot captured by the image sensor;
[0091] Step S102: Based on the original image, generate a histogram for the X direction of the original image;
[0092] In the histogram, the X-axis represents the coordinate position of the original image in the X direction, and the Y-axis represents the arithmetic mean of all pixels in the column corresponding to the coordinate position.
[0093] Step S103: Based on the preset brightness threshold, determine the starting boundary coordinates and ending boundary coordinates of the light spot region in the x-direction in the histogram. The interval between the starting boundary coordinates and the ending boundary coordinates is the initial light spot region.
[0094] Step S104: Based on the brightness of the initial spot area, adaptively broaden the starting boundary coordinates and the ending boundary coordinates to obtain the broadened spot boundary coordinates, and define the spot calculation range based on the broadened spot boundary coordinates.
[0095] Step S105: Within the range of the light spot calculation, calculate the x-coordinate of the original light spot centroid in the current frame;
[0096] Step S106: Extend the light spot calculation range outward by the same preset width on the left and right sides respectively to delineate the left background area and the right background area;
[0097] Step S107: Calculate the x-coordinate of the real-time background centroid of the current frame within the left and right background regions;
[0098] Step S108: Perform Kalman filtering on the background centroid data of historical multi-frames with a small time window to obtain the background reference benchmark in the x direction;
[0099] Step S109: Calculate the difference between the background reference base and the real-time background centroid as the global jitter offset in the x-direction;
[0100] Step S110: Adaptively adjust the anti-shake coefficient according to the motion state of the focusing motor;
[0101] Step S111: Calculate the jitter compensation value based on the global jitter offset and the anti-jitter coefficient;
[0102] Step S112: Add the jitter compensation value to the original spot centroid and output the x-coordinate of the spot centroid after jitter reduction.
[0103] Each of the above steps will be explained in detail below.
[0104] Step S101: Acquire the original image of the laser spot captured by the image sensor.
[0105] The system uses a CMOS image sensor to acquire raw images of the laser spot projected onto the sensor's image plane in real time. The laser spot in the image exhibits slight jitter due to environmental vibrations, requiring jitter reduction processing to extract the precise centroid.
[0106] Step S102: Generate a histogram based on the original image.
[0107] like Figure 2 As shown, a histogram is generated based on the original image, where:
[0108] Histogram X-axis: The coordinate position of the original image in the X direction (e.g., value range 0~1279 pixels);
[0109] Histogram Y-axis: The arithmetic mean of all pixels in the column corresponding to the X coordinate position (i.e., the average brightness of the column, ranging from 0 to 255).
[0110] Step S103: Based on the preset brightness threshold, determine the starting boundary coordinates and ending boundary coordinates of the spot area in the x-direction in the histogram.
[0111] A preset brightness threshold (Threshold) is used to distinguish the light spot from the background.
[0112] The method for determining the boundary of the light spot is to scan from both ends of the histogram (i.e., the leftmost and rightmost ends) toward the center.
[0113] Scanning from left to right, the first location where the brightness value is greater than or equal to the brightness threshold is determined as the starting boundary coordinate of the spot region. This can be considered as the "rising left edge" of the light spot.
[0114] Scanning from right to left, the first location where the brightness value is greater than or equal to the brightness threshold is determined as the end boundary coordinate of the spot region. This can be considered as the "falling right edge" of the light spot.
[0115] The interval between the starting boundary coordinates and the ending boundary coordinates It was initially identified as the initial spot area.
[0116] Step S104: Adaptively widen the boundary of the initial spot region to define the spot calculation range.
[0117] Since the edge of the light spot may have a gradual change, the boundary determined directly by the threshold may not completely encompass the effective signal area of the light spot. Therefore, it is necessary to adaptively broaden the light spot based on the brightness characteristics of the initial light spot area.
[0118] One implementation method is to calculate the initial light spot area. Average brightness within .
[0119] when When the light spot is strong, the width of the beam increases. 64 pixels;
[0120] when At that time, the light spot intensity was moderate and the width was [missing information]. The range is 0 to 64 pixels; the brighter the spot, the wider the scaling can be appropriately increased.
[0121] when When the light spot is weak, it will not broaden or will broaden to a minimum.
[0122] The starting coordinates after widening (i.e., the rising edge after widening) are: ;
[0123] The end coordinates after widening (i.e., the falling edge after widening) are: .
[0124] interval The range of light spot calculations is defined as the range used to calculate the centroid of the light spot.
[0125] Step S105: Within the range of the light spot calculation, calculate the x-coordinate of the original light spot centroid of the current frame.
[0126] To eliminate the impact of background noise on centroid calculation, the minimum brightness value of the histogram is used. The weighted average method is based on the benchmark. The calculation formula is as follows:
[0127] ;
[0128] in:
[0129] The x-coordinate of the original spot centroid;
[0130] and These are the starting and ending coordinates of the light spot calculation range, respectively;
[0131] This represents the i-th coordinate position on the X-axis of the histogram;
[0132] For histogram The corresponding brightness value;
[0133] It represents the minimum brightness value in the entire histogram of the current frame, serving as the baseline for background noise.
[0134] Step S106: Define the background area on the left and right sides of the light spot calculation range.
[0135] To estimate global jitter, a stable background reference needs to be found outside the spot area. This is within the spot calculation range. Extend the left and right sides outwards by the same preset width W (e.g., 64 pixels) to define two background regions:
[0136] Left background area: ;
[0137] Right background area: ;
[0138] in, .
[0139] Step S107: Calculate the x-coordinate of the real-time background centroid of the current frame.
[0140] Ideally, the left and right background regions should contain only uniform background noise. The overall centroid of the merged region is calculated and used as the real-time background centroid for the current frame. .
[0141] The calculation formula uses a weighted average of the original brightness values:
[0142] ;
[0143] in:
[0144] The x-coordinate of the real-time background centroid;
[0145] and These are the pixel widths that expand to the left and right, respectively.
[0146] Step S108: Obtain the background reference in the x-direction using Kalman filtering. Since environmental jitter is random, the background centroid of a single frame... It itself fluctuates. To obtain a stable, jitter-free background position reference, calculations are performed on multiple consecutive historical frames (small time windows). The sequence is processed by Kalman filtering to obtain a background reference. It represents the position of the background texture in an ideal, jitter-free state.
[0147] Step S109: Calculate the global jitter offset in the x direction.
[0148] The actual position of the background in the current frame With theoretical stable position The difference between them, which is considered to be the overall image displacement caused by global jitter, is called the global jitter offset in the x-direction. ;
[0149] ;
[0150] in, It is a signed number.
[0151] Step S110: Adaptively adjust the anti-shake coefficient according to the motion state of the focusing motor.
[0152] Anti-shake coefficient (Value range 0~1) is a weighting factor used to control the intensity of de-jittering, which determines the intensity of compensation.
[0153] Increasing the anti-shake factor OIS_K will enhance the anti-shake effect, but it will also reduce the perceptual resolution for subtle changes in the centroid of the light spot. Therefore, two key requirements need to be balanced:
[0154] 1) In a static state, the upper limit of the fluctuation of the centroid of the light spot should be controlled within half of the system's allowable error, which usually requires an appropriate increase in the anti-jitter coefficient;
[0155] 2) When the focusing motor is moving, any displacement of the center of mass of the light spot that exceeds the range required for focusing accuracy must be reflected in the final output without distortion, and cannot be filtered out as a shake error. This requires reducing the anti-shake coefficient under the corresponding motion state.
[0156] The final value of the anti-jitter coefficient is a balance between "tracking sensitivity during movement" and "stability when stationary" obtained on the basis of satisfying the above two principles.
[0157] Dynamically adjust according to the motion state of the focusing motor (e.g., high-speed motion, low-speed motion, or stationary state). Specifically:
[0158] During high-speed motion: To avoid misinterpreting actual focus shift as jitter and filtering it out, Use a smaller first value, such as 0.3.
[0159] When stationary: to maximize the suppression of jitter, Use a larger third value, such as 0.7.
[0160] For low-speed motion: use the second middle value, such as 0.5.
[0161] Step S111: Calculate the jitter compensation value in the x direction.
[0162] global jitter offset With adaptive de-shake coefficient Multiplying these values yields the final jitter compensation value applied to the centroid correction in the x-direction. :
[0163] ;
[0164] Wherein: This value is a signed number whose direction and magnitude combine jitter estimation and system motion state.
[0165] Step S112: Output the x-coordinate of the centroid of the de-jittered light spot.
[0166] The original spot centroid calculated in step S105 is used as the basis for... The jitter compensation value calculated in step S111 Adding them together gives the final centroid coordinates of the light spot after jitter reduction. :
[0167] ;
[0168] Right now:
[0169] .
[0170] Those skilled in the art have discovered that the minute jitter of the light spot in one direction is essentially a minute jitter of the "whole image," meaning that the jitter amplitude of the light spot is consistent with the global jitter amplitude of the entire sensor image. This global jitter can be characterized as a signed offset. .
[0171] The method provided in this embodiment of the invention can not only be used to calculate the x-coordinate of the spot centroid, but can also be naturally extended to the calculation of the two-dimensional centroid by changing the processing direction. Specifically, after obtaining the coordinates of the de-jittered spot centroid in the X-direction through the aforementioned steps S101 to S112, if it is necessary to further obtain its coordinates in the Y-direction, the specified processing direction can be switched to the Y-direction based on the original image of the same frame, and the corresponding algorithm steps can be repeated.
[0172] At this point, in step S102, the horizontal axis (X-axis) of the generated histogram corresponds to the coordinate position in the Y direction of the original image, while the vertical axis (Y-axis) is the arithmetic mean of the brightness of all pixels in the entire row along the horizontal direction (X-direction) at that Y-coordinate position. Subsequently, steps S103 to S112 are repeated, including defining the spot and background regions in the Y direction, calculating the original centroid and the real-time background centroid, establishing a reference benchmark through Kalman filtering, calculating the global jitter offset in the Y direction, adjusting the anti-jitter coefficient according to the motor status and performing compensation, and finally outputting the coordinates of the spot centroid in the Y direction after anti-jittering. By executing this method in the two orthogonal directions of X and Y respectively, highly stable two-dimensional spot centroid coordinates can be obtained.
[0173] The core innovation of this invention lies in introducing a global displacement compensation mechanism based on the statistical characteristics of the background region, combined with the motion state machine of the focusing motor to achieve adaptive anti-shake control. Specifically, this mechanism distinguishes the spot region from the background region through histogram statistics. First, it calculates the small offset of the real-time centroid of the background region relative to the stable reference base obtained after Kalman filtering, and uses this offset as an estimate of the global jitter. Subsequently, this estimate is superimposed onto the original centroid coordinates of the spot in real time through reverse compensation. Simultaneously, the anti-shake coefficient is dynamically adjusted according to the different motion stages of the focusing motor. The size of the light spot is adjusted to ensure sensitivity during focusing while achieving highly stable output with "zero jitter" at the center of gravity when the light spot is stationary.
[0174] The technical solution provided in this invention does not impose any specific restrictions on the shape of the laser spot, and is applicable to laser spots of various shapes, including but not limited to rectangles, circles, and ellipses.
[0175] In other embodiments, the present invention discloses a histogram-based spot skewing device, comprising:
[0176] The image acquisition module is used to acquire the original image of the laser spot captured by the image sensor;
[0177] The histogram generation module is used to generate a histogram based on the original image, targeting a specified direction.
[0178] The histogram's X-axis represents the coordinate position of the original image in a specified direction, and its Y-axis represents the arithmetic mean of the brightness of all pixels in a row or column perpendicular to the specified direction at the corresponding coordinate position.
[0179] The initial spot region determination module is used to determine the starting boundary coordinates and ending boundary coordinates of the spot region in a specified direction in a histogram based on a preset brightness threshold. The interval between the starting boundary coordinates and the ending boundary coordinates is the initial spot region.
[0180] The spot calculation range determination module is used to adaptively expand the starting boundary coordinates and ending boundary coordinates according to the brightness of the initial spot area, obtain the expanded spot boundary coordinates, and define the spot calculation range based on the expanded spot boundary coordinates.
[0181] The original centroid calculation module is used to calculate the coordinates of the original centroid of the current frame in a specified direction within the spot calculation range;
[0182] The background area delineation module is used to extend outward by the same preset width on the left and right sides of the spot calculation range to delineate the left and right background areas, respectively.
[0183] The real-time background centroid calculation module is used to calculate the coordinates of the real-time background centroid of the current frame in a specified direction within the left and right background regions.
[0184] The background reference benchmark generation module is used to perform small time window Kalman filtering on the background centroid data of multiple historical frames to obtain the background reference benchmark in the specified direction.
[0185] The global jitter calculation module is used to calculate the difference between the background reference base and the real-time background centroid, which is used as the global jitter offset in the specified direction.
[0186] The anti-shake coefficient adjustment module is used to adaptively adjust the anti-shake coefficient according to the motion state of the focusing motor;
[0187] The jitter compensation value calculation module is used to calculate the jitter compensation value based on the global jitter offset and the anti-jitter coefficient.
[0188] The de-jitter centroid output module is used to add the jitter compensation value to the original spot centroid and output the coordinates of the de-jittered spot centroid in a specified direction.
[0189] Furthermore, the initial spot area determination module is specifically configured as follows: scanning from both ends of the histogram towards the center, and determining the coordinates of the first time the brightness reaches or exceeds the preset brightness threshold as the starting boundary coordinates and the ending boundary coordinates, respectively.
[0190] Furthermore, the specific configuration of the spot calculation range determination module is as follows:
[0191] The widening is adjusted according to the average brightness of the initial spot area, and the widening range is positively correlated with the average brightness.
[0192] The width range is 0 to 64 pixels.
[0193] Furthermore, the original centroid calculation module calculates the original spot centroid according to the following formula;
[0194] ;
[0195] in:
[0196] The coordinates of the original spot centroid in the specified direction;
[0197] and These are the starting and ending coordinates of the light spot calculation range, respectively;
[0198] This represents the i-th coordinate position on the X-axis of the histogram;
[0199] For histogram The corresponding brightness value;
[0200] This represents the minimum brightness value in the histogram.
[0201] Furthermore, the real-time background centroid calculation module calculates the real-time background centroid according to the following formula;
[0202] ;
[0203] in:
[0204] The coordinates of the real-time background centroid in the specified direction;
[0205] and These are the pixel widths that expand to the left and right, respectively.
[0206] Furthermore, the anti-shake centroid output module outputs the centroid of the light spot after anti-shake according to the following formula;
[0207] ;
[0208] in:
[0209] The coordinates of the centroid of the final spot after jitter reduction in the specified direction;
[0210] This is the anti-jitter factor;
[0211] Used as a background reference point in the specified direction;
[0212] This is the jitter compensation value.
[0213] Furthermore, the anti-shake coefficient adjustment module is configured as follows:
[0214] When the focusing motor is in high-speed operation, the anti-shake coefficient is adjusted to the first value;
[0215] When the focusing motor is in a low-speed operation state, adjust the anti-shake coefficient to the second value;
[0216] When the focusing motor is stationary, adjust the anti-shake factor to the third value;
[0217] Furthermore, the third value is greater than the second value, and the second value is greater than the first value.
[0218] Furthermore, it should be noted that the histogram-based spot stabilization device provided in the above embodiments is only illustrated by the division of the above functional modules when eliminating jitter. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the histogram-based spot stabilization device can be divided into different functional modules to complete all or part of the functions described above.
[0219] Furthermore, the histogram-based spot stabilization device and the histogram-based spot stabilization method provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0220] In other embodiments, the present invention discloses a computing device comprising:
[0221] One or more processors;
[0222] Memory;
[0223] And one or more programs, wherein the one or more programs are stored in memory and configured to be executed by one or more processors, and the one or more programs include instructions for any of the above-described histogram-based spot de-jitter methods.
[0224] In other embodiments, the present invention discloses a storage medium storing one or more computer-readable programs, the programs including instructions adapted to be loaded by a memory and executed any of the above-described histogram-based spot de-jitter methods.
[0225] This invention discloses a histogram-based spot denoising method, apparatus, computing device, and storage medium, which have the following beneficial effects:
[0226] First, it boasts high stability and strong anti-interference capabilities. By introducing a global jitter estimation and compensation mechanism based on the background region, it can effectively compensate for interference caused by environmental vibrations at the algorithm level. Real-world testing shows that in high-sensitivity scenarios such as with a 20x objective lens, random jitter of approximately 0.3 pixels at the center of the laser spot can be suppressed to near 0.00 pixels, significantly improving the stability and locking accuracy of the laser autofocus system in micro-vibration environments.
[0227] Second, it offers excellent real-time performance with no lag compensation. Unlike traditional time-domain filtering methods that rely on multiple frames of data, the jitter reduction compensation of this invention is calculated and completed in real time based on the spatial domain information (background centroid offset) of the current frame image. This compensation process is completed within a single frame, eliminating the processing delay inherent in filtering and smoothing, thus ensuring the system's fast dynamic response characteristics.
[0228] Third, it has strong adaptability and intelligent adjustment. By associating the motion state of the focusing motor with the dynamic adjustment of the anti-shake coefficient, it effectively solves the contradiction between "sluggish response due to excessive filtering during movement" and "continuous oscillation due to insufficient filtering when stationary". This allows the system to achieve extremely high steady-state accuracy when stationary while pursuing high tracking speed.
[0229] Fourth, it boasts high computational efficiency and ease of implementation. Based on histogram statistics and weighted average calculation, this invention features simple operational logic and low data throughput. This makes it highly suitable for real-time operation on embedded hardware platforms such as FPGAs and high-speed DSPs, reducing system resource overhead and shortening development and deployment cycles, thus demonstrating significant engineering practical value.
[0230] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the present invention. Various changes and modifications can be made to the present invention without departing from its spirit and scope. All such changes and modifications fall within the scope of the present invention as claimed, which is defined by the appended claims and their equivalents.
Claims
1. A histogram-based spot de-jitter method, characterized in that, include: Step S1: Acquire the original image of the laser spot captured by the image sensor; Step S2: Based on the original image, generate a histogram for a specified direction; Wherein, the X-axis of the histogram is the coordinate position of the original image in a specified direction, and its Y-axis is the arithmetic mean of the brightness of all pixels in a row or column perpendicular to the specified direction at the corresponding coordinate position. Step S3: Based on a preset brightness threshold, determine the starting boundary coordinates and ending boundary coordinates of the light spot region in the specified direction in the histogram, and the interval between the starting boundary coordinates and the ending boundary coordinates is the initial light spot region; Step S4: Based on the brightness of the initial spot area, adaptively widen the starting boundary coordinates and the ending boundary coordinates to obtain the widened spot boundary coordinates, and define the spot calculation range based on the widened spot boundary coordinates; Step S5: Within the range of the light spot calculation, calculate the coordinates of the original light spot centroid of the current frame in the specified direction; Step S6: Extend the light spot calculation range outward by the same preset width on the left and right sides respectively to delineate the left background area and the right background area; Step S7: Within the left and right background regions, calculate the coordinates of the real-time background centroid of the current frame in the specified direction; Step S8: Perform Kalman filtering on the background centroid data of historical multi-frames with a small time window to obtain the background reference reference in the specified direction; Step S9: Calculate the difference between the background reference benchmark and the real-time background centroid as the global jitter offset in the specified direction; Step S10: Adaptively adjust the anti-shake coefficient according to the motion state of the focusing motor; Step S11: Calculate the jitter compensation value based on the global jitter offset and the anti-jitter coefficient; Step S12: Add the jitter compensation value to the original spot centroid and output the coordinates of the de-jittered spot centroid in the specified direction.
2. The spot stabilization method according to claim 1, characterized in that, In step S3, determining the starting and ending boundary coordinates of the light spot region in the specified direction specifically includes: Scanning from both ends of the histogram toward the center, the coordinates at which the first brightness threshold is reached or exceeded are respectively determined as the starting boundary coordinates and the ending boundary coordinates.
3. The spot stabilization method according to claim 1, characterized in that, In step S4, the adaptive widening specifically involves: The widening is adjusted according to the average brightness of the initial spot area, and the widening range is positively correlated with the average brightness. The width range is 0 to 64 pixels.
4. The spot stabilization method according to claim 1, characterized in that, In step S5, the formula for calculating the original spot centroid is: ; in: The coordinates of the original spot centroid in the specified direction; and These are the starting and ending coordinates of the light spot calculation range, respectively; This represents the i-th coordinate position on the X-axis of the histogram; For histogram The corresponding brightness value; This represents the minimum brightness value in the histogram.
5. The spot stabilization method according to claim 4, characterized in that, In step S7, the formula for calculating the real-time background centroid is: ; in: The coordinates of the real-time background centroid in the specified direction; and These are the pixel widths that expand to the left and right, respectively.
6. The spot stabilization method according to claim 5, characterized in that, The formula for calculating the centroid of the light spot after shake reduction is as follows: ; in: The coordinates of the centroid of the final spot after anti-jitter processing are located in the specified direction. This is the anti-jitter factor; The specified direction serves as the background reference datum; This is the jitter compensation value.
7. The spot stabilization method according to claim 1, characterized in that, In step S10, the adaptive adjustment of the anti-shake coefficient based on the motion state of the focusing motor specifically includes: When the focusing motor is in high-speed operation, the anti-shake coefficient is adjusted to the first value; When the focusing motor is in a low-speed operation state, the anti-shake coefficient is adjusted to the second value; When the focusing motor is stationary, the anti-shake coefficient is adjusted to the third value; Furthermore, the third value is greater than the second value, and the second value is greater than the first value.
8. A histogram-based spot stabilization device, characterized in that, include: The image acquisition module is used to acquire the original image of the laser spot captured by the image sensor; The histogram generation module is used to generate a histogram based on the original image for a specified direction. Wherein, the X-axis of the histogram is the coordinate position of the original image in a specified direction, and its Y-axis is the arithmetic mean of the brightness of all pixels in a row or column perpendicular to the specified direction at the corresponding coordinate position. The initial spot region determination module is used to determine the start boundary coordinates and end boundary coordinates of the spot region in the specified direction in the histogram according to a preset brightness threshold, and the interval between the start boundary coordinates and the end boundary coordinates is the initial spot region. The spot calculation range determination module is used to adaptively expand the starting boundary coordinates and the ending boundary coordinates according to the brightness of the initial spot area to obtain the expanded spot boundary coordinates, and define the spot calculation range based on the expanded spot boundary coordinates. The original centroid calculation module is used to calculate the coordinates of the original centroid of the current frame in the specified direction within the spot calculation range; The background area delineation module is used to extend outward by the same preset width on the left and right sides of the light spot calculation range, respectively, to delineate the left background area and the right background area. The real-time background centroid calculation module is used to calculate the coordinates of the real-time background centroid of the current frame in the specified direction within the left and right background regions. The background reference benchmark generation module is used to perform small time window Kalman filtering on the background centroid data of historical multi-frames to obtain the background reference benchmark in the specified direction. The global jitter calculation module is used to calculate the difference between the background reference benchmark and the real-time background centroid, as the global jitter offset in the specified direction; The anti-shake coefficient adjustment module is used to adaptively adjust the anti-shake coefficient according to the motion state of the focusing motor; The jitter compensation value calculation module is used to calculate the jitter compensation value based on the global jitter offset and the anti-jitter coefficient. The anti-jitter centroid output module is used to add the jitter compensation value to the original spot centroid and output the coordinates of the anti-jitter spot centroid in the specified direction.
9. A computing device, characterized in that, include: One or more processors; Memory; And one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, and the one or more programs include instructions for the histogram-based spot de-jitter method according to any one of claims 1-7.
10. A storage medium, characterized in that, The storage medium stores one or more computer-readable programs, the programs including instructions adapted to be loaded by memory and executed as described in any one of claims 1-7.