EP-4741919-A1 - FOCUSING METHOD AND ELECTRONIC DEVICE
Abstract
A focusing method and an electronic device (100) are provided. The electronic device (100) includes a camera cover that can move independent of a camera module. The electronic device (100) may dynamically adjust a movement track of a focus motor based on movement of the camera cover, and balance a relative position between the camera cover and the focus motor, thereby implementing quick focusing after a camera application is started, and reducing collision between the focus motor and the camera cover.
Inventors
- LV, Yali
Assignees
- Huawei Technologies Co., Ltd.
Dates
- Publication Date
- 20260513
- Application Date
- 20241228
Claims (13)
- A focusing method, wherein the method is applied to an electronic device, the electronic device comprises a camera module and a camera cover, the camera module comprises a focus motor, and the method comprises: starting, by the electronic device, a camera application, and determining a first target position to which the focus motor is to move; moving, by the electronic device, the camera cover; and when the camera cover moves to a first position and a distance between the first position and the first target position is greater than or equal to a first distance, moving, by the electronic device, the focus motor to the first target position, wherein the first position is less than a target position of the camera cover.
- The method according to claim 1, wherein before the camera cover moves to the first position, the method further comprises: when the camera cover moves to a second position and a distance between the second position and the first target position is less than the first distance, moving, by the electronic device, the focus motor to a third position, wherein a distance between the second position and the third position is greater than or equal to the first distance.
- The method according to claim 2, wherein before the camera cover moves to the first position, the method further comprises: in a process in which the focus motor moves toward the third position, continuing, by the electronic device, to move the camera cover; and when the camera cover moves to a fourth position and a distance between the fourth position and the third position is less than the first distance, moving, by the electronic device, the focus motor to a fifth position, wherein a distance between the fourth position and the fifth position is greater than or equal to the first distance.
- The method according to claim 3, wherein after the camera cover moves to the fourth position, the method further comprises: displaying, by the electronic device, first prompt information, wherein the first prompt information is used to inform a user that an exception occurs in movement of the camera cover.
- The method according to claim 2, wherein before the camera cover moves to the first position, the method further comprises: in a process in which the focus motor moves toward the third position, continuing, by the electronic device, to move the camera cover; and when the camera cover moves to a sixth position, a distance between the sixth position and the third position is greater than the distance between the second position and the third position, and a distance between the sixth position and the first target position is less than the first distance, moving, by the electronic device, the focus motor to a seventh position, wherein a distance between the sixth position and the seventh position is greater than or equal to the first distance.
- The method according to claim 5, wherein before the camera cover moves to the sixth position, the method further comprises: when the focus motor moves to the third position, pausing, by the electronic device, movement of the focus motor.
- The method according to any one of claims 1 to 6, wherein after starting, by the electronic device, the camera application, the method further comprises: starting, by the electronic device after a first time period of starting to move the camera cover, to move the focus motor, or starting to move the camera cover and the focus motor simultaneously.
- The method according to any one of claims 1 to 7, wherein after the camera cover moves to the first position, the method further comprises: continuing, by the electronic device, to move the camera cover until moving the camera cover to the target position of the camera cover.
- The method according to claim 8, wherein after moving the camera cover to the target position of the camera cover, the method further comprises: keeping, by the electronic device, the camera cover at the target position of the camera cover; and when a target position to which the focus motor is to move changes from the first target position to a third target position, moving, by the electronic device, the focus motor to the third target position.
- The method according to any one of claims 1 to 9, wherein the first distance is a safety distance between the focus motor and the camera cover.
- An electronic device, wherein the electronic device comprises a camera module, a camera cover, a memory, and a processor, the camera module is configured to shoot an image, the camera module comprises a lens and a focus motor, the focus motor is configured to push the lens to implement focusing, the camera cover is configured to: provide moving space for the camera module and protect an internal structure of the electronic device, the memory is configured to store a computer program, and the processor is configured to invoke the computer program, so that the electronic device performs the method according to any one of claims 1 to 10.
- A computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are run on an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 10.
- A computer program product, wherein the computer program product comprises computer instructions, and when the computer instructions are run on an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 10.
Description
This application claims priority to Chinese Patent Application No. 202311866430.7, filed with the China National Intellectual Property Administration on December 29, 2023, and entitled "FOCUSING METHOD AND ELECTRONIC DEVICE", which is incorporated herein by reference in its entirety. TECHNICAL FIELD This application relates to the field of terminal technologies, and in particular, to a focusing method and an electronic device. BACKGROUND Currently, a user has an increasing demand for using a camera application in an electronic device such as a mobile phone. For example, the user expects that the camera application can perform quick and accurate focusing after being started. A camera module of the electronic device includes a lens and a focus motor. The electronic device pushes the lens by using the focus motor to implement focusing. Because it takes some time for the focus motor to push the lens to move to a target position, a focusing speed of the camera application is low. SUMMARY This application provides a focusing method and an electronic device. In the method, a focus motor may be moved based on movement of a camera cover, and a relative position between the camera cover and the focus motor are balanced, to implement quick focusing after a camera application is started, and reduce collision between the focus motor and the camera cover. According to a first aspect, this application provides a focusing method. The method may be applied to an electronic device, the electronic device includes a camera module and a camera cover, and the camera module includes a focus motor. The electronic device starts a camera application, and determines a first target position to which the focus motor is to move; the electronic device moves the camera cover; and when the camera cover moves to a first position and a distance between the first position and the first target position is greater than or equal to a first distance, the electronic device moves the focus motor to the first target position, where the first position is less than a target position of the camera cover. For the first target position to which the focus motor is to move, refer to the target position X shown in FIG. 5 or the target position X' shown in FIG. 6 in this application. The camera cover moves to the first position. For the first position, refer to the position Y2 shown in FIG. 5, the position Y1 shown in FIG. 6, or the position Y3' shown in FIG. 7 in this application. For the target position of the camera cover, refer to target positions Y shown in FIG. 5 to FIG. 7 in this application. The first distance can ensure that the camera module does not collide with the camera cover. That the first position is less than the target position of the camera cover may indicate that the first position is closer to an initial position of the camera cover than the target position of the camera cover. The initial position of the camera cover may be a position of the camera cover when the camera application is not started. For the initial position of the camera cover, refer to positions of the battery cover shown in FIG. 5 to FIG. 7 in this application. It can be learned that the electronic device may move the focus motor based on a moving position of the camera cover. Before the camera cover moves to the target position of the camera cover, if the moving position of the camera cover can avoid collision between the camera module and the camera cover after the focus motor moves to the first target position, the electronic device may quickly move the focus motor to the first target position, to implement focusing. In this way, the electronic device may move the focus motor without waiting for the camera cover to move to the target position of the camera cover. According to the foregoing method, quick focusing after the application is started can be implemented, and collision between the camera module and the camera cover can be reduced. With reference to the first aspect, in some embodiments, before the camera cover moves to the first position, when the camera cover moves to a second position and a distance between the second position and the first target position is less than the first distance, the electronic device moves the focus motor to a third position, where a distance between the second position and the third position is greater than or equal to the first distance. For the second position, refer to the position Y1 shown in FIG. 5 or FIG. 7, or the figure in this application. For the third position, refer to the position X1 shown in FIG. 5 or FIG. 7 in this application. It can be learned that, in a process in which the camera cover moves toward the target position of the camera cover, the electronic device may move the focus motor for a plurality of times based on moving positions of the camera cover at different moments. If a moving position of the camera cover causes the camera module to collide with the camera cover after the focus motor moves to the f