Picture panoramic depth range focusing method and device, shooting equipment and storage medium

Through the methods of autofocus calculation and image cropping and synthesis, the problem of the focus subject being out of focus outside the depth of field range during shooting is solved, and clear image presentation within the panoramic depth of field range is achieved, image quality and shooting efficiency are improved.

CN119729206APending Publication Date: 2025-03-28GUANGDONG HONGQIN COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411929606.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

During shooting, the prior art cannot guarantee the clarity of the focus subject outside the depth of field range, resulting in a degradation of image quality.

Method used

By obtaining the focus-related data of the camera module lens, performing automatic focus calculations, multiple lens focal distance values ​​covering the panoramic depth range, shooting the YUV image corresponding to each focal distance value, and cropping the highest sharpness from each frame of the image to synthesize it into a focused image within the panoramic depth range.

Benefits of technology

It realizes clear details in all depths of field from near to far, avoids the problem of blurred foreground or background, makes the image more vivid and realistic, and reduces the need to adjust the focal length multiple times and improves shooting efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119729206A_ABST
    Figure CN119729206A_ABST
Patent Text Reader

Abstract

The invention discloses a picture full depth range focusing method and device, shooting equipment and a storage medium, which are used for solving the problem that a focusing main body in a picture is out of focus outside a depth of field range during shooting in related technologies. The method comprises the following steps: acquiring focusing related data of a camera module lens; performing automatic focusing calculation based on the focusing related data to obtain a plurality of lens focal length distance values covering the panoramic depth range of the camera module lens; detecting a shooting control starting operation for a camera module lens, and obtaining a YUV image corresponding to each lens focal distance value through shooting; the method comprises the following steps of: cutting a part with the highest sharpness from each frame of YUV image as a target cut image, and synthesizing each target cut image to obtain a focus image with clear focus in a panoramic depth range, so that the image parts with different focuses are synthesized into an integrally clear image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of multimedia cameras, and in particular to a method, device, shooting equipment and storage medium for focusing a picture in a full depth range. Background Art

[0002] Focus is an essential part of photography and videography. It is directly related to the quality and visual effect of the image. Whether it is to emphasize the subject, create a sense of space or deal with complex and changing shooting conditions, accurate focus can significantly enhance the expressiveness of the photographic work. Successful focus can make the subject stand out, the details sharp, and at the same time guide the audience's attention. On the other hand, out of focus may result in a blurry image that loses visual appeal.

[0003] At present, whether it is center focus or face focus, it can only maintain partial clarity within the depth of field where the focused subject is located. The area beyond the depth of field will be out of focus and its clarity cannot be guaranteed, thus affecting the quality of the entire image. Summary of the invention

[0004] The present invention provides a method, device, shooting equipment and storage medium for focusing a picture within a full depth of field, which are used to solve or partially solve the problem in the related art that a focused subject in a picture is out of focus outside the depth of field when shooting.

[0005] The present invention provides a method for focusing a picture in a full depth range, the method comprising:

[0006] Get the focus related data of the camera module lens;

[0007] Performing auto-focus calculation based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering the full depth range of the camera module lens;

[0008] Detecting a shooting control start operation for the camera module lens, and obtaining a YUV image corresponding to each focal length value of the lens by shooting;

[0009] The sharpest portion is cropped from each frame of the YUV image as a target cropped image, and a focused image with clear focus within the full depth of field is obtained by synthesizing the target cropped images.

[0010] Optionally, the focus-related data includes a lens focal length and a plurality of lens aperture values; the value of the lens aperture value is related to a focus mode of the lens, and the focus mode includes a macro focus mode and an inf infinity focus mode; the automatic focus calculation is performed based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering the full depth range of the camera module lens, including:

[0011] Calculating a diopter value according to the focal length of the lens, and calculating a focal length distance value of the lens based on the diopter value;

[0012] By adjusting the diopter value, a plurality of different lens focal length distance values ​​are obtained;

[0013] For each of the lens focal length values, combined with the lens focal length, the depth of field value of the lens focal length value under different lens aperture values ​​is calculated, and each of the depth of field values ​​is integrated as the lens focal length value to cover the full depth range of the camera module lens.

[0014] Optionally, the calculation process of the depth of field value under any lens aperture value includes:

[0015] Calculating a foreground depth of field value and a back depth of field value according to the lens aperture value, the lens focal length value and the lens focal length;

[0016] The depth of field value of the lens focal length at the lens aperture value is obtained by summing the foreground depth of field value and the back depth of field value.

[0017] Optionally, the lens focal length value is calculated by the formula LENS_FOCUS_DISTANCE=100 / diopter value.

[0018] Optionally, obtaining a YUV image corresponding to each lens focal length value by photographing includes:

[0019] For each lens focal length value, the lens focal length value is written into a camera driving integrated circuit to control the camera module lens to move to a corresponding position and capture a frame of YUV image corresponding to the lens focal length value.

[0020] Optionally, the step of cropping a portion with the highest sharpness from each frame of the YUV image as a target cropped image includes:

[0021] For each frame of the YUV image, the image sharpness information of each area in the YUV image is counted, the part with the highest sharpness in the YUV image is determined based on the statistical results, and it is cropped to obtain a target cropped image; the target cropped image is the clearest part of the YUV image.

[0022] Optionally, the full depth range represents all depth ranges of depth values ​​from 10 centimeters to infinity.

[0023] The present invention also provides a device for focusing a picture in a full depth range, comprising:

[0024] A data acquisition unit, used to acquire focus-related data of the camera module lens;

[0025] An auto-focus calculation unit, configured to perform auto-focus calculation based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering a full depth range of the camera module lens;

[0026] A YUV image capturing unit, used for detecting a capture control start operation for the camera module lens, and obtaining a YUV image corresponding to each focal length value of the lens by capturing;

[0027] The focus processing unit is used to crop the sharpest part from each frame of the YUV image as a target cropped image, and obtain a focused image with clear focus within the full depth range by synthesizing each of the target cropped images.

[0028] The present invention also provides a photographing device, the device comprising a processor and a memory:

[0029] The memory is used to store program code and transmit the program code to the processor;

[0030] The processor is used to execute the method for focusing a picture in a full depth range as described in any one of the above items according to the instructions in the program code.

[0031] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the method for focusing a full depth range of an image as described in any one of the above items.

[0032] It can be seen from the above technical solutions that the present invention has the following advantages:

[0033] A method for focusing a picture in a full depth range is proposed. First, the focus-related data of the camera module lens is obtained; then, the autofocus calculation is performed based on the focus-related data to obtain multiple lens focal length values ​​covering the full depth range of the camera module lens; when the shooting control start operation for the camera module lens is detected, the YUV image corresponding to each lens focal length value is obtained by shooting; finally, the part with the highest sharpness is cropped from each frame of the YUV image as the target cropped image, and the focused image with clear focus within the full depth range is obtained by synthesizing each target cropped image. Therefore, based on the autofocus calculation, multiple frames of YUV images covering the full depth range in the scene are obtained by controlling the focus, and then the clear part of each frame of the YUV image is extracted, and the focused image with clear focus within the full depth range is obtained by synthesis, so that the image parts with different focal points can be synthesized into an overall clear image. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 A flowchart of a method for focusing a full depth range of an image;

[0036] Figure 2 A schematic diagram of the related distance parameters of depth of field and depth of focus when taking an image;

[0037] Figure 3 A schematic diagram of the overall process of a method for focusing a full depth range of an image;

[0038] Figure 4 The present invention is a structural block diagram of a device for focusing a picture in a full depth range. DETAILED DESCRIPTION

[0039] The embodiments of the present invention provide a method, device, shooting equipment and storage medium for focusing a picture within a full depth of field, which are used to solve or partially solve the problem of the focused subject in the picture being out of focus outside the depth of field when shooting in the related art.

[0040] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] As an example, currently, whether it is center focus or face focus, only partial clarity can be maintained within the depth of field of the focused subject. Areas beyond the depth of field will be out of focus and their clarity cannot be guaranteed, thus affecting the quality of the entire image. Currently, there is an urgent need for a picture focusing solution to solve the problem of out-of-focus outside the depth of field of the focused subject during shooting, so that all areas of the foreground, middle and background of the image are in focus and clear.

[0042] Therefore, one of the core inventions of the embodiment of the present invention is that: in view of the shortcomings of the current technology, a method for focusing a picture in a full depth range is proposed. First, based on the autofocus calculation, multiple frames of YUV images covering the full depth range of the scene are obtained by controlling the focus, and then the clear part of each frame of the YUV image is extracted, and a clear focused image in the full depth range is obtained by synthesis, so that the image parts with different focal points are synthesized into an overall clear image.

[0043] By adopting the technical solution provided by the present invention, on the one hand, based on focusing covering the full depth of field, it is possible to present clear details in all depths of field from near to far in one image, avoiding the problem of blurred foreground or background in traditional photography, making the image more vivid and realistic. At the same time, it can also reduce the need for multiple adjustments to the focal length, and obtain a fully clear image in one shot, which is particularly suitable for complex scenes and rapidly changing environments, greatly improving shooting efficiency. On the other hand, through image cropping and synthesis based on clarity, it can provide richer visual information, enhance visual effects, improve image quality and detail performance, and is suitable for scenes that require high-quality images, such as landscape photography and product display.

[0044] Reference Figure 1 , shows a flowchart of a method for focusing a full depth range of an image provided by an embodiment of the present invention, which may specifically include the following steps:

[0045] Step 101, obtaining focus-related data of the camera module lens;

[0046] Specifically, the focus-related data may include the focal length of the lens and multiple lens aperture values. The value of the lens aperture value is related to the focus mode of the lens. The focus mode may include a macro focus mode and an inf infinity focus mode. The macro focus mode and the inf infinity focus mode may be obtained from the module OTP (One-Time Programmable Memory). The lens focal length and multiple lens aperture value data may be obtained from the configuration file or related code.

[0047] The module OTP value is used to store specific calibration data or configuration information in the camera module. This data plays an important role in maintaining the best performance of the lens under various working conditions. Especially when it comes to different shooting focus modes, such as macro and infinity (inf) focus, the relevant parameters stored in the OTP can help optimize autofocus and other image processing functions.

[0048] Macro focus mode refers to the state when the camera is set to shoot small objects at close range. In this case, the lens needs to be adjusted very accurately to obtain a clear image. Inf focus mode refers to the state when the camera is set to shoot distant scenes. In this case, the lens is adjusted to a position that can produce a clear image of an object at infinity.

[0049] Step 102, performing auto-focus calculation based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering the full depth range of the camera module lens;

[0050] In order to enable those skilled in the art to better understand the embodiments of the present invention, Figure 2 A schematic diagram of related distance parameters of depth of field and focal depth during image capture is shown.

[0051] Combination Figure 2 The process of performing auto-focus calculation based on the focus-related data to obtain multiple lens focal length distance values ​​covering the full depth range of the camera module lens can be achieved by executing the following sub-steps S01 to S03:

[0052] Step S01: calculating a diopter value according to the focal length of the lens, and calculating a focal length distance value of the lens based on the diopter value;

[0053] Among them, the lens focal length distance value represents the shooting distance L between the focal plane and the object. Its distance value is equal to the object distance (the distance between the object and the lens) plus the image distance (the distance between the lens and the focal plane). Therefore, the lens focal length distance value can also be expressed as the focusing distance.

[0054] The diopter of a lens refers to the ability of the lens to refract light. The diopter determines the degree to which the lens can focus distant objects onto the imaging plane.

[0055] In practice, the code cannot use the focus distance directly, but can only write it through the diopter, that is, through the TAGLENS_FOCUS_DISTANCE value, which indirectly writes the focus distance to the camera driveric.

[0056] Therefore, the LENS_FOCUS_DISTANCE value covering the full depth range can be obtained according to the formula LENS_FOCUS_DISTANCE = 100 / diopter. In other words, through this formula, diopter can be converted into focus distance.

[0057] Among them, LENS_FOCUS_DISTANCE represents the lens focal length distance value (focus distance). Usually, the lens focal length distance value is in meters. Here, 100 / diopter is used, which is actually equivalent to 1 / diopter*100, and the result is directly converted into centimeters.

[0058] For example, assuming a lens has a diopter value of 2D, the lens focal distance value is: LENS_FOCUS_DISTANCE = 100 / 2 = 50 cm.

[0059] Step S02: obtaining a plurality of different lens focal length values ​​by adjusting the diopter value;

[0060] After the diopter value is calculated, the minimum focusing distance of the lens can be changed by adjusting the diopter value, and a plurality of different lens focal length values ​​can be obtained, thereby achieving different shooting effects.

[0061] Step S03: for each lens focal length value, in combination with the lens focal length, calculate the depth of field value of the lens focal length value at different lens aperture values, and integrate each depth of field value as the lens focal length value to cover the full depth range of the camera module lens.

[0062] The depth of field is related to the focal length of the lens and the aperture value of the lens. Generally speaking, the larger the aperture, the smaller (shallower) the depth of field, and the smaller the aperture, the larger the depth of field.

[0063] Specifically, the calculation process of the depth of field value under any lens aperture value can be:

[0064] First, according to the lens aperture value, lens focal length value and lens focal length, the foreground depth value is calculated by the following formula:

[0065]

[0066] At the same time, the depth of field value is calculated by the following formula:

[0067]

[0068] In the formula, , Represents the foreground depth of field value and the back depth of field value respectively; Indicates the focal length of the lens; Indicates the lens aperture value; Indicates the focal length of the lens, i.e. the focusing distance; Indicates the diameter of the allowable circle of confusion.

[0069] Then, the depth of field value of the lens focal length at the lens aperture value is obtained by summing the foreground depth of field value and the back depth of field value.

[0070] Combination Figure 2 , the calculation formula of the foreground depth value can also be expressed as:

[0071]

[0072] Then the calculation formula of the back depth of field value can be expressed as:

[0073]

[0074] In the formula, It represents the near point distance plus the image distance; Represents the distance to the far point plus the image distance.

[0075] Therefore, the calculation formula for the depth of field value is:

[0076]

[0077] In combination with actual conditions, the full depth of field range in the embodiment of the present invention represents all depth of field ranges from 10 centimeters to infinity.

[0078] Step 103, detecting a shooting control start operation for the camera module lens, and obtaining a YUV image corresponding to each focal length value of the lens by shooting;

[0079] After obtaining multiple LENS_FOCUS_DISTANCE values ​​covering the full depth of field of the camera module lens, click the photo button to set them one by one in the camera driver ic to control the lens to move to the corresponding position for shooting. Each time a LENS_FOCUS_DISTANCE value is set, a corresponding YUV image is captured. YUV images perform well in real-time video processing and transmission, and their efficient compression and processing capabilities make them very suitable for real-time image synthesis.

[0080] In a specific implementation, the YUV image corresponding to each lens focal length value is obtained by shooting. For each lens focal length value, the lens focal length value is written into the camera driver integrated circuit to control the camera module lens to move to the corresponding position, and a frame of YUV image corresponding to the lens focal length value is shot.

[0081] Step 104 , cropping the sharpest portion from each frame of the YUV image as a target cropped image, and synthesizing the target cropped images to obtain a focused image with clear focus within the full depth range.

[0082] By counting the fv value (image sharpness information) of each area in each frame of YUV image, the sharpest part of each frame of YUV image is found. It is cropped to obtain the clearest part of each frame of YUV image. By synthesizing the cropped images, a focused image with clear focus in all depths of field from 10 cm to infinity can be obtained.

[0083] In a specific implementation, the sharpest part of each frame of the YUV image is cropped as the target cropped image. This can be done by: for each frame of the YUV image, counting the image sharpness information of each area in the YUV image, determining the sharpest part of the YUV image based on the statistical results, and cropping it to obtain the target cropped image; the target cropped image is the clearest part of the YUV image.

[0084] Therefore, by controlling the focus, multiple frames of YUV images covering the full depth range of the scene are obtained, and then the clear part of each frame of the YUV image is extracted, and a clear focused image with a full depth range is obtained through synthesis (which can also be understood as a focused YUV image), so that image parts with different focal points can be synthesized into an overall clear image.

[0085] Furthermore, after obtaining a focused image, continue to use the focused image to replace the original YUV image, and continue to perform other post-processing algorithm processes as a new YUV image, so that a picture with clear foreground, middle and background can be obtained. Among them, the post-processing algorithm refers to the process of performing a series of operations on the obtained image data to improve image quality, extract useful information or meet specific application requirements. Post-processing can mainly include color space conversion, image enhancement (such as contrast adjustment, sharpening and blurring, color correction), denoising (such as spatial domain filtering, frequency domain filtering), etc. Since the post-processing algorithm is not a technical point claimed to be protected by the present invention, it will not be repeated here. The corresponding specific processing means can be implemented with reference to the relevant technology. It can be understood that the present invention is not limited to this.

[0086] In an embodiment of the present invention, a method for focusing a full depth range of a picture is proposed. First, based on the autofocus calculation, a multi-frame YUV image covering the full depth range of the scene is obtained by controlling the focus, then the clear part of each frame of the YUV image is extracted, and a focused image with a clear full depth range is obtained by synthesis, so as to realize the synthesis of image parts with different focal points into an overall clear image. On the one hand, based on the focus covering the full depth range, clear details within all depths of field from near to far can be presented in one image, avoiding the problem of blurred foreground or background in traditional photography, making the image more vivid and realistic. At the same time, it can also reduce the need for multiple adjustments to the focal length, and a fully clear image can be obtained in one shot, which is particularly suitable for complex scenes and rapidly changing environments, greatly improving shooting efficiency. On the other hand, through image cropping and synthesis based on clarity, richer visual information can be provided, the visual effect is enhanced, and the image quality and detail performance are improved, which is suitable for scenes requiring high-quality images such as landscape photography and product display.

[0087] For better explanation, refer to Figure 3 , showing a schematic diagram of the overall process of a method for focusing a full depth range of an image provided by an embodiment of the present invention. It should be noted that this embodiment only briefly describes the general process of focusing a full depth range of an image, and the specific implementation process of each step can be understood by referring to the relevant content in the aforementioned embodiment, which will not be described here. It can be understood that the present invention is not limited to this.

[0088] Step 301: Obtain the focal length of the camera module lens and multiple lens aperture values;

[0089] Step 302: performing auto-focus calculation based on the lens focal length and multiple lens aperture values ​​to obtain multiple lens focal length distance values ​​covering the full depth range of the camera module lens;

[0090] Step 303: Detecting a shooting control start operation for the camera module lens, and for each lens focal length value, writing the lens focal length value into the camera driver integrated circuit to control the camera module lens to move to a corresponding position, and shooting a frame of YUV image corresponding to the lens focal length value;

[0091] Step 304: for each frame of the YUV image, count the image sharpness information of each area in the YUV image, determine the sharpest part in the YUV image based on the statistical result, and crop it to obtain a target cropped image with the highest clarity in the YUV image;

[0092] Step 305: obtaining a focused image with clear focus within a full depth of field by synthesizing the cropped images of each target;

[0093] Step 306: Use the focused image to replace the original YUV image and continue the post-processing algorithm flow to obtain a clear picture with the foreground, middle and background.

[0094] Reference Figure 4 , shows a structural block diagram of a device for focusing a full depth range of an image provided by an embodiment of the present invention, which may specifically include:

[0095] The data acquisition unit 401 is used to acquire focus-related data of the camera module lens;

[0096] An auto-focus calculation unit 402 is used to perform auto-focus calculation based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering the full depth range of the camera module lens;

[0097] A YUV image capturing unit 403 is used to detect a capture control start operation for the camera module lens, and obtain a YUV image corresponding to each lens focal length value by capturing;

[0098] The focus processing unit 404 is used to crop the sharpest part from each frame of the YUV image as a target cropped image, and obtain a focused image with clear focus within the full depth range by synthesizing the target cropped images.

[0099] In an optional embodiment, the focus-related data includes a lens focal length and a plurality of lens aperture values; the value of the lens aperture value is related to a focus mode of the lens, and the focus mode includes a macro focus mode and an inf infinity focus mode; the auto-focus calculation unit 402 includes:

[0100] A lens focal length distance value calculation unit, used to calculate a diopter value according to the lens focal length, and calculate the lens focal length distance value based on the diopter value;

[0101] A diopter value adjustment unit, used to obtain a plurality of different lens focal length distance values ​​by adjusting the diopter value;

[0102] The depth of field value calculation unit is used to calculate the depth of field value of the lens focal length value under different lens aperture values ​​for each lens focal length value in combination with the lens focal length, and integrate each of the depth of field values ​​as the lens focal length value to cover the full depth of field range of the camera module lens.

[0103] In an optional embodiment, the depth of field value calculation unit is specifically used to:

[0104] Calculating a foreground depth of field value and a back depth of field value according to the lens aperture value, the lens focal length value and the lens focal length;

[0105] The depth of field value of the lens focal length at the lens aperture value is obtained by summing the foreground depth of field value and the back depth of field value.

[0106] In an optional embodiment, the lens focal length distance value is calculated by the formula LENS_FOCUS_DISTANCE=100 / diopter value.

[0107] In an optional embodiment, the YUV image capturing unit 403 is specifically used for:

[0108] For each lens focal length value, the lens focal length value is written into a camera driving integrated circuit to control the camera module lens to move to a corresponding position and capture a frame of YUV image corresponding to the lens focal length value.

[0109] In an optional embodiment, the focus processing unit 404 is specifically used for:

[0110] For each frame of the YUV image, the image sharpness information of each area in the YUV image is counted, the part with the highest sharpness in the YUV image is determined based on the statistical results, and it is cropped to obtain a target cropped image; the target cropped image is the clearest part of the YUV image.

[0111] In an optional embodiment, the full depth range represents all depth ranges of depth values ​​from 10 centimeters to infinity.

[0112] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the aforementioned method embodiment.

[0113] The embodiment of the present invention further provides a photographing device, the device comprising a processor and a memory:

[0114] The memory is used to store the program code and transmit the program code to the processor;

[0115] The processor is used to execute the method for focusing a picture in a full depth range according to any embodiment of the present invention according to the instructions in the program code.

[0116] An embodiment of the present invention further provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the method for focusing a picture in a full depth range according to any embodiment of the present invention.

[0117] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0118] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0119] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0120] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0121] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0122] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for focusing a picture in a full depth range, characterized in that: include: Get the focus related data of the camera module lens; Performing auto-focus calculation based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering the full depth range of the camera module lens; Detecting a shooting control start operation for the camera module lens, and obtaining a YUV image corresponding to each focal length value of the lens by shooting; The sharpest portion is cropped from each frame of the YUV image as a target cropped image, and a focused image with clear focus within the full depth of field is obtained by synthesizing the target cropped images.

2. The method for focusing a picture in a full depth range according to claim 1, characterized in that: The focus-related data includes a lens focal length and a plurality of lens aperture values; the value of the lens aperture value is related to a focus mode of the lens, and the focus mode includes a macro focus mode and an inf infinity focus mode; The automatic focus calculation is performed based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering the panoramic depth range of the camera module lens, including: Calculating a diopter value according to the focal length of the lens, and calculating a focal length distance value of the lens based on the diopter value; By adjusting the diopter value, a plurality of different lens focal length distance values ​​are obtained; For each of the lens focal length values, combined with the lens focal length, the depth of field value of the lens focal length value under different lens aperture values ​​is calculated, and each of the depth of field values ​​is integrated as the lens focal length value to cover the full depth range of the camera module lens.

3. The method for focusing a picture in a full depth range according to claim 2, characterized in that: The calculation process of the depth of field value under any lens aperture value includes: Calculating a foreground depth of field value and a back depth of field value according to the lens aperture value, the lens focal length value and the lens focal length; The depth of field value of the lens focal length at the lens aperture value is obtained by summing the foreground depth of field value and the back depth of field value.

4. The method for focusing a picture in a full depth range according to claim 2, characterized in that: The lens focal length value is calculated by the formula LENS_FOCUS_DISTANCE=100 / diopter value.

5. The method for focusing a picture in a full depth range according to claim 1, characterized in that: The method of obtaining a YUV image corresponding to each focal length value of the lens by shooting includes: For each lens focal length value, the lens focal length value is written into a camera driving integrated circuit to control the camera module lens to move to a corresponding position and capture a frame of YUV image corresponding to the lens focal length value.

6. The method for focusing a picture in a full depth range according to claim 1, characterized in that: The step of cutting out the sharpest portion from each frame of the YUV image as a target cut image includes: For each frame of the YUV image, the image sharpness information of each area in the YUV image is counted, the part with the highest sharpness in the YUV image is determined based on the statistical results, and it is cropped to obtain a target cropped image; the target cropped image is the clearest part of the YUV image.

7. The method for focusing a picture in a full depth range according to any one of claims 1 to 6, characterized in that: The full depth of field range represents all depth of field ranges from 10 cm to infinity.

8. A device for focusing a picture in a full depth range, characterized in that: include: A data acquisition unit, used to acquire focus-related data of the camera module lens; An auto-focus calculation unit, configured to perform auto-focus calculation based on the focus-related data to obtain a plurality of lens focal length distance values ​​covering a full depth range of the camera module lens; A YUV image capturing unit, used for detecting a capture control start operation for the camera module lens, and obtaining a YUV image corresponding to each focal length value of the lens by capturing; The focus processing unit is used to crop the sharpest part from each frame of the YUV image as a target cropped image, and obtain a focused image with clear focus within the full depth range by synthesizing each of the target cropped images.

9. A photographing device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the method for focusing a picture in a full depth range as described in any one of claims 1 to 7 according to the instructions in the program code.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program code, and the program code is used to execute the method for focusing a picture in a full depth range as described in any one of claims 1-7.