Focusing method and device, terminal computer readable storage medium
By combining the information collected by the first sensor and the second sensor, the accuracy of camera focus is achieved, the problem of inaccurate focus during the photography process is solved, and the imaging quality and user experience are improved.
Patent Information
- Application Number
- CN202210368511.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2042-04-06
AI Technical Summary
During the photography process, the camera's focus is difficult to accurately carry out, especially when the image quality is poor, which affects the imaging quality and user experience.
By using the first sensor to acquire depth information of the target object and the second sensor to acquire image information, combining both to determine the focus information, and flexibly select to achieve accurate focus.
Ensures the accuracy of camera focus and improves imaging quality and user experience, especially in poor image quality.
Smart Images

Figure CN114666508B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and more specifically, to a focusing method, a focusing device, a terminal and a non-volatile computer-readable storage medium. Background Art
[0002] With the continuous development of science and technology, smart terminals have penetrated into people's daily lives. More and more people choose to take photos with smartphones. During the photo shooting process, whether the camera is focused and whether the focus is accurate often affects the clarity of the photo. At present, the camera focuses through contrast focus and phase focus. However, when the image quality obtained on the preview interface of the camera is poor, it is often difficult to focus accurately, which will affect the final image quality and lead to a poor user experience. Summary of the invention
[0003] Embodiments of the present application provide a focusing method, a focusing device, a terminal, and a non-volatile computer-readable storage medium.
[0004] The focusing method of the embodiment of the present application includes: collecting first depth information of the target object according to the first sensor to determine first focusing information; collecting image information of the target object according to the second sensor to determine second focusing information; and focusing the camera of the terminal according to the first focusing information and the second focusing information.
[0005] The focusing device of the embodiment of the present application includes a first acquisition module, a second acquisition module and a focusing module. The first acquisition module is used to acquire first depth information of the target object according to the first sensor to determine first focusing information. The second acquisition module is used to acquire image information of the target object according to the second sensor to determine second focusing information. The focusing module is used to focus the camera of the terminal according to the first focusing information and the second focusing information.
[0006] The terminal of the embodiment of the present application includes one or more processors, a memory and one or more programs, wherein one or more of the programs are stored in the memory and executed by one or more of the processors. The program includes instructions for executing the following focusing method: collecting first depth information of the target object according to the first sensor to determine first focusing information; collecting image information of the target object according to the second sensor to determine second focusing information; and focusing the camera of the terminal according to the first focusing information and the second focusing information.
[0007] The non-volatile computer-readable storage medium of an embodiment of the present application includes a computer program. When the computer program is executed by one or more processors, the processor performs the following focusing method: collecting first depth information of the target object according to a first sensor to determine first focus information; collecting image information of the target object according to a second sensor to determine second focus information; and focusing the camera of the terminal according to the first focus information and the second focus information.
[0008] In the focusing method, focusing device, terminal and non-volatile computer-readable storage medium of the implementation mode of the present application, the first focus information and the second focus information are respectively obtained by the first sensor and the second sensor, wherein the first focus information is obtained based on the depth information of the target object, and the second focus information is obtained based on the image information of the target object. In this way, it can be ensured that when focusing the camera of the terminal, the first focus information and the second focus information can be flexibly selected to complete the precise focusing of the camera, so as to ensure the imaging quality of the final captured image, thereby improving the user experience.
[0009] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0011] Figure 1 is a flowchart of a focusing method in certain embodiments of the present application;
[0012] Figure 2 is a schematic diagram of the structure of a terminal in some implementation modes of the present application;
[0013] Figure 3 is a schematic structural diagram of a focusing device according to some embodiments of the present application;
[0014] Figure 4 is a flowchart of a focusing method in certain embodiments of the present application;
[0015] Figure 5 is a schematic diagram of a scene of a focusing method in some embodiments of the present application;
[0016] Figures 6 to 10 is a flowchart of a focusing method in certain embodiments of the present application;
[0017] Fig.11 is a schematic structural diagram of a focusing device according to some embodiments of the present application;
[0018] Fig.12 It is a schematic diagram of the connection status of a non-volatile computer-readable storage medium and a processor in certain embodiments of the present application. DETAILED DESCRIPTION
[0019] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.
[0020] See also Figure 1 and Figure 2 The present application provides a focusing method. The focusing method comprises the steps of:
[0021] 01: collecting first depth information of the target object according to the first sensor 20 to determine first focus information;
[0022] 02: collecting image information of the target object according to the second sensor 30 to determine second focus information; and
[0023] 03: Focusing the camera of the terminal according to the first focus information and the second focus information.
[0024] See also Figure 2 , an embodiment of the present application provides a focusing device 10. The focusing device 10 includes a first acquisition module 11, a second acquisition module 12 and a focusing module 13. The focusing method of the embodiment of the present application can be applied to the focusing device 10. Among them, the first acquisition module 11, the second acquisition module 12 and the focusing module 13 are used to execute step 01, step 02 and step 03 respectively. That is, the first acquisition module 11 is used to acquire the first depth information of the target object according to the first sensor 20 to determine the first focusing information. The second acquisition module 12 is used to acquire the image information of the target object according to the second sensor 30 to determine the second focusing information. The focusing module 13 is used to focus the camera of the terminal according to the first focusing information and the second focusing information.
[0025] See also Figure 3, an embodiment of the present application provides a terminal. The focusing method of the embodiment of the present application can be applied to the terminal. The terminal includes one or more processors 50, a memory and one or more programs. One or more programs are stored in the memory and executed by one or more processors 50. One or more programs include methods for executing steps 01, 02 and 03. That is, when the processor 50 executes one or more programs, it can: collect first depth information of the target object according to the first sensor 20 to determine first focus information; collect image information of the target object according to the second sensor 30 to determine second focus information; and focus the camera of the terminal according to the first focus information and the second focus information.
[0026] Specifically, the terminal further includes a first sensor 20, a second sensor 30 and a housing 60. The first sensor 20 is a time of flight (TOF) sensor, and the second sensor 30 is a phase detection auto focus (PDAF) sensor. The first sensor 20, the second sensor 30 and the processor 50 are arranged in the housing 60. The housing 60 can also be used to install functional modules such as an imaging device, a power supply device, and a communication device of the terminal, so that the housing 60 provides dustproof, drop-proof, waterproof and other protections for the functional modules.
[0027] The terminal can be VR glasses, AR glasses, smart phones, tablet computers, laptops, smart watches, game consoles, head-mounted display devices, etc. This application takes the terminal as a smart phone as an example. It can be understood that the terminal includes but is not limited to smart phones.
[0028] More specifically, when the first sensor 20 collects the first depth information of the target object to determine the first focus information, the first sensor 20 emits light, and according to the time required for the light to return to the first sensor 20, the depth between the target object and the first sensor 20 is calculated, and the direction and amount of movement required for the camera lens to move when focusing are obtained according to the depth information, that is, the first focus information. For example, move 1 mm in the direction away from the target object.
[0029] When the second sensor 30 collects the image information of the target object to determine the second focus information, the principle is to reserve some shielded pixels on the photosensitive element of the second sensor 30 for phase detection, so as to obtain the direction and amount of movement of the camera lens when focusing through the distance between pixels in the image and its change, that is, the second focus information. For example, move 1 mm in the direction close to the target object.
[0030] Next, the processor 50 may focus the camera of the terminal according to the first focus information and the second focus information.
[0031] Specifically, the processor 50 may first calculate the confidence level of the first focus information and the confidence level of the second focus information to determine whether to select the first focus information or the second focus information to focus the camera of the terminal.
[0032] The confidence of the first focus information is related to the intensity of the laser emitted by the first sensor 20 (TOF sensor). When the intensity of the laser emitted by the TOF sensor is greater, the confidence of the first focus information is higher. The confidence of the first focus information is also related to the first depth information measured by the first sensor 20, that is, the distance between the target object and the first sensor 20. When the first depth information is greater, the confidence of the first focus information is smaller. In this way, the processor 50 can score the confidence of the first focus information according to the intensity of the laser emitted by the first sensor 20 and / or the size of the first depth information to obtain the confidence of the first focus information.
[0033] The confidence of the second focus information is related to the number of image details of the preview image obtained by the terminal camera in the preview interface. The more image details there are, the higher the confidence of the second focus information. The image details refer to the grayscale changes in the preview image, including isolated points, thin lines, and sudden changes in the preview image. In this way, the processor 50 can score the confidence of the second focus information according to the image details in the image information obtained by the second sensor 30, thereby obtaining the confidence of the second focus information.
[0034] In one embodiment, after the processor 50 obtains the confidence of the first focus information and the confidence of the second focus information, the processor 50 can determine which focus information to select to focus the camera of the terminal by comparing the confidence of the first focus information and the confidence of the second focus information. For example, if the confidence of the first focus information is 0.8 and the confidence of the second focus information is 0.9, it means that the second focus information is more reliable, and the processor 50 selects the second focus information to focus the camera of the terminal. For another example, if the confidence of the first focus information is 0.95 and the confidence of the second focus information is 0.9, it means that the first focus information is more reliable, and the processor 50 selects the first focus information to focus the camera of the terminal.
[0035] It should be noted that, at present, when the PADF sensor, i.e., the second sensor 30, implements the focusing function, if a dark state and a low-texture area appear in the preview image of the camera, it is easy to cause inaccurate focusing. Among them, when the image appears dark, it means that the terminal is in a low-light environment, and when the image appears a low-texture area, it means that there are few details in the image.
[0036] It can be understood that in the above situation, the processor 50 collects the target object through the second sensor 30 to determine that the confidence of the second focus information is low. At this time, the processor 50 will select the first focus information to focus the camera of the terminal, thereby eliminating the impact on the focus of the camera when the image quality of the preview image is poor. In this way, the focus of the camera can be guaranteed to be more accurate, so as to ensure that the final imaging quality is better, thereby improving the user experience.
[0037] In the focusing method, focusing device 10 and terminal of the implementation mode of the present application, the first sensor 20 and the second sensor 30 are used to obtain the first focusing information and the second focusing information respectively, wherein the first focusing information is obtained based on the depth information of the target object, and the second focusing information is obtained based on the image information of the target object. In this way, it can be ensured that when focusing the camera of the terminal, the first focusing information and the second focusing information can be flexibly selected to complete the precise focusing of the camera, so as to ensure the imaging quality of the final captured image, thereby improving the user experience.
[0038] See also Figures 2 to 4 In some embodiments, step 01: collecting first depth information of a target object according to a first sensor 20 may include the following steps:
[0039] 011: collecting depth information of different positions of the target object according to the first sensor 20; and
[0040] 012: Determine first depth information according to depth information at different positions.
[0041] In some embodiments, the first acquisition module 11 is used to perform step 011 and step 012. That is, the first acquisition module 11 is used to acquire depth information of different positions of the target object according to the first sensor 20, and determine the first depth information according to the depth information of different positions.
[0042] In some embodiments, one or more programs execute step 011. The processor 50 is used to execute step 011 and step 012. That is, the processor 50 is used to collect depth information of different positions of the target object according to the first sensor 20, and determine the first depth information according to the depth information of different positions.
[0043] Specifically, when the processor 50 controls the first sensor 20 to collect the first depth information of the target object, the processor 50 may first collect the depth information of different positions of the target object. In this way, the processor 50 may determine the first depth information based on the depth information of different positions of the target object.
[0044] In one embodiment, the first depth information may be depth information corresponding to the center of depth information at different positions of the target object. Figure 5 As shown, when the processor 50 controls the first sensor 20 to collect the target object, it can collect the depth information of four positions P1 to P4 on the target object, and then the first depth information is the depth information of the point P0 located at the center of these four positions.
[0045] In yet another embodiment, the first depth information may also be an average value of depth information at different positions of the target object. Figure 5 As shown, if the processor 50 acquires depth information of the four positions of the target object P1 to P4 of 8 mm, 6 mm, 7 mm and 11 mm respectively, the first depth information is 8 mm.
[0046] In another embodiment, the first depth information may also be the depth information corresponding to the touch position of the user on the display screen of the terminal. It can be understood that when the user uses the terminal to take pictures, if the user touches a certain position on the display screen, it indicates that the user needs to use the position as the focus to focus the camera. Therefore, the first depth information may also be determined based on the depth information corresponding to the touch position of the user on the display screen of the terminal. For example, if the depth information of the touch position of the user on the display screen is 8 mm, the first depth information is 8 mm.
[0047] In this way, after the user determines the first depth information, the terminal camera can be accurately focused according to the above three implementation methods, or focused according to the center position of the target object, or based on the position the user wants to focus on, to achieve focus on different areas.
[0048] See also Figure 2 , Figure 3 and Figure 6 The focusing method of the embodiment of the present application may further include the steps of:
[0049] 04: When the difference between two consecutive frames of first depth information is greater than a preset threshold, the first depth information is sent to the terminal.
[0050] In some embodiments, the focusing device 10 further includes a sending module 14, and the sending module 14 is used to perform step 04. That is, the sending module 14 is used to send the first depth information to the terminal when the difference between two consecutive frames of the first depth information is greater than a preset threshold.
[0051] In some embodiments, one or more programs are used to execute step 04. The processor 50 is used to execute step 04. That is, the processor 50 is used to send the first depth information to the terminal when the difference between two consecutive frames of first depth information is greater than a preset threshold.
[0052] Specifically, the processor 50 may also control the first sensor 20 to collect the first depth information of the target object at a predetermined frame rate. For example, if 5 frames of images of the target object are obtained per second, 5 pieces of first depth information may be obtained accordingly.
[0053] Next, the processor 50 can determine whether the difference between the first depth information of two consecutive frames is greater than the preset threshold, and send the first depth information to the terminal when the difference is greater than the preset threshold. For example, the first depth information corresponding to the target object of the first frame is 8 mm, the second depth information corresponding to the target object of the second frame is 10 mm, and the preset threshold is 5 mm. At this time, the difference between the first depth information of two consecutive frames is less than the preset threshold, and the processor 50 determines that the user has only slightly shaken during the photo shooting process, instead of changing the target object to be photographed, and the processor 50 does not update the first depth information in the current terminal. If the first depth information corresponding to the target object of the first frame is 8 mm, and the second depth information corresponding to the target object of the second frame is 15 mm, it means that the user has changed the target object to be photographed, and the processor 50 needs to update the first depth information to the terminal to update the first focus information, so that the terminal camera can focus when shooting the new target object.
[0054] See also Figure 2 , Figure 3 and Figure 7 In some implementations, step 03: focusing the camera of the terminal according to the first focus information and the second focus information may include the following steps:
[0055] 031: Obtain a first confidence level of the first focus information and a second confidence level of the second focus information; and
[0056] 032: When the first confidence level is greater than the second confidence level, selecting the first focus information to focus the camera of the terminal; or,
[0057] 033: When the second confidence level is greater than the first confidence level, select second focus information to focus the camera of the terminal.
[0058] In some embodiments, the focus module 13 is used to perform step 031, step 032, and step 033. That is, the focus module 13 is used to obtain a first confidence level of the first focus information and a second confidence level of the second focus information; and when the first confidence level is greater than the second confidence level, the first focus information is selected to focus the camera of the terminal; or when the second confidence level is greater than the first confidence level, the second focus information is selected to focus the camera of the terminal.
[0059] In some embodiments, one or more programs are used to perform step 031, step 032, and step 033. The processor 50 is used to perform step 031, step 032, and step 033. That is, the processor 50 is used to obtain a first confidence level of the first focus information and a second confidence level of the second focus information; and when the first confidence level is greater than the second confidence level, the first focus information is selected to focus the camera of the terminal; or when the second confidence level is greater than the first confidence level, the second focus information is selected to focus the camera of the terminal.
[0060] Specifically, before the processor 50 focuses the camera of the terminal according to the first focus information and the second focus information, the processor 50 may first obtain a first confidence level of the first focus information and a second confidence level of the second focus information, and after judging the magnitude of the first confidence level and the second confidence level, determine whether to select the first focus information or the second focus information to focus the camera of the terminal.
[0061] According to the above, the first confidence is related to the intensity of the laser emitted by the first sensor 20. When the intensity of the laser emitted by the TOF sensor is greater, the confidence of the first focus information is higher. The confidence of the first focus information is also related to the first depth information measured by the first sensor 20, that is, the distance between the target object and the first sensor 20. When the first depth information is greater, the confidence of the first focus information is smaller.
[0062] The second confidence level is related to the number of image details of the preview image obtained by the terminal's camera in the preview interface. The more image details there are, the higher the confidence level of the second focus information. The image details refer to the grayscale changes in the preview image, including isolated points, thin lines, and sudden changes in the preview image.
[0063] In this way, after the processor 50 determines the first confidence level and the second confidence level, the processor 50 can determine which focus information to select to focus the camera of the terminal. For example, when the first confidence level is 0.95 and the second confidence level is 0.9, that is, the first confidence level is greater than the second confidence level, the processor 50 can select the first focus information to focus the camera of the terminal. For another example, when the first confidence level is 0.8 and the second confidence level is 0.9, that is, the second confidence level is greater than the first confidence level, the processor 50 can select the second focus information to focus the camera of the terminal.
[0064] In summary, the processor 50 flexibly selects the first focus information and the second focus information to achieve accurate focus of the camera of the terminal, thereby ensuring the user experience.
[0065] See also Figure 2 , Figure 3 and Figure 8In some implementations, step 03: focusing the camera of the terminal according to the first focus information and the second focus information may include the following steps:
[0066] 034: Obtain a first confidence level of the first focus information and a second confidence level of the second focus information;
[0067] 035: Determine a first weight corresponding to the first confidence level and a second weight corresponding to the second confidence level;
[0068] 036: Determine target focus information according to the first weight, the first focus information, the second weight, and the second focus information; and
[0069] 037: Focus the terminal's camera according to the target focus information.
[0070] In some embodiments, the focusing module 13 is used to perform step 034, step 035, step 036, and step 037. That is, the focusing module 13 is used to obtain a first confidence level of the first focusing information and a second confidence level of the second focusing information; determine a first weight corresponding to the first confidence level and a second weight corresponding to the second confidence level; determine target focusing information according to the first weight level, the first focusing information, the second weight level, and the second focusing information; and focus the camera of the terminal according to the target focusing information.
[0071] In some embodiments, one or more programs are used to perform step 034, step 035, step 036, and step 037. The processor 50 is used to perform step 034, step 035, step 036, and step 037. That is, the processor 50 is used to obtain a first confidence level of the first focus information and a second confidence level of the second focus information; determine a first weight corresponding to the first confidence level and a second weight corresponding to the second confidence level; determine target focus information according to the first weight level, the first focus information, the second weight level, and the second focus information; and focus the camera of the terminal according to the target focus information.
[0072] Specifically, after the processor 50 obtains the first confidence of the first focus information and the second confidence of the second focus information, the processor 50 may also determine a first weight corresponding to the first confidence and a second weight corresponding to the second confidence. For example, the first weight may be the first confidence / (the sum of the first confidence and the second confidence), and the second weight may be the second confidence / (the sum of the first confidence and the second confidence).
[0073] In this way, the processor 50 can determine the target focus information according to the first weight, the first focus information, the second weight, and the second focus information.
[0074] For example, the first confidence is 0.8 and the second confidence is 0.9, then the first weight is 0.47 and the second weight is 0.53. If the first focus information is to control the camera lens to move 1 mm away from the target object, and the second focus information is to control the camera lens to move 2 mm away from the target object, then the target focus information is 0.47*1+0.53*2=1.53 mm, that is, the target focus information is to control the camera lens to move 1.53 mm away from the target object.
[0075] Finally, the processor 50 can control the movement of the lens of the terminal camera according to the target focus information, thereby completing the focus of the terminal camera. Among them, since the target focus information respectively integrates the first focus information, the second focus information, and the first weight and the second weight obtained according to the first confidence of the first focus information and the second confidence of the second focus information, it can be ensured that when the processor 50 focuses the terminal camera through the target focus information, the focus result is relatively accurate, thereby ensuring the user experience.
[0076] See also Figure 2 , Figure 3 and Fig. 9 In some embodiments, step 031 or step 034: obtaining a first confidence level of the first focus information and a second confidence level of the second focus information may include the steps of:
[0077] 0311: Determine a first confidence level according to the first depth information of the target object or the intensity of the light emitted by the first sensor 20; and
[0078] 0312: Determine clarity based on image information of the target object, and determine a second confidence level based on the clarity.
[0079] In some embodiments, the focusing module 13 is used to perform step 0311 and step 0312. That is, the focusing module 13 is used to determine the first confidence level according to the first depth information of the target object or the intensity of the light emitted by the first sensor 20; determine the clarity according to the image information of the target object, and determine the second confidence level according to the clarity.
[0080] In some embodiments, one or more programs are used to perform step 0311 and step 0312. The processor 50 is used to perform step 0311 and step 0312. That is, the processor 50 is used to determine the first confidence level according to the first depth information of the target object or the intensity of the light emitted by the first sensor 20; and determine the clarity according to the image information of the target object, and determine the second confidence level according to the clarity.
[0081] Specifically, according to the above, when the processor 50 obtains the first confidence of the first focus information and the second confidence of the second focus information, the first confidence is related to the intensity of the laser emitted by the first sensor 20 and the distance between the target object and the first sensor 20. The distance between the target object and the first sensor 20 is the first depth information obtained by the first sensor 20 when collecting the target object. In this way, the processor 50 can determine the first confidence according to the first depth information or the intensity of the light emitted by the first sensor 20.
[0082] In some embodiments, the processor 50 may also determine the first confidence level according to the first depth information and the intensity of the light emitted by the first sensor 20. For example, different weights may be set in advance for the intensity of the light emitted by the first sensor 20 and the first depth information, and the first confidence level may be determined by weighted averaging.
[0083] The second confidence level is related to the number of image details of the preview image obtained by the terminal's camera in the preview interface. Image details refer to the grayscale changes in the preview image, including isolated points, thin lines, and sudden changes in the preview image. Therefore, the higher the image clarity, the more image details in the preview image can be represented. Therefore, the processor 50 can first determine the clarity based on the image information of the target object, and then determine the second confidence level based on the clarity. According to the above, the more image details there are, the higher the second confidence level. Therefore, the higher the clarity, the higher the second confidence level.
[0084] See also Figure 2 , Fig.10 and Fig.11 The focusing method of the embodiment of the present application further includes the steps of:
[0085] 05: Control the third sensor 40 to acquire multiple frames of images of the target object;
[0086] 06: Compare the contrasts of multiple regions in the image to select the region with the largest contrast;
[0087] 07: Determine the third focus information based on the area with the largest contrast;
[0088] 08: Obtain a first confidence level of the first focus information and a second confidence level of the second focus information; and
[0089] 09: When both the first confidence level and the second confidence level are less than a preset confidence level, focusing the camera of the terminal according to the third focusing information.
[0090] In some embodiments, the focusing device 10 further includes a control module 15, a comparison module 16, a determination module 17, and an acquisition module 18. The control module 15 is used to execute step 05, the comparison module 16 is used to execute step 06, the determination module 17 is used to execute step 07, the acquisition module 18 is used to execute step 08, and the focusing module 13 is used to execute step 09. That is, the control module 15 is used to control the third sensor 40 to acquire multiple frames of images of the target object. The comparison module 16 is used to compare the contrast of multiple regions in the image to select the region with the largest contrast. The determination module 17 is used to determine the third focusing information based on the region with the largest contrast. The acquisition module 18 is used to obtain a first confidence of the first focusing information and a second confidence of the second focusing information. The focusing module 13 is used to focus the camera of the terminal according to the third focusing information when both the first confidence and the second confidence are less than the preset confidence.
[0091] In some embodiments, one or more programs are used to perform step 05, step 06, step 07, step 08, and step 09. The processor 50 is used to perform step 05, step 06, step 07, step 08, and step 09. That is, the processor 50 is used to control the third sensor 40 to obtain multiple frames of images of the target object; compare the contrast of multiple regions in the image to select the region with the largest contrast; determine the third focus information according to the region with the largest contrast; obtain the first confidence of the first focus information and the second confidence of the second focus information; and when the first confidence and the second confidence are both less than the preset confidence, focus the camera of the terminal according to the third focus information.
[0092] Specifically, please combine Figure 2 The terminal may further include a third sensor 40. The third sensor 40 is a contrast focusing (Continuous Auto Focus, CAF) sensor.
[0093] More specifically, the processor 50 may first acquire an image of the target object through the third sensor 40. The image may be an image of the terminal in a preview interface.
[0094] Next, the processor 50 divides the image into a plurality of regions, and compares the contrast of each region one by one, thereby selecting the region with the largest contrast.
[0095] It should be noted that in the third sensor 40 (CAF sensor), when the processor 50 selects the area with the largest contrast, it means that the camera lens moves to the focal position. Therefore, when the processor 50 determines the area with the largest contrast, the third focus information can be determined. The third focus information may include the direction and amount of movement required for the current lens to move to the focal position. Due to the characteristics of the third sensor 40, the third focus information obtained by the processor 50 is more accurate than the first focus information and the second focus information, but the difference is that it takes a longer time to achieve the focus of the terminal camera through the third sensor 40.
[0096] In this way, when the processor 50 determines the first focus information and the second focus information respectively, it can first obtain the first confidence of the first focus information and the second confidence of the second focus information, and judge whether the first confidence and the second confidence are less than the preset confidence. Only when the first confidence and the second confidence are less than the preset confidence, the third sensor 40 is controlled to complete the above work and provide the third focus information to complete the focus of the terminal camera.
[0097] When the first confidence level and the second confidence level are greater than the preset confidence level, it means that the first focus information and the second focus information are relatively accurate, and the processor 50 will only select one of the first focus information and the second focus information to complete the focus of the terminal camera. The selection of the first focus information and the second focus information is explained in the above embodiment, and will not be repeated here.
[0098] In this way, it can be ensured that when the first focus information and the second focus information are sufficient to accurately focus the camera, the third focus information can also be used to accurately focus the camera, thereby taking both focus efficiency and focus accuracy into consideration to complete the focus of the camera, thereby ensuring the user experience.
[0099] See also Fig.12 The embodiment of the present application further provides a non-volatile computer-readable storage medium 300 including a computer program 301. When the computer program 301 is executed by one or more processors 50, the one or more processors 50 execute the focusing method of any of the above embodiments.
[0100] For example, when the computer program 301 is executed by one or more processors 50, the processor 50 performs the following focusing method:
[0101] 01: collecting first depth information of the target object according to the first sensor 20 to determine first focus information;
[0102] 02: collecting image information of the target object according to the second sensor 30 to determine second focus information; and
[0103] 03: Focusing the camera of the terminal according to the first focus information and the second focus information.
[0104] For another example, when the computer program 301 is executed by one or more processors 50, the processor 50 performs the following focusing method:
[0105] 011: collecting depth information of different positions of the target object according to the first sensor 20; and
[0106] 012: Determine first depth information according to depth information at different positions.
[0107] For another example, when the computer program 301 is executed by one or more processors 50, the processor 50 performs the following focusing method:
[0108] 031: Obtain a first confidence level of the first focus information and a second confidence level of the second focus information; and
[0109] 032: When the first confidence level is greater than the second confidence level, selecting the first focus information to focus the camera of the terminal; or,
[0110] 033: When the second confidence level is greater than the first confidence level, select second focus information to focus the camera of the terminal.
[0111] In the description of this specification, the descriptions with reference to the terms "certain embodiments", "in an example", "exemplarily", etc., mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0112] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0113] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A focusing method, characterized in that: include: Collecting first depth information of the target object according to the first sensor to determine first focus information; collecting image information of the target object according to the second sensor to determine second focus information; and Obtaining a first confidence level of the first focus information and a second confidence level of the second focus information; Determine a first weight corresponding to the first confidence level and a second weight corresponding to the second confidence level, wherein the first weight is a ratio of the first confidence level to the sum of the first confidence level and the second confidence level, and the second weight is a ratio of the second confidence level to the sum of the first confidence level and the second confidence level; Determining target focus information according to the first weight, the first focus information, the second weight, and the second focus information; The camera of the terminal is focused according to the target focus information.
2. The focusing method according to claim 1, characterized in that: The first sensor is a time-of-flight sensor, and the second sensor is a phase focusing sensor.
3. The focusing method according to claim 2, characterized in that: The collecting first depth information of the target object according to the first sensor includes: collecting depth information of different positions of the target object according to the first sensor; The first depth information is determined according to the depth information at different positions.
4. The focusing method according to claim 3, characterized in that: The first depth information includes depth information corresponding to the center of the depth information at different positions, or an average value of the depth information at different positions, or depth information corresponding to a touch position of the user on the display screen of the terminal.
5. The focusing method according to claim 1, characterized in that: The first sensor collects the first depth information at a predetermined frame rate, and the focusing method further includes: When the difference between two consecutive frames of the first depth information is greater than a preset threshold, the first depth information is sent to the terminal.
6. The focusing method according to claim 1, characterized in that: The obtaining of a first confidence level of the first focus information and a second confidence level of the second focus information includes: Determining the first confidence level according to the first depth information of the target object or the intensity of the light emitted by the first sensor; and The clarity is determined according to the image information of the target object, and the second confidence is determined according to the clarity.
7. The focusing method according to claim 1, characterized in that: The terminal may further include a third sensor, and the focusing method may further include: Controlling the third sensor to acquire an image of the target object; Comparing the contrasts of multiple regions in the image to select the region with the largest contrast; determining third focus information according to the area with the largest contrast; Obtaining a first confidence level of the first focus information and a second confidence level of the second focus information; When both the first confidence level and the second confidence level are less than a preset confidence level, the camera of the terminal is focused according to the third focus information.
8. A focusing device, characterized in that: The focusing device comprises: A first acquisition module, the first acquisition module is used to acquire first depth information of the target object according to the first sensor to determine first focus information; A second acquisition module, the second acquisition module is used to acquire image information of the target object according to the second sensor to determine second focus information; A focusing module, wherein the focusing module is used to obtain a first confidence of the first focusing information and a second confidence of the second focusing information, and to determine a first weight corresponding to the first confidence and a second weight corresponding to the second confidence, wherein the first weight is a ratio of the first confidence to the sum of the first confidence and the second confidence, and the second weight is a ratio of the second confidence to the sum of the first confidence and the second confidence, and to determine target focus information according to the first weight, the first focusing information, the second weight and the second focusing information, and to focus the camera of the terminal according to the target focus information.
9. A terminal, characterized in that: include: One or more processors, memory; and One or more programs, wherein one or more of the programs are stored in the memory and executed by one or more of the processors, and the programs include instructions for executing the focusing method according to any one of claims 1 to 7.
10. A non-volatile computer-readable storage medium storing a computer program, wherein when the computer program is executed by one or more processors, the processors implement the focusing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Focusing method and device and electronic equipment
CN113141468A
Focusing method and device
CN114125268A