A linear laser focusing control method, device and equipment
By acquiring laser spot images in real time and dynamically switching lens adjustment modes, the problem of insufficient estimation accuracy when defocusing over a large area in a line laser focusing system is solved, enabling rapid approximation and fine adjustment, and improving the overall performance of focusing control.
Patent Information
- Application Number
- CN202610745758.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-27
- Publication Date
- 2026-08-25
AI Technical Summary
Traditional line laser focusing control methods have insufficient estimation accuracy when defocusing over a large range, PID control algorithms accumulate errors across the entire range, and lookup table methods cannot guarantee estimation accuracy in nonlinear regions.
The imaging component acquires laser spot images in real time, dynamically switches lens adjustment modes, and combines rapid approximation and fine adjustment modes to control the movement of the drive component to achieve focusing.
It can quickly approach the focus point when out of focus over a wide range and improve positioning accuracy in the near-focus area, balancing response speed and focusing accuracy, and avoiding oscillation and error accumulation.
Smart Images

Figure CN122632423A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of laser focusing technology, and in particular to a linear laser focusing control method, apparatus and equipment. Background Technology
[0002] In online laser autofocus systems, the defocus distance is usually calculated by detecting the centroid offset of the laser spot, and then the motor is controlled to drive the imaging components to achieve focusing.
[0003] In related technologies, traditional focusing control methods mainly include PID control algorithms and lookup table methods. However, in practical applications, because PID control algorithms use a uniform control mode across the entire range, the integral term accumulates errors when the focus is wide. When entering the near-focal region, this accumulated error causes the motor to overcorrect, resulting in reciprocating oscillations near the focal point. As for the lookup table method, it relies primarily on pre-calibrated mapping relationships. However, the linear relationship between the spot centroid offset and the defocus distance only holds true within a small range near the focal point. In the nonlinear region of wide defocus, the lookup table method struggles to guarantee estimation accuracy.
[0004] Therefore, there is an urgent need for a linear laser focusing control method, device, and equipment to solve the problem of insufficient estimation accuracy when the focus is defocused over a large area in traditional focusing control methods. Summary of the Invention
[0005] The purpose of this application is to provide a linear laser focusing control method, device, and equipment to solve the problem of insufficient estimation accuracy when there is a large defocusing range in traditional focusing control methods.
[0006] In a first aspect, embodiments of this application provide a line laser focusing control method, applied to a line laser focusing system, which includes a laser emitting component, an imaging component, and a driving component. The method includes: acquiring, in real time, a spot image formed after the laser emitting component emits a laser towards a target object through the imaging component. The spot image contains the laser spot. Based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component, determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes. Based on the target adjustment mode and the current deviation distance, determining the current motion amount of the driving component. Based on the current motion amount, controlling the driving component to drive the imaging component to move, so that the object-side focal position of the imaging component falls on the surface of the target object.
[0007] The linear laser focusing control method provided in this application embodiment acquires the spot image formed after the laser emitting component emits laser light onto the target object in real time through the imaging component. Based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focus position of the imaging component, a target adjustment mode suitable for the current deviation distance is determined from at least two preset adjustment modes. Based on the target adjustment mode, the motion amount of the driving component is determined. Finally, the driving component is controlled to drive the imaging component to move so that its object-side focus falls on the surface of the target object. It can shorten the focusing time by using a fast approach mode when there is a large defocus area, and improve the positioning accuracy by using a fine adjustment mode in the near-focus area, thereby taking into account both response speed and focusing accuracy across the entire range.
[0008] One possible implementation involves determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes, based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component. This includes: calculating the centroid position of the laser spot in the spot image based on the spot image; calculating the current deviation distance between the centroid position and the current focal position of the imaging component based on the centroid position and the current focal position of the imaging component; determining the distance range within which the current deviation distance falls; and determining the target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the distance range within which the current deviation distance falls.
[0009] One possible implementation is that the distance interval includes a first distance interval and a second distance interval. The first distance interval and the second distance interval are divided by a dynamic threshold, and the deviation distance corresponding to the first distance interval is greater than the deviation distance corresponding to the second distance interval. Based on the distance interval in which the current deviation distance is located, a target adjustment mode suitable for the current deviation distance is determined from at least two preset lens adjustment modes, including: if the distance interval is determined to be the first distance interval, determining the target adjustment mode suitable for the current deviation distance as the first target adjustment mode; if the distance interval is determined to be the second distance interval, determining the target adjustment mode suitable for the current deviation distance as the second target adjustment mode.
[0010] One possible implementation involves determining the current motion of the driving component based on the target adjustment mode and the current deviation distance when the target adjustment mode is the first target adjustment mode. This includes: determining a first motion component of the driving component based on the current deviation distance; obtaining the current velocity of the driving component; determining a second motion component of the driving component based on the current velocity; and determining the current motion of the driving component based on the first and second motion components.
[0011] One possible implementation involves determining the current motion of the driving component based on the target adjustment mode and the current deviation distance when the target adjustment mode is set to the second target adjustment mode. This includes selecting a target mapping coefficient from pre-calibrated mapping coefficients based on the current deviation distance and the corresponding deviation direction. The mapping coefficients include a first mapping coefficient and a second mapping coefficient. The first mapping coefficient corresponds to the upper defocus direction in the deviation direction. The second mapping coefficient corresponds to the lower defocus direction in the deviation direction. The current motion of the driving component is then determined based on the current deviation distance and the target mapping coefficient.
[0012] One possible implementation involves controlling a driving component to drive the imaging component based on the current amount of motion, including: determining a target driving position for the driving component based on the current amount of motion; determining the number of deceleration pulses required for the driving component to decelerate from the current driving position to the target driving position according to a preset deceleration method, based on the driving speed information of the driving component. The driving speed information includes the current driving speed, driving acceleration, and driving jerk. During the motion of the imaging component driven by the driving component, acquiring the current driving speed and current driving position of the driving component; determining the remaining amount of motion of the driving component based on the current driving position and the target driving position; and controlling the driving component to decelerate from the current driving position to the target driving position according to the preset deceleration method when the remaining amount of motion is less than or equal to the amount of motion corresponding to the number of deceleration pulses.
[0013] One possible implementation of the line laser focusing control method provided in this application embodiment further includes: when it is determined that the current deviation distance is greater than the dimming distance threshold, controlling the imaging component to activate the automatic dimming mode; when it is determined that the current deviation distance is less than or equal to the dimming distance threshold, controlling the imaging component to deactivate the automatic dimming mode and fixing the exposure brightness to the brightness level at the marked focus.
[0014] One possible implementation is that the dimming distance threshold is determined based on a dynamic threshold between distance intervals of at least two preset lens adjustment modes. The dimming distance threshold is less than the dynamic threshold.
[0015] Secondly, embodiments of this application provide a line laser focusing control device applied to a line laser focusing system, which includes a laser emitting component, an imaging component, and a driving component. The device includes: an acquisition module, a determination module, and a control module.
[0016] The acquisition module is used to acquire, in real time, images of the laser spot formed after the laser emitting component emits laser light onto the target object. The image contains the laser spot.
[0017] The determination module is used to determine a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes, based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component.
[0018] The determination module is also used to determine the current motion of the drive components based on the target adjustment mode and the current deviation distance.
[0019] The control module is used to control the driving component to drive the imaging component to move according to the current amount of motion, so that the object-side focal point of the imaging component falls on the surface of the target object.
[0020] One possible implementation involves a determining module that, when determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component, specifically performs the following steps: Calculates the centroid position of the laser spot in the spot image based on the spot image. Calculates the current deviation distance between the centroid position and the current focal position of the imaging component based on the centroid position and the current focal position of the imaging component. Determines the distance range within which the current deviation distance falls based on the current deviation distance. Finally, determines the target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the distance range within which the current deviation distance falls.
[0021] One possible implementation is that the distance interval includes a first distance interval and a second distance interval. The first distance interval and the second distance interval are divided by a dynamic threshold, and the deviation distance corresponding to the first distance interval is greater than the deviation distance corresponding to the second distance interval. The determining module, when determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the distance interval in which the current deviation distance is located, specifically performs the following: if the distance interval is determined to be the first distance interval, determine the target adjustment mode suitable for the current deviation distance as the first target adjustment mode; if the distance interval is determined to be the second distance interval, determine the target adjustment mode suitable for the current deviation distance as the second target adjustment mode.
[0022] One possible implementation, when the target adjustment mode is the first target adjustment mode, the determining module, when determining the current motion of the driving component based on the target adjustment mode and the current deviation distance, specifically performs the following steps: determining the first motion component of the driving component based on the current deviation distance; obtaining the current velocity of the driving component; determining the second motion component of the driving component based on the current velocity; and determining the current motion of the driving component based on the first and second motion components.
[0023] One possible implementation, when the target adjustment mode is the second target adjustment mode, the determining module, when determining the current motion of the driving component based on the target adjustment mode and the current deviation distance, specifically performs the following: Based on the current deviation distance and the deviation direction corresponding to the current deviation distance, it selects a target mapping coefficient from pre-calibrated mapping coefficients. The mapping coefficients include a first mapping coefficient and a second mapping coefficient. The first mapping coefficient corresponds to the upper defocus direction in the deviation direction. The second mapping coefficient corresponds to the lower defocus direction in the deviation direction. Based on the current deviation distance and the target mapping coefficient, the current motion of the driving component is determined.
[0024] One possible implementation involves a control module that, when controlling the motion of the imaging component based on the current amount of motion, specifically performs the following: Determines the target driving position of the driving component based on the current amount of motion. Determines the number of deceleration pulses required for the driving component to decelerate from the current driving position to the target driving position according to a preset deceleration method, based on the driving speed information of the driving component. The driving speed information includes the current driving speed, driving acceleration, and driving jerk. During the motion of the imaging component, the module acquires the current driving speed and current driving position of the driving component. Based on the current driving position and the target driving position, the module determines the remaining amount of motion of the driving component. When the remaining amount of motion is determined to be less than or equal to the amount of motion corresponding to the number of deceleration pulses, the module controls the driving component to decelerate from the current driving position to the target driving position according to the preset deceleration method.
[0025] In one possible implementation, the line laser focusing control device provided in this application embodiment is further configured to: control the imaging component to activate the automatic dimming mode when it is determined that the current deviation distance is greater than the dimming distance threshold; and control the imaging component to deactivate the automatic dimming mode and fix the exposure brightness to the brightness level at the marked focus when it is determined that the current deviation distance is less than or equal to the dimming distance threshold.
[0026] One possible implementation is that the dimming distance threshold is determined based on a dynamic threshold between distance intervals of at least two preset lens adjustment modes. The dimming distance threshold is less than the dynamic threshold.
[0027] Thirdly, embodiments of this application provide a line laser focusing control device that has the function of implementing the line laser focusing control method of the first aspect or any possible implementation thereof. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0028] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, enable the computer to perform the line laser focusing control method of the first aspect or any possible implementation thereof.
[0029] Fifthly, embodiments of this application provide a computer program product containing instructions that, when run on a computer, enable the computer to execute the line laser focusing control method described in the first aspect or any possible implementation thereof.
[0030] The technical effects of any of the design methods in aspects two through five can be found in aspect one or in different possible implementations of aspect one, and will not be repeated here. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0032] Figure 1 A system structure diagram of a line laser focusing control system provided in this application embodiment; Figure 2 A flowchart of a line laser focusing control method provided in this application embodiment; Figure 3 A schematic diagram of a line laser focusing control device provided in an embodiment of this application; Figure 4 This is another system architecture diagram of a line laser focusing control system provided in an embodiment of this application. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0034] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0035] In related technologies, focusing control methods mainly include PID control algorithms and lookup table methods. However, in practical applications, PID control algorithms use a uniform control mode across the entire range. When the focus is wide, the integral term accumulates errors. When entering the near-focal region, this accumulated error causes the motor to overcorrect, easily resulting in reciprocating oscillations near the focal point. Lookup table methods rely on pre-calibrated mapping relationships, but the linear relationship between the spot centroid offset and the defocus distance only holds true within a small range near the focal point. In the nonlinear region of wide defocus, it is difficult to guarantee estimation accuracy.
[0036] Based on this, embodiments of this application provide a line laser focusing control method, apparatus, and device, applied to a line laser focusing system, which includes a laser emitting component, an imaging component, and a driving component. The method includes real-time acquisition of a spot image formed after the laser emitting component emits a laser towards a target object. The spot image contains the laser spot. Based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component, a target adjustment mode suitable for the current deviation distance is determined from at least two preset lens adjustment modes. Based on the target adjustment mode and the current deviation distance, the current motion amount of the driving component is determined. Based on the current motion amount, the driving component is controlled to drive the imaging component to move, so that the object-side focal position of the imaging component falls on the surface of the target object.
[0037] The linear laser focusing control method provided in this application embodiment acquires the spot image formed after the laser emitting component emits laser light onto the target object in real time through the imaging component. Based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focus position of the imaging component, a target adjustment mode suitable for the current deviation distance is determined from at least two preset adjustment modes. Based on the target adjustment mode, the motion amount of the driving component is determined. Finally, the driving component is controlled to drive the imaging component to move so that its object-side focus falls on the surface of the target object. It can shorten the focusing time by using a fast approach mode when there is a large defocus area, and improve the positioning accuracy by using a fine adjustment mode in the near-focus area, thereby taking into account both response speed and focusing accuracy across the entire range.
[0038] The methods provided in the embodiments of this application will now be described in conjunction with the specific accompanying drawings.
[0039] On one hand, embodiments of this application provide a line laser focusing system. For example... Figure 1 As shown, the line laser focusing system 100 may include: a laser emitting component 101, an imaging component 102, a driving component 103, a control unit 104, and a conveyor belt 105.
[0040] The laser emitting component 101 is used to emit a laser beam toward a target object. The laser beam is focused onto the surface of the target object and reflected to form a laser spot. For example, the laser emitting component 101 may include optical elements such as a laser diode, a collimating lens, and a focusing lens to generate and emit a laser beam.
[0041] Imaging component 102 is used to acquire an image of the laser spot. For example, imaging component 102 may include a lens and an image sensor (such as CMOS or CCD) for receiving the laser reflected from the surface of the target object and converting it into a digital image signal.
[0042] The driving component 103 is used to drive the imaging component to move, so as to adjust the distance between the imaging component 102 and the target object. For example, the driving component 103 may include a stepper motor and a transmission mechanism (such as a lead screw, guide rail, etc.) to drive the imaging component 102 to move along the optical axis.
[0043] The control unit 104 is connected to the laser emitting assembly 101, the imaging assembly 102, the driving assembly 103, and the conveyor belt 105, respectively. The control unit 104 is used to control the laser emitting assembly 101, the imaging assembly 102, the driving assembly 103, and the conveyor belt 105 to work together using the line laser focusing control method provided in the embodiments of this application. For example, the control unit 104 may include a processor and a memory.
[0044] The conveyor belt 105 is used to carry the movement of the target objects, so that each target object passes through the focusing area of the imaging component 102 in sequence.
[0045] It should be noted that the above Figure 1 The illustrated linear laser focusing control system 100 is merely an example of the application scenario of the solution in this application and is not intended to limit the application scenario of the solution in this application.
[0046] On the one hand, embodiments of this application provide a line laser focusing control method, which can be performed by... Figure 1 The line laser focusing control system 100 shown is executed. For example... Figure 2 As shown, the method may include the following steps.
[0047] S201 acquires in real time the image of the light spot formed after the laser emitting component emits laser light at the target object.
[0048] The light spot image contains laser light spots.
[0049] Specifically, as the conveyor belt carries the target object, the object sequentially passes through the focusing area of the imaging component, during which the distance between the target object and the imaging component continuously changes. Therefore, in order to acquire a clear image, the focusing system needs to adjust the position of the imaging component in real time so that the object-side focus of the imaging component always falls on the surface of the target object.
[0050] Specifically, the laser emitting component emits a laser beam toward the surface of the target object. The laser beam is focused onto the surface of the target object and diffuses. Part of the reflected light enters the imaging component, and the lens in the imaging component converges the reflected light onto its image sensor to form a spot image containing the laser spot.
[0051] During the acquisition process described above, the imaging component continuously acquires spot images at a preset sampling frequency. The spot image acquired at each sampling moment corresponds to the position and state of the target object at that moment. Since the target object is in motion, the position and shape of the laser spot may differ in the spot images acquired at different times. By processing the spot image acquired at the current moment, the defocus state at the current moment can be obtained, thereby controlling the drive component to adjust the position of the imaging component in real time, achieving dynamic focusing on the moving target object.
[0052] It should be noted that the sampling frequency of the imaging component can be set according to the movement speed of the conveyor belt and the focusing accuracy, and this application does not limit it in this regard.
[0053] S202, based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component, determine a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes.
[0054] After acquiring a spot image containing the laser beam in real time, the spot image is processed to calculate the centroid position of the laser beam. Based on the deviation distance between the centroid position and the current focal position of the imaging component, the appropriate lens adjustment mode is determined.
[0055] The centroid position refers to the weighted center position of the brightness of the spot in the spot image.
[0056] It should be noted that in an online laser autofocus system, the position of the laser spot on the image sensor corresponds to the defocus state of the imaging component. When the object-side focus of the imaging component accurately falls on the surface of the target object, the centroid of the laser spot is located at a specific position on the image sensor, which is the target focus position. When the imaging component defocuses, the centroid of the laser spot shifts, and the direction and distance of this shift correspond to the direction and degree of defocus. Therefore, by calculating the deviation between the centroid of the laser spot and the target focus position, the current defocus amount can be calculated, thereby determining the distance the driving component needs to move.
[0057] However, in practical engineering applications, the mapping relationship between the laser spot centroid position and the defocusing amount is not linear across the entire range. When there is a large defocusing distance, i.e., when the current deviation distance is significant, a clear nonlinear relationship exists between the centroid position and the defocusing amount, and simply using a fixed proportional coefficient to estimate the motion will produce a large error. However, within a smaller deviation distance close to the focal point, the centroid position and the defocusing amount approximately satisfy a linear relationship, allowing for high-precision estimation using a linear mapping method.
[0058] To address the aforementioned characteristics, this application provides at least two lens adjustment modes, each suitable for different deviation distance ranges. By dynamically switching the adjustment mode based on the current deviation distance's location within the specified range, both response speed and positioning accuracy can be balanced across the entire measurement range.
[0059] One possible implementation involves calculating the centroid position of the laser spot within the spot image. Based on the centroid position and the current focal position of the imaging component, the current deviation distance between the centroid position and the focal position of the imaging component is calculated. Based on the current deviation distance, the distance range within which the current deviation distance falls is determined. Based on the distance range within which the current deviation distance falls, a target adjustment mode suitable for the current deviation distance is determined from at least two preset lens adjustment modes.
[0060] Specifically, a region of interest (ROI) is defined in the laser spot image. Within the ROI, the pixel coordinates are weighted and averaged using the gray values of each pixel as weights to obtain the centroid coordinates of the laser spot. The formula for calculating the centroid position can be expressed as:
[0061]
[0062] in, and Let x and y be the x and y coordinates of the i-th pixel within the region of interest, respectively. Let be the grayscale value of the i-th pixel. Using the above formula, the centroid position of the laser spot in the spot image at the current moment can be determined as ( ). , ).
[0063] Then, based on the calculated centroid position and the current focal position of the imaging component, the current deviation distance between the centroid position and the focal position of the imaging component is calculated.
[0064] The target focal position of the imaging component is defined by pre-calibrated and stored reference centroid coordinates, which correspond to the imaging position of the laser spot on the image sensor when the imaging component is accurately focused. The currently calculated centroid coordinates are compared with the reference centroid coordinates, and the coordinate difference between the two is calculated. This coordinate difference reflects the deviation between the current laser spot centroid position and the target focal position. Based on this coordinate difference, combined with the optical parameters of the imaging component and the pixel size of the image sensor, the current deviation distance can be calculated, which is the current defocusing amount.
[0065] Then, based on the current deviation distance, the distance interval in which the current deviation distance is located is determined.
[0066] The distance intervals include a first distance interval and a second distance interval. The first distance interval corresponds to a large defocus state, where there is a significant non-linear relationship between the centroid position and the defocus amount. The second distance interval corresponds to a near-focus state, where there is an approximately linear relationship between the centroid position and the defocus amount. The deviation distance corresponding to the first distance interval is greater than the deviation distance corresponding to the second distance interval.
[0067] It should be noted that the division between the first and second distance intervals is determined through a dynamic threshold. Before implementing the focusing function, the trajectory of the light spot centroid across the entire travel range can be scanned to analyze the pattern of centroid position changing with the defocus amount, identifying the close-range region with good linearity. Based on this, the threshold for dividing the first and second distance intervals is dynamically calibrated. This dynamic calibration method can adapt to individual differences in different optical systems, ensuring the accuracy of distance interval division.
[0068] Finally, based on the distance range in which the current deviation distance is located, a target adjustment mode suitable for the current deviation distance is determined from at least two preset lens adjustment modes.
[0069] One possible implementation is to determine the target adjustment mode applicable to the current deviation distance as the first target adjustment mode, given that the distance interval is determined as the first distance interval.
[0070] The first target adjustment mode is suitable for motion estimation in long-distance, non-linear regions. It can quickly shorten the defocus distance while suppressing integral errors, thus avoiding interference with subsequent close-range precise positioning. For example, this first target adjustment mode can be a long-distance rapid approximation mode.
[0071] Another possible implementation is to determine the target adjustment mode applicable to the current deviation distance as the second target adjustment mode, given that the distance interval is determined as the second distance interval.
[0072] The second target adjustment mode is suitable for estimating motion in near-linear regions. Through linear conversion using pre-calibrated mapping coefficients, it can achieve high-precision positioning down to the micrometer level. For example, this second target adjustment mode can be a near-range precision adjustment mode.
[0073] In the above manner, the embodiments of this application dynamically select the most suitable lens adjustment mode according to the current deviation distance. At a long distance, the first target adjustment mode is used to achieve rapid approach, and at a close distance, the second target adjustment mode is switched to achieve precise alignment, thereby taking into account both focusing speed and focusing accuracy across the entire range.
[0074] S203, determine the current motion of the drive component based on the target adjustment mode and the current deviation distance.
[0075] Specifically, based on the determined target adjustment mode and the calculated current deviation distance, the current amount of motion required by the driving component within the current adjustment cycle is determined. This current amount of motion can be represented by the number of driving pulses or steps of the driving component, indicating the distance the driving component drives the imaging component to move.
[0076] It should be noted that in this embodiment, the driving component can use a stepper motor as the driving source. Each time the stepper motor receives a driving pulse, it rotates by a fixed step angle, and the angular displacement is converted into linear displacement of the imaging component through a transmission mechanism. Therefore, by controlling the number of pulses sent to the driving component, the movement distance of the imaging component can be precisely controlled. The current motion determined in this step is the number of pulses that need to be sent to the driving component.
[0077] Since the first and second target adjustment modes are applicable to different deviation distance ranges, the methods for determining the amount of exercise differ between the two modes. The following sections provide a detailed explanation of how to determine the amount of exercise under each mode.
[0078] One possible implementation involves setting the target adjustment mode to the first target adjustment mode, indicating a large defocus state, meaning the current deviation distance is within the first distance range. In this state, the centroid position of the laser spot exhibits a non-linear relationship with the defocus amount. Using only a linear proportional coefficient for motion estimation at this time would result in significant errors. Furthermore, during long-distance movement, directly employing traditional PID control would lead to a large cumulative error in the integral term over a long period. When entering the near-focus, high-precision region, this cumulative error would cause overcorrection, resulting in repeated oscillations of the imaging component near the focus point, affecting focusing stability.
[0079] Specifically, in the first target adjustment mode, the step of determining the current motion of the drive component based on the target adjustment mode and the current deviation distance includes: determining the first motion component of the drive component based on the current deviation distance; obtaining the current velocity of the drive component; determining the second motion component of the drive component based on the current velocity; and determining the current motion of the drive component based on the first and second motion components.
[0080] The first motion component is a proportional component, which can be obtained by multiplying the current deviation distance by a preset proportional coefficient. The proportional coefficient can be pre-calibrated based on system parameters such as the transmission ratio of the driving component, the optical parameters of the imaging component, and the pixel size of the image sensor.
[0081] The current speed of the drive component can be obtained by reading the current drive pulse frequency of the drive component, or by measuring it in real time using a speed sensor such as an encoder.
[0082] The second motion component is a differential component, which can be obtained by multiplying the rate of change of the current deviation distance (i.e., the rate of change of the defocus amount) by a preset differential coefficient. In actual implementation, due to the short adjustment cycle, the change in the target position of the object relative to the imaging component is small within each adjustment cycle. Therefore, the rate of change of the current deviation distance can be indirectly reflected by the current speed of the driving component. Based on this, the current speed can be multiplied by a preset differential coefficient to obtain the second motion component. This second motion component can create damping when the driving component approaches the target position, suppressing overshoot caused by motion inertia or estimation delay in advance, thereby improving the stability of the focusing process.
[0083] It should be noted that in the first target adjustment mode, the integral component in this embodiment is actively set to zero, i.e., I=0. In this mode, due to the large deviation distance during long-distance movement, if the integral term continues to accumulate, it will generate a continuously increasing integral output. When the imaging component moves to the near-focal region, this accumulated integral output cannot be eliminated immediately, causing the driving component to continue moving beyond the target focal position, resulting in overshoot and reciprocating oscillations. By setting the integral term to zero, the interference of long-distance accumulated error on the precise positioning of the near-focal point can be avoided, ensuring that the system is in an initial state when switching from long-distance mode to near-distance mode.
[0084] Then, the first motion component (proportional component) and the second motion component (differential component) are superimposed to obtain the current motion quantity that the drive component needs to perform within the current adjustment cycle. This current motion quantity is output in the form of pulse count to control the movement of the drive component.
[0085] Another possible approach is to use the second target adjustment mode, indicating that the target is close to the focal point and the current deviation distance is within the second distance range. In this state, the position of the laser spot centroid and the defocus amount approximately satisfy a linear relationship, allowing for motion estimation using a linear mapping method to achieve high-precision positioning.
[0086] It should be noted that, due to the characteristics of optical systems, the defocusing characteristics of imaging components may differ on either side of the focal point. In other words, the sensitivity of the laser spot centroid to changes in defocus may differ when the target object is located above the focal point (i.e., object distance less than focal length) and below the focal point (i.e., object distance greater than focal length). Therefore, different mapping coefficients need to be calibrated for the upper and lower defocusing directions to ensure the accuracy of bidirectional motion estimation.
[0087] Specifically, when the target adjustment mode is the second target adjustment mode, the step of determining the current motion of the driving component based on the target adjustment mode and the current deviation distance includes: selecting a target mapping coefficient from pre-calibrated mapping coefficients based on the current deviation distance and the deviation direction corresponding to the current deviation distance. The mapping coefficients include a first mapping coefficient and a second mapping coefficient. The first mapping coefficient corresponds to the upper defocus direction in the deviation direction. The second mapping coefficient corresponds to the lower defocus direction in the deviation direction. The current motion of the driving component is then determined based on the current deviation distance and the target mapping coefficient.
[0088] The upper and lower defocus can be determined by the offset direction of the laser spot centroid relative to the target focal point.
[0089] The first mapping coefficient (denoted as K1) and the second mapping coefficient (denoted as K2) are obtained through pre-calibration. During the calibration process, given the defocus amount, the offset of the laser spot centroid is measured under both upper and lower defocus states. The proportional relationship between the centroid offset and the defocus amount is calculated to obtain the corresponding mapping coefficient. The calibrated mapping coefficients are stored in the line laser focusing system for use during focusing.
[0090] After determining the direction of the current deviation distance, if the deviation direction is upward defocusing, the first mapping coefficient is selected as the target mapping coefficient. If the deviation direction is downward defocusing, the second mapping coefficient is selected as the target mapping coefficient.
[0091] Then, multiplying the current deviation distance by the target mapping coefficient yields the current amount of motion required by the driving component. This current amount of motion can be determined using the following formula.
[0092]
[0093] in, This represents the current amount of exercise, and K represents the target mapping coefficient (K can be selected as K1 or K2 depending on the direction of deviation). This indicates the centroid coordinates of the current laser spot. This indicates the reference centroid coordinates corresponding to the target focus position.
[0094] It should be noted that in practical applications, since line laser focusing systems primarily rely on the defocus-sensitive direction (e.g., the X-axis), the centroid coordinates in this sensitive direction can be extracted for calculating the deviation distance and motion during the calculation of the current motion. If the sensitive direction of the line laser focusing system is the Y-axis, the calculation method for the centroid coordinates in the Y-axis is similar to that in the X-axis, and will not be elaborated upon here. In practical applications, the sensitive direction of the line laser focusing system can be selected appropriately based on the system layout.
[0095] In this way, the second target adjustment mode utilizes the approximately linear relationship between the centroid position and the defocus amount in the near-field region and uses a direction-adaptive linear mapping coefficient to estimate the amount of motion. This enables high-precision positioning at the micrometer level near the focal point, ensuring that the object-side focal point of the imaging component accurately falls on the surface of the target object.
[0096] S204, based on the current amount of motion, control the driving component to drive the imaging component to move so that the object-side focal point of the imaging component falls on the surface of the target object.
[0097] Specifically, the motion of the drive component is controlled based on the current motion amount, and the position of the imaging component is adjusted so that the object-side focus of the imaging component accurately falls on the surface of the target object, thus completing the focusing operation.
[0098] It should be noted that in traditional focusing control schemes, the complete target motion is often calculated first, and then the drive component executes the entire motion process according to a preset fixed speed curve. During this process, the motion strategy cannot be dynamically adjusted based on real-time feedback. This control method has the following shortcomings in terms of focusing efficiency and accuracy: If the motion speed is too slow, the focusing response is sluggish; if the motion speed is too fast, overshoot and mechanical shock are likely to occur when approaching the target position, affecting the positioning accuracy and lifespan of the imaging component.
[0099] To address the aforementioned issues, this application's embodiments employ a combination of real-time deceleration prediction and S-curve motion planning. During the movement of the drive component, the relationship between the remaining motion and the number of pulses required for deceleration is monitored in real time, triggering a deceleration sequence at the appropriate time to achieve smooth start-stop and precise positioning of the drive component.
[0100] One possible implementation, the step of controlling the driving component to drive the imaging component to move based on the current amount of motion, may include: determining the target driving position of the driving component based on the current amount of motion; determining the number of deceleration pulses required for the driving component to decelerate from the current driving position to the target driving position according to a preset deceleration method based on the driving speed information of the driving component; acquiring the current driving speed and current driving position of the driving component during the movement of the imaging component; determining the remaining amount of motion of the driving component based on the current driving position and the target driving position; and controlling the driving component to decelerate from the current driving position to the target driving position according to the preset deceleration method when the remaining amount of motion is less than or equal to the amount of motion corresponding to the number of deceleration pulses.
[0101] The preset deceleration mode can be an S-shaped deceleration mode. An S-shaped curve refers to a motion planning curve where acceleration changes continuously, and the velocity curve exhibits a smooth S-shape. Drive speed information includes current drive speed, drive acceleration, and drive jerk. Current drive speed refers to the speed of the drive component at the current moment, which can be represented by pulse frequency. Drive acceleration refers to the rate of change of the drive component's speed. Drive jerk refers to the rate of change of acceleration.
[0102] Specifically, using the current position of the drive component as a reference, the current motion quantity is added to the pulse count value corresponding to the current position to obtain the pulse count value corresponding to the target drive position. This target drive position is the endpoint position that the drive component needs to reach within this adjustment cycle.
[0103] Then, based on the driving speed information of the driving component, the number of deceleration pulses required for the driving component to decelerate from the current driving position to the target driving position according to the preset deceleration method is determined.
[0104] Based on the aforementioned drive speed information, the total number of pulses required to decelerate from the current speed to a standstill according to a preset S-shaped deceleration curve can be calculated in real time. This number of deceleration pulses represents the amount of motion required for the drive component to smoothly stop from its current state.
[0105] Next, during the process of the driving component driving the imaging component to move, the current driving speed and current driving position of the driving component are acquired in real time.
[0106] The current driving position of the driving component can be obtained by reading the cumulative count value of the driving pulses, and the current driving speed can be obtained by reading the frequency of the driving pulses or by encoder feedback.
[0107] Then, the pulse count value corresponding to the current driving position is subtracted from the pulse count value corresponding to the target driving position to obtain the remaining number of pulses that the driving component still needs to move to the target position. This remaining number of pulses is the remaining amount of motion.
[0108] During the movement of the drive component, the remaining motion is continuously compared with the number of deceleration pulses. When the remaining motion is greater than the number of deceleration pulses, it indicates that the current distance to the target position is still far, and the drive component can continue to maintain the current speed or continue to accelerate according to the acceleration curve. When the remaining motion is less than or equal to the number of deceleration pulses, it indicates that the deceleration critical point has been reached. At this time, the drive component immediately forces itself to enter the deceleration sequence from the current motion state, smoothly decelerates according to the preset S-shaped deceleration curve, and finally stops accurately at the target drive position.
[0109] Furthermore, in online laser focusing systems, the imaging components typically possess an automatic dimming function, which automatically adjusts the exposure time or gain based on the brightness of the laser spot image to adapt to target object surfaces with varying reflectivities. However, automatic dimming inherently suffers from response lag; during the movement of the driving components, it struggles to match the ideal target brightness in real time, resulting in a slight difference between the laser spot brightness and the expected value.
[0110] At a distance where the image is out of focus, the total amount of defocus is large, and the error in calculating the centroid of the light spot caused by dimming lag is relatively small compared to the total amount of defocus, so its impact on the focusing result can be ignored. However, in the fine-tuning stage near the focus point, the amount of defocus itself is already very small. At this time, the proportion of the centroid calculation error caused by the fluctuation of the light spot brightness increases significantly. If automatic dimming continues to be enabled, it will lead to positioning deviation and a decrease in the accuracy of repeated focusing.
[0111] To address the aforementioned issues, this application embodiment sets a dimming distance threshold. During the long-distance phase, automatic dimming remains enabled to adapt to environmental changes, while during the near-focus phase, automatic dimming is disabled and the brightness is fixed, ensuring that the light intensity reference during the fine-correction phase remains consistent with the marked focus.
[0112] The dimming distance threshold can be determined by a dynamic threshold between distance ranges of at least two preset lens adjustment modes. This dimming distance threshold is less than this dynamic threshold.
[0113] Specifically, when the lens adjustment mode includes the aforementioned first target adjustment mode and second target adjustment mode, the distance range of the first target adjustment mode is the first distance range, and the distance range of the second target adjustment mode is the second distance range. The division between the first distance range and the second distance range is determined based on the aforementioned dynamic threshold. This dimming distance threshold can be determined based on this dynamic threshold. For example, this dimming distance threshold can be 1 / 4 of the dynamic threshold.
[0114] It should be noted that the dimming distance threshold setting differs from the threshold used to divide the first and second distance intervals mentioned above. The dimming distance threshold is typically set to a smaller value than the dynamic threshold, for example, 1 / 4 of the dynamic threshold. This is because the impact of dimming fluctuations on centroid calculation is only significant within extremely close distances. Setting the dimming distance threshold sufficiently small allows for extending the auto-dimming operating range as much as possible while maintaining focus accuracy, thus better adapting to changes in ambient light.
[0115] Specifically, during the process of driving the imaging component to move, the relationship between the current deviation distance and the preset dimming distance threshold is determined in real time.
[0116] One possible implementation is to control the imaging component to activate the automatic dimming mode when it is determined that the current deviation distance is greater than the dimming distance threshold.
[0117] Specifically, if the current deviation distance is greater than the dimming distance threshold, it indicates that the image is currently in a long-distance out-of-focus state. At this time, the imaging component can be controlled to activate the automatic dimming mode. In automatic dimming mode, the imaging component automatically adjusts the exposure parameters according to the brightness of the light spot image to adapt to the changes in the reflectivity of the target object's surface, ensuring that the light spot image has appropriate brightness for easy centroid calculation.
[0118] Another possible implementation is to control the imaging component to turn off the automatic dimming mode and fix the exposure brightness to the brightness level when the focus is marked, if the current deviation distance is determined to be less than or equal to the dimming distance threshold.
[0119] Specifically, if the current deviation distance is less than or equal to the dimming distance threshold, it indicates that the near-focus fine correction stage has been entered. At this time, the imaging component is controlled to turn off the automatic dimming mode and the exposure brightness is fixed to the brightness level when the focus is marked.
[0120] The brightness level at which the focus is marked can be pre-recorded and stored during the system calibration phase. It corresponds to the brightness setting that yields the best spot image quality under the current environmental conditions when the imaging components are accurately focused. By locking the exposure brightness to this preset level, the light intensity fluctuations caused by auto-dimming lag can be eliminated, ensuring that every centroid calculation near the focus is performed under the same light intensity reference, thereby effectively improving the accuracy of repeated focusing and positioning consistency.
[0121] The above primarily describes the solutions provided in the embodiments of this application from the perspective of the working principle of the device. It is understood that, in order to achieve the above functions, the line laser focusing control device includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the algorithm steps of the examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0122] This application embodiment can divide the linear laser focusing control device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module.
[0123] It should be noted that the module division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. When dividing functional modules according to their respective functions, Figure 3 A schematic diagram of a possible configuration of the line laser focusing control device involved in the above and embodiment is shown. For example... Figure 3 As shown, the line laser focusing control device 300 may include: an acquisition module 301, a determination module 302, and a control module 303.
[0124] The acquisition module 301 is used to support the execution of the line laser focusing control device 300. Figure 2 S201 in the schematic line laser focusing control method.
[0125] Determining module 302, used to support the execution of line laser focusing control device 300 Figure 2 S202 and S203 are shown in the schematic line laser focusing control method.
[0126] Control module 303 is used to support the execution of the line laser focusing control device 300. Figure 2 S204 in the schematic line laser focusing control method.
[0127] The determining module, when determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component, specifically performs the following steps: Calculate the centroid position of the laser spot in the spot image based on the spot image. Calculate the current deviation distance between the centroid position and the current focal position of the imaging component based on the centroid position and the current focal position of the imaging component. Determine the distance range in which the current deviation distance falls based on the current deviation distance. Determine the target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the distance range in which the current deviation distance falls.
[0128] One possible implementation is that the distance interval includes a first distance interval and a second distance interval. The first distance interval and the second distance interval are divided by a dynamic threshold, and the deviation distance corresponding to the first distance interval is greater than the deviation distance corresponding to the second distance interval. The determining module, when determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the distance interval in which the current deviation distance is located, specifically performs the following: if the distance interval is determined to be the first distance interval, determine the target adjustment mode suitable for the current deviation distance as the first target adjustment mode; if the distance interval is determined to be the second distance interval, determine the target adjustment mode suitable for the current deviation distance as the second target adjustment mode.
[0129] One possible implementation, when the target adjustment mode is the first target adjustment mode, the determining module, when determining the current motion of the driving component based on the target adjustment mode and the current deviation distance, specifically performs the following steps: determining the first motion component of the driving component based on the current deviation distance; obtaining the current velocity of the driving component; determining the second motion component of the driving component based on the current velocity; and determining the current motion of the driving component based on the first and second motion components.
[0130] One possible implementation, when the target adjustment mode is the second target adjustment mode, the determining module, when determining the current motion of the driving component based on the target adjustment mode and the current deviation distance, specifically performs the following: Based on the current deviation distance and the deviation direction corresponding to the current deviation distance, it selects a target mapping coefficient from pre-calibrated mapping coefficients. The mapping coefficients include a first mapping coefficient and a second mapping coefficient. The first mapping coefficient corresponds to the upper defocus direction in the deviation direction. The second mapping coefficient corresponds to the lower defocus direction in the deviation direction. Based on the current deviation distance and the target mapping coefficient, the current motion of the driving component is determined.
[0131] One possible implementation involves a control module that, when controlling the motion of the imaging component based on the current amount of motion, specifically performs the following: Determines the target driving position of the driving component based on the current amount of motion. Determines the number of deceleration pulses required for the driving component to decelerate from the current driving position to the target driving position according to a preset deceleration method, based on the driving speed information of the driving component. The driving speed information includes the current driving speed, driving acceleration, and driving jerk. During the motion of the imaging component, the module acquires the current driving speed and current driving position of the driving component. Based on the current driving position and the target driving position, the module determines the remaining amount of motion of the driving component. When the remaining amount of motion is determined to be less than or equal to the amount of motion corresponding to the number of deceleration pulses, the module controls the driving component to decelerate from the current driving position to the target driving position according to the preset deceleration method.
[0132] In one possible implementation, the line laser focusing control device provided in this application embodiment is further configured to: control the imaging component to activate the automatic dimming mode when it is determined that the current deviation distance is greater than the dimming distance threshold; and control the imaging component to deactivate the automatic dimming mode and fix the exposure brightness to the brightness level at the marked focus when it is determined that the current deviation distance is less than or equal to the dimming distance threshold.
[0133] One possible implementation is that the dimming distance threshold is determined based on a dynamic threshold between distance intervals of at least two preset lens adjustment modes. The dimming distance threshold is less than the dynamic threshold.
[0134] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0135] The linear laser focusing control device 300 provided in this application embodiment is used to perform the above-mentioned... Figure 2 The line laser focusing control method shown can therefore achieve the same effect as the line laser focusing control method described above.
[0136] This application also provides a line laser focusing control device, which can execute the line laser focusing control method and related steps described in the above method embodiments.
[0137] This application also provides a computer-readable storage medium storing instructions that, when executed, perform the line laser focusing control method and related steps in the above method embodiments.
[0138] This application also provides a computer program product that, when run on a computer, causes the computer to execute the linear laser focusing control method and related steps described in the above method embodiments.
[0139] In some embodiments, the methods shown in this application can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of art.
[0140] This application also provides a linear laser focusing control system 100, such as... Figure 4 As shown, the line laser focusing control system 100 includes at least one processor 401 and at least one interface circuit 402.
[0141] As an example, when the line laser focusing control system 100 includes a processor and an interface circuit, the processor can be... Figure 4 The processor 401 shown in the solid box (or the processor 401 shown in the dashed box) can be an interface circuit. Figure 4 The interface circuit 402 is shown in the solid box (or the interface circuit 402 shown in the dashed box). When the linear laser focusing control system 100 includes two processors and two interface circuits, then the two processors include... Figure 4 The processor 401 shown in the solid box and the processor 401 shown in the dashed box, these two interface circuits include Figure 4 Interface circuit 402 is shown in both solid and dashed boxes. No limitations are imposed on this.
[0142] Processor 401 and interface circuit 402 can be interconnected via a line. For example, interface circuit 402 can be used to receive signals. Alternatively, interface circuit 402 can be used to send signals to other devices (e.g., processor 401). For instance, interface circuit 402 can read computer instructions stored in memory and send those instructions to processor 401. Processor 401 executes the instructions and, in conjunction with input / output devices, implements the various steps in the above embodiments, such as implementing... Figure 2 The methods illustrated are the steps performed in the embodiments shown. Of course, this line laser focusing control system may also include other discrete components, and this application does not specifically limit this.
[0143] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0144] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0145] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0146] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0147] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to it, or all or part of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0148] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A linear laser focusing control method, characterized in that, The method is applied to a line laser focusing system, which includes a laser emitting component, an imaging component, and a driving component; the method includes: The imaging component acquires in real time an image of the laser spot formed after the laser emission component emits a laser towards the target object; the image of the laser spot contains the laser spot. Based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component, a target adjustment mode suitable for the current deviation distance is determined from at least two preset lens adjustment modes; Based on the target adjustment mode and the current deviation distance, determine the current motion of the drive component; Based on the current amount of motion, the driving component is controlled to drive the imaging component to move so that the object-side focal point of the imaging component falls on the surface of the target object.
2. The method according to claim 1, characterized in that, The step of determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component includes: Based on the laser spot image, calculate the centroid position of the laser spot in the laser spot image; Based on the centroid position and the current focal position of the imaging component, calculate the current deviation distance between the centroid position and the focal position of the imaging component; Based on the current deviation distance, determine the distance interval in which the current deviation distance falls; Based on the distance range in which the current deviation distance is located, a target adjustment mode suitable for the current deviation distance is determined from at least two preset lens adjustment modes.
3. The method according to claim 2, characterized in that, The distance interval includes a first distance interval and a second distance interval; the first distance interval and the second distance interval are divided by a dynamic threshold, and the deviation distance corresponding to the first distance interval is greater than the deviation distance corresponding to the second distance interval; the step of determining a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the distance interval in which the current deviation distance is located includes: If the distance interval is determined to be the first distance interval, the target adjustment mode applicable to the current deviation distance is determined to be the first target adjustment mode; If the distance interval is determined to be the second distance interval, the target adjustment mode applicable to the current deviation distance is determined to be the second target adjustment mode.
4. The method according to claim 1, characterized in that, When the target adjustment mode is the first target adjustment mode, determining the current motion of the drive component based on the target adjustment mode and the current deviation distance includes: Based on the current deviation distance, the first motion component of the drive component is determined; Obtain the current speed of the driving component; Based on the current speed, determine the second motion component of the drive component; The current motion of the drive component is determined based on the first motion component and the second motion component.
5. The method according to claim 1, characterized in that, When the target adjustment mode is the second target adjustment mode, determining the current motion of the drive component based on the target adjustment mode and the current deviation distance includes: Based on the current deviation distance and the deviation direction corresponding to the current deviation distance, a target mapping coefficient is selected from the pre-calibrated mapping coefficients; the mapping coefficients include a first mapping coefficient and a second mapping coefficient; the first mapping coefficient corresponds to the upper defocus direction in the deviation direction; the second mapping coefficient corresponds to the lower defocus direction in the deviation direction; The current motion of the drive component is determined based on the current deviation distance and the target mapping coefficient.
6. The method according to claim 1, characterized in that, The step of controlling the driving component to drive the imaging component to move according to the current motion amount includes: Based on the current amount of motion, determine the target driving position of the driving component; Based on the drive speed information of the drive component, determine the number of deceleration pulses required for the drive component to decelerate from the current drive position to the target drive position according to a preset deceleration method; the drive speed information includes the current drive speed, drive acceleration, and drive jerk. During the process of the driving component driving the imaging component to move, the current driving speed and the current driving position of the driving component are obtained; Based on the current driving position and the target driving position, determine the remaining motion of the driving component; When it is determined that the remaining motion is less than or equal to the motion corresponding to the number of deceleration pulses, the drive component is controlled to decelerate from the current drive position to the target drive position according to a preset deceleration method.
7. The method according to claim 1, characterized in that, The method further includes: If the current deviation distance is determined to be greater than the dimming distance threshold, the imaging component is controlled to activate the automatic dimming mode; If the current deviation distance is determined to be less than or equal to the dimming distance threshold, the imaging component is controlled to turn off the automatic dimming mode and the exposure brightness is fixed at the brightness level when the focus is marked.
8. The method according to claim 7, characterized in that, The dimming distance threshold is determined based on a dynamic threshold between distance ranges of at least two preset lens adjustment modes; the dimming distance threshold is less than the dynamic threshold.
9. A line laser focusing control device, characterized in that, An apparatus for use in a line laser focusing system, the line laser focusing system comprising a laser emitting component, an imaging component, and a driving component; the apparatus comprising: The acquisition module is used to acquire, in real time, an image of the laser spot formed after the laser emitting component emits a laser beam at the target object; the image of the laser spot contains the laser spot. The determining module is used to determine a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes, based on the current deviation distance between the centroid position of the laser spot in the spot image and the current focal position of the imaging component. The determining module is further configured to determine the current motion of the driving component based on the target adjustment mode and the current deviation distance; The control module is used to control the driving component to drive the imaging component to move according to the current motion amount, so that the object-side focal point of the imaging component falls on the surface of the target object.
10. The apparatus according to claim 9, characterized in that, The determining module is specifically configured to: calculate the centroid position of the laser spot in the spot image based on the spot image; calculate the current deviation distance between the centroid position and the current focal position of the imaging component based on the centroid position and the current focal position of the imaging component; determine the distance range in which the current deviation distance is located based on the current deviation distance; and determine a target adjustment mode suitable for the current deviation distance from at least two preset lens adjustment modes based on the distance range in which the current deviation distance is located.
11. The apparatus according to claim 10, characterized in that, The distance interval includes a first distance interval and a second distance interval; the first distance interval and the second distance interval are divided by a dynamic threshold, and the deviation distance corresponding to the first distance interval is greater than the deviation distance corresponding to the second distance interval; the determining module is specifically used for: when the distance interval is determined to be the first distance interval, determining a target adjustment mode applicable to the current deviation distance as a first target adjustment mode; when the distance interval is determined to be the second distance interval, determining a target adjustment mode applicable to the current deviation distance as a second target adjustment mode.
12. The apparatus according to claim 9, characterized in that, When the target adjustment mode is the first target adjustment mode, the determining module is specifically used to: determine the first motion component of the driving component based on the current deviation distance; obtain the current speed of the driving component; and determine the second motion component of the driving component based on the current speed. The current motion of the drive component is determined based on the first motion component and the second motion component.
13. The apparatus according to claim 9, characterized in that, When the target adjustment mode is the second target adjustment mode, the determining module is specifically used to: select a target mapping coefficient from pre-calibrated mapping coefficients based on the current deviation distance and the deviation direction corresponding to the current deviation distance; the mapping coefficients include a first mapping coefficient and a second mapping coefficient; the first mapping coefficient corresponds to the upper defocus direction in the deviation direction; the second mapping coefficient corresponds to the lower defocus direction in the deviation direction; and determine the current motion of the driving component based on the current deviation distance and the target mapping coefficient.
14. The apparatus according to claim 9, characterized in that, The control module is specifically configured to: determine the target driving position of the driving component based on the current amount of motion; determine the number of deceleration pulses required for the driving component to decelerate from the current driving position to the target driving position according to a preset deceleration method based on the driving speed information of the driving component; the driving speed information includes the current driving speed, driving acceleration, and driving jerk. During the process of the driving component driving the imaging component to move, the current driving speed and the current driving position of the driving component are obtained; Based on the current driving position and the target driving position, the remaining motion of the driving component is determined; when the remaining motion is determined to be less than or equal to the motion corresponding to the number of deceleration pulses, the driving component is controlled to decelerate from the current driving position to the target driving position according to a preset deceleration method.
15. The apparatus according to claim 9, characterized in that, The laser focusing control device is further configured to: control the imaging component to enable automatic dimming mode when it is determined that the current deviation distance is greater than the dimming distance threshold; and control the imaging component to disable the automatic dimming mode and fix the exposure brightness to the brightness level when the focus is marked when it is determined that the current deviation distance is less than or equal to the dimming distance threshold.
16. The apparatus according to claim 15, characterized in that, The dimming distance threshold is determined based on a dynamic threshold between distance ranges of at least two preset lens adjustment modes; the dimming distance threshold is less than the dynamic threshold.
17. A line laser focusing control device, characterized in that, The line laser focusing control device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, and the processor executing the machine-executable instructions to implement the line laser focusing control method according to any one of claims 1 to 8.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the line laser focusing control method according to any one of claims 1 to 8.