Focusing method and apparatus, electronic device, and medium

By determining the motion information of the subject and adjusting the position of the focus frame, the problem of focus frame lag during subject movement is solved, improving image quality and reducing the power consumption of electronic devices.

CN122372834APending Publication Date: 2026-07-10BEIJING XIAOMI MOBILE SOFTWARE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING XIAOMI MOBILE SOFTWARE CO LTD
Filing Date
2025-01-08
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

When the subject is moving, existing technology struggles to track the focus frame in time, resulting in poor image quality.

Method used

By determining the motion information of the subject, the position of the focus frame is adjusted so that the focus frame can track the subject in a timely manner. The motion information is used to adjust the position of the focus frame to avoid lag.

Benefits of technology

It improves image quality and reduces the power consumption of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122372834A_ABST
    Figure CN122372834A_ABST
Patent Text Reader

Abstract

This disclosure relates to a focusing method, apparatus, electronic device, and medium. The focusing method includes: determining motion information of a subject; adjusting the position of a first focusing frame based on the motion information, the first focusing frame being set according to an acquired image; and focusing on the subject based on the adjusted position of the first focusing frame. By adjusting the position of the focusing frame using motion information, the focusing frame can track the subject in a timely manner for focusing, thereby improving image quality. Simultaneously, since only motion information is needed to adjust the position of the first focusing frame, there is no need to detect and set the corresponding focusing frame for each frame, thus reducing the power consumption of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of photography technology, and more particularly to a focusing method, apparatus, electronic device, and medium. Background Technology

[0002] During image capture, electronic devices use a focusing frame to focus on the subject to improve image quality. However, if the subject is moving, the focusing frame may struggle to track it and end up outside the subject's frame, resulting in poor image quality. Summary of the Invention

[0003] To overcome the problems existing in related technologies, this disclosure provides a focusing method, apparatus, electronic device, and medium.

[0004] According to a first aspect of the present disclosure, a focusing method is provided, the focusing method comprising:

[0005] Determine the motion information of the subject being photographed;

[0006] Based on the motion information, the position of the first focus frame is adjusted, and the first focus frame is set according to the acquired image;

[0007] The subject is focused based on the first focus frame after its position is adjusted.

[0008] In some embodiments of this disclosure, the motion information includes position change information; determining the motion information of the photographed object includes:

[0009] Determine the position of the second focus frame, which is the focus frame used to focus on the subject at a historical moment;

[0010] The position change information is determined based on the position of the second focusing frame.

[0011] In some embodiments of this disclosure, a corresponding second focus frame exists at different historical moments; determining the position change information based on the position of the second focus frame includes:

[0012] The position change information is determined based on the starting points of the two second focus frames whose time difference with that of the first focus frame is the shortest; or,

[0013] The position change information is determined based on the starting point positions of the first focus frame and the second focus frame whose time difference with the first focus frame is the shortest.

[0014] In some embodiments of this disclosure, a corresponding second focus frame exists at different historical moments; before determining the position change information based on the position of the second focus frame, the focusing method further includes:

[0015] Based on the position of each second focus frame and the corresponding historical time, determine the movement direction of multiple second focus frames;

[0016] Determining the position change information based on the position of the second focus frame includes:

[0017] The position change information is determined based on the starting point position of the second focusing frame, where the angle between the direction of movement and the target direction is within a preset angle. The target direction is the direction of movement of the second focusing frame that has the shortest time difference from the first focusing frame.

[0018] In some embodiments of this disclosure, the position change information includes a position change rate; adjusting the position of the first focus frame according to the motion information includes:

[0019] If the rate of change of position is greater than or equal to a preset rate of change, the position of the first focus frame is adjusted according to the rate of change of position.

[0020] In some embodiments of this disclosure, determining the motion information of the photographed object includes:

[0021] If the number of targets is greater than or equal to a preset number, the motion information is determined, where the number of targets is the sum of the number of the first focus frame and the number of the second focus frame.

[0022] In some embodiments of this disclosure, adjusting the position of the first focus frame based on the motion information includes:

[0023] Based on the motion information, the starting point position of the first focusing frame is adjusted from the first position to the second position;

[0024] Based on the size of the first focusing frame, the first focusing frame with the second position as the starting point is formed after position adjustment.

[0025] In some embodiments of this disclosure, before adjusting the position of the first focus frame based on the motion information, the focusing method further includes:

[0026] Acquire a target image containing the object being photographed;

[0027] The target image is processed using a preset algorithm to obtain a first target location related to the photographed object;

[0028] Set the first focus frame at the first target position.

[0029] In some embodiments of this disclosure, the subject being photographed is a human portrait, and the preset algorithm is a face recognition algorithm; or, the subject being photographed is an object, and the preset algorithm is a tracking algorithm.

[0030] According to a second aspect of the present disclosure, a focusing device is provided, the focusing device comprising:

[0031] A determination module, configured to determine motion information of the subject being photographed;

[0032] An adjustment module is configured to adjust the position of a first focus frame based on the motion information, wherein the first focus frame is set according to the acquired image.

[0033] A focusing module configured to focus on the subject based on the first focusing frame after position adjustment.

[0034] According to a third aspect of the present disclosure, an electronic device is provided, the electronic device comprising:

[0035] processor;

[0036] Memory used to store the processor's executable instructions;

[0037] The processor is configured to execute the focusing method described above.

[0038] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, which, when instructions in the storage medium are executed by a processor of a terminal, enables the terminal to perform the focusing method as described above.

[0039] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0040] The motion information of the subject is determined to reflect its movement. Based on this motion information, the position of the first focus frame is adjusted to align with the subject's position. The subject is then focused on based on the adjusted focus frame to ensure it is clearly visible. By adjusting the focus frame position using motion information, the focus frame can track the subject promptly for focusing, thus improving image quality. Furthermore, since only motion information is needed to adjust the first focus frame position, there is no need to detect and set the focus frame for each frame, thereby reducing the power consumption of the electronic device.

[0041] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0042] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0043] Figure 1 This is a diagram illustrating a focused image;

[0044] Figure 2 This is a schematic diagram illustrating a focused image according to an exemplary embodiment;

[0045] Figure 3 This is a flowchart illustrating a focusing method according to an exemplary embodiment;

[0046] Figure 4 This is a flowchart illustrating a focusing method according to another exemplary embodiment;

[0047] Figure 5 This is a flowchart illustrating a focusing method according to another exemplary embodiment;

[0048] Figure 6 This is a flowchart illustrating a focusing method according to another exemplary embodiment;

[0049] Figure 7 This is a flowchart illustrating a focusing method according to another exemplary embodiment;

[0050] Figure 8 This is a block diagram illustrating a focusing device according to an exemplary embodiment;

[0051] Figure 9 This is a block diagram of an electronic device according to an exemplary embodiment.

[0052] In the picture:

[0053] 100 - Determining module; 200 - Adjustment module; 300 - Focusing module; 400 - Electronic equipment; 402 - Processing component; 404 - Memory; 406 - Power supply component; 408 - Multimedia component; 410 - Audio component; 412 - Input / output interface; 414 - Sensor component; 416 - Communication component; 420 - Processor. Detailed Implementation

[0054] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims. It should also be understood that the term “and / or” as used in this disclosure refers to and includes any or all possible combinations of one or more of the associated listed items.

[0055] With the development of electronic devices, they can now capture images of various types of subjects in multiple modes. During image capture, the electronic device uses a focusing frame to focus on the subject to ensure sharpness in the image. However, due to power consumption limitations, electronic devices cannot identify the subject in each frame to set the corresponding focusing frame. Furthermore, if the subject is moving quickly, the focusing frame may struggle to track it in time, resulting in lag. Figure 1 As shown, the ideal position of the focus frame during portrait photography is the face. Since the focus frame is set every certain number of frames, it lags behind when the subject moves quickly, ending up in the background outside the face's position. Because the focus frame is outside the subject's position, problems such as out-of-focus images occur during focusing, resulting in poor image quality.

[0056] To address the aforementioned technical problems, this disclosure provides a focusing method that adjusts the position of the focusing frame based on the motion information of the subject to achieve focus, avoiding issues such as blurry focus due to focusing frame lag, thereby improving image quality. For example... Figure 2 As shown, after adjusting the position of the focus frame with motion information, the focus frame can be positioned at the face position to focus on the face and make the face appear clearly.

[0057] This disclosure provides a focusing method, such as... Figure 3 As shown, the method includes:

[0058] S100, Determine the motion information of the subject being photographed.

[0059] S200. Adjust the position of the first focus frame according to the motion information. The first focus frame is set according to the acquired image.

[0060] The S300 focuses on the subject based on the first focus frame after position adjustment.

[0061] In this embodiment, motion information of the subject is determined to reflect its movement. Based on the motion information, the position of the first focus frame is adjusted to align with the position of the subject. Based on the adjusted first focus frame, the subject is focused to ensure it is clearly presented. By adjusting the focus frame position using motion information, the focus frame can track the subject in a timely manner for focusing, thereby improving image quality. Furthermore, since only motion information is needed to adjust the position of the first focus frame, there is no need to detect and set the focus frame for each frame, thus reducing the power consumption of the electronic device.

[0062] For example, during the process of photographing a subject, if the subject moves while the electronic device remains stationary or moves asynchronously, the position of the subject in the frame changes, generating motion information. Conversely, if the subject remains stationary while the electronic device moves, the position of the subject in the frame changes, generating motion information.

[0063] In one embodiment, the motion information includes position change information. For example... Figure 4 As shown, the motion information of the subject in step S100 can be determined in the following way:

[0064] S110. Determine the position of the second focus frame, which is the focus frame used to focus on the subject at a historical moment.

[0065] S120. Determine the position change information based on the position of the second focus frame.

[0066] In this embodiment, since the second focus frame is used to focus on the subject at a historical moment, changes in the position of the focus frame can reflect the motion information of the subject. The position of the second focus frame is determined, and based on this position, the position change information is determined as motion information. By combining the position of the second focus frame to determine the position change information, there is no need to perform additional analysis of the acquired image to obtain motion information, thereby reducing the complexity of focus frame adjustment.

[0067] For example, the historical moment is the moment before the current moment. The second focus frame can be the first focus frame set according to the acquired image at the historical moment, or it can be the first focus frame after the position of the historical moment has been adjusted.

[0068] In one embodiment, a corresponding second focus frame exists at different historical moments. The determination of position change information based on the position of the second focus frame in step S120 can be achieved as follows:

[0069] The position change information is determined based on the starting point positions of the two second focus frames that have the shortest time difference with the first focus frame.

[0070] In this embodiment, since corresponding second focus frames exist at different historical moments, and the time difference between the second focus frames and the first focus frame varies, the closer the time difference between the second focus frames and the first focus frame, the better it reflects the movement of the subject at the current moment. Position change information is determined based on the starting positions of the two second focus frames with the shortest time difference from the first focus frame, thus reflecting the movement of the subject at the current moment. By determining the position change information using two second focus frames adjacent to the first focus frame, the required position change of the first focus frame can be accurately predicted to eliminate the lag effect, thereby improving image quality. Furthermore, since the position change information only needs to be determined based on the starting positions of two second focus frames, the amount of information required for position adjustment is small, thus reducing the complexity of focus frame adjustment.

[0071] For example, the step of determining the position change information based on the starting point positions of the two second focus frames with the shortest time difference from the first focus frame can be based on the starting point positions of the two second focus frames with the shortest time difference from the first focus frame and a first preset time. The first preset time is the time difference between the two second focus frames used to determine the position change information. That is, the first preset time can be the time difference between the two second focus frames when they are set according to the acquired image, the time difference between the two second focus frames after position adjustment, or the time difference between the two second focus frames before and after position adjustment.

[0072] For example, since the positions of two second focus frames are required to determine the position change information, steps S100 to S300 are not executed when the number of second focus frames is less than two. That is, the subject is focused based on the first focus frame.

[0073] For example, the step of determining the position change information based on the starting positions of the two second focus frames with the shortest time difference from the first focus frame can be implemented by determining the movement direction of the second focus frame based on the two starting positions, and determining the movement speed of the second focus frame based on the two starting positions. The movement direction and speed can be represented by a rate of position change. The position change information may include the rate of position change.

[0074] In one embodiment, the determination of position change information based on the position of the second focus frame in step S120 can also be determined in the following way:

[0075] The position change information is determined based on the starting point positions of the first focus frame and the second focus frame whose time difference with the first focus frame is the shortest.

[0076] In this embodiment, since corresponding second focus frames exist at different historical moments, and the time difference between the second focus frames and the first focus frame varies, the closer the time difference between the second focus frame and the first focus frame, the better it reflects the movement of the subject at the current moment. Position change information is determined based on the starting point positions of the first focus frame and the second focus frame with the shortest time difference from the first focus frame, thus reflecting the movement of the subject at the current moment. Determining position change information by using the starting point positions of the first focus frame and the second focus frame preceding the first focus frame allows for accurate prediction of the required position of the first focus frame, thereby improving image quality. Furthermore, since position change information only needs to be determined based on the starting point position of one second focus frame, it can be determined promptly, thus improving focusing reliability.

[0077] For example, the step above, which determines the position change information based on the starting point position of the first focus frame and the second focus frame whose time difference with the first focus frame is the shortest, can be done in the same way as the step above, which determines the position change information based on the starting point positions of the two second focus frames whose time difference with the first focus frame is the shortest. Only the two second focus frames need to be replaced with the first focus frame and one second focus frame, which will not be elaborated here.

[0078] For example, since the position of a second focus frame is required to determine the position change information, steps S100 to S300 are not executed when the number of second focus frames is less than one. That is, the subject is focused based on the first focus frame.

[0079] In one embodiment, a corresponding second focus frame exists for each different historical moment. Before determining the position change information based on the position of the second focus frame in step S100, the focusing method further includes:

[0080] Based on the position of each second focus frame and the corresponding historical time, the movement direction of multiple second focus frames is determined.

[0081] The determination of position change information based on the position of the second focus frame in step S120 can also be achieved through the following methods:

[0082] Based on the starting point position of the second focus frame within a preset angle range of the angle difference between the direction of movement and the target direction, the position change information is determined. The target direction is the direction of movement of the second focus frame that has the shortest time difference from the first focus frame.

[0083] In this embodiment, since the subject may adjust its direction of movement during motion, and there are multiple second focus frames, determining the position change information based on the positions of each second focus frame would increase the error in the position change information due to some second focus frames having different movement directions, making it difficult to accurately adjust the position of the first focus frame. Since the positions of two focus frames can determine the movement direction of one focus frame, the movement directions of multiple second focus frames are determined based on their positions and corresponding historical moments. Because the movement directions of second focus frames whose movement directions differ from the target direction by an angle within a preset angle can be considered consistent, the position change information is determined based on the starting point position of the second focus frames whose movement directions differ from the target direction by an angle within a preset angle. By selecting second focus frames with consistent movement directions to determine the position change information, interference from second focus frames with different movement directions is avoided, thereby improving focusing accuracy. Furthermore, since the position change information can be determined by combining the positions of multiple second focus frames, the positions of these multiple second focus frames can reflect the movement pattern of the subject over a certain period, making the position change information closer to reality, further improving focusing accuracy.

[0084] For example, the preset angle can range from 30° to 90°. The preset angle can be 45°, 60°, 75°, etc.

[0085] For example, in the above steps, determining the position change information based on the starting point position of the second focus frame within a preset angle range of the angle difference between the movement direction and the target direction can be achieved using the starting point positions of two or more second focus frames. The specific implementation method is the same as in the above steps, where the position change information is determined based on the starting point positions of the two second focus frames with the shortest time difference from the first focus frame; this will not be elaborated upon here. Compared to two second focus frames, when using three or more second focus frames, the movement direction and speed need to be determined based on the starting point positions of each focus frame.

[0086] For example, in addition to determining motion information based on the position of the second focus frame, the motion direction and speed in the motion information can also be determined based on event information output by the event-based visual sensor, or by matching feature points in two or more adjacent images acquired at historical moments to determine the motion direction and speed in the motion information.

[0087] In one embodiment, the position change information includes the position change rate. The adjustment of the position of the first focus frame based on the motion information in step S200 can be determined as follows:

[0088] If the rate of position change is greater than or equal to the preset rate of change, the position of the first focus frame is adjusted according to the rate of position change.

[0089] In this embodiment, since the rate of position change reflects the speed of the subject, when the rate of position change is greater than or equal to a preset rate, the subject's speed is fast, which can easily lead to lag in the first focus frame. The position of the first focus frame is adjusted according to the rate of position change to restore the lag. By adjusting the position of the first focus frame when the rate of position change is large, erroneous adjustments to the focus frame position, even when the subject can be tracked, are avoided, thus improving focusing reliability. Simultaneously, since the position of the first focus frame is not adjusted when the rate of position change is small, no additional adjustment process is required, thereby reducing the complexity of focus frame adjustment and the power consumption of the electronic device.

[0090] For example, the position change rate being greater than or equal to a preset change rate can be defined as the motion velocity within the position change rate being greater than or equal to the preset change rate. The preset change rate can range from 1.5 m / s to 5 m / s. The preset change rate can also be 2.5 m / s, 3.5 m / s, 4.5 m / s, etc.

[0091] For example, after determining the motion information of the subject in step S100, the focusing method further includes:

[0092] When the rate of change of position is less than the preset rate of change, focus is applied to the subject based on the first focus frame.

[0093] In one embodiment, the motion information of the subject determined in step S100 can also be determined in the following way:

[0094] If the number of targets is greater than or equal to the preset number, motion information is determined, and the number of targets is the sum of the number of the first focus frame and the number of the second focus frame.

[0095] In this embodiment, since determining the motion information of the subject requires considering the positions of a certain number of focus frames, the sum of the numbers of the first and second focus frames is determined as the target number. When the target number is greater than or equal to a preset number, the number of focus frames is sufficient, and the motion information is determined. By determining the motion information when the number of focus frames is sufficient, misdetermining motion information and affecting focusing is avoided, thereby improving the reliability of focusing.

[0096] For example, when determining position change information based on the starting point positions of a first focus frame and a second focus frame, the preset quantity can be two. When determining position change information based on the starting point positions of two or more second focus frames, the preset quantity can be three.

[0097] For example, the focusing method further includes:

[0098] When the number of targets is less than the preset number, focus is applied to the subject based on the first focus frame.

[0099] In one embodiment, such as Figure 5 As shown, the adjustment of the position of the first focus frame based on motion information in step S200 can also be determined in the following way:

[0100] S210. Based on the motion information, adjust the starting point position of the first focus frame from the first position to the second position.

[0101] S220. Based on the size of the first focusing frame, the first focusing frame after position adjustment is formed with the second position as the starting point.

[0102] In this embodiment, the focus frame needs to be set based on the starting point position and size, and the size of the focus frame is fixed. Based on motion information, the starting point position of the first focus frame is adjusted from a first position to a second position. Based on the size of the first focus frame, the second position is used as the starting point to form the adjusted first focus frame, thus forming the first focus frame at the expected position. Adjusting the position of the focus frame by adjusting the starting point eliminates the need to adjust every point within the entire focus frame, thereby reducing the complexity of focus frame adjustment.

[0103] For example, in step S210, adjusting the starting position of the first focusing frame from the first position to the second position based on motion information can be achieved by determining the position change based on the time difference between the current or next moment and the setting of the first focusing frame, as well as the motion speed in the motion information. Based on the position change and the direction of motion, the first position is adjusted in both the horizontal and vertical directions to obtain the second position as the starting position. For example, if the direction of motion is the positive horizontal direction, the coordinates of the first position are (0, 1), the horizontal component of the position change is 1, and the vertical component is 0, then the coordinates of the second position are (1, 1).

[0104] For example, in the preview interface of the camera application, if the user does not press the shooting control or mode switching control, steps S100 to S300 can be repeated. That is, the second focus frame at the historical moment is retained. If the user presses the shooting control, steps S100 to S300 are re-executed. That is, the second focus frame at the historical moment is cleared.

[0105] In one embodiment, such as Figure 6 As shown, before adjusting the position of the first focus frame based on motion information in step S200, the focusing method further includes:

[0106] S400: Acquire target images containing the subject being photographed.

[0107] S410. The target image is processed using a preset algorithm to obtain the first target position related to the photographed object.

[0108] S420, Set the first focus frame at the first target position.

[0109] In this embodiment, a target image containing the subject is acquired, and a preset algorithm is used to process the target image to obtain a first target position related to the subject. A first focus frame is set at the first target position, so that the first focus frame is located at the subject position. By processing the target image to set the first focus frame, the first focus frame can be located at the subject position for focusing, thereby improving the image quality.

[0110] For example, the acquisition of the target image of the subject in step S400 can be based on the second focus frame after the previous position adjustment, focusing on the subject to acquire the target image.

[0111] For example, in step S410, processing the target image using a preset algorithm to obtain the first target position related to the subject can be performed after a second preset time has elapsed since the previously acquired image was processed using the preset algorithm to obtain the second target position. That is, some acquired target images are not processed using the preset algorithm to reduce the power consumption of the electronic device. The value of the second preset time can be set according to the power consumption requirements of the electronic device.

[0112] In one embodiment, the subject being photographed is a human portrait, and the preset algorithm is a face recognition algorithm.

[0113] In this embodiment, since the subject is a portrait, focusing on the face requires identifying the face position and setting a focus frame. The first focus frame is set by performing face recognition on the target image. This first focus frame can be positioned at the face position for focusing, thereby improving image quality.

[0114] In one embodiment, the subject being photographed is classified as an object, and the preset algorithm is a tracking algorithm.

[0115] In this embodiment, since the subject being photographed is an object (such as a ball, vehicle, etc.), focusing on the subject requires tracking the object's position and setting a focus frame. The first focus frame is set by tracking the object using the target image. This first focus frame can be positioned at the object's location for focusing, thereby improving image quality.

[0116] This disclosure provides a focusing method, such as... Figure 7 As shown, the method includes:

[0117] The S500 reads the type of the subject in response to the user opening the camera application.

[0118] S510: Acquire a target image containing the object being photographed.

[0119] S520. Determine whether the subject being photographed is a portrait. If yes, proceed to step S530. If no, proceed to step S640.

[0120] S530. Determine whether the second preset time has elapsed since the last setting of the first focus frame. If yes, proceed to step S540; otherwise, proceed to step S570.

[0121] S540: Use the previously set first focus frame as the second focus frame.

[0122] S550: The target image is processed using a face recognition algorithm to obtain the face location.

[0123] S560: Set the first focus frame based on the face position.

[0124] S570. Determine the sum of the number of the first focus frame and the number of the second focus frame as the target number.

[0125] S580. Determine if the target quantity is greater than or equal to three. If yes, proceed to step S590. If no, proceed to step S660.

[0126] S590, Determine the position of the second focus frame.

[0127] S600. Determine the position change rate based on the starting point positions of the two second focus frames that have the shortest time difference with the first focus frame and the first preset time.

[0128] S610. Determine whether the rate of change of position is greater than or equal to the preset rate of change. If yes, proceed to step S620. If no, proceed to step S660.

[0129] S620: Adjust the position of the first focus frame according to the rate of position change.

[0130] S630: Based on the first focus frame after position adjustment, focus on the subject and return to step S510.

[0131] S640. The target image is processed using a tracking algorithm to obtain the object's position.

[0132] S650: Set the first focus frame according to the object's position.

[0133] S660: Based on the first focus frame, focus on the subject and return to step S510.

[0134] In this embodiment, in response to the user's activation of the camera application, an image of the subject needs to be acquired, and the type of the subject needs to be read to determine the focusing method. A target image containing the subject is acquired to set a focus frame. If the subject is a portrait, it is determined whether a second preset time has elapsed since the last setting of the first focus frame to determine whether the target image should be detected. If a second preset time has elapsed since the last setting of the first focus frame, the first focus frame can be set within the power consumption limit. A face recognition algorithm is used to process the target image to obtain the face position, and the first focus frame is set at the face position. The previously set first focus frame is used as the second focus frame for determining the rate of position change. The sum of the number of first and second focus frames is determined as a target number to determine if the number of focus frames is sufficient for position adjustment. If the target number is greater than or equal to three, the number of focus frames is sufficient for position adjustment, and the position of the second focus frame is determined. Based on the starting positions of the two second focus frames with the shortest time difference from the first focus frame setting and the first preset time, the rate of position change is determined to determine the movement of the subject. When the rate of position change is greater than or equal to a preset rate of change, the position of the first focus frame is adjusted according to the rate of position change. Based on the adjusted first focus frame, the subject is focused on to acquire an image of the subject. When the subject is not a portrait, a tracking algorithm is used to process the target image to obtain the object's position. Based on the object's position, the first focus frame is set to focus on the object. When the subject is not a portrait, the number of targets is less than three, and / or the rate of position change is less than a preset rate of change, there is no need to adjust the position of the first focus frame. Based on the first focus frame, the subject is focused on to acquire an image of the subject. By adjusting the position of the focus frame according to the rate of position change, the focus frame can track the subject in a timely manner to achieve focus, thereby improving image quality. At the same time, since the position of the first focus frame only needs to be adjusted according to the rate of position change, there is no need to detect and set the corresponding focus frame for each frame, thus reducing the power consumption of the electronic device.

[0135] In one exemplary embodiment, a focusing device is provided for implementing the method described above. (Reference) Figure 8 As shown, the focusing device may include a determining module 100, an adjusting module 200, and a focusing module 300. During the implementation of the above method,

[0136] The determination module 100 is configured to determine the motion information of the subject being photographed.

[0137] The adjustment module 200 is configured to adjust the position of the first focus frame based on motion information, the first focus frame being set according to the acquired image.

[0138] The focusing module 300 is configured to focus on the subject based on the first focusing frame after position adjustment.

[0139] In one exemplary embodiment, a focusing device is provided, wherein a determining module 100 is configured to:

[0140] Determine the position of the second focus frame, which is the focus frame used to focus on the subject at a historical moment.

[0141] Based on the position of the second focus frame, determine the position change information.

[0142] In one exemplary embodiment, a focusing device is provided, wherein a determining module 100 is configured to:

[0143] The position change information is determined based on the starting point positions of the two second focus frames that have the shortest time difference with the first focus frame.

[0144] In one exemplary embodiment, a focusing device is provided, wherein a determining module 100 is configured to:

[0145] The position change information is determined based on the starting point positions of the first focus frame and the second focus frame whose time difference with the first focus frame is the shortest.

[0146] In one exemplary embodiment, a focusing device is provided, wherein a determining module 100 is configured to:

[0147] Based on the position of each second focus frame and the corresponding historical time, the movement direction of multiple second focus frames is determined.

[0148] In one exemplary embodiment, a focusing device is provided, wherein a determining module 100 is configured to:

[0149] Based on the starting point position of the second focus frame within a preset angle range of the angle difference between the direction of movement and the target direction, the position change information is determined. The target direction is the direction of movement of the second focus frame that has the shortest time difference from the first focus frame.

[0150] In one exemplary embodiment, a focusing device is provided, wherein the adjustment module 200 is configured to:

[0151] If the rate of position change is greater than or equal to the preset rate of change, the position of the first focus frame is adjusted according to the rate of position change.

[0152] In one exemplary embodiment, a focusing device is provided, wherein a determining module 100 is configured to:

[0153] If the number of targets is greater than or equal to the preset number, motion information is determined, and the number of targets is the sum of the number of the first focus frame and the number of the second focus frame.

[0154] In one exemplary embodiment, a focusing device is provided, wherein the adjustment module 200 is configured to:

[0155] Based on the motion information, the starting point of the first focus frame is adjusted from the first position to the second position.

[0156] Based on the size of the first focus frame, the first focus frame after position adjustment is formed with the second position as the starting point.

[0157] In one exemplary embodiment, a focusing device is provided, the device further comprising:

[0158] The acquisition module is configured to acquire target images containing the subject being photographed.

[0159] The processing module is configured to process the target image using a preset algorithm to obtain a first target position related to the photographed object.

[0160] The settings module is configured to set the first focus frame at the first target location.

[0161] In one exemplary embodiment, an electronic device is provided, such as a mobile phone, a laptop computer, a tablet computer, and a wearable device.

[0162] refer to Figure 9 As shown, the electronic device 400 may include one or more of the following components: processing component 402, memory 404, power supply component 406, multimedia component 408, audio component 410, input / output (I / O) interface 412, sensor component 414, and communication component 416.

[0163] Processing component 402 typically controls the overall operation of electronic device 400, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 402 may include one or more modules to facilitate interaction between processing component 402 and other components. For example, processing component 402 may include a multimedia module to facilitate interaction between multimedia component 408 and processing component 402.

[0164] Memory 404 is configured to store various types of data to support the operation of electronic device 400. Examples of this data include instructions for any application or method operating on electronic device 400, contact data, phonebook data, messages, pictures, videos, etc. Memory 404 can be implemented by any type of volatile or non-volatile storage terminal 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 storage, flash memory, magnetic disk, or optical disk.

[0165] Power supply component 406 provides power to various components of electronic device 400. Power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 400.

[0166] Multimedia component 408 includes a screen that provides an output interface between electronic device 400 and 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 touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 408 includes a front-facing camera module and / or a rear-facing camera module. When electronic device 400 is in an operating mode, such as shooting mode or video mode, the front-facing camera module and / or rear-facing camera module may receive external multimedia data. Each front-facing camera module and rear-facing camera module may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0167] Audio component 410 is configured to output and / or input audio signals. For example, audio component 410 includes a microphone (MIC) configured to receive external audio signals when electronic device 400 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 404 or transmitted via communication component 416. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.

[0168] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0169] Sensor assembly 414 includes one or more sensors for providing state assessments of various aspects of electronic device 400. For example, sensor assembly 414 may detect the on / off state of electronic device 400, the relative positioning of components such as the display and keypad of electronic device 400, changes in position of electronic device 400 or a component of electronic device 400, the presence or absence of user contact with electronic device 400, orientation or acceleration / deceleration of electronic device 400, and temperature changes of electronic device 400. Sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 414 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0170] Communication component 416 is configured to facilitate wired or wireless communication between electronic device 400 and other terminals. Electronic device 400 can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G, 5G, or combinations thereof. In one exemplary embodiment, communication component 416 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 416 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0171] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing terminals (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods shown in the above embodiments or combinations thereof.

[0172] In one exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, which can be executed by a processor 420 of an electronic device 400 to perform the methods shown in the embodiments or combinations thereof. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage terminal, etc. When the instructions in the storage medium are executed by the processor of the terminal, the terminal is able to perform the methods shown in the embodiments or combinations thereof.

[0173] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0174] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0175] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0176] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0177] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A focusing method, characterized in that, The focusing method includes: Determine the motion information of the subject being photographed; Based on the motion information, the position of the first focus frame is adjusted, and the first focus frame is set according to the acquired image; The subject is focused based on the first focus frame after its position is adjusted.

2. The focusing method according to claim 1, characterized in that, The motion information includes position change information; the motion information of the object being photographed includes: Determine the position of the second focus frame, which is the focus frame used to focus on the subject at a historical moment; The position change information is determined based on the position of the second focusing frame.

3. The focusing method according to claim 2, characterized in that, Different historical moments each have a corresponding second focus frame; determining the position change information based on the position of the second focus frame includes: The position change information is determined based on the starting points of the two second focus frames whose time difference with that of the first focus frame is the shortest; or, The position change information is determined based on the starting point positions of the first focus frame and the second focus frame whose time difference with the first focus frame is the shortest.

4. The focusing method according to claim 2, characterized in that, Different historical moments each have a corresponding second focus frame; before determining the position change information based on the position of the second focus frame, the focusing method further includes: Based on the position of each second focus frame and the corresponding historical time, determine the movement direction of multiple second focus frames; Determining the position change information based on the position of the second focus frame includes: The position change information is determined based on the starting point position of the second focusing frame, where the angle between the direction of movement and the target direction is within a preset angle. The target direction is the direction of movement of the second focusing frame that has the shortest time difference from the first focusing frame.

5. The focusing method according to claim 2, characterized in that, The position change information includes the position change rate; adjusting the position of the first focus frame based on the motion information includes: If the rate of change of position is greater than or equal to a preset rate of change, the position of the first focus frame is adjusted according to the rate of change of position.

6. The focusing method according to claim 2, characterized in that, The determination of the motion information of the subject includes: If the number of targets is greater than or equal to a preset number, the motion information is determined, where the number of targets is the sum of the number of the first focus frame and the number of the second focus frame.

7. The focusing method according to claim 1, characterized in that, Adjusting the position of the first focus frame based on the motion information includes: Based on the motion information, the starting point position of the first focusing frame is adjusted from the first position to the second position; Based on the size of the first focusing frame, the first focusing frame with the second position as the starting point is formed after position adjustment.

8. The focusing method according to any one of claims 1 to 7, characterized in that, Before adjusting the position of the first focus frame based on the motion information, the focusing method further includes: Acquire a target image containing the object being photographed; The target image is processed using a preset algorithm to obtain a first target location related to the photographed object; Set the first focus frame at the first target position.

9. The focusing method according to claim 8, characterized in that, The subject being photographed is classified as a human portrait, and the preset algorithm is a face recognition algorithm; or, the subject being photographed is classified as an object, and the preset algorithm is a tracking algorithm.

10. A focusing device, characterized in that, The focusing device includes: A determination module, configured to determine motion information of the subject being photographed; An adjustment module is configured to adjust the position of a first focus frame based on the motion information, wherein the first focus frame is set according to the acquired image. A focusing module configured to focus on the subject based on the first focusing frame after position adjustment.

11. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to perform the focusing method as described in any one of claims 1 to 9.

12. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the terminal, the terminal is able to perform the focusing method as described in any one of claims 1 to 9.