Vehicle-mounted visual system optical lens focusing method and related device
By determining the low-texture focusing mode and combining it with vehicle motion state parameters to perform inverse motion compensation and generate a virtual edge guide map, the problem of unstable imaging quality in low-texture environments by traditional focusing methods is solved, achieving efficient and accurate autofocus and ensuring clear imaging.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGGUAN TSIMSAFE ELECTRONICS TECH
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-02
Smart Images

Figure CN122138049A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of optical lens focusing technology, in particular to a vehicle-mounted vision system optical lens focusing method and related device. BACKGROUND
[0002] In advanced driver assistance systems and autonomous driving systems, the front-view camera needs to continuously provide clear images under various road and lighting conditions to ensure the reliability of the perception algorithm, and automatic focusing as a key link to ensure imaging quality directly affects the robustness of the system. However, in low-texture scenes such as tunnels, night or facing large-area monochrome walls, traditional focusing methods are difficult to perform reliable sharpness evaluation due to the lack of effective edge information, resulting in the lens being unable to accurately focus and being difficult to maintain stable imaging quality. SUMMARY
[0003] The main purpose of the present application is to provide a vehicle-mounted vision system optical lens focusing method and related device, which aims to solve the problems raised in the above background.
[0004] In a first aspect, the present application provides a vehicle-mounted vision system optical lens focusing method, which comprises the following steps: determining whether to enter a low-texture focusing mode based on a current image frame collected by a front-view camera; if yes, obtaining a preset number of continuous image frames and vehicle motion state parameter information corresponding to each of the image frames; wherein the continuous image frames include the current image frame; based on the vehicle motion state parameter information corresponding to each image frame, performing inverse motion compensation on the continuous image frames to obtain a sequence of compensated image frames; generating a virtual edge guide map based on the sequence of compensated image frames, and focusing the optical lens based on the virtual edge guide map.
[0005] In a second aspect, the present application also provides a vehicle-mounted vision system optical lens focusing device, which comprises: a determination module for determining whether to enter a low-texture focusing mode based on a current image frame collected by a front-view camera; an obtaining module for obtaining a preset number of continuous image frames and vehicle motion state parameter information corresponding to each of the image frames when it is determined to enter the low-texture focusing mode; wherein the continuous image frames include the current image frame; a compensation processing module for performing inverse motion compensation on the continuous image frames based on the vehicle motion state parameter information corresponding to each image frame to obtain a sequence of compensated image frames; The focusing control module is used to generate a virtual edge guide map based on the compensated image frame sequence, and to focus the optical lens based on the virtual edge guide map.
[0006] Thirdly, this application also provides a terminal device, the terminal device including a processor, a memory and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the optical lens focusing method of the vehicle vision system as described in any of the preceding claims.
[0007] Fourthly, this application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the optical lens focusing method of the vehicle vision system as described in any of the preceding claims.
[0008] This application provides a focusing method and related apparatus for an optical lens in an in-vehicle vision system. The method determines whether to enter a low-texture focusing mode based on the current image frame captured by the forward-looking camera, and performs inverse motion compensation on continuous image frames in combination with vehicle motion state parameters. This effectively reduces image blurring caused by vehicle motion, ensuring stable and clear image data even in low-texture environments. Furthermore, a virtual edge guide map is generated based on the compensated image frame sequence, and the optical lens is focused according to the virtual edge guide map. This achieves efficient and accurate automatic focusing in low-texture environments, maintaining and improving the imaging quality of the in-vehicle vision system in low-texture environments. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments 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 based on these drawings without creative effort.
[0010] Figure 1 A flowchart illustrating a focusing method for an optical lens in a vehicle vision system, provided in an embodiment of this application; Figure 2 A schematic block diagram of the structure of an optical lens focusing device for an in-vehicle vision system provided in an embodiment of this application; Figure 3 This is a schematic block diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation
[0011] 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, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0012] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0013] This application provides a method and related apparatus for focusing an optical lens in a vehicle vision system.
[0014] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0015] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for focusing an optical lens in an in-vehicle vision system, provided as an embodiment of this application. This method can be used in a server, which can be a standalone server, a server cluster, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms.
[0016] like Figure 1 As shown, the focusing method of the optical lens of the vehicle vision system includes steps S1 to S4.
[0017] Step S1: Determine whether to enter low-texture focusing mode based on the current image frame captured by the front-view camera.
[0018] Specifically, during vehicle operation, the system acquires current image frames from the vehicle's forward-facing camera in real time, and determines whether to enter a low-texture focusing mode based on these frames. The forward-facing camera is the image acquisition device of the in-vehicle vision system, and it is located at the front of the vehicle.
[0019] In some embodiments, determining whether to enter low-texture focusing mode based on the current image frame captured by the front-view camera includes: Step S11: Calculate the gradient magnitude of each pixel in the current image frame.
[0020] Specifically, step S11 includes: Step S111: Perform grayscale processing on the current image frame to obtain the current grayscale image frame.
[0021] Step S112: Perform convolution operations on the current grayscale image frame in the horizontal and vertical directions using the Sobel operator to obtain the horizontal gradient component and vertical gradient component corresponding to each pixel of the current grayscale image frame.
[0022] Step S113: For each pixel of the current grayscale image frame, calculate the gradient magnitude corresponding to the pixel based on the horizontal gradient component and the vertical gradient component corresponding to the pixel.
[0023] Specifically, adopt Calculate the gradient magnitude corresponding to each pixel of the current grayscale image frame, where, The position in the current grayscale image frame is The gradient magnitude corresponding to the pixel. The position in the current grayscale image frame is The horizontal gradient components corresponding to the pixels, The position in the current grayscale image frame is The vertical gradient component corresponding to the pixel.
[0024] Step S12: Calculate the standard deviation between the magnitudes of each gradient.
[0025] Step S13: Determine the texture determination threshold based on the pixel brightness distribution of the current image frame.
[0026] The pixel brightness distribution of the current image frame refers to the grayscale value corresponding to each pixel of the current grayscale image frame.
[0027] Specifically, the average gray value among the gray values corresponding to each pixel of the current grayscale image frame is calculated, and the texture determination threshold corresponding to the average gray value is determined according to a preset empirical rule.
[0028] The empirical rules are derived from a large amount of experimental data and statistical analysis. Specifically, when the average gray value is <50, the corresponding texture judgment threshold is 0.12; when 50 ≤ average gray value <180, the corresponding texture judgment threshold is 0.18; and when the average gray value is greater than 180, the corresponding texture judgment threshold is 0.22.
[0029] Step S14: Determine whether the standard deviation is less than the texture determination threshold.
[0030] Step S15: If it is less than, determine to enter the low texture focusing mode.
[0031] Step S16: If it is not less than, determine that you will not enter the low texture focusing mode.
[0032] Understandably, the method provided in steps S11 to S16, on the one hand, quantifies the edge information in the image by calculating the gradient magnitude corresponding to each pixel, which helps to accurately assess the texture complexity of the current scene; on the other hand, by calculating the standard deviation of the gradient magnitude corresponding to each pixel and comparing it with a pre-set texture judgment threshold, it realizes intelligent analysis of the environment in front of the vehicle, so as to automatically trigger a more accurate focusing mode in low texture environment and maintain the imaging quality of the vehicle vision system.
[0033] Step S2: If yes, obtain a preset number of consecutive image frames and vehicle motion state parameter information corresponding to each image frame; wherein, the consecutive image frames include the current image frame.
[0034] The first image frame in the continuous image frames is the current image frame.
[0035] Specifically, after determining that the low-texture focusing mode has been entered, multiple consecutive image frames, including the current image frame, are acquired. For each image frame, its shooting time and the vehicle motion state parameters corresponding to the shooting time are recorded synchronously.
[0036] Step S3: Based on the vehicle motion state parameter information corresponding to each image frame, perform reverse motion compensation on the continuous image frames to obtain a compensated image frame sequence; The number of consecutive image frames is odd.
[0037] Specifically, the intermediate image frame of the consecutive image frames is determined as the reference image frame. For each non-reference image frame in the consecutive image frames, the non-reference image frame is mapped to the position corresponding to the reference image frame to obtain the compensation image frame corresponding to the non-reference image frame. The compensation image frames and the reference image frame are arranged in sequence to obtain the compensation image frame sequence.
[0038] In some embodiments, the step of performing inverse motion compensation on the consecutive image frames based on the vehicle motion state parameter information corresponding to each image frame to obtain a compensated image frame sequence includes: Step S31: Determine the intermediate image frame of the continuous image frames as the reference image frame.
[0039] Step S32: For each non-reference image frame in the continuous image frames, construct the homography matrix corresponding to the non-reference image frame based on the vehicle motion state parameter information corresponding to the non-reference image frame, the inter-frame time difference between the non-reference image frame and the reference image frame, and the intrinsic parameter matrix of the forward-looking camera.
[0040] The motion state parameter information includes pitch angle. Longitudinal velocity yaw rate Pitch angle The tilt angle of the vehicle body relative to the horizontal plane, and its longitudinal velocity. The instantaneous velocity of a vehicle along its direction of travel; yaw rate. The pitch angle refers to the angular velocity of a vehicle's rotation about its vertical axis (Z-axis). Measured by an inertial measurement unit installed on the vehicle; longitudinal velocity Yaw rate is indirectly calculated using wheel speed sensors or a GPS module. Measured by an inertial measurement unit installed on the vehicle.
[0041] Understandably, the method provided in steps S31 to S32, by selecting an intermediate image frame as a reference image frame from an odd number of consecutive image frames, makes the remaining non-reference image frames symmetrically distributed before and after the reference image frame in time, which helps to minimize the cumulative error of homography modeling caused by the non-uniform motion of the vehicle.
[0042] In some embodiments, step S32 includes: Step S321: Calculate the vertical distance from the lens of the front-view camera to the ground based on the installation height and installation pitch angle of the front-view camera and the pitch angle corresponding to the non-reference image frame.
[0043] Specifically, through Calculate the vertical distance from the lens of the forward-facing camera to the ground, where, The vertical distance is... The installation height of the front-view camera. The installation pitch angle of the front-view camera is [insert angle here]. The pitch angle is the angle corresponding to the non-reference image frame.
[0044] Step S322: Based on the longitudinal velocity and yaw rate corresponding to the non-reference image frame and the inter-frame time difference between the non-reference image frame and the reference image frame, determine the three-dimensional displacement vector and planar rotation angle of the non-reference image frame relative to the reference image frame.
[0045] Specifically, the three-dimensional displacement vector is The plane rotation angle is ,in, The time difference between the non-reference image frame and the reference image frame is denoted as .
[0046] Step S323: Based on the intrinsic parameter matrix, the vertical distance, the three-dimensional displacement vector, the plane rotation angle, and the ground normal vector, construct the homography matrix corresponding to the non-reference image frame.
[0047] Specifically, through Construct the homography matrix corresponding to the non-reference image frame; wherein, Let be the homography matrix. = Let be the intrinsic parameter matrix. for Focal length of direction, for Focal length of direction, Let x be the x-coordinate of the intersection of the optical axis and the image plane in the image coordinate system. This represents the ordinate of the intersection point of the optical axis and the image plane in the image coordinate system. For relative rotation matrices, This is the ground normal vector.
[0048] Understandably, the method provided in steps S321 to S323 can accurately locate the positional change of each non-reference image frame relative to the reference image frame, which helps to improve the accuracy of inverse motion compensation and ensure the quality of image compensation.
[0049] Step S33: For each non-reference image frame in the continuous image frames, map the pixel coordinates of each non-reference image frame to the corresponding position of the reference image frame based on the homography matrix corresponding to the non-reference image frame, obtain the pixel coordinate distribution information of the non-reference image frame relative to the reference image frame, and use the bilinear interpolation method to determine the pixel value corresponding to each pixel in the pixel coordinate distribution information, and obtain the compensation image frame corresponding to the non-reference image frame.
[0050] The pixel value refers to the grayscale value.
[0051] Specifically, for each pixel of the non-reference image frame , build Corresponding homogeneous coordinates and through Calculate pixels The homogeneous coordinates corresponding to the inverse homography transformation are then the pixel coordinates. The corresponding position coordinates in the reference image frame are ,because Typically, the values are decimals, while the non-reference image frames only define grayscale values at integer coordinates. If directly... After rounding, the grayscale value distribution information corresponding to the non-reference image frame is determined. The corresponding grayscale values can lead to defects such as jagged edges, high-frequency aliasing, and image blurring, thereby reducing the compensation quality. Therefore, this invention uses the bilinear interpolation method to calculate... The corresponding grayscale value, specifically, for The coordinate values in the table are rounded down to the nearest integer. , ,make , Four gray values are extracted from the gray value distribution information corresponding to the non-reference image frame, namely: , , , Calculate the weighting coefficients , ,pass Calculate pixels The corresponding grayscale value.
[0052] Step S34: Based on the sequence of image frames corresponding to each of the compensated image frames in the continuous image frames and the sequence of image frames corresponding to the reference image frame in the continuous image frames, arrange each of the compensated image frames and the reference image frames in sequence to obtain the compensated image frame sequence.
[0053] Step S4: Generate a virtual edge guide map based on the compensated image frame sequence, and focus the optical lens based on the virtual edge guide map.
[0054] Specifically, each compensated image frame in the compensated image frame sequence is compared with a reference image frame for difference analysis, and a virtual edge guide map is generated based on the results of each difference analysis. The position of the optical lens is adjusted according to the virtual edge guide map so that the optical lens focuses on the focal point that yields the best image quality.
[0055] In some embodiments, generating a virtual edge guidance map based on the compensated image frame sequence includes: Step S411: For each compensation image frame in the compensation image frame sequence, perform pixel-by-pixel absolute difference calculation processing between the compensation image frame and the reference image frame to obtain the difference image corresponding to the compensation image frame.
[0056] Specifically, the step of performing pixel-by-pixel absolute difference calculation on the compensated image frame and the reference image frame refers to calculating the absolute value of the difference between the grayscale values of the pixels corresponding to the same position in the compensated image frame and the reference image frame.
[0057] Step S412: Perform pixel-by-pixel maximum value fusion processing on each of the difference images to obtain the difference enhancement image.
[0058] Specifically, for the same pixel location, the maximum gray value among the gray values corresponding to the pixel location in each difference image is retained to generate the difference enhancement image.
[0059] Step S413: Perform pixel-by-pixel weighted fusion processing on the difference enhancement image and the reference image frame to obtain the virtual edge guidance map.
[0060] Specifically, for the same pixel location, a grayscale weighted fusion process is performed on the grayscale value corresponding to the pixel location in the difference enhancement image and the grayscale value corresponding to the pixel location in the reference image frame to generate the virtual edge guidance map.
[0061] Understandably, the method provided in steps S411 to S413, on the one hand, effectively identifies and quantifies the degree of spatial change of each compensated image frame relative to the reference image frame by performing pixel-by-pixel absolute difference calculation on each compensated image frame in the compensated image frame sequence and the reference image frame. This helps to highlight scene changes in the moving area and provides an effective data basis for subsequent operations. On the other hand, by performing pixel-by-pixel maximum value fusion processing on all obtained difference images, the expressiveness of significantly changed areas in the image is enhanced, ensuring that even small dynamic changes can be accurately captured and reflected in the final difference enhancement image, which helps to improve the quality of the virtual edge guide map. Furthermore, by performing pixel-by-pixel weighted fusion processing on the difference enhancement image and the reference image frame, a virtual edge guide map that comprehensively considers static structural information (provided by the reference image frame) and dynamic change information (reflected by the difference enhancement image) is created, improving the robustness of the virtual edge guide map.
[0062] In some embodiments, focusing the optical lens based on the virtual edge guide map includes: Step S421: The Sobel operator is used to perform convolution operations on the virtual edge guide map in the horizontal and vertical directions to obtain the horizontal gradient component and vertical gradient component corresponding to each pixel of the virtual edge guide map.
[0063] Step S422: For each pixel of the virtual edge guide map, calculate the square of the gradient magnitude corresponding to the pixel based on the horizontal gradient component and the vertical gradient component corresponding to the pixel.
[0064] Specifically, for each pixel of the virtual edge guide map, the square of the horizontal gradient component corresponding to the pixel is added to the square of the vertical gradient component corresponding to the pixel to obtain the square of the gradient magnitude corresponding to the pixel.
[0065] Step S423: Sum the squared gradient magnitudes of each pixel in the virtual edge guide map to obtain the first focus evaluation function value.
[0066] Step S424: Control the optical lens to move along a certain direction with a preset step size, and calculate the 1+i focus evaluation function value corresponding to each movement. When the 1+i focus evaluation function value is less than the i-th focus evaluation function value, control the optical lens to move in the opposite direction with a preset step size. When the 1+in focus evaluation function value is less than the 2+in focus evaluation function value, drive the optical lens to move to the position corresponding to the 2+in focus evaluation function value; where i and n are both integers not less than 1.
[0067] It should be noted that the calculation method for each focus evaluation function value involved in step S424 adopts the calculation method for the first focus evaluation function value described above, and will not be repeated here.
[0068] Understandably, the method provided in steps S421 to S424 controls the optical lens to move in a preset step size and dynamically adjusts the direction and position of the lens according to the change in the focus evaluation function value after two consecutive moves. This achieves fine adjustment of the lens until the optimal focus position is found. This method can not only quickly narrow the search range and improve focusing efficiency, but also make more precise adjustments when close to the optimal solution, ensuring that the final image quality reaches the best state.
[0069] The method provided in this embodiment determines whether to enter the low-texture focusing mode based on the current image frame captured by the forward-looking camera, and performs inverse motion compensation on the continuous image frames in combination with vehicle motion state parameters. This effectively reduces the image blurring problem caused by vehicle motion, ensuring that stable and clear image data can be obtained even in low-texture environments. Furthermore, a virtual edge guide map is generated based on the compensated image frame sequence, and the optical lens is focused according to the virtual edge guide map. This achieves efficient and accurate automatic focusing in low-texture environments, maintaining and improving the imaging quality of the vehicle vision system in low-texture environments.
[0070] Please see Figure 2 , Figure 2 This is a schematic diagram of the structure of an optical lens focusing device for an in-vehicle vision system provided in one embodiment of this application. Figure 2 As shown, the optical lens focusing device 100 of the vehicle vision system includes: The judgment module 110 is used to determine whether to enter the low texture focusing mode based on the current image frame captured by the front-view camera.
[0071] The acquisition module 120 is used to acquire a preset number of consecutive image frames and vehicle motion state parameter information corresponding to each image frame when it is determined that the low texture focusing mode has been entered; wherein, the consecutive image frames include the current image frame.
[0072] The compensation processing module 130 is used to perform reverse motion compensation on the continuous image frames based on the vehicle motion state parameter information corresponding to each image frame, so as to obtain a compensated image frame sequence.
[0073] The focusing control module 140 is used to generate a virtual edge guide map based on the compensated image frame sequence, and to focus the optical lens based on the virtual edge guide map.
[0074] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the device and each module described above can be referred to the corresponding process in the aforementioned embodiment of the optical lens focusing method for vehicle vision systems, and will not be repeated here.
[0075] The vehicle vision system optical lens focusing device 100 provided in the above embodiments can be implemented as a computer program, which can be used in, for example... Figure 3 The terminal device 200 shown is running on it.
[0076] Please see Figure 3 , Figure 3 The following is a schematic block diagram of the structure of a terminal device 200 provided in an embodiment of this application. The terminal device 200 includes a processor 201 and a memory 202, which are connected through a system bus 203. The memory 202 may include a non-volatile storage medium and internal memory.
[0077] The non-volatile storage medium can store a computer program. The computer program includes program instructions that, when executed by the processor 201, cause the processor 201 to perform any of the above-described optical lens focusing methods for an in-vehicle vision system.
[0078] The processor 201 provides computing and control capabilities to support the operation of the entire terminal device 200.
[0079] The internal memory provides an environment for the execution of computer programs in non-volatile storage media. When the computer program is executed by the processor 201, the processor 201 can execute any of the above-mentioned optical lens focusing methods for vehicle vision systems.
[0080] Those skilled in the art will understand that Figure 3The structure shown in the figure is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the terminal device 200 involved in the present application. The specific terminal device 200 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0081] It should be understood that processor 201 can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, the general-purpose processor can be a microprocessor or any conventional processor.
[0082] In some embodiments, the processor 201 is configured to run a computer program stored in memory to perform the following steps: Determine whether to enter low-texture focus mode based on the current image frame captured by the front-view camera; If so, acquire a preset number of consecutive image frames and vehicle motion state parameter information corresponding to each image frame; wherein, the consecutive image frames include the current image frame; Based on the vehicle motion state parameter information corresponding to each image frame, inverse motion compensation is performed on the continuous image frames to obtain a compensated image frame sequence. A virtual edge guide map is generated based on the compensated image frame sequence, and the optical lens is focused based on the virtual edge guide map.
[0083] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the terminal device 200 described above can be referred to the corresponding process of the aforementioned focusing method for the optical lens of the vehicle vision system, and will not be repeated here.
[0084] This application also provides a computer-readable storage medium storing a computer program that, when executed by one or more processors, causes the one or more processors to implement the optical lens focusing method for an in-vehicle vision system as provided in this application.
[0085] The computer-readable storage medium can be an internal storage unit of the terminal device 200 in the aforementioned embodiments, such as a hard disk or memory of the terminal device 200. The computer-readable storage medium can also be an external storage device of the terminal device 200, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided with the terminal device 200.
[0086] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0087] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. It should be noted that, herein, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0088] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. The above descriptions are merely specific implementations of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered 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 focusing method for an optical lens in a vehicle-mounted vision system, characterized in that, include: Determine whether to enter low-texture focus mode based on the current image frame captured by the front-view camera; If so, acquire a preset number of consecutive image frames and vehicle motion state parameter information corresponding to each image frame; wherein, the consecutive image frames include the current image frame; Based on the vehicle motion state parameter information corresponding to each image frame, inverse motion compensation is performed on the continuous image frames to obtain a compensated image frame sequence. A virtual edge guide map is generated based on the compensated image frame sequence, and the optical lens is focused based on the virtual edge guide map.
2. The focusing method for the optical lens of the vehicle-mounted vision system according to claim 1, characterized in that, The step of determining whether to enter low-texture focusing mode based on the current image frame captured by the front-view camera includes: Calculate the gradient magnitude for each pixel in the current image frame; Calculate the standard deviation between the magnitudes of each gradient; The texture determination threshold is determined based on the pixel brightness distribution of the current image frame; Determine whether the standard deviation is less than the texture determination threshold; If it is less than 1, it is determined that the low texture focusing mode is entered; If it is not less than, it is determined that the low texture focus mode will not be entered.
3. The focusing method for the optical lens of the vehicle-mounted vision system according to claim 2, characterized in that, The step of calculating the gradient magnitude corresponding to each pixel of the current image frame includes: Perform grayscale processing on the current image frame to obtain the current grayscale image frame; The Sobel operator is used to perform convolution operations on the current grayscale image frame in the horizontal and vertical directions to obtain the horizontal gradient component and vertical gradient component corresponding to each pixel of the current grayscale image frame. For each pixel in the current grayscale image frame, the gradient magnitude of the pixel is calculated based on the horizontal and vertical gradient components corresponding to the pixel.
4. The focusing method for the optical lens of the vehicle-mounted vision system according to claim 1, characterized in that, The number of image frames in the continuous image frames is odd. The process of performing inverse motion compensation on the continuous image frames based on the vehicle motion state parameter information corresponding to each image frame to obtain a compensated image frame sequence includes: The intermediate image frame of the consecutive image frames is determined as the reference image frame; For each non-reference image frame in the continuous image frames, a homography matrix corresponding to the non-reference image frame is constructed based on the vehicle motion state parameter information corresponding to the non-reference image frame, the inter-frame time difference between the non-reference image frame and the reference image frame, and the intrinsic parameter matrix of the forward-looking camera. For each non-reference image frame in the continuous image frames, the pixel coordinates of each non-reference image frame are mapped to the corresponding position of the reference image frame based on the homography matrix corresponding to the non-reference image frame, so as to obtain the pixel coordinate distribution information of the non-reference image frame relative to the reference image frame. Then, the pixel value corresponding to each pixel in the pixel coordinate distribution information is determined by the bilinear interpolation method, so as to obtain the compensation image frame corresponding to the non-reference image frame. Based on the sequence of image frames corresponding to each of the compensated image frames in the continuous image frames and the sequence of image frames corresponding to the reference image frame in the continuous image frames, the compensated image frames and the reference image frames are arranged in sequence to obtain the compensated image frame sequence.
5. The focusing method for the optical lens of the vehicle-mounted vision system according to claim 4, characterized in that, The vehicle motion state parameter information includes pitch angle, longitudinal velocity, and yaw rate. The construction of the homography matrix corresponding to the non-reference image frame based on the vehicle motion state parameter information corresponding to the non-reference image frame, the inter-frame time difference between the non-reference image frame and the reference image frame, and the intrinsic parameter matrix of the forward-looking camera includes: The vertical distance from the lens of the front-view camera to the ground is calculated based on the installation height and installation pitch angle of the front-view camera and the pitch angle corresponding to the non-reference image frame. Based on the longitudinal velocity and yaw rate corresponding to the non-reference image frame, and the inter-frame time difference between the non-reference image frame and the reference image frame, determine the three-dimensional displacement vector and planar rotation angle of the non-reference image frame relative to the reference image frame; Based on the intrinsic parameter matrix, the vertical distance, the three-dimensional displacement vector, the planar rotation angle, and the ground normal vector, the homography matrix corresponding to the non-reference image frame is constructed.
6. The focusing method for the optical lens of the vehicle-mounted vision system according to claim 4, characterized in that, The generation of the virtual edge guidance map based on the compensated image frame sequence includes: For each compensation image frame in the compensation image frame sequence, a pixel-by-pixel absolute difference calculation is performed between the compensation image frame and the reference image frame to obtain the difference image corresponding to the compensation image frame. The pixel-wise maximum value fusion process is performed on each of the difference images to obtain the difference-enhanced image; The difference enhancement image and the reference image frame are subjected to pixel-by-pixel weighted fusion processing to obtain the virtual edge guidance map.
7. The focusing method for an optical lens in a vehicle-mounted vision system according to claim 6, characterized in that, The focusing of the optical lens based on the virtual edge guide map includes: The Sobel operator is used to perform convolution operations on the virtual edge guide map in the horizontal and vertical directions to obtain the horizontal gradient components and vertical gradient components corresponding to each pixel of the virtual edge guide map. For each pixel in the virtual edge guide map, the square of the gradient magnitude corresponding to the pixel is calculated based on the horizontal gradient component and the vertical gradient component corresponding to the pixel; The first focusing evaluation function value is obtained by summing the squared gradient magnitudes of each pixel in the virtual edge guidance map. The optical lens is controlled to move along a certain direction with a preset step size, and the 1+i-th focusing evaluation function value corresponding to each movement is calculated. When the 1+i-th focusing evaluation function value is less than the i-th focusing evaluation function value, the optical lens is controlled to move in the opposite direction with a preset step size. When the 1+in-th focusing evaluation function value is less than the 2+in-th focusing evaluation function value, the optical lens is driven to move to the position corresponding to the 2+in-th focusing evaluation function value. Here, i and n are both integers not less than 1.
8. A focusing device for an optical lens of a vehicle-mounted vision system, characterized in that, include: The judgment module is used to determine whether to enter the low-texture focusing mode based on the current image frame captured by the front-view camera; The acquisition module is used to acquire a preset number of consecutive image frames and vehicle motion state parameter information corresponding to each image frame when the low texture focusing mode is entered; wherein, the consecutive image frames include the current image frame; The compensation processing module is used to perform inverse motion compensation on the continuous image frames based on the vehicle motion state parameter information corresponding to each image frame, so as to obtain a compensated image frame sequence. The focusing control module is used to generate a virtual edge guide map based on the compensated image frame sequence, and to focus the optical lens based on the virtual edge guide map.
9. A terminal device, characterized in that, The terminal device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the optical lens focusing method of the vehicle vision system as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the focusing method of the optical lens of the vehicle vision system as described in any one of claims 1 to 7.