Focusing method and device, electronic equipment and readable storage medium
By using short-stroke and long-stroke lenses in the terminal device to obtain focus positions respectively, and combining these positions to determine the target focus, the problem of low focus accuracy in the existing technology is solved, and the focus effect and user experience are improved.
Patent Information
- Application Number
- CN202310316619.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2024-10-01
AI Technical Summary
Existing terminal devices are prone to multiple focus positions during the focusing process, resulting in reduced focus position accuracy, virtual focus and jitter, which affects the user experience.
At least two lenses, a short-stroke lens and a long-stroke lens, are used to obtain phase difference images respectively, determine multiple focus positions, and combine these positions to determine the target focus position for focus control.
It improves the accuracy of the focus position, avoids defocus and jitter, especially the focus effect in moiré and vertical stripe scenes, and improves the user experience.
Smart Images

Figure CN118741303A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of focusing technology, and in particular to a focusing method, device, electronic device and readable storage medium. Background Art
[0002] Currently, most terminal devices use single-lens PD focusing (Phase Detection Auto-focus) as the focusing method during shooting. However, since a single long-stroke lens is usually used for PD focusing, it is easy to have multiple focus positions during the focusing process, resulting in reduced focus position accuracy, out-of-focus and jitter, affecting user experience. Summary of the invention
[0003] In view of this, the present disclosure provides a focusing method, device, electronic device and readable storage medium to at least solve the problems existing in the related art.
[0004] According to a first aspect of an embodiment of the present disclosure, a focusing method is provided, which is applied to a terminal device, wherein the terminal device is provided with a first lens and a second lens, and a focusing stroke of the first lens is smaller than a focusing stroke of the second lens, and the method comprises:
[0005] Acquire a plurality of first phase difference images of a target area through the first lens, and acquire a plurality of second phase difference images of the target area through the second lens;
[0006] determining at least one first focal position of the target area according to the plurality of first phase difference images;
[0007] Determining a plurality of second focal positions of the target area according to the plurality of second phase difference images;
[0008] A target focus position is determined according to the at least one first focus position and the plurality of second focus positions, and the terminal device is controlled to focus on the target area according to the target focus position.
[0009] In combination with any implementation manner of the present disclosure, the depth of field distance of the first lens is greater than the depth of field distance of the second lens.
[0010] In combination with any embodiment of the present disclosure, the method further includes:
[0011] photographing the target area through the first lens or the second lens, and preprocessing the photographing result to obtain preprocessing parameters corresponding to the target area;
[0012] The method of acquiring a plurality of first phase difference images of a target area through the first lens and acquiring a plurality of second phase difference images of the target area through the second lens comprises:
[0013] Based on the preprocessing parameters, a plurality of first phase difference images of the target area are acquired through the first lens, and a plurality of second phase difference images of the target area are acquired through the second lens.
[0014] In conjunction with any embodiment of the present disclosure, the pretreatment includes at least one of the following:
[0015] Removing noise from the shooting result by using a digital filter;
[0016] Controlling the contrast of the photographing result to be within a preset contrast range;
[0017] The size of the photographing result is controlled to be within a preset size range.
[0018] In combination with any embodiment of the present disclosure, the step of acquiring a plurality of first phase difference images of a target area through the first lens, and acquiring a plurality of second phase difference images of the target area through the second lens includes:
[0019] Moving the first lens according to a first preset step length within a focusing stroke, and acquiring a pair of first phase difference images of the target area through the first lens every time the first preset step length is moved;
[0020] The first lens is moved according to a second preset step length within a focusing stroke, and a pair of second phase difference images of the target area is acquired through the second lens every time the second preset step length is moved.
[0021] In combination with any embodiment of the present disclosure, determining at least one first focal position of the target area according to the multiple first phase difference images includes:
[0022] Respectively determining the absolute error sum of each pair of first phase difference images in the plurality of first phase difference images of the target area, and determining a first absolute error sum curve of the plurality of first phase difference images according to each absolute error;
[0023] At least one first focus position of the target area is determined according to the first absolute error and the curve.
[0024] In combination with any embodiment of the present disclosure, determining a plurality of second focal positions of the target area according to the plurality of second phase difference images includes:
[0025] Respectively determining the absolute error sum of each pair of second phase difference images in the plurality of second phase difference images of the target area, and determining a second absolute error sum curve of the plurality of second phase difference images according to each absolute error;
[0026] A plurality of second focus positions of the target area are determined according to the second absolute error and the curve.
[0027] In combination with any implementation manner of the present disclosure, the first preset step length is greater than the second preset step length.
[0028] In combination with any embodiment of the present disclosure, determining a target focal position according to the at least one first focal position and the plurality of second focal positions includes:
[0029] For the at least one first focal position, respectively determining the second focal position closest to each first focal position as the pre-selected focal position;
[0030] A preselected focus position, among at least one preselected focus position, which is closest to the corresponding first focus position is determined as the target focus position.
[0031] In combination with any embodiment of the present disclosure, the terminal device is provided with a drive motor;
[0032] The focusing the target area according to the target focal position includes:
[0033] The driving motor is moved to the target focus position to drive the first lens and / or the second lens to focus on the target area.
[0034] According to a second aspect of an embodiment of the present disclosure, a focusing device is provided, which is applied to a terminal device, wherein the terminal device is provided with a first lens and a second lens, and a focusing stroke of the first lens is smaller than a focusing stroke of the second lens, and the device comprises:
[0035] A phase difference image acquisition module, used to: acquire a plurality of first phase difference images of a target area through the first lens, and acquire a plurality of second phase difference images of the target area through the second lens;
[0036] A first focus determination module, configured to: determine at least one first focus position of the target area according to the plurality of first phase difference images;
[0037] A second focus determination module, configured to: determine a plurality of second focus positions of the target area according to the plurality of second phase difference images;
[0038] The target focus determination module is used to: determine the target focus position according to the at least one first focus position and the multiple second focus positions, and control the terminal device to focus on the target area according to the target focus position.
[0039] In combination with any implementation manner of the present disclosure, the depth of field distance of the first lens is greater than the depth of field distance of the second lens.
[0040] In combination with any embodiment of the present disclosure, the device further includes a preprocessing module, which is used to:
[0041] photographing the target area through the first lens or the second lens, and preprocessing the photographing result to obtain preprocessing parameters corresponding to the target area;
[0042] When the phase difference image acquisition module acquires a plurality of first phase difference images of the target area through the first lens and acquires a plurality of second phase difference images of the target area through the second lens, the phase difference image acquisition module is used to:
[0043] Based on the preprocessing parameters, a plurality of first phase difference images of the target area are acquired through the first lens, and a plurality of second phase difference images of the target area are acquired through the second lens.
[0044] In conjunction with any embodiment of the present disclosure, the pretreatment includes at least one of the following:
[0045] Removing noise from the shooting result by using a digital filter;
[0046] Controlling the contrast of the photographing result to be within a preset contrast range;
[0047] The size of the photographing result is controlled to be within a preset size range.
[0048] In combination with any embodiment of the present disclosure, when the phase difference image acquisition module acquires a plurality of first phase difference images of a target area through the first lens and acquires a plurality of second phase difference images of the target area through the second lens, it is used to:
[0049] Moving the first lens according to a first preset step length within a focusing stroke, and acquiring a pair of first phase difference images of the target area through the first lens every time the first preset step length is moved;
[0050] The first lens is moved according to a second preset step length within a focusing stroke, and a pair of second phase difference images of the target area is acquired through the second lens every time the second preset step length is moved.
[0051] In combination with any embodiment of the present disclosure, when the first focus determination module determines at least one first focus position of the target area according to the multiple first phase difference images, it is used to:
[0052] Respectively determining the absolute error sum of each pair of first phase difference images in the plurality of first phase difference images of the target area, and determining a first absolute error sum curve of the plurality of first phase difference images according to each absolute error;
[0053] At least one first focus position of the target area is determined according to the first absolute error and the curve.
[0054] In combination with any embodiment of the present disclosure, when the second focus determination module determines the multiple second focus positions of the target area according to the multiple second phase difference images, it is used to:
[0055] Respectively determining the absolute error sum of each pair of second phase difference images in the plurality of second phase difference images of the target area, and determining a second absolute error sum curve of the plurality of second phase difference images according to each absolute error;
[0056] A plurality of second focus positions of the target area are determined according to the second absolute error and the curve.
[0057] In combination with any implementation manner of the present disclosure, the first preset step length is greater than the second preset step length.
[0058] In combination with any embodiment of the present disclosure, when determining the target focus position according to the at least one first focus position and the plurality of second focus positions, the target focus determination module is configured to:
[0059] For the at least one first focal position, respectively determining the second focal position closest to each first focal position as the pre-selected focal position;
[0060] A preselected focus position, among at least one preselected focus position, which is closest to the corresponding first focus position is determined as the target focus position.
[0061] In combination with any embodiment of the present disclosure, the terminal device is provided with a drive motor;
[0062] The target focus determination module focuses the target area according to the target focus position, and is used to:
[0063] The driving motor is moved to the target focus position to drive the first lens and / or the second lens to focus on the target area.
[0064] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0065] A memory, configured to store instructions executable by the processor;
[0066] The processor is configured to execute the executable instructions in the memory to implement the steps of the method described in any embodiment of the first aspect above.
[0067] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the steps of the method described in any embodiment of the first aspect are implemented.
[0068] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0069] The target focus position is determined by combining the focus positions obtained by the first lens and the second lens respectively, and the terminal device is controlled to focus on the target area according to the target focus position, thereby improving the focus position accuracy, avoiding out-of-focus and jitter phenomena, and especially improving the focusing effect of the terminal for moiré scenes and vertical stripes scenes, thereby improving the user experience.
[0070] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0072] Figure 1 is a flow chart of a focusing method according to an exemplary embodiment of the present disclosure;
[0073] Figure 2 is a schematic diagram of a SAD curve according to an exemplary embodiment of the present disclosure;
[0074] Figure 3 is another SAD curve schematic diagram shown in the present disclosure according to an exemplary embodiment;
[0075] Figure 4 is a flow chart of another focusing method according to an exemplary embodiment of the present disclosure;
[0076] Figure 5 is a schematic diagram of a focusing device according to an exemplary embodiment of the present disclosure;
[0077] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0078] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0079] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0080] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0081] Currently, most terminal devices use single-lens PD focusing (Phase Detection Auto-focus) as the focusing method during shooting. However, since a single long-stroke lens is usually used for PD focusing, it is easy to cause multiple focus positions during the focusing process, resulting in out-of-focus and jitter, affecting the user experience.
[0082] During the PD focusing process, the long-stroke lens of the terminal device acquires multiple phase difference images respectively, and determines the distance of the imaging object by calculating the phase difference between the images, thereby automatically adjusting the lens focal length to achieve focusing. When shooting moiré scenes, such as vertical stripes and other complex periodic texture scenes, the pixel difference between adjacent phase difference images is very small, which makes it difficult to accurately locate the best focus position during PD focusing, and it is more likely to be out of focus.
[0083] In view of this, the present disclosure provides a focusing method to at least solve the problems existing in the related art.
[0084] The method disclosed in the present invention can be applied to a terminal device, which is provided with a first lens and a second lens. The focusing stroke of the first lens is smaller than the focusing stroke of the second lens, and the focusing stroke represents the total distance range that the lens can move during the focusing process. Relatively speaking, the first lens is a short-stroke lens, and the second lens is a long-stroke lens; exemplarily, the outer lens corresponding to the back panel of the terminal device can be set as the first lens, and the inner lens farther from the back panel can be set as the second lens, that is, the solution described in the present invention is realized by a set of inner and outer nested dual-lens structures.
[0085] Figure 1 A flow chart of a focusing method according to an exemplary embodiment of the present disclosure is shown, including steps S101 to S104.
[0086] In step S101, a plurality of first phase difference images of a target area are acquired through the first lens, and a plurality of second phase difference images of the target area are acquired through the second lens. Optionally, the target area includes an area within a moiré scene, such as a complex periodic texture scene such as a vertical stripe scene.
[0087] Exemplarily, the target area that needs to be photographed can be photographed using the short-stroke lens (i.e., the first lens) and the long-stroke lens (i.e., the second lens) on the terminal device, respectively, to obtain multiple first phase difference images captured by the first lens and multiple second phase difference images captured by the second lens, respectively.
[0088] Among them, both the first lens and the second lens can obtain a pair of phase difference images at multiple different positions in the current journey. For example, the light source device of the terminal device can emit a light beam and divide it into two paths through a beam splitter, one path is guided to the surface of the object, and the other path is guided to the reference plane (which can be a reflector or a flat plate). When the two light beams converge again, interference will occur in space and cause changes in light intensity. The terminal device can collect the distribution of interference light intensity through image sensors such as CCD (Charge Coupled Device) or CMOS (Complementary Metal-Oxide-Semiconductor pixel sensor) and generate an interference image. By extracting the phase information of the interference image, a pair of phase difference images can be obtained, and the phase difference image contains the morphological information of the surface of the object.
[0089] Since the focus stroke of the first lens is shorter than the focus stroke of the second lens, the number of first phase difference images captured by the first lens is usually smaller than the number of second phase difference images captured by the second lens.
[0090] In one example, the first lens and the second lens can both acquire a pair of phase difference images at a plurality of different positions in the current travel based on respective preset step sizes.
[0091] Exemplarily, the first lens may be moved according to a first preset step length within a focusing range, and a pair of first phase difference images of the target area may be acquired through the first lens each time the first preset step length is moved.
[0092] For example, the focus stroke of the first lens may be composed of a plurality of first preset steps, and the first lens may be moved one first preset step at a time and acquire a pair of first phase difference images until the moving distance reaches the focus stroke.
[0093] In another example, the first lens may be moved according to a second preset step length within a focus range, and a pair of second phase difference images of the target area may be acquired through the second lens every time the second preset step length is moved.
[0094] For example, the focus stroke of the second lens may also be composed of a plurality of second preset steps, and the second lens may be moved one second preset step at a time and acquire a pair of second phase difference images until the moving distance reaches the focus stroke.
[0095] Since the focus stroke of the first lens is smaller than the focus stroke of the second lens, when the first preset step length corresponds to the second preset step length, the number of first phase difference images captured by the first lens will be smaller than the number of second phase difference images captured by the second lens. In one example, the first preset step length can be controlled to be larger than the second preset step length to ensure that the number of the first phase difference images is smaller than the number of the second phase difference images. In another example, the depth of field distance of the first lens can be set to be larger than the depth of field distance of the second lens to further ensure that the number of the first phase difference images is smaller than the number of the second phase difference images.
[0096] In step S102, at least one first focus position of the target area is determined according to the plurality of first phase difference images.
[0097] Exemplarily, the absolute error sum of each pair of first phase difference images in the target area may be determined respectively, and a first Sum of Absolute Differences (SAD) curve of the multiple first phase difference images may be determined according to each absolute error.
[0098] First, each pair of first phase difference images can be peak aligned and phase difference parameters can be obtained. According to the phase difference parameters and the preset acquisition wavelength of the first lens, the absolute error of each pixel in the current pair of phase difference images can be obtained. The absolute error sum of the current pair of phase difference images can be obtained by summing the absolute errors of all pixels in the current pair of phase difference images. Repeat the above method to obtain the absolute error sum of each pair of first phase difference images, and then draw the first absolute error sum curve of the first phase difference image based on different positions on the focus stroke and the corresponding absolute error sum.
[0099] Afterwards, at least one first focus position of the target area may be determined according to the first absolute error and the curve.
[0100] like Figure 2 As shown in FIG. 1 , the first absolute error sum curve represents the absolute error and state of the phase difference image collected by the first lens at different formation positions. In the first absolute error sum curve, the lower the SAD value, the clearer the focus. Since the focus stroke of the first lens is short, the absolute error points collected are small, so the number of low SAD values is small. Figure 2 For example, the stroke position (stroke position 5) corresponding to the unique lowest point of the first absolute error and curve can be used as the first focal position, which is used as a reference position for subsequent calculation of the target focal position.
[0101] In step S103, at least one first focus position of the target area is determined according to the plurality of first phase difference images.
[0102] Similar to the above method, the absolute error sum of each pair of second phase difference images in the multiple second phase difference images of the target area can be determined respectively, and the second absolute error sum curve of the multiple second phase difference images can be determined according to each absolute error.
[0103] Then, a plurality of second focus positions of the target area may be determined according to the second absolute error and the curve. Figure 3 As shown in FIG. 1 , the second error sum curve represents the absolute error and state of the phase difference image collected by the second lens at different formation positions. Since the focusing stroke of the second lens is long, more absolute error points are collected, and the multiple second phase difference images overlap in multiple places, the number of SAD values at the low position is large. Figure 3 For example, the stroke positions (stroke positions 7, 17, 26) corresponding to multiple lowest points of the displacement of the second absolute error and curve can be used as the second focal position, as another set of reference positions for subsequent calculation of the target focal position.
[0104] In step S104, a target focus position is determined according to the at least one first focus position and the plurality of second focus positions, and the terminal device is controlled to focus on the target area according to the target focus position.
[0105] After acquiring at least one first focus position and multiple second focus positions, a unique target focus position may be further determined so that the terminal device focuses on the target area.
[0106] Figure 4 A flow chart of a focusing method according to an exemplary embodiment of the present disclosure is shown, including steps S104A to S104C.
[0107] In step S104A, for the at least one first focus position, the second focus position closest to each first focus position is respectively determined as a pre-selected focus position.
[0108] Wherein, in the case of multiple first focal positions, the second focal position closest to each first focal position can be determined respectively, and all second focal positions that meet the requirements can be determined as the pre-selected focal position, that is, corresponding to each first focal position, a second focal position closest to it is obtained as the pre-selected focal position. In the case of only one first focal position, the second focal position closest to the first focal position can be determined as the pre-selected focal position.
[0109] In step S104B, the pre-selected focus position closest to the corresponding first focus position among the at least one pre-selected focus position is determined as the target focus position.
[0110] Wherein, when there are multiple pre-selected focus positions, the closest pre-selected focus position among the pre-selected focus positions and the first focus positions corresponding to the pre-selected focus positions can be determined as the target focus position. When there is only one pre-selected focus position, the pre-selected focus position can be directly determined as the target focus position.
[0111] by Figure 2 and Figure 3 Taking the first focal position and three second focal positions shown in the figure as examples, the second focal position closest to the first focal position (stroke 5) is the focal position in stroke 7, so stroke 7 can be used as the pre-selected focal position. Furthermore, since there is only one pre-selected focal position, stroke 7 can be used as the target focal position.
[0112] In step S104C, the target area is focused according to the target focal position.
[0113] Exemplarily, when the terminal device is provided with a drive motor, the drive motor can be controlled to drive the first lens and / or the second lens to focus on the target area. For example, the target focal position is sent to the motor controller, and the drive motor is rotated to drive the lens to the target focal position. During the movement of the lens, the focus sensor of the terminal device can continuously monitor the focus error of the focus point, and adjust the rotation speed and direction of the motor through the feedback mechanism, so that the lens moves to the target focal position in the shortest time, thereby ensuring the focusing efficiency.
[0114] The solution disclosed in the present invention determines the target focus position by combining the focus positions obtained by the first lens and the second lens respectively, and controls the terminal device to focus on the target area according to the target focus position, thereby improving the focus position accuracy, avoiding out-of-focus and jitter phenomena, and especially improving the focusing effect of the terminal for moiré scenes, such as vertical stripes scenes, thereby improving the user experience.
[0115] In an optional embodiment, the method further includes:
[0116] The target area is photographed through the first lens or the second lens, and the photographing result is preprocessed to obtain preprocessing parameters corresponding to the target area. Thereafter, based on the preprocessing parameters, multiple first phase difference images of the target area can be obtained through the first lens, and multiple second phase difference images of the target area can be obtained through the second lens.
[0117] Exemplarily, before acquiring the phase difference image, the target area can be photographed in advance through the first lens or the second lens, and the acquired photographing result can be used as the original phase difference image, and the subsequently acquired phase difference image can be processed by preprocessing parameters obtained by preprocessing the original phase difference image, thereby reducing the computational pressure when each group of phase differences is processed separately in the subsequent process and improving the processing speed.
[0118] In an example, the first pair of first phase difference images acquired by the first lens may be used as the original phase difference images and preprocessed, thereby omitting a separate shooting step.
[0119] Exemplarily, the preprocessing includes at least one of the following:
[0120] Removing noise from the shooting result by using a digital filter;
[0121] Controlling the contrast of the photographing result to be within a preset contrast range;
[0122] The size of the photographing result is controlled to be within a preset size range.
[0123] The method disclosed in the present invention, based on the preprocessing parameters, obtains multiple first phase difference images of the target area through the first lens, and obtains multiple second phase difference images of the target area through the second lens, so as to reduce the calculation pressure when each group of phase differences is processed separately in the subsequent process and improve the processing speed, thereby further improving the focusing effect of the terminal device.
[0124] For the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously.
[0125] Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0126] Corresponding to the aforementioned application function implementation method embodiment, the present disclosure also provides an application function implementation device and a corresponding terminal embodiment.
[0127] like Figure 5 As shown, the present disclosure also provides a focusing device, which is applied to a terminal device, wherein the terminal device is provided with a first lens and a second lens, and the focusing stroke of the first lens is smaller than the focusing stroke of the second lens, and the device comprises:
[0128] The phase difference image acquisition module 501 is used to: acquire a plurality of first phase difference images of a target area through the first lens, and acquire a plurality of second phase difference images of the target area through the second lens;
[0129] A first focus determination module 502 is used to: determine at least one first focus position of the target area according to the plurality of first phase difference images;
[0130] A second focus determination module 503 is used to: determine a plurality of second focus positions of the target area according to the plurality of second phase difference images;
[0131] The target focus determination module 504 is used to determine a target focus position according to the at least one first focus position and the multiple second focus positions, and control the terminal device to focus on the target area according to the target focus position.
[0132] In combination with any implementation manner of the present disclosure, the depth of field distance of the first lens is greater than the depth of field distance of the second lens.
[0133] In combination with any embodiment of the present disclosure, the device further includes a preprocessing module, which is used to:
[0134] photographing the target area through the first lens or the second lens, and preprocessing the photographing result to obtain preprocessing parameters corresponding to the target area;
[0135] When the phase difference image acquisition module acquires a plurality of first phase difference images of the target area through the first lens and acquires a plurality of second phase difference images of the target area through the second lens, the phase difference image acquisition module is used to:
[0136] Based on the preprocessing parameters, a plurality of first phase difference images of the target area are acquired through the first lens, and a plurality of second phase difference images of the target area are acquired through the second lens.
[0137] In conjunction with any embodiment of the present disclosure, the pretreatment includes at least one of the following:
[0138] Removing noise from the shooting result by using a digital filter;
[0139] Controlling the contrast of the photographing result to be within a preset contrast range;
[0140] The size of the photographing result is controlled to be within a preset size range.
[0141] In combination with any embodiment of the present disclosure, when the phase difference image acquisition module acquires a plurality of first phase difference images of a target area through the first lens and acquires a plurality of second phase difference images of the target area through the second lens, it is used to:
[0142] Moving the first lens according to a first preset step length within a focusing stroke, and acquiring a pair of first phase difference images of the target area through the first lens every time the first preset step length is moved;
[0143] The first lens is moved according to a second preset step length within a focusing stroke, and a pair of second phase difference images of the target area is acquired through the second lens every time the second preset step length is moved.
[0144] In combination with any embodiment of the present disclosure, when the first focus determination module determines at least one first focus position of the target area according to the multiple first phase difference images, it is used to:
[0145] Respectively determining the absolute error sum of each pair of first phase difference images in the plurality of first phase difference images of the target area, and determining a first absolute error sum curve of the plurality of first phase difference images according to each absolute error;
[0146] At least one first focus position of the target area is determined according to the first absolute error and the curve.
[0147] In combination with any embodiment of the present disclosure, when the second focus determination module determines the plurality of second focus positions of the target area according to the plurality of second phase difference images, it is configured to:
[0148] Respectively determining the absolute error sum of each pair of second phase difference images in the plurality of second phase difference images of the target area, and determining a second absolute error sum curve of the plurality of second phase difference images according to each absolute error;
[0149] A plurality of second focus positions of the target area are determined according to the second absolute error and the curve.
[0150] In combination with any implementation manner of the present disclosure, the first preset step length is greater than the second preset step length.
[0151] In combination with any embodiment of the present disclosure, when determining the target focus position according to the at least one first focus position and the plurality of second focus positions, the target focus determination module is configured to:
[0152] For the at least one first focal position, respectively determining the second focal position closest to each first focal position as the pre-selected focal position;
[0153] A preselected focus position, among at least one preselected focus position, which is closest to the corresponding first focus position is determined as the target focus position.
[0154] In combination with any embodiment of the present disclosure, the terminal device is provided with a drive motor;
[0155] The target focus determination module focuses the target area according to the target focus position, and is used to:
[0156] The driving motor is moved to the target focus position to drive the first lens and / or the second lens to focus on the target area.
[0157] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the disclosed solution. A person of ordinary skill in the art may understand and implement it without creative work.
[0158] Figure 6 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown.
[0159] Please refer to the attached Figure 6 , which exemplarily shows a block diagram of an electronic device. For example, the device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0160] Reference Figure 6 , the device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 562 , a sensor component 614 , and a communication component 616 .
[0161] The processing component 602 generally controls the overall operation of the device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.
[0162] The memory 604 is configured to store various types of data to support operations on the device 600. Examples of such data include instructions for any application or method operating on the device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0163] The power supply component 606 provides power to the various components of the device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 600.
[0164] The multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0165] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the device 600 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 includes a speaker for outputting audio signals.
[0166] I / O interface 562 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0167] The sensor assembly 614 includes one or more sensors for providing various aspects of the status assessment of the device 600. For example, the sensor assembly 614 can detect the open / closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600, the sensor assembly 614 can detect the position change of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, the orientation or acceleration / deceleration of the device 600, and the temperature change of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0168] The communication component 616 is configured to facilitate wired or wireless communication between the device 600 and other devices. The device 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0169] In an exemplary embodiment, the device 600 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the power supply method of the above-mentioned electronic device.
[0170] In an exemplary embodiment of the present disclosure, a non-transitory computer-readable storage medium including instructions is provided, such as a memory 604 including instructions, and the instructions can be executed by a processor 620 of an apparatus 600 to complete the power supply method of the electronic device. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0171] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0172] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A focusing method, characterized in that: Applied to a terminal device, the terminal device is provided with a first lens and a second lens, the focus range of the first lens is smaller than the focus range of the second lens, and the method includes: Acquire a plurality of first phase difference images of a target area through the first lens, and acquire a plurality of second phase difference images of the target area through the second lens; determining at least one first focal position of the target area according to the plurality of first phase difference images; Determining a plurality of second focal positions of the target area according to the plurality of second phase difference images; A target focus position is determined according to the at least one first focus position and the plurality of second focus positions, and the terminal device is controlled to focus on the target area according to the target focus position.
2. The method according to claim 1, characterized in that The depth of field distance of the first lens is greater than the depth of field distance of the second lens.
3. The method according to claim 1, characterized in that The target area includes an area within the moiré scene.
4. The method according to claim 1, characterized in that The method of acquiring a plurality of first phase difference images of a target area through the first lens and acquiring a plurality of second phase difference images of the target area through the second lens comprises: Moving the first lens according to a first preset step length within a focusing stroke, and acquiring a pair of first phase difference images of the target area through the first lens every time the first preset step length is moved; The first lens is moved according to a second preset step length within a focusing stroke, and a pair of second phase difference images of the target area is acquired through the second lens every time the second preset step length is moved.
5. The method according to claim 4, characterized in that The step of determining at least one first focal position of the target area according to the plurality of first phase difference images comprises: Respectively determining the absolute error sum of each pair of first phase difference images in the plurality of first phase difference images of the target area, and determining a first absolute error sum curve of the plurality of first phase difference images according to each absolute error; At least one first focus position of the target area is determined according to the first absolute error and the curve.
6. The method according to claim 4, characterized in that The step of determining a plurality of second focal positions of the target area according to the plurality of second phase difference images comprises: Respectively determining the absolute error sum of each pair of second phase difference images in the plurality of second phase difference images of the target area, and determining a second absolute error sum curve of the plurality of second phase difference images according to each absolute error; A plurality of second focus positions of the target area are determined according to the second absolute error and the curve.
7. The method according to claim 4, characterized in that The first preset step length is greater than the second preset step length.
8. The method according to claim 1, characterized in that The determining of the target focal position according to the at least one first focal position and the plurality of second focal positions comprises: For the at least one first focal position, respectively determining the second focal position closest to each first focal position as the pre-selected focal position; A preselected focus position, among at least one preselected focus position, which is closest to the corresponding first focus position is determined as the target focus position.
9. The method according to claim 1, characterized in that: The method further comprises: photographing the target area through the first lens or the second lens, and preprocessing the photographing result to obtain preprocessing parameters corresponding to the target area; The method of acquiring a plurality of first phase difference images of a target area through the first lens and acquiring a plurality of second phase difference images of the target area through the second lens comprises: Based on the preprocessing parameters, a plurality of first phase difference images of the target area are acquired through the first lens, and a plurality of second phase difference images of the target area are acquired through the second lens.
10. The method according to claim 9, characterized in that The pre-processing includes at least one of the following: Removing noise from the shooting result by using a digital filter; Controlling the contrast of the photographing result to be within a preset contrast range; The size of the photographing result is controlled to be within a preset size range.
11. A focusing device, characterized in that: Applied to a terminal device, the terminal device is provided with a first lens and a second lens, the focus range of the first lens is smaller than the focus range of the second lens, and the device comprises: A phase difference image acquisition module, used to: acquire a plurality of first phase difference images of a target area through the first lens, and acquire a plurality of second phase difference images of the target area through the second lens; A first focus determination module, configured to: determine at least one first focus position of the target area according to the plurality of first phase difference images; A second focus determination module, configured to: determine a plurality of second focus positions of the target area according to the plurality of second phase difference images; The target focus determination module is used to: determine the target focus position according to the at least one first focus position and the multiple second focus positions, and control the terminal device to focus on the target area according to the target focus position.
12. An electronic device, characterized in that: The electronic device comprises: A memory for storing processor executable instructions; A processor configured to execute the executable instructions in the memory to implement the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
