Anti-shake method, device and computer-readable storage medium for camera equipment
Through the active anti-shake method based on the timing prediction algorithm, the jitter of the long-focus thermal imager is predicted and compensated in advance, which solves the problem of image instability caused by jitter and achieves more efficient video image stability.
Patent Information
- Application Number
- CN202210576152.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-24
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-05-24
AI Technical Summary
When long focal length thermal imagers are exposed to mechanical jitter, especially when mounted on moving objects, serious image jitter results in poor quality of captured content. Existing anti-shake methods cannot predict jitter in advance, resulting in compensation lag and affecting picture stability.
The active lens anti-shake method based on timing prediction algorithm is used to obtain a list of jitter data samples, train a jitter prediction model, predict the jitter trend at the next moment in advance, and simultaneously perform displacement compensation to reduce jitter and improve video picture stability.
By predicting jitter trends and synchronous compensation in advance, it significantly reduces the chance of the image shaking back and forth, providing a more stable video image and suitable for thermal imaging cameras with ultra-long observation distances.
Smart Images

Figure CN115242966B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an anti-shake method, device and computer-readable storage medium for a camera device. Background Art
[0002] There is a certain amount of mechanical jitter in the installation environment of thermal imagers, especially when the device is installed on a moving object (such as an airplane, ship or car), the jitter problem is more prominent; when using a long-focal-length thermal imager to observe objects thousands of meters away, even a slight mechanical jitter may cause the image to shake violently, resulting in poor quality of the captured content. Therefore, how to improve the anti-shake performance of thermal imagers has become an issue that needs to be urgently addressed. Summary of the invention
[0003] The present application provides an anti-shake method, device and computer-readable storage medium for a camera device, which can reduce image shaking.
[0004] In order to solve the above technical problems, the technical solution adopted in the present application is: to provide an anti-shake method for a camera device, the method comprising: obtaining a jitter data sample list of the camera device, the jitter data sample list including actual jitter data at historical moments and actual jitter data at the current moment; based on the jitter data sample list, training a current jitter prediction model to obtain a trained jitter prediction model; using the trained jitter prediction model to predict the jitter data of the camera device at the next moment to obtain jitter prediction data; based on the jitter prediction data, performing jitter compensation on the camera device at the next moment; obtaining the actual jitter data of the camera device at the next moment to obtain device jitter data; updating the jitter data sample list based on the device jitter data, updating the current jitter prediction model to the trained jitter prediction model, and returning to the step of training the current jitter prediction model based on the jitter data sample list.
[0005] In order to solve the above-mentioned technical problems, another technical solution adopted in the present application is: to provide a camera device, which includes a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the anti-shake method of the camera device in the above-mentioned technical solution.
[0006] To solve the above technical problems, another technical solution adopted in the present application is: providing a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, it is used to implement the anti-shake method of the camera device in the above technical solution.
[0007] Through the above scheme, the beneficial effects of the present application are: first obtain a jitter data sample list of the camera device, the jitter data sample list includes actual jitter data at historical moments and actual jitter data at the current moment; then use the jitter data sample list to train the current jitter prediction model to obtain a trained jitter prediction model; use the trained jitter prediction model to predict the jitter data of the camera device at the next moment to obtain jitter prediction data; use the jitter prediction data to perform jitter compensation on the camera device at the next moment, and obtain the actual jitter data of the camera device at the next moment to obtain device jitter data; then use the device jitter data Update the jitter data sample list, update the current jitter prediction model to the trained jitter prediction model, and return to execute based on the jitter data sample list to train the current jitter prediction model, so as to continuously update the jitter prediction model with the latest actual jitter data, so as to improve the prediction accuracy; this solution compensates the camera device for displacement while the camera device is displaced due to jitter, instead of waiting until the camera device has a large displacement before compensating, so it can improve the compensation response speed of the camera device, alleviate the jitter problem of the camera device, provide a more stable video picture, and reduce the chance of the captured picture shaking back and forth. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0009] Figure 1 It is a flowchart of an embodiment of an anti-shake method for a camera device provided by the present application;
[0010] Figure 2 is a flowchart of another embodiment of the anti-shake method for a camera device provided by the present application;
[0011] Figure 3 is a schematic diagram of the structure of the jitter prediction model provided by this application;
[0012] Figure 4 It is a structural schematic diagram of an embodiment of a camera device provided by the present application;
[0013] Figure 5 is a structural schematic diagram of another embodiment of the camera device provided by the present application;
[0014] Figure 6 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0015] The present application is further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present application, but are not intended to limit the scope of the present application. Similarly, the following examples are only some embodiments of the present application rather than all embodiments, and all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0016] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0017] It should be noted that the terms "first", "second" and "third" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second" and "third" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0018] The anti-shake algorithm in the related technology generally detects the displacement through the built-in gyroscope first, and then fine-tunes the displacement of the lens group or image sensor in the opposite direction, thereby alleviating the image blur problem caused by camera shake. However, this solution is not effective in long-focus thermal imagers because: the shake cannot be predicted in advance, and it is necessary to wait until the displacement is significantly offset before performing displacement compensation in the opposite direction. Although this passive correction method can stabilize the video image well on visible light cameras with a short observation distance, due to the lag in control, it will cause the image to shake back and forth on long-focus thermal imagers with an observation distance of several kilometers.
[0019] Based on this, the present application provides an active lens anti-shake method based on a timing prediction algorithm, that is, the mechanical jitter trend at the next moment is predicted in advance through the timing prediction algorithm, and displacement compensation in the opposite direction is performed synchronously, rather than waiting until the displacement is significantly offset before performing displacement compensation in the opposite direction, thereby providing a more stable video image for a long-focus thermal imager, which is described in detail below.
[0020] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of an anti-shake method for a camera device provided by the present application, the method comprising:
[0021] S11: Obtain a list of jitter data samples of a camera device.
[0022] By analyzing the mechanical jitter data of the long-focal-length thermal imager, it is found that the changes in the jitter waveform in adjacent periods of time are not completely random, but show a certain regularity. Therefore, a jitter prediction model is established. The jitter prediction model is trained to obtain the trained jitter prediction model, and the trained jitter prediction model is used to predict the jitter situation at future moments, so that jitter compensation can be performed when the future moment arrives, thereby improving the jitter situation of the equipment.
[0023] Furthermore, a jitter data sample list may be created first, and the jitter data sample list is used to store the actual jitter data collected by the offset sensor in the camera device in each time period. Specifically, in the initial state, the jitter data sample list is empty; the camera device also includes an image sensor, and when the camera device is in a working state, the offset sensor is used to detect the jitter of the image sensor in real time to obtain the actual jitter data at each detection moment; after completing the jitter data collection, the jitter data sample list includes the actual jitter data of the historical moment and the actual jitter data of the current moment, and the time interval between the earliest historical moment and the current moment can be a preset time interval, such as: 3s.
[0024] S12: Based on the jitter data sample list, the current jitter prediction model is trained to obtain a trained jitter prediction model.
[0025] After completing the collection of actual jitter data from the historical moment to the current moment, the current jitter prediction model is trained using the actual jitter data at multiple moments in the jitter data sample list (recorded as training samples) to obtain a trained jitter prediction model. It can be understood that during the first training, the current jitter prediction model is the pre-established jitter prediction model.
[0026] In a specific embodiment, a set number of training samples can be selected from the jitter data sample list in the order of the moments corresponding to the training samples to form batch sample data, and the batch sample data can be input into the current jitter prediction model so that the current jitter prediction model processes the batch sample data to obtain the sample prediction data at the prediction moment; then the loss between the sample prediction data and the training sample at the prediction moment is calculated to obtain the current loss value; then it is determined whether the preset training end condition is met at present, and if so, the trained jitter prediction model is obtained; if not, the step of selecting a set number of training samples from the jitter data sample list in the order of the moments corresponding to the training samples to form batch sample data is returned to until the preset training end condition is met. It can be understood that the set number is the number of training samples in the batch sample data, which is less than the number of all training samples in the jitter data sample list; for example, assuming that the jitter data sample list includes training samples at time T1-T1000, and the set number is 50, then the training samples at time T1-T50 are first selected from the jitter data sample list to form the first batch of sample data; after the processing of the first batch of sample data is completed, the training samples at time T51-T100 are selected to form the second batch of sample data, and so on, until the training of the current jitter prediction model is completed.
[0027] Furthermore, the preset training end conditions include: loss value convergence, that is, the difference between the previous loss value and the current loss value is less than the set value; determining whether the current loss value is less than the preset loss value, the preset loss value is a preset loss threshold, if the current loss value is less than the preset loss value, it is determined that the preset training end conditions are met; the number of training times reaches the set value (for example: training 10,000 times); or the accuracy obtained when testing using the test set reaches the set conditions (for example: exceeding the preset accuracy), etc.
[0028] S13: using the trained jitter prediction model to predict jitter data of the camera device at the next moment to obtain jitter prediction data.
[0029] When the trained jitter prediction model is obtained, multiple data in the jitter data sample list can be input into the trained jitter prediction model to predict the jitter condition of the camera device at the next moment after the current moment, and generate jitter prediction data at the next moment. m , n actual jitter data are needed to calculate t m+1 The jitter situation at the moment can be predicted by inputting the actual jitter data of the (n-1) moments before the current moment and the actual jitter data of the current moment into the trained jitter prediction model, thereby obtaining t m+1 Jitter prediction data at the moment.
[0030] S14: Based on the jitter prediction data, perform jitter compensation on the camera device at the next moment.
[0031] After obtaining the jitter prediction data for the next moment, the jitter condition that may occur at the next moment can be compensated when the next moment arrives, so as to reduce the jitter degree of the camera equipment at the next moment; specifically, the image sensor can be driven to move in the direction opposite to the direction corresponding to the jitter prediction data.
[0032] S15: Acquire actual jitter data of the camera device at the next moment to obtain device jitter data.
[0033] Since the prediction of the jitter data at the next moment using the trained jitter prediction model may not be accurate, the actual jitter data of the camera device (i.e., the device jitter data) can be obtained when the next moment arrives, so that the device jitter data can be used to update the jitter prediction model and improve the prediction accuracy of the model.
[0034] S16: updating the jitter data sample list based on the device jitter data, and updating the current jitter prediction model to the trained jitter prediction model.
[0035] After obtaining the device jitter data corresponding to the next moment, the device jitter data can be stored in the jitter data sample list so as to update the data in the jitter data sample list; then the current jitter prediction model is updated to the trained jitter prediction model, and the step of training the current jitter prediction model based on the jitter data sample list is returned, that is, return to execute S12, so as to use the device jitter data of the next moment to predict the actual jitter data of the camera device at the subsequent moment, and by continuously updating the jitter data sample list and using the updated jitter data sample list to train the jitter prediction model, the prediction effect of the model can be continuously improved. For example, assuming that the jitter prediction model established at the beginning is recorded as model 1, then during the first training, the current training model is model 1, and after completing the training of model 1, model 2 is obtained; model 2 is used as the current jitter training model, and model 2 is trained to obtain model 3; model 3 is used as the current jitter prediction model, and so on, the prediction accuracy of the model is gradually improved.
[0036] This embodiment provides an active anti-shake solution based on timing prediction. During the operation of the camera device, the jitter trend at the next moment is predicted in advance based on the actual jitter data collected in the recent period, and then synchronous displacement compensation is performed, that is, when the image sensor in the camera device is displaced due to jitter, it is driven to move in the opposite direction at the same time to perform displacement compensation, instead of waiting until the image sensor has a large displacement and then compensating in the opposite direction, thereby alleviating the jitter problem of the camera device, reducing the probability of the picture shaking back and forth, and providing a more stable video picture; in addition, this solution can be applied to the field of camera anti-shake technology, especially for anti-shake control of thermal imagers with ultra-long observation distances.
[0037] See also Figure 2 , Figure 2 1 is a flow chart of another embodiment of an anti-shake method for a camera device provided by the present application, the method comprising:
[0038] S21: Create a jitter data sample list and initialize the number of samples to a preset value.
[0039] First, create a jitter data sample list and the number of samples, and then initialize the number of samples. For example, the preset value is 0, that is, the number of samples is initialized to 0, which represents the number of training samples obtained by the jitter prediction model; then, use the following scheme to perform anti-shake control and model training at the same time.
[0040] S22: Generate first sub-jitter data based on actual jitter data of the camera device collected by the offset sensor, and update the sample number by adding the sample number to the preset step length.
[0041] The jitter data sample list includes a preset number of first sub-jitter data. The camera device includes an image sensor and an offset sensor. The actual jitter data of the camera device collected by the offset sensor can be first obtained to obtain the second sub-jitter data. The offset sensor can be a three-axis gyroscope; then the second sub-jitter data is differentially processed to obtain the first sub-jitter data.
[0042] In a specific embodiment, the second sub-jitter data includes an offset value in a target direction, and the image sensor is controlled to move the offset value in a direction opposite to the target direction to perform jitter compensation on the camera device. Specifically, the target direction includes a first preset direction, a second preset direction, and a third preset direction, and the offset value includes a first sub-offset value, a second sub-offset value, and a third sub-offset value. The image sensor is controlled to move the first sub-offset value in a direction opposite to the first preset direction; the image sensor is controlled to move the second sub-offset value in a direction opposite to the second preset direction; and the image sensor is controlled to move the third sub-offset value in a direction opposite to the third preset direction.
[0043] S23: Determine whether the number of samples is less than a preset number.
[0044] If the number of samples detected is greater than or equal to the preset number, it indicates that the number of training samples is sufficient, and the collection of training samples can be terminated at this time. If the number of samples detected is less than the preset number, the process returns to the step of generating the first sub-jitter data based on the actual jitter data of the camera device collected by the offset sensor after the first preset time, until the number of samples is equal to the preset number; wherein the first preset time is a pre-set time interval, generally 1ms.
[0045] In one implementation, the preset step size may be 1, the preset number may be 100; the first preset direction is the X-axis direction, the second preset direction is the Y-axis direction, and the third preset direction is the Z-axis direction. The following scheme may be adopted:
[0046] 1) Collect the actual jitter data of the image sensor from the three-axis gyroscope to obtain the jitter offset vector (i.e., offset value): [x, y, z], where x is the jitter offset value in the X-axis direction (i.e., the first sub-offset value), y is the jitter offset value in the Y-axis direction (i.e., the second sub-offset value), and z is the jitter offset value in the Z-axis direction (i.e., the third sub-offset value).
[0047] 2) The image sensor is shifted by x in the opposite direction of the X axis (i.e., the direction opposite to the X axis direction), by y in the opposite direction of the Y axis (i.e., the direction opposite to the Y axis direction), and by z in the opposite direction of the Z axis (i.e., the direction opposite to the Z axis direction).
[0048] 3) Store the jitter offset vector [x, y, z] into the jitter data sample list, increase the number of samples by 1, and determine whether the number of samples is less than 100.
[0049] 4) If the number of samples is less than 100, jump to step 1) after the first preset time; if the number of samples is greater than or equal to 100, go to step 5).
[0050] 5) Perform differential operation on the jitter offset vector and store the operation result in the jitter data sample list.
[0051] Since the jitter waveform shows a certain regularity, when processing data, a differential operation is first performed on the original data (i.e., the jitter offset vector [x, y, z]) to convert it into a stable sequence, and then the processed result is stored in the jitter data sample list to replace the original data.
[0052] S24: Based on the jitter data sample list, the current jitter prediction model is trained to obtain a trained jitter prediction model.
[0053] The jitter prediction model uses a time series neural network to learn the jitter patterns in the recent period, such as Figure 3 As shown, the jitter prediction model includes a first prediction module and a second prediction module. The first prediction module is used to predict the jitter data of the camera device at the next moment based on the input data to obtain sample prediction features; the second prediction module is used to process the sample prediction features to obtain a jitter prediction value; the loss between the jitter prediction value and the actual jitter data at the next moment is calculated to obtain the current loss value; it can be judged whether the current loss value converges or is less than the set value, so as to judge whether the preset training end condition is reached. If so, the trained jitter prediction model is obtained.
[0054] Furthermore, based on the root mean square error (MSE) loss function, the weights of the neural network can be optimized using the adaptive moment estimation (Adam) algorithm to gradually reduce the loss value and continuously improve the prediction accuracy. The calculation formula of RMSE is as follows:
[0055]
[0056] Among them, x t is the actual jitter data at time t, is the jitter prediction value at time t, and N is the number of samples.
[0057] In a specific embodiment, the first prediction module includes an input layer and a first hidden layer, the first hidden layer includes multiple first sub-processing layers, and the input of the input layer comes from data of a three-axis gyroscope, namely, X-axis data, Y-axis data, and Z-axis data; the second prediction module includes a second hidden layer, a third hidden layer, and an output layer, the second hidden layer includes multiple second sub-processing layers, and the first sub-processing layers correspond one-to-one to the second sub-processing layers.
[0058] Furthermore, the first sub-processing layer is a long short-term memory (LSTM) recurrent neural network, that is, the first hidden layer contains three independent LSTM recurrent neural networks, each of which is responsible for predicting the jitter offset data on a channel (there are three channels in total, namely x, y, and z); the second sub-processing layer can adopt a dropout structure, which discards neurons with a probability of p and retains other neurons with a probability of q (q=1-p), and each neuron has the same probability of being closed; since some nodes of the LSTM recurrent neural network are discarded, it can well avoid overfitting of the deep neural network and improve the robustness of the neural network. In this scheme, p can be 0.2; the third hidden layer is a fully connected neural network, the number of neural units in the fully connected neural network can be 9, and each neuron is connected to the output of all neurons in the previous layer; the output layer outputs the jitter prediction value on three axes (X axis, Y axis, Z axis) at the next moment.
[0059] In actual use, the actual jitter data at the current moment and the actual jitter data at (N-1) moments before the current moment (i.e., N historical data) can be input into the input layer for model training; the N historical data are iteratively calculated through the LSTM recurrent neural network to update the state of the memory unit, and then the jitter trend at the next moment is predicted based on the N historical data.
[0060] It is understandable that when the camera device is just running, due to the lack of actual jitter data from the three-axis gyroscope, the jitter prediction model cannot output accurate jitter trends. Therefore, at this stage, traditional methods are used for jitter compensation while the actual jitter data is stored in the jitter data sample list to improve the prediction accuracy of the jitter prediction model.
[0061] After the above-mentioned first stage (i.e., the model training stage), the current jitter prediction model has completed pre-training. At this time, the jitter trend at the next moment predicted by the model can be used to synchronously compensate for the upcoming jitter offset. Therefore, the second stage is also called the synchronous anti-shake stage. The specific plan is as follows.
[0062] S25: using the trained jitter prediction model to predict jitter data of the camera device at the next moment to obtain jitter prediction data.
[0063] The jitter prediction data includes multiple jitter prediction values. The first prediction module is used to predict the jitter data of the camera device at the next moment to obtain a jitter offset feature. The second prediction module is used to process the jitter offset feature to obtain multiple jitter prediction values.
[0064] Further, the jitter offset feature includes multiple first sub-offset features, the first sub-jitter data includes multiple sub-jitter data, and multiple first sub-processing layers are used to process the multiple sub-jitter data in the first sub-jitter data respectively to obtain corresponding first sub-offset features; the second sub-processing layer is used to randomly delete the first sub-offset features output by the corresponding first sub-processing layer to obtain the second sub-offset features; the third hidden layer is used to fully connect the second sub-offset features output by all the second sub-processing layers to obtain the third sub-offset features; the output layer is used to process the third sub-offset feature to obtain multiple jitter prediction values, and the multiple jitter prediction values include a first jitter prediction value in a first preset direction, a second jitter prediction value in a second preset direction, and a third jitter prediction value in a third preset direction. For example, the jitter offset vector of the next moment output by the current jitter prediction module is [x', y', z'], where x' is the jitter offset value predicted by the current jitter prediction module to be generated in the X-axis direction (i.e., the first jitter prediction value), y' is the jitter offset value to be generated in the Y-axis direction (i.e., the second jitter prediction value), and z' is the jitter offset value to be generated in the Z-axis direction (i.e., the third jitter prediction value).
[0065] S26: Controlling the image sensor to move in a direction opposite to the target direction at a speed corresponding to the jitter prediction value within a second preset time.
[0066] The image sensor is controlled to move in a direction opposite to the first preset direction at a first preset speed within the second preset time, where the first preset speed is the ratio of the first jitter prediction value to the second preset time; the image sensor is controlled to move in a direction opposite to the second preset direction at a second preset speed within the second preset time, where the second preset speed is the ratio of the second jitter prediction value to the second preset time; the image sensor is controlled to move in a direction opposite to the third preset direction at a third preset speed within the second preset time, where the third preset speed is the ratio of the third jitter prediction value to the second preset time.
[0067] For example, the second preset time is recorded as t, and during the time t, when mechanical vibration occurs externally, the image sensor is moved toward the X axis at a speed (-x' / t), the image sensor is moved toward the Y axis at a speed (-y' / t), and the image sensor is moved toward the Z axis at a speed (-z' / t); after the time t, the offset compensation is terminated. It can be understood that a negative value of the speed indicates that the displacement compensation is performed in the opposite direction.
[0068] S27: Using an offset sensor to collect actual jitter data of the camera device within a second preset time to obtain device jitter data.
[0069] The device jitter data includes the jitter offset values in the X-Z axis direction. The actual jitter data within the second preset time can be collected from the three-axis gyroscope to obtain the actual jitter offset vector [x c ,y c ,z c ], where x c is the actual jitter offset value in the X-axis direction within the second preset time, y c is the actual jitter offset value in the Y-axis direction within the second preset time, z c is the actual jitter offset value in the Z-axis direction within the second preset time.
[0070] S28: updating the jitter data sample list based on the device jitter data, and updating the current jitter prediction model to the trained jitter prediction model.
[0071] Perform differential processing on the device jitter data to obtain processed device jitter data; store the processed device jitter data in a jitter data sample list, delete the data with the earliest storage time from the jitter data sample list, update the current jitter prediction model to the trained jitter prediction model, and return to the step of training the current jitter prediction model based on the jitter data sample list, that is, use the jitter data sample list to optimize the trained jitter prediction model.
[0072] Further, it can be determined whether the time difference between the next moment and the next moment reaches a third preset time; if so, the jitter prediction model that has been optimized is used to predict the jitter data of the camera device at the next moment to obtain the jitter prediction data, that is, to execute S25. Specifically, the data in the latest jitter data sample list is input into the current jitter prediction model, and the weight of the neural network is optimized using the Adam algorithm based on the mean square error loss function, so that the loss function value gradually decreases and the prediction accuracy is continuously improved. After each prediction step is achieved, the latest actual jitter value is used to replace the jitter prediction value to perform iterative calculation of the next prediction step.
[0073] The method provided in this embodiment makes use of the timing prediction capability of the machine learning algorithm to predict the jitter trend at the next moment in advance through historical data, and generates a compensation in the opposite direction when external jitter occurs at the next moment, thereby better suppressing the jitter and providing more fine-grained anti-shake control, meeting the stringent anti-shake requirements of long-focal-length thermal imagers and improving applicability.
[0074] See also Figure 4 , Figure 4 It is a structural schematic diagram of an embodiment of a camera device provided in the present application. The camera device 40 includes a memory 41 and a processor 42 connected to each other. The memory 41 is used to store a computer program. When the computer program is executed by the processor 42, it is used to implement the anti-shake method of the camera device in the above embodiment.
[0075] See also Figure 5 , Figure 5 It is a structural schematic diagram of another embodiment of the camera device provided by the present application, and the camera device includes an offset sensor module 51, a jitter timing prediction module 52, a jitter compensation calculation module 53, a jitter compensator module 54 and an image sensor module 55.
[0076] The offset sensor module 51 is connected to the image sensor module 55, and is used to obtain a jitter data sample list of the camera device, which includes actual jitter data at historical moments and actual jitter data at the current moment; obtain the actual jitter data of the camera device at the next moment to obtain device jitter data.
[0077] The jitter timing prediction module 52 is connected to the offset sensor module 51, and is used to train the current jitter prediction model based on the jitter data sample list to obtain the trained jitter prediction model; use the trained jitter prediction model to predict the jitter data of the camera device at the next moment to obtain jitter prediction data.
[0078] The jitter compensation calculation module 53 is connected to the offset sensor module 51 and the jitter timing prediction module 52 , and is used to calculate the compensation value of the image sensor module 55 at the next moment based on the jitter prediction data.
[0079] The jitter compensator module 54 is connected to the jitter compensation calculation module 53, and is used to generate a control instruction based on the compensation value output by the jitter compensation calculation module 53 and send the control instruction to the image sensor module 55 to adjust the displacement of the image sensor module 55 to achieve jitter compensation. Specifically, assuming that the offset value at the next moment is [x, y, z], the jitter compensator module 54 offsets the image sensor module 55 by x in the opposite direction of the X axis, by y in the opposite direction of the Y axis, and by y in the opposite direction of the Z axis.
[0080] Furthermore, the jitter timing prediction module 52 is also used to update the jitter data sample list based on the device jitter data, update the current jitter prediction model to the trained jitter prediction model, and return to execute the operation of training the current jitter prediction model based on the jitter data sample list.
[0081] This embodiment provides a jitter prediction solution based on machine learning, which predicts the jitter trend at the next moment according to historical data for active lens anti-shake. Since the jitter trend at the next moment is predicted in advance, synchronous compensation is performed in the opposite direction when the jitter occurs, which can better alleviate the jitter.
[0082] See also Figure 6 , Figure 6It is a structural diagram of an embodiment of a computer-readable storage medium provided in the present application. The computer-readable storage medium 60 is used to store a computer program 61. When the computer program 61 is executed by a processor, it is used to implement the anti-shake method of the camera device in the above embodiment.
[0083] The computer-readable storage medium 60 may be a server, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which may store program codes.
[0084] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0086] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0087] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for stabilizing an image pickup device, characterized in that: The camera device comprises an image sensor, including: Acquire a jitter data sample list of the camera device, wherein the jitter data sample list includes actual jitter data at historical moments and actual jitter data at a current moment; Based on the jitter data sample list, training the current jitter prediction model to obtain a trained jitter prediction model; Using the trained jitter prediction model, predicting jitter data of the camera device at a next moment to obtain jitter prediction data, wherein the jitter prediction data includes a plurality of jitter prediction values; Based on the jitter prediction data, performing jitter compensation on the camera device at the next moment; The step of performing jitter compensation on the camera device at the next moment based on the jitter prediction data comprises: controlling the image sensor to move in a direction opposite to the target direction at a speed corresponding to the jitter prediction value within a second preset time; Acquire actual jitter data of the camera device at the next moment to obtain device jitter data; The jitter data sample list is updated based on the device jitter data, the current jitter prediction model is updated to the trained jitter prediction model, and the step of training the current jitter prediction model based on the jitter data sample list is returned.
2. The anti-shake method of a camera device according to claim 1, characterized in that: The jitter data sample list includes a preset number of first sub-jitter data, the camera device includes an offset sensor, and the step of obtaining the jitter data sample list of the camera device includes: Initialize the number of samples to a preset value; Based on the actual jitter data of the camera device collected by the offset sensor, the first sub-jitter data is generated, and the number of samples is added to a preset step length to update the number of samples; Determining whether the number of samples is less than a preset number; If so, the step of generating the first sub-jitter data based on the actual jitter data of the camera device collected by the offset sensor is returned after a first preset time until the number of samples is equal to the preset number.
3. The anti-shake method of a camera device according to claim 2, characterized in that: The step of generating the first sub-jitter data based on the actual jitter data of the camera device collected by the offset sensor comprises: Acquire actual jitter data of the camera device collected by the offset sensor to obtain second sub-jitter data; The second sub-division data is differentially processed to obtain the first sub-division data.
4. The anti-shake method of a camera device according to claim 3, characterized in that: The camera device further includes an image sensor, the second sub-jitter data includes an offset value in a target direction, and the method further includes: The image sensor is controlled to move the offset value in a direction opposite to the target direction to perform shake compensation on the camera device.
5. The anti-shake method of a camera device according to claim 4, characterized in that: The target direction includes a first preset direction, a second preset direction, and a third preset direction, the offset value includes a first sub-offset value, a second sub-offset value, and a third sub-offset value, and the step of controlling the image sensor to move the offset value in a direction opposite to the target direction includes: Controlling the image sensor to move the first sub-offset value in a direction opposite to the first preset direction; Controlling the image sensor to move the second sub-offset value in a direction opposite to the second preset direction; The image sensor is controlled to move the third sub-offset value in a direction opposite to the third preset direction.
6. The anti-shake method of a camera device according to claim 1, characterized in that: The target direction includes a first preset direction, a second preset direction, and a third preset direction, the multiple jitter prediction values include a first jitter prediction value in the first preset direction, a second jitter prediction value in the second preset direction, and a third jitter prediction value in the third preset direction, and the step of controlling the image sensor to move in a direction opposite to the target direction at a speed corresponding to the jitter prediction value within the second preset time includes: controlling the image sensor to move in a direction opposite to the first preset direction at a first preset speed within the second preset time, where the first preset speed is a ratio of the first jitter prediction value to the second preset time; controlling the image sensor to move in a direction opposite to the second preset direction at a second preset speed within the second preset time, where the second preset speed is a ratio of the second jitter prediction value to the second preset time; The image sensor is controlled to move in a direction opposite to the third preset direction at a third preset speed within the second preset time, where the third preset speed is a ratio of the third jitter prediction value to the second preset time.
7. The anti-shake method of a camera device according to claim 1, characterized in that: The camera device includes an offset sensor, and the step of acquiring actual jitter data of the camera device at the next moment to obtain device jitter data includes: Using the offset sensor to collect actual jitter data of the camera device within a second preset time to obtain the device jitter data; The step of updating the jitter data sample list based on the device jitter data comprises: Performing differential processing on the device jitter data to obtain processed device jitter data; The processed device jitter data is stored in the jitter data sample list, and the data stored earliest is deleted from the jitter data sample list.
8. The anti-shake method of a camera device according to claim 1, characterized in that: The method further comprises: Determine whether the time difference between the next moment and the next moment reaches a third preset time; If so, return to the step of using the trained jitter prediction model to predict the jitter data of the camera device at the next moment to obtain jitter prediction data.
9. The anti-shake method of a camera device according to claim 1, characterized in that: The jitter prediction data includes a plurality of jitter prediction values, the jitter prediction model includes a first prediction module and a second prediction module, and the step of using the trained jitter prediction model to predict the jitter data of the camera device at the next moment to obtain the jitter prediction data includes: Using the first prediction module to predict the jitter data of the camera device at the next moment to obtain a jitter offset feature; The second prediction module is used to process the jitter offset feature to obtain the multiple jitter prediction values.
10. The anti-shake method of a camera device according to claim 9, characterized in that: The jitter offset feature includes a plurality of first sub-offset features, the jitter data includes a plurality of sub-jitter data, the first prediction module includes a first hidden layer, the first hidden layer includes a plurality of first sub-processing layers, the second prediction module includes a second hidden layer, an output layer and a third hidden layer, the second hidden layer includes a plurality of second sub-processing layers, and the first sub-processing layers correspond to the second sub-processing layers one by one; the step of using the first prediction module to predict the jitter data of the camera device at the next moment to obtain the jitter offset feature includes: Using the multiple first sub-processing layers to process the multiple sub-jitter data respectively to obtain corresponding first sub-offset features; The step of using the second prediction module to process the jitter offset feature to obtain the multiple jitter prediction values includes: Using the second sub-processing layer to randomly delete the first sub-offset feature output by the corresponding first sub-processing layer to obtain a second sub-offset feature; Using the third hidden layer to perform full connection processing on all second sub-offset features output by the second sub-processing layer to obtain third sub-offset features; The output layer is used to process the third sub-offset feature to obtain the multiple jitter prediction values.
11. A camera device, characterized in that: The invention comprises a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the anti-shake method of the camera device according to any one of claims 1 to 10.
12. A computer-readable storage medium for storing a computer program, characterized in that: When the computer program is executed by a processor, it is used to implement the anti-shake method of the camera device according to any one of claims 1 to 10.
Citation Information
Patent Citations
Video anti-shake method and readable storage medium
CN113163121A
