Image processing method and terminal device

By using the second camera equipped with OIS to deblur the first camera in the terminal device, combined with downsampling and cropping technology, the problem of inconsistent definition between frames in low-light scenes is solved, and the consistency of image clarity is achieved. Improvement and optimization of computing power efficiency.

CN115225799BActive Publication Date: 2024-10-15HUAWEI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110402621.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-14
Publication Date
2024-10-15
Estimated Expiration
2041-04-14

AI Technical Summary

Technical Problem

In low-light scenes, the inconsistency in definition between frames due to hand shake when shooting on terminal equipment causes video tremors. Existing optical anti-shake devices cannot completely solve this problem, and due to cost constraints, they are usually only equipped with the main camera and not the main camera. Other lenses make it difficult to improve image clarity and consistency.

Method used

By starting the second camera equipped with OIS when the first camera is detected to be activated, the clear frames collected by the second camera are used to deblur the blurred frames collected by the first camera, and a combination of downsampling and cropping techniques are used to generate global high-precision registration. information, merging frames to improve image clarity and consistency.

Benefits of technology

It effectively improves the clarity and consistency of images captured by terminal devices, reduces the computing power required for image registration, enables mobile terminal devices to perform deblurring in real time, and significantly improves the shooting effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115225799B_ABST
    Figure CN115225799B_ABST
Patent Text Reader

Abstract

An image processing method. In the method, when a terminal device starts a first camera to shoot, the terminal device can simultaneously start a second camera with OIS, and use the clear frames captured by the second camera with OIS to deblur the blurred frames captured by the first camera, so that the terminal device has a better deblurring effect on the blurred frames, thereby making the clarity consistency of the captured images displayed by the terminal device higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal and image processing technology, and in particular to an image processing method and a terminal device. Background Art

[0002] Currently, when using a terminal device to shoot in a low-light scene, since the person is holding the terminal device and moving it all the time, some frames in the recorded video will be clear and some frames will be blurred, resulting in inconsistent clarity between frames. This will give the user a visual feeling that the video screen is constantly "shaking", which is an extremely poor experience.

[0003] In order to suppress this phenomenon, the camera of the smart terminal is usually equipped with a physical device called optical image stabilization (OIS). OIS can effectively alleviate the problem of inconsistent clarity between frames, but it cannot completely solve the problem. In addition, considering the cost of smart terminals, OIS is usually only provided for commonly used cameras, while other lenses are not.

[0004] Therefore, how to improve the clarity consistency of images captured by terminal devices is still a problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides an image processing method for improving the clarity consistency of images captured by a terminal device.

[0006] In a first aspect, the present application provides an image processing method, including: in response to a first operation of a user, a terminal device starts a first camera; when detecting that the first camera is started, the terminal device starts a second camera, wherein the second camera is equipped with OIS optical image stabilization; the terminal device obtains a first frame captured by the first camera; the terminal device obtains a second frame captured by the second camera, and the second frame corresponds to the first frame; the terminal device fuses the second frame with the first frame to obtain a deblurred frame; and the terminal device displays an image of the deblurred frame.

[0007] In the above embodiment, when the terminal device starts shooting with the first camera, it can simultaneously start the second camera with OIS, and use the second frame captured by the second camera with OIS to deblur the first frame captured by the first camera. This can enable the terminal device to have a better deblurring effect on the blurred frame, thereby making the clarity consistency of the picture displayed by the terminal device higher.

[0008] In combination with some embodiments of the first aspect, in some embodiments, before the terminal device obtains the second frame captured by the second camera, the method also includes: the terminal device determines that the first frame is a blurred frame; before the terminal device fuses the second frame into the first frame to obtain a deblurred frame, the method also includes: the terminal device determines that the second frame is a clear frame.

[0009] In the above embodiment, the blurred frame is deblurred using the clear frame, so that the deblurring effect of the terminal device is better.

[0010] In combination with some embodiments of the first aspect, in some embodiments, before the terminal device starts the second camera, the step also includes: the terminal device determines whether the first camera is equipped with OIS; if the first camera is not equipped with OIS, starting the second camera.

[0011] In the above embodiment, the terminal device can determine in real time whether the activated camera is equipped with OIS. Only when the activated camera is not equipped with OIS, the second camera equipped with OIS is activated, instead of activating another camera equipped with OIS as long as one camera is activated, thereby reducing the power consumption of the terminal device.

[0012] In combination with some embodiments of the first aspect, in some embodiments, the terminal device fuses the second frame into the first frame to obtain a deblurred frame, specifically including: the terminal device determines the alignment information for converting the second frame to the first frame; the terminal device fuses the second frame into the first frame based on the alignment information to obtain the deblurred frame.

[0013] In the above embodiment, the terminal device fuses the second frame into the first frame according to the registration information, so that the fusion is more accurate, and thus the deblurring effect of the obtained deblurred frame is better.

[0014] In combination with some embodiments of the first aspect, in some embodiments, the terminal device determines the registration information for converting the second frame to the first frame, specifically including: the terminal device generates global low-precision registration information based on the feature points extracted after downsampling the first frame and the second frame; the terminal device generates local high-precision registration information based on the feature points extracted after cropping the first frame and the second frame; the terminal device uses the local high-precision registration information to calibrate the global low-precision registration information to obtain global high-precision registration information as the registration information for converting the second frame to the first frame.

[0015] In the above embodiment, when performing deblurring processing, the terminal device downsamples the first frame and the second frame respectively, extracts feature points for matching to obtain global low-precision registration information, and crops them respectively and extracts feature points for matching to obtain local high-precision registration information, and then uses the local high-precision registration information to calibrate the global low-precision registration information to obtain the global high-precision information required for deblurring processing, which greatly reduces the computing power required for image registration, so that even if the terminal device is a mobile terminal device, it is possible to achieve real-time deblurring processing, so that the clarity consistency of the images taken by the mobile terminal device is higher.

[0016] In combination with some embodiments of the first aspect, in some embodiments, the terminal device generates global low-precision registration information based on the feature points extracted after downsampling the first frame and the second frame, specifically including: the terminal device extracts feature points after downsampling the first frame according to a first downsampling ratio to obtain a first feature point set; the terminal device extracts feature points after downsampling the second frame according to the first downsampling ratio to obtain a second feature point set; the terminal device generates the global low-precision registration information for transforming the second frame to the first frame based on the first feature point set and the second feature point set.

[0017] In the above embodiment, the terminal device downsamples the first frame and the second frame using the same downsampling ratio, so that the generated images have better correspondence and reduce the computing power required to generate global low-precision registration information.

[0018] In combination with some embodiments of the first aspect, in some embodiments, the terminal device generates local high-precision registration information based on the feature points extracted after cropping the first frame and the second frame, specifically including: the terminal device crops the first frame according to the first area ratio, the first center point position and the first shape to obtain a first cropped area, extracts feature points from the first cropped area to obtain a third feature point set; the first area ratio is the ratio of the area of ​​the first cropped area to the total area of ​​the first frame, and the first shape is the shape of the first cropped area; the first center point position is the position of the center point of the first cropped area relative to the center point of the first frame; the terminal device crops the second frame according to the first area ratio, the first center point position and the first shape to obtain a second cropped area, extracts feature points from the second cropped area to obtain a fourth feature point set; the terminal device generates the local high-precision registration information for transforming the second cropped area to the first cropped area based on the third feature point set and the fourth feature point set.

[0019] In the above embodiment, the terminal device uses the same cropping configuration to crop the first frame and the second frame, so that the generated images have better correspondence, reducing the computing power required to generate local high-precision registration information.

[0020] In combination with some embodiments of the first aspect, in some embodiments, the first downsampling ratio is a preset downsampling ratio; or the first downsampling ratio is a downsampling ratio determined by the terminal device according to real-time computing capability.

[0021] In combination with some embodiments of the first aspect, in some embodiments, the first area ratio is a preset ratio; or the first area ratio is a ratio determined by the terminal device according to real-time computing capability.

[0022] In the above embodiment, the first downsampling ratio or the first area ratio may be determined by the terminal device according to the real-time computing capability, so that the deblurring process may be completed in real time even when the computing power of the terminal device is low.

[0023] In combination with some embodiments of the first aspect, in some embodiments, the first center point position is the center point of the frame.

[0024] In the above embodiment, the center point of the frame is used as the center point of cropping, so that the resolution of the central area that the user pays attention to is not lost, the deblurring effect is the best, and the human-computer interaction performance of the terminal device is improved.

[0025] In combination with some embodiments of the first aspect, in some embodiments, the first shape is a rectangle or a square.

[0026] In the above embodiment, a rectangle or a square is used as the cutting shape, so that the matrix of feature points is more regular during feature extraction and subsequent feature comparison, thereby reducing the computing power required for correcting the registration information to obtain global high-precision registration information.

[0027] In combination with some embodiments of the first aspect, in some embodiments, the terminal device obtains the second frame captured by the second camera, specifically including: the terminal device sends a clear frame selection identifier to the second camera, and the clear frame selection identifier includes time information and blur degree information of the first frame; the terminal device receives the second frame corresponding to the first frame fed back by the second camera.

[0028] In the above embodiment, the second camera is allowed to feedback a clear frame that matches the blurry frame according to the clear frame selection mark, thereby reducing the computing power requirement of the main processor in the terminal device.

[0029] In combination with some embodiments of the first aspect, in some embodiments, the second frame is a frame captured by the second camera, the capture time interval between which and the first frame is within a first preset time length, and the blurriness of which does not exceed a preset blur threshold compared to the blurriness of the first frame.

[0030] In the above embodiment, the collection time interval between the second frame and the first frame is limited to a first preset time length and the blur degree does not exceed a preset blur threshold, instead of using the clearest frame collected by the second camera. This ensures that when the second frame is fused into the first frame, there are not too many frame jumps, thereby ensuring the continuity of the final displayed frame and improving the consistency of the image clarity captured by the terminal device.

[0031] In the second aspect, the present application provides a terminal device, which includes: a first startup module, used to start a first camera in response to a first operation of a user; a second startup module, used to start a second camera when it is detected that the first camera is started, wherein the second camera is equipped with OIS optical image stabilization; a first acquisition module, used to acquire a first frame captured by the first camera; a second acquisition module, used to acquire a second frame captured by the second camera, the second frame corresponding to the first frame; a fusion module, used to fuse the second frame into the first frame to obtain a deblurred frame; and a display module, used to display the image of the deblurred frame.

[0032] In combination with some embodiments of the second aspect, in some embodiments, the terminal device further includes: a first determination module for determining that the first frame is a blurry frame; a second determination module for determining that the second frame is a clear frame. In combination with some embodiments of the second aspect, in some embodiments, the terminal device further includes: a third determination module for determining whether the first camera is equipped with OIS when the first camera is started; a third start module for starting the second camera when the third determination module determines that the first camera is not equipped with OIS.

[0033] In combination with some embodiments of the second aspect, in some embodiments, the fusion module specifically includes: a registration unit, used to determine the registration information for converting the second frame to the first frame; and a fusion unit, used to fuse the second frame into the first frame according to the registration information to obtain the deblurred frame.

[0034] In combination with some embodiments of the second aspect, in some embodiments, the registration module specifically includes: a first registration subunit, used to generate global low-precision registration information based on the feature points extracted after downsampling the first frame and the second frame; a second registration subunit, used to generate local high-precision registration information based on the feature points extracted after cropping the first frame and the second frame; and a third registration subunit, used to calibrate the global low-precision registration information using the local high-precision registration information to obtain global high-precision registration information as the registration information for converting the second frame to the first frame.

[0035] In combination with some embodiments of the second aspect, in some embodiments, the first registration subunit specifically includes: a first feature subunit, used to extract feature points after downsampling the first frame according to a first downsampling ratio to obtain a first feature point set; a second feature subunit, used to extract feature points after downsampling the second frame according to the first downsampling ratio to obtain a second feature point set; a global low-precision registration subunit, used to generate the global low-precision registration information for transforming the second frame to the first frame based on the first feature point set and the second feature point set.

[0036] In combination with some embodiments of the second aspect, in some embodiments, the second registration subunit specifically includes: a third feature subunit, used to crop the first frame according to the first area ratio, the first center point position and the first shape to obtain a first cropped area, extract feature points from the first cropped area to obtain a third feature point set; the first area ratio is the ratio of the area of ​​the first cropped area to the total area of ​​the first frame, and the first shape is the shape of the first cropped area; the first center point position is the position of the center point of the first cropped area relative to the center point of the first frame; a fourth feature subunit, used to crop the second frame according to the first area ratio, the first center point position and the first shape to obtain a second cropped area, extract feature points from the second cropped area to obtain a fourth feature point set; a local high-precision registration subunit, used to generate the local high-precision registration information for transforming the second cropped area to the first cropped area based on the third feature point set and the fourth feature point set.

[0037] In combination with some embodiments of the second aspect, in some embodiments, the first downsampling ratio is a preset downsampling ratio; or the first downsampling ratio is a downsampling ratio determined by the terminal device according to real-time computing capability.

[0038] In combination with some embodiments of the second aspect, in some embodiments, the first area ratio is a preset ratio; or the first area ratio is a ratio determined by the terminal device according to real-time computing capability.

[0039] In combination with some embodiments of the second aspect, in some embodiments, the first center point position is the center point of the frame.

[0040] In combination with some embodiments of the second aspect, in some embodiments, the first shape is a rectangle or a square.

[0041] In combination with some embodiments of the second aspect, in some embodiments, it is characterized in that the second acquisition module specifically includes: an identification sending unit, used to send a clear frame selection identification to the second camera, and the clear frame selection identification includes time information and blur degree information of the first frame; a feedback receiving unit, used to receive the second frame corresponding to the first frame fed back by the second camera.

[0042] In combination with some embodiments of the second aspect, in some embodiments, the second frame is a frame captured by the second camera, the capture time interval between which and the first frame is within a first preset time length, and the blurriness of which does not exceed a preset blur threshold compared to the blurriness of the first frame.

[0043] In a third aspect, the present application provides a terminal device, comprising: one or more processors, a memory, a first camera, a second camera and a display screen; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the terminal device to execute: in response to a first operation of a user, start the first camera; when detecting that the first camera is started, start the second camera, wherein the second camera is equipped with OIS; obtain a first frame captured by the first camera; obtain a second frame captured by the second camera, the second frame corresponding to the first frame; fuse the second frame into the first frame to obtain a deblurred frame; and display an image of the deblurred frame.

[0044] In combination with some embodiments of the third aspect, in some embodiments, the one or more processors are further used to call the computer instruction to cause the terminal device to execute: determining that the first frame is a blurred frame; and determining that the second frame is a clear frame.

[0045] In combination with some embodiments of the third aspect, in some embodiments, the one or more processors are also used to call the computer instruction to enable the terminal device to execute: determining whether the first camera is equipped with OIS; if the first camera is not equipped with OIS, starting the second camera.

[0046] In combination with some embodiments of the third aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the terminal device to execute: determine the alignment information for converting the second frame to the first frame; and fuse the second frame into the first frame based on the alignment information to obtain the deblurred frame.

[0047] In combination with some embodiments of the third aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the terminal device to execute: generating global low-precision registration information based on the feature points extracted after downsampling the first frame and the second frame; generating local high-precision registration information based on the feature points extracted after cropping the first frame and the second frame; and calibrating the global low-precision registration information using the local high-precision registration information to obtain global high-precision registration information as the registration information for converting the second frame to the first frame.

[0048] In combination with some embodiments of the third aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the terminal device to execute: extracting feature points after downsampling the first frame according to a first downsampling ratio to obtain a first feature point set; extracting feature points after downsampling the second frame according to the first downsampling ratio to obtain a second feature point set; and generating the global low-precision registration information for transforming the second frame to the first frame based on the first feature point set and the second feature point set.

[0049] In combination with some embodiments of the third aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the terminal device to execute: cropping the first frame according to the first area ratio, the first center point position and the first shape to obtain a first cropping area, extracting feature points from the first cropping area to obtain a third feature point set; the first area ratio is the ratio of the area of ​​the first cropping area to the total area of ​​the first frame, and the first shape is the shape of the first cropping area; the first center point position is the position of the center point of the first cropping area relative to the center point of the first frame; cropping the second frame according to the first area ratio, the first center point position and the first shape to obtain a second cropping area, extracting feature points from the second cropping area to obtain a fourth feature point set; and generating the local high-precision registration information for transforming the second cropping area to the first cropping area based on the third feature point set and the fourth feature point set.

[0050] In combination with some embodiments of the third aspect, in some embodiments, the first downsampling ratio is a preset downsampling ratio; or the first downsampling ratio is a downsampling ratio determined by the terminal device according to real-time computing capability.

[0051] In combination with some embodiments of the third aspect, in some embodiments, the first area ratio is a preset ratio; or the first area ratio is a ratio determined by the terminal device according to real-time computing capability.

[0052] In combination with some embodiments of the third aspect, in some embodiments, the first center point position is the center point of the frame.

[0053] In combination with some embodiments of the third aspect, in some embodiments, the first shape is a rectangle or a square.

[0054] In combination with some embodiments of the third aspect, in some embodiments, the one or more processors are specifically used to call the computer instructions to enable the terminal device to execute: sending a clear frame selection identifier to the second camera, the clear frame selection identifier including time information and blur level information of the first frame; receiving the second frame corresponding to the first frame fed back by the second camera.

[0055] In combination with some embodiments of the third aspect, in some embodiments, the second frame is a frame captured by the second camera, the capture time interval between which and the first frame is within a first preset time length, and the blurriness of which does not exceed a preset blur threshold compared to the blurriness of the first frame.

[0056] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to a terminal device, and the chip system includes one or more processors, which are used to call computer instructions so that the terminal device executes the method described in the first aspect and any possible implementation method of the first aspect.

[0057] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when the computer program product is run on a terminal device, enables the terminal device to execute the method described in the first aspect and any possible implementation method of the first aspect.

[0058] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions. When the instructions are executed on a terminal device, the terminal device executes the method described in the first aspect and any possible implementation method of the first aspect.

[0059] It can be understood that the terminal device provided in the second aspect, the terminal device provided in the third aspect, the chip system provided in the fourth aspect, the computer program product provided in the fifth aspect, and the computer storage medium provided in the sixth aspect are all used to execute the method provided in the embodiment of the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 It is a schematic diagram of the information flow for image processing;

[0061] Figure 2 It is a schematic diagram of information flow of an image processing method in an embodiment of the present application;

[0062] Figure 3It is an exemplary comparison diagram of the deblurring effect after the fusion of clear frames and blurred frames with different sharpness in the embodiment of the present application;

[0063] Figure 4 is an exemplary comparison diagram of images captured by a camera equipped with OIS and a camera not equipped with OIS in an embodiment of the present application;

[0064] Figure 5 This is a schematic diagram of an information flow for image processing in an embodiment of the present application;

[0065] Figure 6 is another information flow diagram for performing image processing in an embodiment of the present application;

[0066] Figure 7 is an exemplary schematic diagram of the hardware structure of the terminal device 100 in an embodiment of the present application;

[0067] Figure 8 is a flowchart of an image processing method in an embodiment of the present application;

[0068] Fig. 9 is an exemplary schematic diagram of downsampling a frame and extracting feature points in an embodiment of the present application;

[0069] Fig.10 is a schematic diagram of an exemplary scenario for generating low-precision registration information in an embodiment of the present application;

[0070] Fig.11 is a schematic diagram of an exemplary scene of cropping a frame and extracting feature points in an embodiment of the present application;

[0071] Fig.12 is a schematic diagram of an exemplary scenario for generating local high-precision registration information in an embodiment of the present application;

[0072] Fig.13 is a schematic diagram of an exemplary scenario in which a clear frame Q1 is fused into a blurry frame M1 in an embodiment of the present application;

[0073] Fig.14 is another flowchart of the image processing method in an embodiment of the present application;

[0074] Fig.15 is another flowchart of the image processing method in an embodiment of the present application;

[0075] Fig.16 It is another flowchart of the image processing method in the embodiment of the present application. DETAILED DESCRIPTION

[0076] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.

[0077] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0078] An embodiment of the present application provides an image processing method for improving the clarity of an image captured by a terminal device.

[0079] In one implementation, Figure 1 As shown in the figure, a video sequence can be input and the blur frame detection module can be first used to determine which frames are blurry and which frames are clear. When the current frame is determined to be a blur frame, the blur kernel is generated using the blur frame. A clear frame that best matches the blur frame is selected and the blur kernel is applied to the clear frame to generate a new blur frame. The new blur frame is block matched with the original blur frame to calculate the registration information. Finally, according to the registration information, the new blur frame is fused with the original blur frame to obtain a deblurred frame. Repeating these steps many times can obtain the final deblurred video.

[0080] However, the effect of this implementation is limited by the clarity of the clear frames in the current video sequence. On the other hand, during the registration, the clear frames are first blurred and then block matching is performed. The computational complexity of this operation is extremely high and requires multiple iterations to solve. The computing power of current mobile terminal devices cannot support real-time operation when processing high-definition images (such as 4K and 1080P resolution images).

[0081] In an image processing method provided in an embodiment of the present application, Figure 2As shown, when the turned-on camera is not equipped with OIS, another camera equipped with OIS will be turned on at the same time to start shooting, and blur frame detection will be performed on the video frames output by the two cameras at the same time; then the clear frame that best matches the current blurry frame is selected and sent to the registration module for registration, and then the clear frame is fused with the blurry frame to obtain a deblurred frame, so that the blurry frame is replaced by a clearer deblurred frame, thereby improving the clarity consistency of the image taken by the terminal device.

[0082] It can be understood that the shooting in the embodiment of the present application can be taking photos or photographing, which is not limited here.

[0083] like Figure 3 FIG. 1 is an exemplary comparison diagram of the deblurring effect of the deblurred frame obtained by fusing the clear frames with different sharpness with the blurry frames. It can be seen that the clearer the clear frame fused with the blurry frame is, the better the deblurring effect of the blurry frame is.

[0084] like Figure 4 FIG. 1 is a schematic diagram showing an exemplary comparison of images captured by a camera equipped with OIS and a camera not equipped with OIS. It can be seen that the image captured by the camera equipped with OIS is clearer than that captured by the camera not equipped with OIS.

[0085] In the image processing method provided by the present application, the terminal device does not only search for clear frames from the video sequence shot by a camera that is not equipped with OIS, but also starts another camera with OIS when the camera is started. Clear frames that match the blurred frames can be found from the frames shot by the camera with OIS. Since the camera equipped with OIS can obtain more clear frames, the deblurring effect of the blurred frames can be better after adopting the image processing method, so that the clarity consistency of the images shot by the terminal device is higher.

[0086] In another image processing method provided in an embodiment of the present application, Figure 5 As shown, when the clear frame A and the blurred frame B need to be fused, the terminal device can, on the one hand, downsample the clear frame A and the blurred frame B to obtain global low-precision registration information; on the other hand, it can crop the specific areas corresponding to the clear frame A and the blurred frame B to obtain local high-precision registration information; then use the local high-precision registration information to improve the accuracy of the global low-precision registration information to obtain global high-precision registration information; finally, use the global high-precision registration information to fuse the clear frame A and the blurred frame B to obtain a deblurred frame, so that the blurry frame is replaced by a clearer deblurred frame, thereby improving the clarity consistency of the image taken by the terminal device.

[0087] It can be understood that after downsampling the clear frame and the blurred frame to obtain the global low-precision registration information, the amount of calculation required to obtain the global registration information is greatly reduced, and when the terminal device is a mobile terminal device, the mobile terminal device can perform relevant calculations in real time. Correspondingly, only calculating the local high-precision registration information of a small part of the clear frame and the blurred frame after cropping also greatly reduces the amount of calculation required to obtain the high-precision registration information between the clear frame and the blurred frame, so that the mobile terminal device can perform relevant calculations in real time. Therefore, after adopting this image processing method, the amount of calculation required for the mobile terminal to fuse the clear frame and the blurred frame is greatly reduced, and the mobile terminal can perform relevant processing in real time, so that the clarity consistency of the image captured by the terminal device is higher.

[0088] It is understandable that the above-mentioned image processing methods provided in the embodiments of the present application can also be used in combination, such as Figure 6 As shown, when the turned-on camera is not equipped with OIS, the terminal device can simultaneously turn on another camera equipped with OIS to start shooting, and perform blurred frame detection on the video frames input by the two cameras at the same time. When the camera without OIS shoots a blurred frame, you can select a clear frame shot by a camera equipped with OIS that best matches the blurred frame. On the one hand, down-sampling and registration are performed to obtain global low-precision registration information, and on the other hand, local high-precision registration information is obtained after cropping. The local high-precision registration information is then used to correct the global low-precision registration information to obtain global high-precision registration information. The global high-precision registration information is used to fuse the clear frame into the blurred frame to obtain a deblurred frame, so that the blurred frame is replaced by a clearer deblurred frame, thereby improving the clarity consistency of the image captured by the terminal device.

[0089] In this way, not only can the clarity consistency of the images taken by the terminal device be higher, but also the amount of calculation required for the registration and fusion of clear frames and blurred frames is greatly reduced. Therefore, even if the terminal device is a mobile terminal device with low computing power, relevant calculations can be performed in real time, thereby improving the clarity consistency of the captured images in real time.

[0090] The following introduces an exemplary terminal device 100 provided in an embodiment of the present application.

[0091] Figure 7 It is a structural diagram of the terminal device 100 provided in an embodiment of the present application.

[0092] The embodiment is described in detail below by taking the terminal device 100 as an example. It should be understood that the terminal device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0093] The terminal device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, one or more cameras 193, a display screen 194 and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0094] It is understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0095] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0096] The controller may be the nerve center and command center of the terminal device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0097] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0098] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0099] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the terminal device 100.

[0100] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0101] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0102] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0103] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the terminal device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the terminal device 100.

[0104] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0105] The SIM interface can be used to communicate with the SIM card interface 195 to implement the function of transmitting data to the SIM card or reading data in the SIM card.

[0106] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the terminal device 100, and can also be used to transmit data between the terminal device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other terminal devices, such as AR devices, etc.

[0107] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0108] The charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.

[0109] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.

[0110] The wireless communication function of the terminal device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0111] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0112] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0113] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0114] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the terminal device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0115] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0116] The terminal device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0117] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0118] The terminal device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0119] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0120] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0121] In the embodiment of the present application, the one or N cameras 193 may include cameras equipped with OIS and cameras not equipped with OIS, which is not limited here.

[0122] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the terminal device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0123] Video codecs are used to compress or decompress digital videos. The terminal device 100 may support one or more video codecs. Thus, the terminal device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0124] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the terminal device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0125] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0126] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.

[0127] Non-volatile memory may include disk storage devices and flash memory.

[0128] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.

[0129] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data, etc.

[0130] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0131] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the terminal device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.

[0132] The terminal device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0133] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0134] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The terminal device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0135] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the terminal device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the ear.

[0136] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The terminal device 100 can be provided with at least one microphone 170C. In other embodiments, the terminal device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the terminal device 100 can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, realization of directional recording function, etc.

[0137] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0138] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The terminal device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the terminal device 100 detects the touch operation intensity according to the pressure sensor 180A. The terminal device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0139] The gyroscope sensor 180B can be used to determine the motion posture of the terminal device 100. In some embodiments, the angular velocity of the terminal device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the terminal device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the terminal device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.

[0140] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0141] The magnetic sensor 180D includes a Hall sensor. The terminal device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the terminal device 100 is a flip phone, the terminal device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover automatic unlocking and other features are set.

[0142] The acceleration sensor 180E can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes). When the terminal device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the terminal device and applied to applications such as horizontal and vertical screen switching and pedometers.

[0143] The distance sensor 180F is used to measure the distance. The terminal device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the terminal device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0144] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The terminal device 100 emits infrared light outward through the light emitting diode. The terminal device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 100. When insufficient reflected light is detected, the terminal device 100 can determine that there is no object near the terminal device 100. The terminal device 100 can use the proximity light sensor 180G to detect that the user holds the terminal device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode, and pocket mode automatically unlocks and locks the screen.

[0145] The ambient light sensor 180L is used to sense the ambient light brightness. The terminal device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the terminal device 100 is in a pocket to prevent accidental touch.

[0146] The fingerprint sensor 180H is used to collect fingerprints. The terminal device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0147] The temperature sensor 180J is used to detect temperature. In some embodiments, the terminal device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the terminal device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the terminal device 100 heats the battery 142 to avoid abnormal shutdown of the terminal device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the terminal device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

[0148] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the terminal device 100, which is different from the position of the display screen 194.

[0149] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The terminal device 100 may receive key input and generate key signal input related to user settings and function control of the terminal device 100.

[0150] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0151] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.

[0152] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the terminal device 100 by inserting the SIM card interface 195 or pulling the SIM card interface 195 out. The terminal device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The terminal device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.

[0153] In the embodiment of the present application, the processor 110 can call the operation instructions stored in the internal memory 121 according to the image acquired by the camera 194, execute the image processing method in the embodiment of the present application, improve the clarity of the image taken by the terminal device, and send it to the display screen 194 for display.

[0154] The following describes some application scenarios involved in the embodiments of the present application in combination with the hardware structure of the exemplary terminal device 100:

[0155] For example, in an application scenario, terminal device A has 1 front camera and 2 rear cameras. The 2 rear cameras are: a main camera with high image clarity and equipped with OIS, and a wide-angle lens with a wide viewing angle and short focal length. If the user needs to take photos or videos with higher definition, the main camera can be turned on for shooting; if the user needs to take photos or videos with a wider range of images, the wide-angle camera can be turned on for shooting.

[0156] The main camera and wide-angle camera will be used separately according to the user's choice. When shooting by default, terminal device A starts the wide-angle camera to shoot, and obtains photos or videos with a wider screen range. If the user needs to take higher-definition photos or videos, it is necessary to adjust the shooting mode to high-definition shooting mode. At this time, terminal device A will turn off the wide-angle camera and switch to start the main camera for shooting. At this time, the photos or videos taken will have higher resolution, but the screen range will be smaller.

[0157] After adopting the image processing method in the embodiment of the present application, when the terminal device A starts the wide-angle camera by default to shoot, the main camera will be started at the same time, and a text prompt box can be displayed on the display screen to prompt the user: "The main camera will be used at the same time to improve the clarity of the picture taken by the wide-angle camera". When the wide-angle camera is working, the terminal device A will start the main camera, and use the higher-definition frames captured by the main camera to deblur the blurred frames captured by the wide-angle camera, so that the final captured picture is clearer and has a wider range.

[0158] For example, in another application scenario, terminal device A has 1 front camera and 3 rear cameras. The 3 rear cameras are: a main camera with high image clarity and equipped with OIS, a wide-angle lens with a wide viewing angle and a short focal length, and a telephoto camera with a small viewing angle and a long focal length. If the user needs to take photos or videos with higher definition, the main camera can be turned on for shooting; if the user needs to take photos or videos with a wider range of images, the wide-angle camera can be turned on for shooting; if the user needs to shoot scenes farther away, the telephoto camera can be turned on for shooting.

[0159] The main camera, wide-angle camera and telephoto camera will be used separately according to the user's choice. When shooting by default, terminal device A starts the wide-angle camera to shoot, so as to obtain photos or videos with a wider screen range. If the user needs to take higher-definition photos or videos, it is necessary to adjust the shooting mode to the high-definition shooting mode. At this time, terminal device A will turn off the wide-angle camera and switch to start the main camera for shooting. At this time, the photos or videos taken will have higher resolution, but the screen range will be smaller. If the user needs to shoot a scene farther away, it is necessary to adjust to the long-distance shooting mode. At this time, terminal device A will turn off other cameras and switch to start the telephoto camera for shooting. At this time, it can shoot scenes farther away, but the photos or videos taken have a small viewing angle and low resolution.

[0160] After adopting the image processing method in the embodiment of the present application, when the terminal device A starts the wide-angle camera by default to shoot, the main camera will be started at the same time, and a text prompt box can be displayed on the display screen to prompt the user: "The main camera will be used at the same time to improve the clarity of the picture taken by the wide-angle camera". When the wide-angle camera is working, the terminal device A will start the main camera, and use the higher-definition frames captured by the main camera to deblur the blurred frames captured by the wide-angle camera, so that the final captured picture is clearer and has a wider range.

[0161] If the user wants to take pictures of distant objects, the shooting mode is adjusted to the telephoto shooting mode. When the terminal device A starts the telephoto camera, the main camera can be started at the same time, and a text prompt box can be displayed on the display screen to remind the user: "The main camera will be used at the same time to improve the clarity of the picture taken by the telephoto camera". When the wide-angle camera is working, the terminal device A will start the main camera, and use the higher-definition frames collected by the main camera to deblur the blurred frames collected by the telephoto camera, so that not only can the farther objects be captured, but the picture is also clear.

[0162] For example, in another application scenario, terminal device A has 1 front camera and 4 rear cameras. The 4 rear cameras are: a main camera with high image clarity and equipped with OIS, a wide-angle lens with a wide viewing angle and a short focal length, a telephoto camera 1 with a small viewing angle and a long focal length and equipped with OIS, and a telephoto camera 2 with a longer focal length. If the user needs to take photos or videos with higher definition, the main camera can be turned on for shooting; if the user needs to take photos or videos with a wider range of images, the wide-angle camera can be turned on for shooting; if the user needs to shoot a scene farther away, the telephoto camera 1 can be turned on for shooting; if the user needs to shoot a scene farther away, the telephoto camera 2 can be turned on for shooting.

[0163] Among them, the main camera, wide-angle camera, telephoto camera 1 and telephoto camera 2 will all be used separately according to the user's choice. When shooting by default, terminal device A starts the wide-angle camera to shoot, and obtains photos or videos with a wider screen range. If the user needs to take higher-definition photos or videos, it is necessary to adjust the shooting mode to the high-definition shooting mode. At this time, terminal device A will turn off the wide-angle camera and switch to start the main camera for shooting. At this time, the photos or videos taken have higher resolution, but the screen range is smaller. If the user needs to shoot a scene at a distance, it is necessary to adjust to the long-distance shooting mode. At this time, terminal device A will turn off other cameras and switch to start telephoto camera 1 for shooting. At this time, the scene at a distance can be shot; if the user needs to shoot a scene at a farther distance, it is necessary to adjust to the ultra-telephoto shooting mode. At this time, terminal device A will turn off other cameras and switch to start telephoto camera 2 for shooting. At this time, the scene at a farther distance can be shot, but the photos or videos taken have a small viewing angle and low resolution.

[0164] After adopting the image processing method in the embodiment of the present application, when the terminal device A starts the wide-angle camera by default to shoot, the main camera will be started at the same time, and a text prompt box can be displayed on the display screen to prompt the user: "The main camera will be used at the same time to improve the clarity of the picture taken by the wide-angle camera". When the wide-angle camera is working, the terminal device A will start the main camera, and use the higher-definition frames captured by the main camera to deblur the blurred frames captured by the wide-angle camera, so that the final captured picture is clearer and has a wider range.

[0165] If the user wants to shoot very far away objects, the shooting mode is adjusted to the ultra-telephoto shooting mode. When the terminal device A starts the telephoto camera 2, the telephoto camera 1 can be started at the same time, and a text prompt box can be displayed on the display screen to prompt the user: "The telephoto camera 1 will be used at the same time to improve the clarity of the picture shot by the telephoto camera 2". When the telephoto camera 1 is working, the terminal device A will start the telephoto camera 2, and use the higher-definition frames captured by the telephoto camera 1 to deblur the blurred frames captured by the telephoto camera 2, so that not only can the farther objects be captured, but the picture is also very clear.

[0166] For example, in another application scenario, terminal device A has 1 front camera and 3 rear cameras. The 3 rear cameras are: a main camera with high image clarity, a wide-angle lens with a wide viewing angle and short focal length, and an anti-shake camera equipped with OIS. If the user needs to take photos or videos with higher definition, the main camera can be turned on for shooting; if the user needs to take photos or videos with a wider range of images, the wide-angle camera can be turned on for shooting; if the user needs to take pictures of the scene while moving, the anti-shake camera can be turned on for shooting.

[0167] The main camera, wide-angle camera, and anti-shake camera will all be used separately according to the user's choice. By default, terminal device A starts the wide-angle camera to shoot, so as to obtain photos or videos with a wider screen range. If the user needs to take higher-definition photos or videos, it is necessary to adjust the shooting mode to the high-definition shooting mode. At this time, terminal device A will turn off the wide-angle camera and switch to start the main camera for shooting. At this time, the photos or videos taken will have higher resolution, but the screen range will be smaller. If the user needs to shoot while moving, it is necessary to adjust to the anti-shake mode. At this time, terminal device A will turn off other cameras and switch to start the anti-shake camera for shooting, so that the picture can be kept stable when shooting while moving.

[0168] After adopting the image processing method in the embodiment of the present application, when the terminal device A starts the wide-angle camera by default to shoot, the anti-shake camera will be started at the same time, and a text prompt box can be displayed on the display screen to prompt the user: "The anti-shake camera will be used at the same time to improve the clarity of the picture taken by the wide-angle camera". When the wide-angle camera is working, the terminal device A will start the anti-shake camera, and use the frames with stable clarity collected by the anti-shake camera to deblur the blurred frames collected by the wide-angle camera, so that the final captured picture is clearer and more stable.

[0169] If the user wants to take a clearer picture, after adjusting the shooting mode to the high-definition shooting mode, the terminal device A will start the anti-shake camera at the same time when starting the main camera for shooting, and a text prompt box may be displayed on the display screen to remind the user: "The anti-shake camera will be used at the same time to improve the stability of the picture taken by the main camera". When the main camera is working, the terminal device A will start the anti-shake camera, and use the clear and stable frames collected by the anti-shake camera to deblur the blurred frames collected by the main camera, so that the final captured picture is clearer and more stable.

[0170] It is understandable that, in addition to the above-mentioned exemplary application scenarios, in some other application scenarios, the terminal device may have more or fewer cameras, and these cameras may also have various other functions, which are not limited here.

[0171] The following describes the image processing method in the embodiment of the present application in detail in combination with the hardware structure of the exemplary terminal device 100 and some specific application scenarios:

[0172] Application scenario 1: The terminal device includes camera A with a wide-angle lens but not equipped with OIS and camera B with an anti-shake function but equipped with OIS. The user starts camera A to take a photo.

[0173] See also Figure 8 , is a flow chart of the image processing method in the embodiment of the present application:

[0174] S801, in response to operation A of starting shooting by a user, the terminal device turns on camera A which is not equipped with OIS;

[0175] It can be understood that operation A can be clicking on a photo shooting control, clicking on a video recording control, or other combination of operations that can trigger the start of shooting, etc., which is not limited here; the photo shooting control or the video recording control can be a control in the software preset by the terminal device at the factory, or a control in third-party software, which is not limited here.

[0176] For example, the user wants to shoot an external scene, so the user can open the video recording software and click to start recording as operation A, triggering the interrupt device to turn on the camera A with a wide-angle lens that is not equipped with OIS to shoot the surrounding scene.

[0177] S802, the terminal device caches a 5-frame video sequence shot by camera A in real time, which is recorded as X1;

[0178] After the terminal device turns on camera A, camera A can capture video frames to obtain a video sequence. The terminal device can cache the video sequence captured by camera A in real time.

[0179] In the embodiment of the present application, the terminal device caches a 5-frame video sequence shot by camera A as an example, and the 5-frame video sequence cached in real time is recorded as X1. It can be understood that in actual applications, the terminal device can cache more or fewer frames of video sequences shot by camera A in real time, which is not limited here.

[0180] It should be noted that the terminal device can cache multiple frames as a video sequence when recording or taking photos. The difference is that, if taking photos, the terminal device can finally select an optimal frame from the video sequence as the photo.

[0181] S803, when detecting that camera A is started, the terminal device starts camera B equipped with OIS;

[0182] In the embodiment of the present application, when it is detected that the camera A which is not equipped with OIS is started, the terminal device will start the camera B which is equipped with OIS.

[0183] Specifically, in some embodiments of the present application, the terminal device may first determine whether the activated camera is equipped with OIS. When it is determined that the activated camera A is not equipped with OIS, the terminal device will activate the camera B equipped with OIS.

[0184] It is understandable that in scenes with relatively harsh shooting environments, such as dark environments, shaking scenes, etc., camera B equipped with OIS can capture clearer frame images than camera A not equipped with OIS.

[0185] On the other hand, although the frame image captured by camera A may not be as clear as the frame image captured by camera B, since camera A has a wide-angle lens, the frame image captured by camera A may cover a wider range of scenes and have a stronger sense of spatial depth. Therefore, the two cameras have different functions and roles to meet user needs, and the frame image captured by one camera will not completely replace the frame image captured by another camera.

[0186] In some embodiments of the present application, the camera A may also be referred to as a first camera, and the camera B may also be referred to as a second camera, which is not limited here.

[0187] S804, the terminal device caches a 5-frame video sequence shot by camera B in real time, which is recorded as X2;

[0188] After the terminal device turns on camera B, camera B can capture video frames to obtain a video sequence. The terminal device can cache the video sequence captured by camera B in real time.

[0189] In the embodiment of the present application, the terminal device caches a 5-frame video sequence shot by camera B as an example, and the 5-frame video sequence cached in real time is recorded as X2. It can be understood that in actual applications, the terminal device can cache more or fewer frames of video sequences shot by camera B in real time, which is not limited here.

[0190] S805, taking the middle frame of X1 as the current frame D1, and the terminal device determines whether the current frame D1 is a clear frame;

[0191] The terminal device starts the camera to shoot pictures, caches the captured frames to obtain a video sequence, and then displays the frames in the video sequence in a certain time sequence.

[0192] For example, for a 5-frame video sequence X1 captured by camera A, the terminal device can display the 5 frames in X1 in order from the earliest to the latest shooting time. If the frame to be displayed is called the current frame D1, assuming that the middle frame of X1 is the current frame D1, the terminal device can first determine whether the current frame D1 is a clear frame.

[0193] It should be noted that, to determine whether a frame is a blurred frame or a clear frame, relevant methods in the prior art can be used, such as determining the change curve of the color level between consecutive pixels, determining the degree of sharpening, etc., which will not be elaborated here.

[0194] There are many specific ways to judge blurry frames and clear frames according to preset conditions, for example:

[0195] In some embodiments, if the first preset condition is a condition set in the terminal device that a frame is a blurred frame, when the current frame meets the first preset condition, the terminal device can determine that the current frame D1 is a blurred frame; if the current frame does not meet the first preset condition, the terminal device can determine that the current frame D1 is a clear frame.

[0196] In some other embodiments, if the second preset condition is a condition that a frame is a clear frame set in the terminal device, when the current frame meets the second preset condition, the terminal device can determine that the current frame D1 is a clear frame; if the current frame does not meet the second preset condition, the terminal device can determine that the current frame D1 is a blurred frame;

[0197] In other embodiments, if the third preset condition is a condition that a frame set in the terminal device is a blurred frame, and the fourth preset condition is a condition that a frame set in the terminal device is a clear frame, when the current frame meets the third preset condition, the terminal device can determine that the current frame D1 is a blurred frame; if the current frame meets the fourth preset condition, the terminal device can determine that the current frame D1 is a clear frame.

[0198] It is understandable that there may be more ways to combine various conditions to determine whether a frame is a blurry frame or a clear frame, which is not limited here.

[0199] In the embodiment of the present application, when the terminal device determines that the current frame D1 is a clear frame, step S816 can be executed; when the terminal device determines that the current frame D1 is not a clear frame, step S806 can be executed.

[0200] In some embodiments, if the terminal device directly determines that the current frame D1 is a blurred frame, step S806 may not be executed, and the subsequent steps of step S806 may be directly executed, which is not limited here.

[0201] S806, the terminal device determines that the current frame D1 is a fuzzy frame, recorded as fuzzy frame M1;

[0202] If the first preset condition is a condition that a frame is a fuzzy frame set in the terminal device, when the current frame D1 meets the first preset condition, the terminal device can determine that the current frame D1 is a fuzzy frame, which can be recorded as a fuzzy frame M1 in the embodiment of the present application.

[0203] In the embodiment of the present application, after determining that a frame is a blurred frame, subsequent steps S807, S808, and S810 may be executed. It is understandable that the terminal device may execute these steps synchronously according to the computing power and execution speed, or may execute these steps in sequence in a certain order, or may dynamically adjust the execution order of these steps in real time during the execution process, etc., which is not limited here.

[0204] S807, the terminal device selects a clear frame Q1 matching the blurry frame M1 from X2;

[0205] After the terminal device determines that the current frame D1 is the blurred frame M1, a clear frame Q1 that matches the blurred frame M1 and is clear can be selected from the video sequence X2 captured and cached by the camera B.

[0206] In some embodiments, after determining that the current frame D1 is a blurry frame M1, the terminal device may send a clear frame selection identifier to camera B, and a matching and clear clear frame Q1 may be determined by camera B. The clear frame selection identifier may carry time information and blur degree information of the blurry frame M1.

[0207] In some embodiments, the determined clear frame Q1 can be a frame in the video sequence X2 whose clarity does not exceed the blurriness threshold compared with the blurry frame M1, and whose acquisition time is closest to the acquisition time of the blurry frame M1, or a frame whose acquisition time is within the first preset time length of the acquisition time of the blurry frame M1.

[0208] The specific rule for selecting which frame in the video sequence X2 as the clear frame Q1 matching the blurred frame M1 can be determined according to actual needs, or by referring to the relevant rules in the prior art for selecting a clear frame matching a target frame from a video sequence, which is not limited here.

[0209] S808, the terminal device downsamples the blurred frame M1 and extracts a feature point T1;

[0210] It is understandable that downsampling, also known as image reduction, i.e. reducing the image resolution, can significantly reduce the computing power required for image-related calculations. For example, if an image I is of size M*N, downsampling it by a factor of s will result in a resolution image of (M / s)*(N / s), where s is generally the common divisor of M and N. For an image in matrix form, this is equivalent to converting the image in the s*s window of the original image into a pixel, and the value of this pixel is the mean of all pixels in the window.

[0211] In some embodiments, a feature point may refer to a point where the grayscale value of an image changes dramatically or a point with a large curvature on the edge of an image (i.e., the intersection of two edges). Image feature points can play a role in an image matching algorithm based on feature points. Image feature points can reflect the essential features of an image and can identify a target object in an image. Image matching can be accomplished by matching feature points.

[0212] In the embodiment of the present application, the first downsampling ratio at which the terminal device downsamples the blurred frame M1 may be a preset downsampling ratio or a downsampling ratio determined according to the current computing capability of the terminal device, which is not limited here.

[0213] It is understandable that after the blurred frame M1 is downsampled, the feature points of the downsampled image can be extracted by using the related feature point extraction method in the prior art to obtain the feature point T1, which will not be described in detail here.

[0214] For example, Fig. 9 The figure shows an exemplary schematic diagram of downsampling a frame and extracting feature points. Downsampling the blurred frame M1 with a size of 10*10 by 2 times can obtain a 5*5 picture. Feature points are extracted from the picture to obtain a matrix set [T1] describing the feature points of the image.

[0215] S809, the terminal device downsamples the clear frame Q1 and extracts feature points T2;

[0216] The method of downsampling and extracting features is similar to that in step S808 and will not be described again here.

[0217] It can be understood that, in the embodiment of the present application, step S809 adopts the same first downsampling ratio as that in step S808.

[0218] S810, the terminal device generates global low-precision registration information H1 according to the feature point T1 and the feature point T2;

[0219] Image registration is the process of matching and superimposing two or more images acquired at different times, with different sensors or under different weather conditions. The registration process can generally be carried out in the following way: first, feature extraction is performed on the two images to obtain feature points; matching feature point pairs are found by performing similarity measurement; then, image space coordinate transformation parameters are obtained through matching feature point pairs; and finally, image registration is performed based on the coordinate transformation parameters.

[0220] In the embodiment of the present application, the matrix of image space coordinate transformation parameters from a clear frame to a blurred frame is referred to as registration information.

[0221] It is understandable that the methods for generating low-precision registration information and high-precision registration information can be the same. However, since the blurred frame M1 and the clear frame Q1 are downsampled, relatively few feature points are extracted. Therefore, the generated registration information is called global low-precision registration information H1.

[0222] For example, Fig.10The figure shows an exemplary scenario diagram for generating low-precision registration information. For the 5*5 picture obtained by downsampling the 10*10 blurry frame M1, the feature point T1 extracted, and the 4*4 picture obtained by downsampling the 8*8 clear frame Q1, the feature point T2 extracted, the similarity measurement is performed to find the matching feature point pairs, and then the global low-precision registration information H1 from the clear frame Q1 to the blurry frame M1 can be calculated through the matching feature point pairs.

[0223] S811, the terminal device crops the blurred frame M1 and extracts feature points T3;

[0224] In the embodiment of the present application, cropping the frame means reducing the image size of the frame without reducing the resolution of the frame (without losing clarity).

[0225] Specifically, in some embodiments, the terminal device may crop the blurred frame M1 according to the first area ratio, the first center point position and the first shape, blur the cropped area, extract feature points from the blurred cropped area, and obtain feature points T3. The first area ratio is the ratio of the area of ​​the blurred cropped area to the total area of ​​the blurred frame, the first shape is the shape of the blurred cropped area, and the first center point position is the position of the center point of the blurred cropped area relative to the center point of the blurred frame.

[0226] In some embodiments, the center area of ​​the frame is cropped, that is, the first center point is the center point of the frame. It is understandable that other positions in the frame can also be selected for cropping according to actual conditions, which is not limited here.

[0227] In some embodiments, the first area ratio may be a preset ratio, or a ratio determined by the terminal device according to real-time computing capability, which is not limited here.

[0228] In some embodiments, the first shape may be a square or a rectangle. It is understandable that, according to actual conditions, the screen may be cut into other shapes, which is not limited here.

[0229] In some embodiments, for a frame image with a 4K resolution, it can be cropped according to the first area ratio of 1 / 4. It can be understood that, depending on the actual situation, it can also be cropped to obtain a larger or smaller image, which is not limited here.

[0230] For example, Fig.11 As shown in FIG. 1 , a schematic diagram of an exemplary scene of cropping a frame and extracting feature points is shown. For a 10*10 blurred frame M1, a 5*5 image in the central area can be cropped and feature points can be extracted from the image to obtain a matrix set of feature points describing the image [T3].

[0231] S812, the terminal device crops the clear frame Q1 and extracts feature points T4;

[0232] The method of cutting and extracting features is similar to step S811 and will not be repeated here.

[0233] Specifically, in some embodiments, the terminal device may crop the clear frame Q1 according to the first area ratio, the first center point position and the first shape to obtain a clear cropped area, extract feature points from the clear cropped area, and obtain feature points T4. The first area ratio is the ratio of the area of ​​the clear cropped area to the total area of ​​the clear frame, the first shape is the shape of the clear cropped area, and the first center point position is the position of the center point of the clear cropped area relative to the center point of the clear frame.

[0234] It can be understood that in the embodiment of the present application, the first area ratio, the first center point position and the first shape in step S812 are the same as those in step S812.

[0235] It should be noted that the above-mentioned feature point T1, feature point T2, feature point T3, and feature point T4 in the embodiment of the present application can all be feature point sets.

[0236] S813, the terminal device generates local high-precision registration information h2 according to the feature point T3 and the feature point T4;

[0237] According to the feature points T3 and T4, the terminal device can generate registration information h2 for transforming the image space of the picture obtained by cutting the clear frame Q1 into the image space of the picture obtained by cutting the blurred frame M1.

[0238] For example, Fig.12 As shown in FIG. 1 , a schematic diagram of an exemplary scenario for generating local high-precision registration information is shown. For the 5*5 image obtained by cutting the central area of ​​the 10*10 blurred frame M1, the feature point T3 extracted, and the 4*4 image obtained by cutting the central area of ​​the 8*8 clear frame Q1, the feature point T4 extracted, the similarity measurement is performed to find the matching feature point pairs, and then the local high-precision registration information h2 of the image obtained by cutting the clear frame Q1 to the image obtained by cutting the blurred frame M1 can be calculated through the matching feature point pairs.

[0239] S814, the terminal device uses the local high-precision registration information h2 to correct the global low-precision registration information H1 to obtain global high-precision registration information H3;

[0240] The terminal device may correct the global low-precision registration information H1 according to the local high-precision registration information h2 to improve the accuracy of the global low-precision registration information, thereby obtaining the global high-precision registration information H3.

[0241] It is understandable that there are many specific ways to use h2 to calibrate H1 to obtain H3, and one of them is described below as an example:

[0242] The registration information H1, h2, and H3 are matrices composed of the registration information of each block of the entire image. The registration information of the i-th block of the image represented by H1 is recorded as Hi; the registration information of the i-th block of the image represented by h2 is recorded as hi; the registration information of the j-th block of the image around Hi is recorded as Hj; the weight of the i-th block of registration information is recorded as ωi; the spatial consistency hyperparameter is recorded as λ; and H3 is recorded as Using the following formula 1, by making h i The value is close to H i , so that H j The value is close to the surrounding H i The value of

[0243]

[0244] S815, the terminal device uses the global high-precision registration information H3 to fuse the clear frame Q1 with the blurred frame M1 to obtain a deblurred frame F1;

[0245] After obtaining the global high-precision registration information H3, the terminal device can use H3 to fuse the clear frame Q1 into the blurry frame M1 to obtain the deblurred frame F1.

[0246] For example, Fig.13 FIG. 1 is a schematic diagram of an exemplary scene in which a clear frame Q1 is fused to a blurred frame M1. According to the global high-precision registration information H3, each image block in the clear frame Q1 can be transformed to a corresponding position in the blurred frame M1 and fused to the blurred frame M1, thereby obtaining a deblurred frame F1.

[0247] S816. The terminal device displays the image of the deblurred frame or the image of the clear frame in X1;

[0248] When the terminal device determines that the current frame in X1 is a clear frame in step S805, or when the terminal device determines that the current frame in X1 is a blurred frame in step S805, after subsequently processing the blurred frame into a deblurred frame, the terminal device can display the image of the deblurred frame or the image of the clear frame in X1.

[0249] In the embodiment of the present application, when the camera started for shooting does not have OIS, the terminal device can simultaneously start a camera with OIS, and use the clear frame shot by the camera with OIS to deblur the blurry frame without OIS, which can make the terminal device have a better deblurring effect on the blurry frame, so that the clarity consistency of the picture displayed by the terminal device is higher. In addition, when performing the deblurring process, the terminal device downsamples the clear frame and the blurry frame respectively, extracts the feature point matching to obtain global low-precision registration information, and extracts the feature point matching after cropping to obtain local high-precision registration information, and then uses the local high-precision registration information to calibrate the global low-precision registration information to obtain the global high-precision information required for the deblurring process, which greatly reduces the computing power required for image registration, so that even if the terminal device is a mobile terminal device, it is possible to achieve real-time deblurring, so that the clarity consistency of the image shot by the mobile terminal device is higher.

[0250] The following is a detailed description of the image processing method in the embodiment of the present application by taking another application scenario as an example:

[0251] Application scenario 2: The terminal device includes a camera C, which is equipped with OIS, or the camera C is not equipped with OIS and the terminal device does not have a camera equipped with OIS. The user starts the camera C to shoot.

[0252] See also Fig.14 , is another flowchart of the image processing method in the embodiment of the present application:

[0253] S1401, in response to the user's operation B of starting shooting, the terminal device turns on the camera C;

[0254] In some embodiments of the present application, the camera C may also be referred to as a second camera, which is not limited here.

[0255] S1402, the terminal device caches a 5-frame video sequence captured by camera C in real time, which is recorded as X3;

[0256] Steps S1401 to S1402 are similar to steps S801 to S802 and will not be described again here.

[0257] S1403, taking the middle frame of X3 as the current frame D1, and the terminal device determines whether the current frame D1 is a clear frame;

[0258] S1404, the terminal device determines that the current frame D1 is a fuzzy frame, recorded as fuzzy frame M1;

[0259] Steps S1403 to S1404 are similar to steps S805 to S806 and will not be described in detail here.

[0260] S1405, the terminal device selects a clear frame Q1 matching the blurry frame M1 from X3;

[0261] After the terminal device determines that the current frame D1 is a blurred frame M1, a clear frame Q1 matching the blurred frame M1 can be selected from the video sequence X3 captured and cached by the camera C.

[0262] In some embodiments, the determined clear frame Q1 may be a frame in the video sequence X3 whose clarity does not exceed a blur level threshold compared with the blurry frame M1 and whose time is closest to the acquisition time of the blurry frame M1.

[0263] In some embodiments, the determined clear frame Q1 may be a frame in the video sequence X3 whose clarity does not exceed the blur level threshold compared with the blurry frame M1 and whose acquisition time is within the first preset time interval with the acquisition time of the blurry frame M1.

[0264] The specific rule for selecting which frame in the video sequence X3 as the clear frame Q1 matching the blurred frame M1 can be determined according to actual needs, or by referring to the relevant rules in the prior art for selecting a clear frame matching a target frame from a video sequence, which is not limited here.

[0265] In some embodiments, regardless of whether the camera C is equipped with OIS, steps S1401 to S1405 may be performed in sequence.

[0266] S1406, the terminal device downsamples the blurred frame M1 and extracts a feature point T1;

[0267] S1407, the terminal device downsamples the clear frame Q1 and extracts feature points T2;

[0268] S1408, the terminal device generates global low-precision registration information H1 according to the feature point T1 and the feature point T2;

[0269] S1409, the terminal device crops the blurred frame M1 and extracts feature points T3;

[0270] S1410, the terminal device crops the clear frame Q1 and extracts feature points T4;

[0271] S1411, the terminal device generates local high-precision registration information h2 according to the feature point T3 and the feature point T4;

[0272] S1412, the terminal device uses the local high-precision registration information h2 to correct the global low-precision registration information H1 to obtain global high-precision registration information H3;

[0273] S1413, the terminal device uses the global high-precision registration information H3 to fuse the clear frame Q1 with the blurred frame M1 to obtain a deblurred frame F1;

[0274] S1414. The terminal device displays the image of the deblurred frame or the image of the clear frame in X1.

[0275] Steps S1406 to S1414 are similar to steps S808 to S816 and may be included in the description of steps S808 to S816, which will not be repeated here.

[0276] In an embodiment of the present application, the terminal device can perform deblurring on the blurred frames in the video sequence captured by a camera, so that the clarity of the images displayed by the terminal device is more consistent. In addition, when performing the deblurring process, the terminal device downsamples the clear frame and the blurred frame respectively, extracts feature point matching to obtain global low-precision registration information, and extracts feature point matching to obtain local high-precision registration information after cropping, and then uses the local high-precision registration information to calibrate the global low-precision registration information to obtain the global high-precision information required for the deblurring process, which greatly reduces the computing power required for image registration, so that even if the terminal device is a mobile terminal device, it is possible to perform real-time deblurring, so that the clarity of the image captured by the mobile terminal device is more consistent.

[0277] In some embodiments of the present application, Figure 8 and Fig.14 The image processing methods in the embodiments shown can also be used in combination. For example, the terminal device can determine whether the activated camera is equipped with OIS; when it is determined that the activated camera is equipped with OIS, for example, the activated camera is camera A, the terminal device can Figure 8 The embodiment shown in the figure performs the image processing method: when it is determined that the started camera A is not equipped with OIS, the camera B equipped with OIS is started; when it is determined that the started camera is not equipped with OIS, for example, the started camera C is not equipped with OIS, the terminal device can Fig.14 The embodiment shown in the figure performs the image processing method: when it is determined that the started camera C is not equipped with OIS and a frame captured by the camera C is a blurry frame, a clear frame matching the blurry frame and being clear is determined from the frames captured by the camera C. It can be understood that there may be other methods of Figure 8 and Fig.14 The manner in which the image processing methods are combined in the illustrated embodiments is not limited herein.

[0278] Combination Figure 8 and Fig.14 The embodiment shown, as Fig.15As shown, the embodiment of the present application also provides another image processing method:

[0279] S1501, in response to operation A of the user starting shooting, the terminal device starts camera A;

[0280] S1502: When detecting that camera A is started, the terminal device starts camera B, which is equipped with OIS;

[0281] In some embodiments of the present application, when it is detected that camera A is started, the terminal device can directly start camera B.

[0282] In some embodiments of the present application, after detecting that camera A is started, the terminal device can determine whether camera A is equipped with OIS; if it is equipped with OIS, camera B is started.

[0283] S1503, the terminal device obtains the first frame captured by the camera A;

[0284] In some embodiments of the present application, the terminal device determines that the first frame is a blurred frame before executing subsequent steps.

[0285] S1504: The terminal device obtains a second frame captured by the camera B, where the second frame corresponds to the first frame;

[0286] In some embodiments of the present application, the terminal device can determine whether the frame captured by camera B is a clear frame. Only when the captured frame is a clear frame, the clear frame is used as the second frame corresponding to the first frame.

[0287] Steps S1501-S1503 may refer to the description of the above steps S801-S807, which will not be repeated here.

[0288] S1505: The terminal device fuses the second frame with the first frame to obtain a deblurred frame;

[0289] In some embodiments of the present application, the terminal device may first determine the alignment information transformed from the second frame to the first frame, and then fuse the second frame to the first frame according to the alignment information to obtain a deblurred frame.

[0290] Specifically, there are many ways for the terminal device to obtain the registration information H4:

[0291] In some embodiments, the second frame may be directly registered with the first frame to obtain the registration information H4;

[0292] In some embodiments, the second frame and the first frame may be downsampled first, and then registered to obtain the registration information H4;

[0293] In some embodiments, the registration may be performed in the manner described with reference to steps S808 to S814 above.

[0294] Other methods may also be used for registration to obtain the registration information H4, which is not limited here.

[0295] S1506: The terminal device displays the image of the deblurred frame.

[0296] Please refer to the above steps S815 to S816, which will not be described in detail here.

[0297] In an embodiment of the present application, when the terminal device starts camera A for shooting, the terminal device can simultaneously start camera B with OIS, and use the clear frames captured by camera B with OIS to deblur the blurred frames captured by camera A. This can enable the terminal device to have a better deblurring effect on the blurred frames, thereby making the clarity consistency of the picture displayed by the terminal device higher.

[0298] Combination Figure 8 and Fig.14 The embodiment shown, as Fig.16 As shown, the embodiment of the present application also provides another image processing method:

[0299] S1601, the terminal device obtains a blurry frame M1 and a clear frame Q1;

[0300] In the embodiment of the present application, the blurred frame M1 and the clear frame Q1 may come from many sources:

[0301] In some embodiments, the terminal device may obtain the blurry frame M1 and the clear frame Q1 according to steps S801 to S807;

[0302] In some embodiments, the terminal device may obtain the blurry frame M1 and the clear frame Q1 according to steps S1401 to S1405;

[0303] In some embodiments, the blurry frame M1 and the clear frame Q1 may be specified by the user;

[0304] In some embodiments, the blurry frame M1 and the clear frame Q1 may be obtained by the terminal device from the user's photo album according to a default rule;

[0305] There are many other ways to obtain the blurry frame M1 and the clear frame Q1, which are not limited here.

[0306] S1602, the terminal device downsamples the blurred frame M1 and extracts a feature point T1;

[0307] S1603, the terminal device downsamples the clear frame Q1 and extracts feature points T2;

[0308] S1604, the terminal device generates global low-precision registration information H1 according to the feature point T1 and the feature point T2;

[0309] S1605, the terminal device crops the blurred frame M1 and extracts feature points T3;

[0310] S1606, the terminal device crops the clear frame Q1 and extracts feature points T4;

[0311] S1607, the terminal device generates local high-precision registration information h2 according to the feature point T3 and the feature point T4;

[0312] S1608. The terminal device uses the local high-precision registration information h2 to correct the global low-precision registration information H1 to obtain global high-precision registration information H3.

[0313] S1609, the terminal device uses the global high-precision registration information H3 to fuse the clear frame Q1 with the blurred frame M1 to obtain a deblurred frame F1;

[0314] S1610. The terminal device displays the image of the deblurred frame F1.

[0315] Steps S1602 to S1610 are similar to steps S808 to S816, and the description of steps S808 to S816 may be referred to, which will not be repeated here.

[0316] In an embodiment of the present application, when performing deblurring processing, the terminal device downsamples the clear frame and the blurred frame respectively, extracts feature point matching to obtain global low-precision registration information, and then crops them respectively and extracts feature point matching to obtain local high-precision registration information, and then uses the local high-precision registration information to calibrate the global low-precision registration information to obtain the global high-precision information required for deblurring processing, which greatly reduces the computing power required for image registration, so that even if the terminal device is a mobile terminal device, it is possible to achieve real-time deblurring processing, so that the clarity consistency of the images taken by the mobile terminal device is higher.

[0317] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0318] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0319] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0320] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. An image processing method, characterized in that: include: In response to a first operation of the user, the terminal device starts a first camera and caches a video sequence captured by the first camera in real time; The first camera is not equipped with optical image stabilization OIS; When detecting that the first camera is started, the terminal device starts the second camera and caches the video sequence shot by the second camera in real time, where the second camera is equipped with OIS optical image stabilization; The terminal device selects a first frame from a video sequence captured by the first camera; The terminal device determines whether the first frame is a blurred frame, and if so, selects a second frame corresponding to the first frame from the video sequence captured by the second camera, and the capture time interval between the second frame and the first frame is within a first preset time length; The terminal device downsamples the first frame and extracts a feature point T1, and downsamples the second frame and extracts a feature point T2, and generates global low-precision registration information according to the feature point T1 and the feature point T2; The terminal device crops the first frame and extracts feature points T3, and crops the second frame and extracts feature points T4, and generates local high-precision registration information according to the feature points T3 and T4; The terminal device uses the local high-precision registration information to calibrate the global low-precision registration information to obtain global high-precision registration information, and uses the global high-precision registration information to fuse the second frame into the first frame to obtain a deblurred frame; the terminal device displays an image of the deblurred frame.

2. The method according to claim 1, characterized in that The terminal device downsamples the first frame and proposes a feature point T1, and downsamples the second frame and extracts a feature point T2, and generates global low-precision registration information according to the feature point T1 and the feature point T2, specifically including: The terminal device downsamples the first frame according to a first downsampling ratio and extracts feature points to obtain a first feature point set; The terminal device downsamples the second frame according to the first downsampling ratio and extracts feature points to obtain a second feature point set; The terminal device generates the global low-precision registration information for transforming the second frame into the first frame based on the first feature point set and the second feature point set.

3. The method according to claim 2, characterized in that The first downsampling ratio is a preset downsampling ratio; or the first downsampling ratio is a downsampling ratio determined by the terminal device according to real-time computing capability.

4. The method according to any one of claims 1 to 3, characterized in that The terminal device crops the first frame and extracts feature point T3, and crops the second frame and extracts feature point T4, and generates local high-precision registration information according to the feature point T3 and the feature point T4, specifically including: The terminal device crops the first frame according to the first area ratio, the first center point position and the first shape to obtain a first cropped area, and extracts feature points from the first cropped area to obtain a third feature point set; the first area ratio is the ratio of the area of ​​the first cropped area to the total area of ​​the first frame, the first shape is the shape of the first cropped area; the first center point position is the center point of the first cropped area; The terminal device crops the second frame according to the first area ratio, the first center point position and the first shape to obtain a second cropped area, and extracts feature points from the second cropped area to obtain a fourth feature point set; The terminal device generates the local high-precision registration information for transforming the second cropping area to the first cropping area based on the third feature point set and the fourth feature point set.

5. The method according to claim 4, characterized in that The first area ratio is a preset ratio; or the first area ratio is a ratio determined by the terminal device according to real-time computing capability.

6. The method according to claim 4, characterized in that The first center point position is the center point of the first frame.

7. The method according to claim 4, characterized in that The first shape is a rectangle or a square.

8. The method according to claim 1, characterized in that: The second frame is a frame captured by the second camera, in which the blurriness of the frame does not exceed a preset blur threshold compared with the blurriness of the first frame.

9. A terminal device, characterized in that: The terminal device comprises: one or more processors, a memory, a first camera, a second camera and a display screen; the first camera is not equipped with optical image stabilization OIS, and the second camera is equipped with OIS, The memory is coupled to the one or more processors, and is used to store computer program codes, wherein the computer program codes include computer instructions, and the processor executes the computer instructions to implement the steps of the method according to any one of claims 1 to 8.

10. A chip system, wherein the chip system is applied to a terminal device, the chip system comprises one or more processors, and the processor is used to call computer instructions to implement the steps of the method described in any one of claims 1-8.

11. A computer program product comprising instructions, comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

12. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Image processing method and terminal

    CN107071263A

  • Shooting method, terminal and computer readable storage medium

    CN109688293A

  • Image processing method and device, electronic equipment and computer readable storage medium

    CN110233970A