Camera shooting automatic focusing method and system based on machine learning algorithm
By applying machine learning algorithms in camera equipment, combining convolutional neural networks, long-term memory networks and deep reinforcement learning models, the autofocus function is optimized, and the problem of traditional autofocus technology performing poorly in complex scenarios is solved, and high-quality image autofocus effect is achieved.
Patent Information
- Application Number
- CN202411891092.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-11
AI Technical Summary
Traditional autofocus technology performs poorly in complex scenarios, making it difficult to meet users' needs for improving image quality.
The automatic focus method of camera shooting is adopted based on machine learning algorithms. By preprocessing and feature extraction of the original image data acquired in real time, the spatial features, dynamic motion characteristics and optimal focal length adjustment strategies of the image are extracted using convolutional neural network, long and short-term memory network and deep reinforcement learning model, and the automatic focus setting parameters are synthesized to optimize the automatic focus function of the camera device.
In complex scenarios, the image clarity is significantly improved, the operational interference is reduced, and the application range is wide. It is suitable for smartphones, professional cameras and surveillance camera equipment, significantly improving the user experience.
Smart Images

Figure CN119603554A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of machine learning algorithms and digital image processing, and in particular to a camera automatic focusing method and system based on a machine learning algorithm. Background Art
[0002] With the popularization and development of imaging equipment, users have higher and higher requirements for the quality of captured images. Traditional autofocus technology mainly relies on image sensors and reflector components. Compared with professional camera operators, these methods often do not perform well in autofocus in complex scenes (such as low-light environments, multi-object scenes, or motion scenes). With the advancement of machine learning algorithm technology, especially in the field of image processing technology, it has shown significant advantages. Due to the improvement of the computing power and image processing capabilities of camera terminal hardware equipment, how to effectively combine machine learning algorithms with the focusing technology of camera equipment is a major direction of camera equipment research and development at this stage. Summary of the invention
[0003] The technical problem to be solved by this application is how to apply machine learning algorithms to optimize the automatic focusing function of a camera device.
[0004] According to the first aspect, an embodiment provides a method for automatic focusing of a camera based on a machine learning algorithm, comprising: Preprocessing at least N pieces of original image data marked with time node information acquired in real time to obtain a standard focus image sequence, wherein N is a natural number not less than 1; Performing image feature extraction on the standard focus image sequence to obtain first-category image features, second-category image features and third-category image features; the first-category image features include edges, textures and / or object shapes of each image element in the standard focus image sequence; the second-category image features include target object motion trajectories and / or optimal focal lengths of target objects of each image element in the standard focus image sequence; the third-category image features include optimal image clarity values of target objects in each image element in the standard focus image sequence; Inputting the first type of image features into a preset convolutional neural network mathematical model to obtain a first focusing parameter output by the convolutional neural network mathematical model; inputting the second type of image features into a preset long short-term memory network mathematical model to obtain a second focusing parameter output by the long short-term memory network mathematical model; inputting the third type of image features into a preset deep reinforcement learning mathematical model to obtain a third focusing parameter output by the deep reinforcement learning mathematical model; Automatic focus setting parameters are acquired according to the first focus parameter, the second focus parameter, and the third focus parameter, and automatic focus is performed on the camera device that acquires the original image data according to the automatic focus setting parameters.
[0005] In one embodiment, the acquiring of automatic focus setting parameters according to the first focus parameter, the second focus parameter and the third focus parameter includes: The parameter types of the first focus parameter, the second focus parameter, the third focus parameter and the automatic focus setting parameter include an exposure factor, an aperture factor, a shutter speed factor and / or a noise control factor; respectively presetting a weight value of each parameter type in the first focusing parameter, the second focusing parameter, and the third focusing parameter; The parameter value of each parameter type of the automatic focus setting parameters is the sum of the products of the coefficients of the corresponding parameter types in the first focus parameter, the second focus parameter and the third focus parameter and their respective weight values.
[0006] In one embodiment, the obtaining of automatic focus setting parameters according to the first focus parameter, the second focus parameter and the third focus parameter further includes: The weight values of each parameter type in the first focusing parameter, the second focusing parameter and the third focusing parameter preset respectively are different for different types of camera scenes; the types of camera scenes include static scenes, dynamic scenes, special light source scenes and / or multi-focus object scenes.
[0007] In one embodiment, the preprocessing of at least N frames of raw image data marked with time node information acquired in real time to obtain a standard focus image sequence includes: Each piece of the original image data is subjected to denoising and / or enhancement processing to obtain an image element in the standard focus image sequence; the denoising processing is used to remove noise points generated during the acquisition process of the original image data, and the enhancement processing is used to apply data enhancement technology to flip, crop, scale and / or adjust the illumination of the region of interest in the original image data.
[0008] In one embodiment, the step of automatically focusing the camera device that acquires the original image data according to the automatic focusing setting parameters includes: Taking the difference between the current focus parameter of the camera device and the automatic focus setting parameter to obtain a focus parameter difference; Obtaining a minimum parameter adjustment step size according to a minimum parameter adjustment value of the camera device and a focus parameter difference; The current focusing parameters of the camera device are adjusted according to the minimum parameter adjustment step; and the original image data is re-collected after each adjustment to complete the automatic focusing process of the camera device through iterative optimization.
[0009] In one embodiment, the convolutional neural network mathematical model is used to extract the spatial features of each image element in the standard focus image sequence, and obtain the first focusing parameter based on the spatial features; the long short-term memory network mathematical model is used to extract the dynamic movement trend features of the target object in the standard focus image sequence, and obtain the second focusing parameter based on the dynamic movement trend features; the deep reinforcement learning mathematical model is used to extract the optimal focal length adjustment strategy for each image element in the standard focus image sequence, and obtain the third focusing parameter based on the optimal focal length adjustment strategy.
[0010] In one embodiment, the automatic focusing method for video recording further includes: Applying a preset convolutional neural network to extract image features from each image element in the standard focus image sequence to obtain a fourth type of image features; Inputting the fourth type of image features into a preset long short-term memory network to obtain the focus parameters of the target object in the standard focus image sequence; the focus parameters of the target object include the motion trajectory of the target object and the optimal focal length of the target object in the standard focus image sequence; Inputting the target object focusing parameter into a preset deep reinforcement learning network to obtain a fourth focusing parameter; Then, automatic focusing setting parameters are obtained according to the first focusing parameter, the second focusing parameter, the third focusing parameter and the fourth focusing parameter.
[0011] In one embodiment, the acquiring of automatic focus setting parameters according to the first focus parameter, the second focus parameter, the third focus parameter and the fourth focus parameter comprises: The parameter value of the automatic focus setting parameter is the sum of the products of the coefficient values of the first focus parameter, the second focus parameter, the third focus parameter, and the fourth focus parameter and their respective weight values.
[0012] According to the second aspect, an embodiment provides a computer-readable storage medium, on which a program is stored. The program can be executed by a processor to implement the automatic focusing method for video recording as described in the first aspect.
[0013] According to the third aspect, an embodiment provides a camera automatic focusing system based on a machine learning algorithm, which is used to apply the camera automatic focusing method as described in the first aspect, and the camera automatic focusing system includes: A preprocessing unit, used to preprocess at least N pieces of original image data marked with time node information acquired in real time to obtain a standard focus image sequence, wherein N is a natural number not less than 1; a feature extraction unit, configured to extract image features from the standard focus image sequence to obtain first-category image features, second-category image features, and third-category image features; the first-category image features include edges, textures, and / or object shapes of each of the image elements in the standard focus image sequence; the second-category image features include target object motion trajectories and / or optimal focal lengths of the target objects of each of the image elements in the standard focus image sequence; and the third-category image features include optimal image clarity values of the target objects in each of the image elements in the standard focus image sequence; A first mathematical model unit, used for inputting the first type of image features into a preset convolutional neural network mathematical model to obtain a first focusing parameter output by the convolutional neural network mathematical model; A second mathematical model unit, used for inputting the second type of image features into a preset long short-term memory network mathematical model to obtain a second focusing parameter output by the long short-term memory network mathematical model; A third mathematical model unit, used for inputting the third type of image features into a preset deep reinforcement learning mathematical model to obtain a third focusing parameter output by the deep reinforcement learning mathematical model; A parameter adjustment unit is used to obtain automatic focus setting parameters according to the first focus parameter, the second focus parameter and the third focus parameter, and automatically focus the camera device that obtains the original image data according to the automatic focus setting parameters.
[0014] According to the automatic focusing method for video recording in the above-mentioned embodiment, since convolutional neural networks, long short-term memory networks and deep reinforcement learning are jointly applied to the automatic focusing technology, the automatic focusing function is optimized while reducing the operation of the video recording device, thereby greatly improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A schematic diagram of a process flow of an automatic focusing method for video recording in an embodiment; Figure 2 The structure block diagram of the automatic focusing system of a camera in an embodiment is shown in FIG. DETAILED DESCRIPTION
[0016] The present invention is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are for making the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different situations, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification, this is to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations according to the description in the specification and the general technical knowledge in the art.
[0017] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0018] The serial numbers assigned to the components herein, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0019] Autofocus (AF) technology is one of the core technologies in various cameras. How to quickly and accurately achieve autofocus is of great significance to various cameras. Existing autofocus methods based on digital image processing can be divided into focus depth method and defocus depth method. The focus depth method obtains a series of images with different sharpness during the focusing process, calculates the sharpness evaluation value with the focus evaluation function, and then controls the stepper motor to drive the lens to move with the focus search strategy until the lens reaches the quasi-focus position. This method has a simple system structure, low cost, accurate focusing results, and fast focusing speed, and has become the mainstream method in the field of autofocus. However, this method often requires manual design of focus search strategies. Commonly used strategies include hill climbing search strategy, Fibonacci search strategy, golden section search strategy, etc. The focusing accuracy and speed of these existing search strategies are greatly affected by artificial experience parameters, which reduces the robustness of the algorithm. Therefore, it is necessary to explore new autofocus methods, which only require the interaction between the camera and the environment to autonomously learn the optimal autofocus search strategy.
[0020] In the embodiments of the present application, a machine learning algorithm is introduced into the automatic focusing function of the camera to solve the shortcomings of traditional autofocus technology in complex scenes. Due to the technical advantages of the machine learning algorithm in image data processing, it can achieve dynamic response to complex shooting scenes and improve image clarity. It can also reduce operational interference by pre-setting personalized focusing strategies. It has a wide range of applications (covering smartphones, professional cameras and surveillance cameras), thereby greatly improving the user experience.
[0021] Embodiment 1: Please refer to Figure 1 , is a flow chart of a method for automatic focusing of a camera in an embodiment, which realizes the automatic focusing function of a camera based on a machine learning algorithm, and specifically includes: Step 101: pre-process the image data.
[0022] At least N pieces of raw image data with time node information obtained in real time are preprocessed to obtain a standard focus image sequence, where N is a natural number not less than 1. In one embodiment, the image data is preprocessed to perform denoising and / or enhancement processing on each piece of raw image data to obtain an image element in the standard focus image sequence. The denoising processing is used to remove noise generated during the acquisition of the raw image data, and the enhancement processing is used to apply data enhancement technology to flip, crop, scale and / or adjust the illumination of the region of interest in the raw image data.
[0023] Step 102: extract image features.
[0024] Image feature extraction is performed on the standard focus image sequence to obtain first-category image features, second-category image features, and third-category image features. The first-category image features include the edge, texture, and / or object shape of each image element in the standard focus image sequence, the second-category image features include the target object motion trajectory and / or the target object optimal focal length of each image element in the standard focus image sequence, and the third-category image features include the optimal image clarity value of each image element in the standard focus image sequence.
[0025] Step 103, obtaining the focusing parameters output by the mathematical model.
[0026] The first type of image features are input into a preset convolutional neural network mathematical model to obtain a first focusing parameter output by the convolutional neural network mathematical model. The second type of image features are input into a preset long short-term memory network mathematical model to obtain a second focusing parameter output by the long short-term memory network mathematical model. The third type of image features are input into a preset deep reinforcement learning mathematical model to obtain a third focusing parameter output by the deep reinforcement learning mathematical model. The convolutional neural network (CNN) mathematical model has a good processing effect in image processing tasks such as image classification, target detection and image segmentation. The convolutional neural network mathematical model is used to extract the spatial features of each image element in the standard focus image sequence, and obtain the first focusing parameter based on the spatial features. The long short-term memory network (LSTM) mathematical model can capture the temporal dynamics between video frames and understand the temporal relationship in the image sequence, thereby improving the accuracy of image processing. The long short-term memory network mathematical model is used to extract the dynamic movement trend features of the target object in the standard focus image sequence, and obtain the second focusing parameter based on the dynamic movement trend features. The deep reinforcement learning network (DRL) has strong robustness and can adapt to various complex scenes and interference factors, thereby improving the stability and reliability of image processing. It can adaptively adjust decisions according to environmental changes. The deep reinforcement learning mathematical model is used to extract the optimal focal length adjustment strategy for each image element in the standard focus image sequence, and obtain the third focusing parameter based on the optimal focal length adjustment strategy.
[0027] Step 104, obtaining automatic focus setting parameters.
[0028] The automatic focus setting parameter is obtained according to the first focus parameter, the second focus parameter and the third focus parameter, and the camera device that obtains the original image data is automatically focused according to the automatic focus setting parameter. The parameter types of the first focus parameter, the second focus parameter, the third focus parameter and the automatic focus setting parameter include an exposure factor, an aperture factor, a shutter speed factor and / or a noise control factor.
[0029] In one embodiment, obtaining the automatic focus setting parameters includes: The weight value of each parameter type in the first focus parameter, the second focus parameter and the third focus parameter is preset respectively, and the parameter value of each parameter type of the automatic focus setting parameter is the sum of the product of the coefficient of the corresponding parameter type in the first focus parameter, the second focus parameter and the third focus parameter and the respective weight value. For example, the first focus parameter is set to X, and its weight value is a; the second focus parameter is set to Y, and its weight value is b; the third focus parameter is set to Z, and its weight value is c, then the automatic focus setting parameter P is: P=a*X+b*Y+c*Z.
[0030] In one embodiment, the weight values of each parameter type in the first focusing parameter, the second focusing parameter and the third focusing parameter are preset differently for different types of camera scenes. The types of camera scenes include static scenes, dynamic scenes, special light source scenes and / or multi-focus object scenes.
[0031] In one embodiment, the process of automatic focusing of the camera device includes: First, the difference between the current focus parameter of the camera device and the automatic focus setting parameter is taken to obtain the focus parameter difference; Then, the minimum parameter adjustment step length is obtained according to the minimum parameter adjustment value of the camera device and the focus parameter difference; Finally, the current focusing parameters of the camera device are adjusted according to the minimum step size of the parameter adjustment, and the original image data is recaptured after each adjustment to complete the automatic focusing process of the camera device through iterative optimization.
[0032] In one embodiment, the automatic focusing method for video recording further includes: Step 105: Obtain a fourth focusing parameter.
[0033] First, a preset convolutional neural network is applied to extract image features from each image element in the standard focus image sequence to obtain the fourth type of image features.
[0034] Then, the fourth type of image features is input into a preset long short-term memory network to obtain the focus parameters of the target object in the standard focus image sequence, wherein the focus parameters of the target object include the motion trajectory of the target object and the optimal focal length of the target object in the standard focus image sequence.
[0035] Then, the target object focusing parameter is input into a preset deep reinforcement learning network to obtain a fourth focusing parameter.
[0036] Step 106: fine-tune and obtain the automatic focus setting parameters.
[0037] The automatic focus setting parameter is obtained according to the first focus parameter, the second focus parameter, the third focus parameter and the fourth focus parameter, that is, the sum of the products of the coefficient values of the first focus parameter, the second focus parameter, the third focus parameter and the fourth focus parameter and their respective weight values is used as the parameter value of the automatic focus setting parameter.
[0038] Please refer to Figure 2, is a structural block diagram of a camera automatic focusing system in an embodiment. In one embodiment of the present application, a camera automatic focusing system is also disclosed for applying the camera automatic focusing method as described above, specifically comprising a preprocessing unit 10, a feature extraction unit 20, a first mathematical model unit 30, a second mathematical model unit 40, a third mathematical model unit 50 and a parameter adjustment unit 60. The preprocessing unit 10 is used to preprocess at least N original image data marked with time node information acquired in real time by a camera device to obtain a standard focus image sequence, wherein N is a natural number not less than 1. The feature extraction unit 20 is used to extract image features from the standard focus image sequence to obtain a first type of image features, a second type of image features and a third type of image features. The first mathematical model unit 30 is used to input the first type of image features into a preset convolutional neural network mathematical model to obtain a first focusing parameter output by the convolutional neural network mathematical model. The first type of image features include the edge, texture and / or object shape of each image element in the standard focus image sequence. The second mathematical model unit 40 is used to input the second type of image features into a preset long short-term memory network mathematical model to obtain the second focusing parameter output by the long short-term memory network mathematical model. The second type of image features includes the target object motion trajectory and / or the target object optimal focal length of each image element in the standard focus image sequence. The third mathematical model unit 50 is used to input the third type of image features into a preset deep reinforcement learning mathematical model to obtain the third focusing parameter output by the deep reinforcement learning mathematical model. The third type of image features includes the optimal value of image clarity for each image element in the standard focus image sequence. The parameter adjustment unit 60 is used to obtain the automatic focus setting parameters based on the first focusing parameter, the second focusing parameter and the third focusing parameter, and automatically focus the camera device that obtains the original image data based on the automatic focus setting parameters.
[0039] The camera auto-focus method disclosed in the embodiment of the present application first pre-processes a plurality of raw image data with time node information obtained in real time to obtain a standard focus image sequence; then extracts image features from the standard focus image sequence to obtain first, second and third image features; then inputs the first, second and third image features into a preset convolutional neural network mathematical model, a long short-term memory network mathematical model and a deep reinforcement learning mathematical model respectively to obtain the first, second and third focus parameters; finally, obtains the auto-focus setting parameters based on the first, second and third focus parameters. Since convolutional neural networks, long short-term memory networks and deep reinforcement learning are jointly applied to the auto-focus technology, the auto-focus function is optimized while reducing the operation of the camera device, thereby greatly improving the user experience.
[0040] The following describes the application of the automatic focusing method for video recording disclosed in the present application through a specific embodiment, which specifically includes: 1. Image data collection of training set.
[0041] First, use a camera device (such as a smartphone camera or a professional camera) to collect data in multiple scenes and environments. Auxiliary light sources can be used to collect data in low-light environments.
[0042] Then, the scene classification is performed, including static scenes (such as indoor still life, landscape), dynamic scenes (such as pedestrians, vehicles), special lighting scenes (such as low light, strong light and backlight environment) and multi-object scenes (including multiple shooting objects at different distances):.
[0043] Finally, the data of each image is labeled, including the scene type (static, dynamic), object distance (obtained by a laser rangefinder or depth camera), ambient light intensity (measured by a light sensor), and focus position (marked as the best focus point) of each image.
[0044] 2. Training set data processing.
[0045] The collected raw image data is denoised, enhanced and annotated. Denoising is to use image filtering methods to remove noise points in the acquisition process. Enhancement is to generate data after flipping, cropping, scaling, and lighting adjustment through data enhancement technology. Annotation is to manually mark the focus position of each image and enter relevant parameters.
[0046] 3. Conduct mathematical model training.
[0047] Mathematical models include convolutional neural networks (CNN), long short-term memory networks (LSTM), and deep reinforcement learning networks (DRL). The training set dataset contains more than 100,000 multi-scene annotated images, in which the data is divided into training sets and validation sets in an 8:2 ratio.
[0048] First, feature extraction: Use CNN to extract key features such as edges, textures, and object shapes in the image.
[0049] Then, the extracted features are input into LSTM to predict the object’s motion trajectory and optimal focal length.
[0050] Finally, deep reinforcement learning is used to train a focus adjustment policy with the goal of maximizing the image clarity score.
[0051] In this embodiment, training iterations are also required, that is, the Adam optimizer is used to adjust the model parameters, the initial value of the learning rate is 0.001, and the learning rate is dynamically adjusted to accelerate convergence.
[0052] The model is tested on the validation set to verify and tune the model, with indicators including prediction accuracy, adjustment time delay (less than 50ms), and clarity score. Low-light and multi-object scenes can also be optimized separately to ensure stable performance.
[0053] 4. Practical application of automatic camera focusing method.
[0054] 1. Data input.
[0055] The camera device collects image data in real time and simultaneously obtains the current scene light intensity, the distance of the main target object and the image clarity score (calculated through image gradient) through the sensor.
[0056] 2. Model reasoning.
[0057] Process images in real-time using the deployed deep learning model, namely: CNN is used to extract the features of the current scene; LSTM analyzes the historical features of dynamic scenes and predicts the target motion trend; DRL outputs the recommended focal length value and adjustment direction.
[0058] 3. Focus adjustment is performed.
[0059] First, compare the current focal length with the recommended focal length and calculate the adjustment step size.
[0060] Then, call the camera driver to adjust the focus in the smallest step size.
[0061] Finally, after the adjustment is completed, the image is recaptured and iteratively optimized until the clarity threshold is met.
[0062] 4. Performance guarantee: Multi-threaded processing technology is used to separate image acquisition, analysis and adjustment to improve real-time response performance (delay less than 50ms).
[0063] 5. Personalized matching and optimization.
[0064] Including user behavior records, dynamic weight adjustment, real-time feedback and optimization, and custom configuration options. User behavior records include automatic recording of user data by the system. User data specifically includes the position and frequency of manual focus adjustment, common scene types, and shooting distance. Dynamic weight adjustment is to update model parameters based on user behavior data, increase the weight of specific scenes (such as users prefer close-up shooting), and optimize focus adjustment strategies, etc., to reduce the number of misjudgments. Real-time feedback and optimization means that the user interface displays the current focus status and clarity score; provides the option of manually adjusting the focus, and feeds back the user adjustment data to the model to optimize the strategy. Custom configuration options mean that users can set the focal range and clarity priority of specific scenes through the configuration interface, such as setting portrait mode to prioritize facial clarity or landscape mode to prioritize distant clarity.
[0065] The automatic focusing method for video recording provided in the embodiment of the present application solves the shortcomings of traditional automatic focusing technology in complex scenes by introducing a machine learning algorithm. The dynamic response of the video recording device to complex scenes is realized, the image clarity is improved, and the user experience is improved by reducing operation interference through a personalized focusing strategy. The automatic focusing method for video recording has a wide range of applications, and can cover smartphones, professional cameras, and surveillance cameras.
[0066] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above-mentioned embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above-mentioned functions can be implemented. In addition, when all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and can be downloaded or copied and saved in the memory of the local device, or the system of the local device is updated, and when the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.
[0067] The above specific examples are used to illustrate the present invention, which is only used to help understand the present invention and is not intended to limit the present invention. For those skilled in the art, according to the concept of the present invention, some simple deductions, modifications or substitutions can be made.
Claims
1. A camera automatic focusing method based on machine learning algorithm, characterized in that: include: Preprocessing at least N pieces of original image data marked with time node information acquired in real time to obtain a standard focus image sequence, wherein N is a natural number not less than 1; Performing image feature extraction on the standard focus image sequence to obtain first-category image features, second-category image features and third-category image features; the first-category image features include edges, textures and / or object shapes of each image element in the standard focus image sequence; the second-category image features include target object motion trajectories and / or optimal focal lengths of target objects of each image element in the standard focus image sequence; the third-category image features include optimal image clarity values of target objects in each image element in the standard focus image sequence; Inputting the first type of image features into a preset convolutional neural network mathematical model to obtain a first focusing parameter output by the convolutional neural network mathematical model; inputting the second type of image features into a preset long short-term memory network mathematical model to obtain a second focusing parameter output by the long short-term memory network mathematical model; inputting the third type of image features into a preset deep reinforcement learning mathematical model to obtain a third focusing parameter output by the deep reinforcement learning mathematical model; Automatic focus setting parameters are acquired according to the first focus parameter, the second focus parameter, and the third focus parameter, and automatic focus is performed on the camera device that acquires the original image data according to the automatic focus setting parameters.
2. The automatic focusing method for video recording as claimed in claim 1, characterized in that: The obtaining of automatic focus setting parameters according to the first focus parameter, the second focus parameter and the third focus parameter comprises: The parameter types of the first focus parameter, the second focus parameter, the third focus parameter and the automatic focus setting parameter include an exposure factor, an aperture factor, a shutter speed factor and / or a noise control factor; respectively presetting a weight value of each parameter type in the first focusing parameter, the second focusing parameter, and the third focusing parameter; The parameter value of each parameter type of the automatic focus setting parameters is the sum of the products of the coefficients of the corresponding parameter types in the first focus parameter, the second focus parameter and the third focus parameter and their respective weight values.
3. The automatic focusing method for video recording as claimed in claim 2, characterized in that: The step of acquiring the automatic focus setting parameter according to the first focus parameter, the second focus parameter and the third focus parameter further comprises: The weight values of each parameter type in the first focusing parameter, the second focusing parameter and the third focusing parameter preset respectively are different for different types of camera scenes; the types of camera scenes include static scenes, dynamic scenes, special light source scenes and / or multi-focus object scenes.
4. The automatic focusing method for video recording as claimed in claim 1, characterized in that: The preprocessing of at least N frames of original image data marked with time node information acquired in real time to obtain a standard focus image sequence includes: Each piece of the original image data is subjected to denoising and / or enhancement processing to obtain an image element in the standard focus image sequence; the denoising processing is used to remove noise points generated during the acquisition process of the original image data, and the enhancement processing is used to apply data enhancement technology to flip, crop, scale and / or adjust the illumination of the region of interest in the original image data.
5. The automatic focusing method for video recording as claimed in claim 1, characterized in that: The method of automatically focusing the camera device that acquires the original image data according to the automatic focusing setting parameters includes: Taking the difference between the current focus parameter of the camera device and the automatic focus setting parameter to obtain a focus parameter difference; Obtaining a minimum parameter adjustment step size according to a minimum parameter adjustment value of the camera device and a focus parameter difference; The current focusing parameters of the camera device are adjusted according to the minimum parameter adjustment step; and the original image data is re-collected after each adjustment to complete the automatic focusing process of the camera device through iterative optimization.
6. The automatic focusing method for video recording as claimed in claim 1, characterized in that: The convolutional neural network mathematical model is used to extract the spatial features of each image element in the standard focus image sequence, and obtain the first focusing parameter based on the spatial features; the long short-term memory network mathematical model is used to extract the dynamic movement trend features of the target object in the standard focus image sequence, and obtain the second focusing parameter based on the dynamic movement trend features; the deep reinforcement learning mathematical model is used to extract the optimal focal length adjustment strategy for each image element in the standard focus image sequence, and obtain the third focusing parameter based on the optimal focal length adjustment strategy.
7. The automatic focusing method for video recording as claimed in claim 1, characterized in that: Also includes: Applying a preset convolutional neural network to extract image features from each image element in the standard focus image sequence to obtain a fourth type of image features; Inputting the fourth type of image features into a preset long short-term memory network to obtain the focus parameters of the target object in the standard focus image sequence; the target object focus parameters include the target object motion trajectory and the target object optimal focal length in the standard focus image sequence; Inputting the target object focusing parameter into a preset deep reinforcement learning network to obtain a fourth focusing parameter; Then, automatic focusing setting parameters are obtained according to the first focusing parameter, the second focusing parameter, the third focusing parameter and the fourth focusing parameter.
8. The automatic focusing method for video recording as claimed in claim 7, characterized in that: The acquiring of automatic focus setting parameters according to the first focus parameter, the second focus parameter, the third focus parameter and the fourth focus parameter comprises: The parameter value of the automatic focus setting parameter is the sum of the products of the coefficient values of the first focus parameter, the second focus parameter, the third focus parameter, and the fourth focus parameter and their respective weight values.
9. A computer-readable storage medium, characterized in that: The medium stores a program, which can be executed by a processor to implement the automatic focusing method for video recording as claimed in any one of claims 1 to 8.
10. A camera automatic focusing system based on machine learning algorithm, characterized in that: Used to apply the automatic camera focusing method according to any one of claims 1 to 8, the automatic camera focusing system comprising: A preprocessing unit, used to preprocess at least N pieces of original image data marked with time node information acquired in real time to obtain a standard focus image sequence, wherein N is a natural number not less than 1; a feature extraction unit, configured to extract image features from the standard focus image sequence to obtain first-category image features, second-category image features, and third-category image features; the first-category image features include edges, textures, and / or object shapes of each of the image elements in the standard focus image sequence; the second-category image features include target object motion trajectories and / or optimal focal lengths of the target objects of each of the image elements in the standard focus image sequence; and the third-category image features include optimal image clarity values of the target objects in each of the image elements in the standard focus image sequence; A first mathematical model unit, used for inputting the first type of image features into a preset convolutional neural network mathematical model to obtain a first focusing parameter output by the convolutional neural network mathematical model; A second mathematical model unit, used for inputting the second type of image features into a preset long short-term memory network mathematical model to obtain a second focusing parameter output by the long short-term memory network mathematical model; A third mathematical model unit, used for inputting the third type of image features into a preset deep reinforcement learning mathematical model to obtain a third focusing parameter output by the deep reinforcement learning mathematical model; A parameter adjustment unit is used to obtain automatic focus setting parameters according to the first focus parameter, the second focus parameter and the third focus parameter, and automatically focus the camera device that obtains the original image data according to the automatic focus setting parameters.
Citation Information
Cited By
Camera automatic focusing method based on laser radar depth estimation
CN120378739A
Integrated focusing control system based on moire fringe phase difference
CN121918285A
An airborne optical imaging intelligent focusing system and method based on deep learning
CN122513656A
An airborne optical imaging intelligent focusing system and method based on deep learning
CN122513656B