Focusing method, focusing device, electronic equipment and storage medium
By using ultra-wideband positioning signals and a ranging module to determine the camera's focusing distance, the focusing problem of laser ranging in backlight and glass-obstructed environments is solved, enabling wider-range and faster focus adjustment.
Patent Information
- Application Number
- CN202410598972.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2025-11-14
AI Technical Summary
Existing laser rangefinders are easily interfered with in backlit or glass-obstructed environments, and their range is short, making it difficult to effectively adjust the camera's focus distance.
The location information of the ranging target is determined by using ultra-wideband positioning signals. The angle and distance of the ranging target in the field of view corresponding to the ranging range of the camera are obtained by the ultra-wideband ranging module. The focus frame in the preview image is mapped to the field of view, and the focusing distance of the camera is adjusted.
It ensures focusing performance in backlit and glass-obstructed environments, prevents focus loss, improves camera focusing capabilities, expands the ranging range, and enhances focusing speed.
Smart Images

Figure CN120957012A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of photography, and in particular to focusing methods, focusing devices, electronic devices, and storage media. Background Technology
[0002] Taking photos has become a core requirement for users when using mobile devices. During the shooting process, it is necessary to adjust the focus distance to ensure that the focus falls on the appropriate distance and that the shooting target is clearly presented.
[0003] In related technologies, laser rangefinders are often used to determine the focusing distance when employing rangefinding methods. This involves emitting and receiving reflected laser light to determine the distance to the target, thereby adjusting the focusing distance. However, laser rangefinders are susceptible to interference in some shooting environments and also suffer from short rangefinding distances. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a focusing method, a focusing device, an electronic device, and a storage medium.
[0005] According to a first aspect of the present disclosure, a focusing method is provided, comprising: in response to activating a camera, determining position information of a ranging target relative to the camera via an ultra-wideband positioning signal, and determining, based on the position information, an angle and distance corresponding to the ranging target in a first field of view, wherein the first field of view is a field of view corresponding to the ranging range of the camera's ranging module, the ranging target is a target within the ranging range, and the ranging target includes a target captured by the camera; determining a focus frame in a preview image surrounding the focusing target, and mapping the focus frame to the first field of view, and determining an angle range corresponding to the focus frame in the first field of view of the camera; and adjusting the focusing distance of the camera according to the angle range, the angle and distance corresponding to the ranging target, so that the camera focuses on the focusing target.
[0006] In one embodiment, the position information includes the distance, pitch angle, and yaw angle of the ranging target relative to the camera; determining the angle and distance corresponding to the ranging target in the first field of view based on the position information includes: determining the spatial coordinates of the ranging target in a reference coordinate system based on the distance, pitch angle, and yaw angle of the ranging target relative to the camera, wherein the reference coordinate system is a coordinate system established based on the camera; and determining the angle and distance corresponding to the ranging target in the first field of view based on the correspondence between the reference coordinate system and the first field of view, and the spatial coordinates of the ranging target in the reference coordinate system.
[0007] In one embodiment, the angle information in the first field of view corresponds to the angle information in the second field of view of the camera, and the second field of view is included in the first field of view. The angle information in the second field of view corresponds to the pixel coordinates in the preview image, and the second field of view is the field of view corresponding to the camera's shooting range. Mapping the focus frame to the first field of view and determining the angle range corresponding to the focus frame in the first field of view of the camera includes: determining the pixel coordinates corresponding to the focus frame in the preview image, and mapping the focus frame to the second field of view based on the correspondence between the angle information in the second field of view and the pixel coordinates in the preview image, and the pixel coordinates, thereby determining the angle range corresponding to the focus frame in the second field of view; and mapping the angle range corresponding to the second field of view to the first field of view based on the correspondence between the angle information in the first field of view and the angle information in the second field of view, and the angle range corresponding to the focus frame in the second field of view, thereby determining the angle range corresponding to the focus frame in the first field of view of the camera.
[0008] In one embodiment, adjusting the camera's focusing distance based on the angle range, the angle corresponding to the ranging target, and the distance includes: determining a numerical relationship between the angle range and the angle corresponding to the ranging target, wherein the numerical relationship includes the angle corresponding to the ranging target being within the angle range and the angle corresponding to the ranging target not being within the angle range; responding to the angle corresponding to the ranging target being within the angle range, identifying the ranging target whose angle is within the angle range as the target ranging target, determining the target distance based on the distance corresponding to the target ranging target, and adjusting the camera's focusing distance based on the target distance.
[0009] In one embodiment, determining the target distance based on the distance corresponding to the target ranging target includes: in response to a single target ranging target, determining the distance corresponding to the target ranging target as the target distance; in response to multiple target ranging targets, determining the minimum distance among multiple distances corresponding to multiple target ranging targets, and determining the minimum distance as the target distance.
[0010] In one embodiment, the method further includes: in response to the angle corresponding to the ranging target not being within the angle range, adjusting the focusing distance of the camera using phase focusing or contrast focusing.
[0011] According to a second aspect of the present disclosure, a focusing device is provided, comprising: a determining unit, configured to, in response to activating a camera, determine position information of a ranging target relative to the camera via an ultra-wideband positioning signal, and determine, based on the position information, an angle and distance corresponding to the ranging target in a first field of view, wherein the first field of view is a field of view corresponding to the ranging range of the camera's ranging module, the ranging target is a target within the ranging range, and the ranging target includes a target captured by the camera; a mapping unit, configured to determine a focusing frame surrounding the focusing target in a preview image, and map the focusing frame to the first field of view, and determine an angle range corresponding to the focusing frame in the first field of view of the camera; and a processing unit, configured to, based on the angle range, the angle and distance corresponding to the ranging target, adjust the focusing distance of the camera, so that the camera focuses on the focusing target.
[0012] In one embodiment, the position information includes the distance, pitch angle, and yaw angle of the ranging target relative to the camera; the determining unit determines the angle and distance corresponding to the ranging target in the first field of view based on the position information in the following manner: determining the spatial coordinates of the ranging target in a reference coordinate system based on the distance, pitch angle, and yaw angle of the ranging target relative to the camera, wherein the reference coordinate system is a coordinate system established based on the camera; determining the angle and distance corresponding to the ranging target in the first field of view based on the correspondence between the reference coordinate system and the first field of view, and the spatial coordinates of the ranging target in the reference coordinate system.
[0013] In one embodiment, the angle information in the first field of view corresponds to the angle information in the second field of view of the camera, and the second field of view is included in the first field of view. The angle information in the second field of view corresponds to the pixel coordinates in the preview image, and the second field of view is the field of view corresponding to the camera's shooting range. The mapping unit maps the focus frame to the first field of view in the following manner to determine the angle range corresponding to the focus frame in the first field of view of the camera: determining the pixel coordinates corresponding to the focus frame in the preview image, and mapping the focus frame to the second field of view according to the correspondence between the angle information in the second field of view and the pixel coordinates in the preview image and the pixel coordinates, to determine the angle range corresponding to the focus frame in the second field of view; and mapping the angle range corresponding to the second field of view to the first field of view according to the correspondence between the angle information in the first field of view and the angle information in the second field of view and the angle range corresponding to the focus frame in the second field of view, to determine the angle range corresponding to the focus frame in the first field of view of the camera.
[0014] In one embodiment, the processing unit adjusts the camera's focusing distance based on the angle range, the angle corresponding to the ranging target, and the distance, as follows: determining a numerical relationship between the angle range and the angle corresponding to the ranging target, the numerical relationship including whether the angle corresponding to the ranging target is within the angle range or not; responding to the angle corresponding to the ranging target being within the angle range, identifying the ranging target with the corresponding angle within the angle range as the target ranging target, determining the target distance based on the distance corresponding to the target ranging target, and adjusting the camera's focusing distance based on the target distance.
[0015] In one embodiment, the processing unit determines the target distance based on the distance corresponding to the target ranging target in the following manner: in response to a single target ranging target, the distance corresponding to the target ranging target is determined as the target distance; in response to multiple target ranging targets, the minimum distance among the multiple distances corresponding to the multiple target ranging targets is determined, and the minimum distance is determined as the target distance.
[0016] In one embodiment, the processing unit is further configured to: adjust the focusing distance of the camera using phase focusing or contrast focusing in response to the angle corresponding to the ranging target not being within the angle range.
[0017] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to: execute the focusing method described in the first aspect or any embodiment of the first aspect.
[0018] According to a fourth aspect of the present disclosure, a storage medium is provided, the storage medium storing instructions that, when executed by a processor, enable the processor to perform the focusing method described in the first aspect or any embodiment of the first aspect.
[0019] The technical solutions provided by the embodiments of this disclosure can include the following beneficial effects: After the camera is started, the position information of the ranging target is determined by the ultra-wideband positioning signal, and the angle and distance corresponding to the ranging target in the first field of view are determined according to the position information. The first field of view is the field of view corresponding to the ranging range of the camera's ranging module. A focus frame is determined in the preview image, and the focus frame is mapped to the corresponding angle range in the first field of view. According to the angle range, the angle and distance corresponding to the ranging target, the focusing distance of the camera is adjusted so that the camera focuses on the focusing target. Through this disclosure, when using the ranging method for focusing, the focusing effect is guaranteed in strong backlight and when there is glass obstruction, and the problem of losing focus is prevented.
[0020] 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
[0021] 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.
[0022] Figure 1 This is a flowchart illustrating a focusing method according to an exemplary embodiment.
[0023] Figure 2 This is a flowchart illustrating a method for determining the angle and distance corresponding to a ranging target in a first field of view, according to an exemplary embodiment.
[0024] Figure 3 This is a flowchart illustrating a method for determining the angular range corresponding to a focus frame in a first field of view of a camera, according to an exemplary embodiment.
[0025] Figure 4 This is a schematic diagram illustrating a first field of view and a second field of view according to an exemplary embodiment disclosed.
[0026] Figure 5 This is a flowchart illustrating a method for adjusting the focus distance of a camera according to an exemplary embodiment.
[0027] Figure 6 This is a flowchart illustrating a method for determining a target distance according to an exemplary embodiment.
[0028] Figure 7 This is a flowchart illustrating a focusing method according to an exemplary embodiment.
[0029] Figure 8 This is a flowchart illustrating a focusing method according to an exemplary embodiment disclosed in a publication.
[0030] Figure 9 This is a block diagram illustrating a focusing device according to an exemplary embodiment.
[0031] Figure 10 This is a block diagram illustrating a focusing device according to an exemplary embodiment. Detailed Implementation
[0032] 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.
[0033] The focusing method provided in this disclosure is applied to scenarios where the focusing distance is determined when taking pictures using electronic devices.
[0034] The camera function has become a core requirement for users of mobile devices, and shooting performance is also an important factor for users when purchasing mobile devices. During the shooting process of a mobile device, it is necessary to adjust the focus distance to ensure that the focus falls on the appropriate distance and that the shooting target is clearly presented. Therefore, focusing ability is an important support for ensuring the shooting performance of the device's camera, and improving focusing ability is an important direction for optimizing the device's imaging system.
[0035] In related technologies, the focusing methods of terminal cameras mainly include image detection focusing and range-measuring focusing. Image detection focusing adjusts the focusing distance based on the image projected onto the sensor. Range-measuring focusing, on the other hand, directly obtains the relative position between the subject and the camera and adjusts the focus based on this relative position information. Image detection focusing and range-measuring focusing are complementary to a certain extent.
[0036] The aforementioned image detection focusing methods mainly include contrast autofocus (CAF) and phase detection autofocus (PDAF). Phase detection autofocus is fast, but it has high hardware requirements and performs poorly in strong backlight and low light conditions. CAF is slow. Laser autofocus (LDAF) is also an option.
[0037] The aforementioned rangefinding and focusing methods are primarily laser rangefinding. This method involves emitting and receiving laser light, combined with Time-of-Flight (TOF) technology, to determine the distance between the camera and the target, thereby adjusting the focusing distance. Specifically, the camera positioning module's transmitter emits a laser, the receiver receives it, the distance between the camera and the target is determined based on the time of flight, and this distance is converted into an image distance. The camera lens is then moved to the optimal focusing position to assist in focusing. However, laser rangefinding is susceptible to interference in strong ultraviolet light environments such as outdoor backlighting, particularly its inability to penetrate transparent materials like glass, leading to focus loss during focusing. Laser rangefinding also suffers from a short range, making it unable to obtain the focusing distance for distant objects. Furthermore, the field of view corresponding to the rangefinding area is relatively small; it is smaller than the field of view corresponding to the camera's shooting range, resulting in the inability to obtain the focusing distance for some objects within the camera's shooting range. These various problems with laser rangefinding limit its application scenarios.
[0038] In view of the problems existing in the above-mentioned focusing and ranging methods, this disclosure proposes a focusing method. After the camera is started, the position information of the ranging target is determined by the ultra-wideband (UWB) positioning signal. Based on the position information, the angle and distance of the ranging module corresponding to the ranging target in the field of view are determined. The focusing frame in the preview image is then determined, and the angle range corresponding to the focusing frame in the first field of view is determined. Based on the angle range, the angle and distance corresponding to the ranging target, the focusing distance of the camera is adjusted so that the camera focuses on the target. This disclosure ensures focusing performance under conditions of strong backlighting or glass obstruction when using the ranging method for focusing, preventing focus loss problems.
[0039] Figure 1 This is a flowchart illustrating a focusing method according to an exemplary embodiment. For example... Figure 1 As shown, the method includes steps S101 to S103.
[0040] In step S101, in response to activating the camera, the position information of the ranging target relative to the camera is determined by the ultra-wideband positioning signal, and the angle and distance corresponding to the ranging target in the first field of view are determined based on the position information.
[0041] Wherein, the first field of view is the field of view corresponding to the ranging range of the camera's ranging module, the ranging target is the target within the ranging range, and the ranging target includes the target captured by the camera.
[0042] In step S102, the focus frame surrounding the focus target in the preview image is determined, and the focus frame is mapped to the first field of view to determine the angle range corresponding to the focus frame in the first field of view of the camera.
[0043] In step S103, the focusing distance of the camera is adjusted according to the angle range, the angle and distance corresponding to the ranging target, so that the camera focuses on the target.
[0044] In this embodiment, when focusing using the rangefinding focusing method after the camera is started, the ultra-wideband ranging module in the terminal, used to assist focusing, is activated, enabling the ultra-wideband ranging module to acquire the position information of the ranging target within the ranging range. Specifically, the ultra-wideband ranging module transmits an ultra-wideband positioning signal (radar wave) through a transmitting antenna and receives the returned ultra-fast band positioning signal through a receiver. Based on the frequency shift of the ultra-fast band positioning signal, the position information of the ranging target relative to the camera is calculated, thereby determining the angle and distance of the ranging target within the field of view (first field of view) corresponding to the ranging range of the camera's ranging module. The angle and distance of the ranging target within the first field of view are used to determine the focusing distance in subsequent processes.
[0045] In this embodiment, the focus frame surrounding the focus target in the preview image can be the focus obtained based on the user's touchscreen operation, or it can be the focus frame determined by the terminal after recognizing the focus target in the preview image through a built-in recognition algorithm. This disclosure maps the focus frame in the preview image to the field of view (first field of view) corresponding to the ranging range of the camera's ranging module, determining the angle range corresponding to the focus frame within the first field of view. Within the first field of view, by comparing the angle range corresponding to the focus frame with the angle corresponding to the ranging target, and combining this with the distance corresponding to the ranging target, the camera focusing distance is adjusted to make the camera focusing distance equal to the distance between the target selected by the focus frame and the camera, ensuring that the target selected by the focus frame is clearly presented.
[0046] In this embodiment, an ultra-wideband ranging module is provided in the terminal to assist camera focusing. When focusing using the ranging method after the camera is started, the focusing distance of the camera is adjusted by the distance measured after the ultra-wideband positioning signal is emitted by the ultra-wideband ranging module. Given the characteristics of ultra-wideband positioning signals—that they are not affected by ultraviolet radiation and are not blocked by glass—the focusing method proposed in this disclosure further improves the focusing capability of the terminal camera, overcoming the problems of short range measurement, susceptibility to ultraviolet interference, and inability to penetrate glass inherent in traditional ranging focusing methods.
[0047] In this embodiment of the disclosure, the position information of the ranging target relative to the camera includes the distance, pitch angle, and yaw angle of the ranging target relative to the camera. The distance and angle of the ranging target in the first field of view are obtained by converting the distance, pitch angle, and yaw angle of the ranging target relative to the camera. The following embodiments of this disclosure describe a method for determining the angle and distance corresponding to the ranging target in the first field of view.
[0048] Figure 2 This is a flowchart illustrating a method for determining the angle and distance corresponding to a ranging target in a first field of view, according to an exemplary embodiment. Figure 2 As shown, the method includes steps S201 to S202.
[0049] In step S201, the spatial coordinates of the ranging target in the reference coordinate system are determined based on the distance, pitch angle, and yaw angle of the ranging target relative to the camera. The reference coordinate system is a coordinate system established based on the camera.
[0050] In step S202, based on the correspondence between the reference coordinate system and the first field of view, and the spatial coordinates of the ranging target in the reference coordinate system, the angle and distance corresponding to the ranging target in the first field of view are determined.
[0051] In this embodiment, an ultra-wideband (UWB) positioning module transmits and receives UWB positioning signals to obtain the distance between the camera and the ranging target, and acquires the pitch and yaw angles of the ranging target relative to the camera, thus obtaining the position information of the ranging target relative to the camera. Further, in a reference coordinate system established based on the camera, the spatial coordinates of the ranging target in the reference coordinate system are calculated based on the distance, pitch, and yaw angles of the ranging target relative to the camera. It is understood that the first field of view is included in the reference coordinate system, and there is a correspondence between the data (distance, angle) in the first field of view and the data (spatial coordinates) in the reference coordinate system. Based on the correspondence between the first field of view and the reference coordinate system, the coordinates of the ranging target in the reference coordinate system are converted into the angle and distance of the ranging target in the first field of view.
[0052] This disclosure allows for the acquisition of the angle and distance of the ranging target within the first field of view, facilitating comparison with the angle range of the focusing frame within the first field of view in subsequent processes. Based on the comparison results, the focusing distance of the camera is adjusted to complete focusing on the target.
[0053] In this embodiment, the angle information in the first field of view corresponds to the angle information in the second field of view of the camera, and the second field of view is included in the first field of view. The angle information in the second field of view corresponds to the pixel coordinates in the preview image, and the second field of view is the field of view corresponding to the camera's shooting range. The following embodiments of this disclosure describe a method for determining the angle range corresponding to the focus frame in the first field of view of the camera.
[0054] Figure 3 This is a flowchart illustrating a method for determining the angular range corresponding to a focus frame in a first field of view of a camera, according to an exemplary embodiment. Figure 3 As shown, the method includes steps S301 to S302.
[0055] In step S301, the pixel coordinates of the focus frame in the preview image are determined, and the focus frame is mapped to the second field of view based on the correspondence between the angle information in the second field of view and the pixel coordinates in the preview image, and the pixel coordinates are determined. The angle range of the focus frame in the second field of view is then determined.
[0056] In step S302, based on the correspondence between the angle information in the first field of view and the angle information in the second field of view, and the angle range corresponding to the focus frame in the second field of view, the angle range corresponding to the focus frame in the second field of view is mapped to the first field of view to determine the angle range corresponding to the focus frame in the first field of view of the camera.
[0057] In this embodiment, the preview image displayed after the terminal camera is activated corresponds to the field of view (second field of view) of the terminal camera's shooting range. That is, the pixel coordinates in the camera preview image correspond to the corresponding angle information in the first field of view, enabling mutual conversion. Furthermore, in this disclosure, the first field of view and the second field of view have a corresponding relationship, such as... Figure 4 The schematic diagrams of the first and second field of view shown in the figure are as follows. Figure 4 The solid-line frame corresponds to the first field of view (UWB ranging FOV), the dashed-line frame corresponds to the second field of view (camera lens FOV), and the grayscale area corresponds to the focusing area. The frame enclosing the grayscale area is the focusing frame. For example... Figure 4 As shown, the second field of view is included within the first field of view; therefore, all data (angle and distance) in the second field of view can be converted into data (angle and distance) in the first field of view. Based on the data conversion relationship between the preview image and the second field of view, and the data conversion relationship between the second field of view and the first field of view, this disclosure maps the focus frame in the preview image to an angle range in the second field of view, and maps the angle range in the second field of view to an angle range in the first field of view, thus completing the mapping of the focus frame.
[0058] This disclosure allows for the acquisition of the angle range corresponding to the focusing frame in the first field of view, facilitating comparison with the angle corresponding to the ranging target in the first field of view in subsequent processes. Based on the comparison results, the focusing distance of the camera is adjusted to complete focusing on the target.
[0059] In this embodiment, an ultra-wideband ranging module is used to measure distance to the target. The ranging frequency of the ultra-wideband ranging module (e.g., 100 frames / s) is higher than the frame rate of the camera, thus improving the focusing speed. Furthermore, as... Figure 4 As shown, the field of view (first field of view) corresponding to the ranging range of the ultra-wideband ranging module is greater than the field of view (second field of view) corresponding to the camera's shooting range. Therefore, the distance corresponding to the ranging target within the first field of view can be obtained through this disclosure, thereby enabling the camera to focus on any ranging target within the camera's shooting range.
[0060] The following embodiments of this disclosure further illustrate a method for adjusting the focusing distance based on the angle range and the corresponding angle of the ranging target.
[0061] Figure 5 This is a flowchart illustrating a method for adjusting the focus distance of a camera according to an exemplary embodiment. Figure 5 As shown, the method includes steps S401 to S402.
[0062] In step S401, the numerical relationship between the angle range and the corresponding angle of the ranging target is determined. The numerical relationship includes whether the corresponding angle of the ranging target is within the angle range or not.
[0063] In step S402, in response to the distance of the ranging target being within the angle range, the ranging target being within the angle range is determined as the target ranging target, the target distance is determined according to the distance corresponding to the target ranging target, and the camera's focus distance is adjusted according to the target distance.
[0064] In this embodiment, the focusing frame is mapped to an angular range within a first field of view, and the position information of the ranging target relative to the camera is converted into an angle and distance within the first field of view. Within the first field of view, the ranging target is determined based on the angular range corresponding to the focusing frame and the angle corresponding to the position information, and then the camera's focusing distance is adjusted according to the distance corresponding to the ranging target. It can be understood that if the angle corresponding to the ranging target is within the angular range, it indicates that the image area corresponding to the ranging target in the preview image is distributed within the focusing frame. In the reference coordinate system, there is a correspondence between the ranging target and the focusing target whose corresponding angle is within the angular range. Therefore, when the angle corresponding to the ranging target is within the angular range, the camera's focusing distance is adjusted according to the distance corresponding to the ranging target.
[0065] It is understood that the ranging range of the camera ranging module may include multiple ranging targets, and the distances between these multiple ranging targets and the camera are different. Furthermore, it is understood that in the presence of multiple ranging targets, there may also be multiple ranging targets whose corresponding angles fall within the angle range (i.e., target ranging targets). In this case, it is necessary to determine the target distance used for adjusting the focus distance from the distances corresponding to the multiple target ranging targets. The following embodiments of this disclosure illustrate a method for determining the target distance.
[0066] Figure 6 This is a flowchart illustrating a method for determining a target distance according to an exemplary embodiment. Figure 6 As shown, the method includes steps S501, S502A, and S502B.
[0067] In step S501, the ranging target whose corresponding angle is within the angle range is determined as the target ranging target.
[0068] In step S502A, in response to the target ranging target being a single entity, the distance corresponding to the target ranging target is determined as the target distance.
[0069] In step S502B, in response to the presence of multiple target ranging targets, the minimum distance among the multiple distances corresponding to the multiple target ranging targets is determined, and the minimum distance is determined as the target distance.
[0070] In this embodiment of the disclosure, if there is a single target for ranging, it indicates that the ranging target is the focus target corresponding to the focus frame in the preview image. The distance corresponding to the single target for ranging is determined as the target distance, and the focus distance is adjusted according to the target distance. If there are multiple target for ranging, it indicates that there are multiple ranging targets corresponding to the focus frame in the preview image, and only one of the ranging targets is the focus target. In this case, the focus target is determined based on a preset selection logic, that is, the ranging target with the smallest corresponding distance is determined as the focus target, and the smallest distance is determined as the target distance. The focus distance is then adjusted according to the target distance.
[0071] It is understood that the target ranging in this disclosure is multiple, and other target selection logics can also be used, such as selecting the ranging target in the angle range closest to the corresponding angle in the first field of view, determining the minimum distance as the target distance, and adjusting the focusing distance according to the target distance.
[0072] It is understood that if the angle corresponding to the target being measured is not within the angular range, it indicates that the method of using an ultra-wideband ranging module to measure the distance and adjust the focus distance is not applicable to the current shooting scene, and other focusing methods should be selected to adjust the focus distance. The following embodiments further illustrate the focusing method of this disclosure.
[0073] Figure 7 This is a flowchart illustrating a focusing method according to an exemplary embodiment. For example... Figure 7 As shown, the method includes steps S601 to S602.
[0074] In step S601, the numerical relationship between the angle range and the corresponding angle of the ranging target is determined.
[0075] In step S602, in response to the target angle being outside the angular range, the camera's focusing distance is adjusted using phase focusing or contrast focusing.
[0076] In this embodiment, if the angle corresponding to the ranging target is not within the angle range, phase detection autofocus or contrast detection autofocus is used to adjust the camera's focusing distance. This disclosure allows for flexible selection of the focusing method based on the current focusing scenario, making it applicable to various different focusing situations.
[0077] In one exemplary embodiment of this disclosure, such as Figure 8The flowchart of the focusing method shows that focusing is performed as follows: In response to opening the camera, ultra-wideband ranging is performed to obtain the distance, yaw angle, and pitch angle of the target relative to the corresponding module. Based on the obtained distance, yaw, and pitch angles, the angle of the target in the ultra-wideband field of view (corresponding to the first field of view) is obtained. The mapping range of the focusing area in the ultra-wideband field of view is calculated. It is determined whether there is a target in the ultra-wideband ranging target that overlaps with the focusing area. In response to the existence of a target in the ultra-wideband ranging target that overlaps with the focusing area, the distance value of that target is returned to the autofocus algorithm to calculate the corresponding image distance position and complete focusing. In response to the absence of a target in the ultra-wideband ranging target that overlaps with the focusing area, the ultra-wideband ranging result is not applied, and phase detection autofocus or contrast detection autofocus is used to complete focusing.
[0078] In this embodiment, after the camera is started, the position information of the ranging target is determined by the Ultra Wide Band (UWB) positioning signal. Based on the position information, the angle and distance of the ranging target in the field of view corresponding to the ranging range of the ranging module are determined. The focus frame in the preview image is also determined, and the angle range corresponding to the focus frame mapped to the first field of view is determined. Based on the angle range, the angle and distance corresponding to the ranging target, the camera's focusing distance is adjusted so that the camera focuses on the target. This disclosure ensures focusing performance under strong backlighting and glass obstruction when using the ranging method for focusing, preventing focus loss problems, enabling the camera to focus on any ranging target within the camera's shooting range, improving focusing speed, and allowing the camera to focus on any ranging target within the camera's shooting range.
[0079] Based on the same concept, this disclosure also provides a focusing device 100.
[0080] It is understood that the focusing device 100 provided in this disclosure includes hardware structures and / or software modules corresponding to each function in order to achieve the above-mentioned functions. In conjunction with the units and algorithm steps of the various examples disclosed in this disclosure, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solutions of this disclosure.
[0081] Figure 9 This is a block diagram illustrating a focusing device 100 according to an exemplary embodiment. (Refer to...) Figure 9 The device includes a determining unit 101, a mapping unit 102, and a processing unit 103.
[0082] The determining unit 101 is used to determine the position information of the ranging target relative to the camera by using an ultra-wideband positioning signal in response to camera activation, and to determine the angle and distance of the ranging target in the first field of view based on the position information.
[0083] Wherein, the first field of view is the field of view corresponding to the ranging range of the camera's ranging module, the ranging target is the target within the ranging range, and the ranging target includes the target captured by the camera.
[0084] The mapping unit 102 is used to determine the focus frame surrounding the focus target in the preview image, and to map the focus frame to the first field of view, thereby determining the angle range corresponding to the focus frame in the first field of view of the camera.
[0085] The processing unit 103 is used to adjust the focusing distance of the camera according to the angle range, the angle and distance corresponding to the ranging target, so that the camera focuses on the target.
[0086] In one embodiment, the position information includes the distance, pitch angle, and yaw angle of the ranging target relative to the camera. The determining unit 101 determines the angle and distance corresponding to the ranging target in the first field of view based on the position information as follows: Based on the distance, pitch angle, and yaw angle of the ranging target relative to the camera, the spatial coordinates of the ranging target in a reference coordinate system, where the reference coordinate system is a coordinate system established based on the camera. Based on the correspondence between the reference coordinate system and the first field of view, and the spatial coordinates of the ranging target in the reference coordinate system, the angle and distance corresponding to the ranging target in the first field of view are determined.
[0087] In one embodiment, the angle information in the first field of view corresponds to the angle information in the second field of view of the camera, and the second field of view is included in the first field of view. The angle information in the second field of view corresponds to the pixel coordinates in the preview image, and the second field of view is the field of view corresponding to the camera's shooting range. The mapping unit 102 maps the focus frame to the first field of view in the following manner to determine the angle range corresponding to the focus frame in the first field of view of the camera: determining the pixel coordinates corresponding to the focus frame in the preview image, and mapping the focus frame to the second field of view based on the correspondence between the angle information in the second field of view and the pixel coordinates in the preview image, thereby determining the angle range corresponding to the focus frame in the second field of view. Based on the correspondence between the angle information in the first field of view and the angle information in the second field of view, and the angle range corresponding to the focus frame in the second field of view, the angle range corresponding to the second field of view is mapped to the first field of view to determine the angle range corresponding to the focus frame in the first field of view of the camera.
[0088] In one embodiment, the processing unit 103 adjusts the camera's focusing distance based on the angle range, the angle corresponding to the ranging target, and the distance, as follows: It determines the numerical relationship between the angle range and the angle corresponding to the ranging target, including whether the angle corresponding to the ranging target is within the angle range or not. In response to the angle corresponding to the ranging target being within the angle range, the ranging target with that angle is identified as the target ranging target. The target distance is determined based on the distance corresponding to the target ranging target, and the camera's focusing distance is adjusted accordingly.
[0089] In one embodiment, the processing unit 103 determines the target distance based on the distance corresponding to the target ranging target in the following manner: If the target ranging target is a single target, the distance corresponding to the target ranging target is determined as the target distance. If the target ranging target is multiple targets, the minimum distance among the multiple distances corresponding to the multiple target ranging targets is determined, and the minimum distance is determined as the target distance.
[0090] In one embodiment, the processing unit 103 is further configured to: adjust the camera's focusing distance using phase focusing or contrast focusing in response to the target angle being outside the angular range.
[0091] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0092] Figure 10 This is a block diagram illustrating a focusing device 200 according to an exemplary embodiment. The device 200 can be provided as a terminal. For example, the device 200 can be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0093] Reference Figure 10 The device 200 may include one or more of the following components: processing component 202, memory 204, power component 206, multimedia component 208, audio component 210, input / output (I / O) interface 212, sensor component 214, and communication component 216.
[0094] Processing component 202 typically controls the overall operation of device 200, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 202 may include one or more processors 220 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 202 may include one or more modules to facilitate interaction between processing component 202 and other components. For example, processing component 202 may include a multimedia module to facilitate interaction between multimedia component 208 and processing component 202.
[0095] Memory 204 is configured to store various types of data to support the operation of device 200. Examples of such data include instructions for any application or method operating on device 200, contact data, phonebook data, messages, pictures, videos, etc. Memory 204 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 storage, flash memory, magnetic disk, or optical disk.
[0096] The power supply component 206 provides power to the various components of the device 200. The power supply component 206 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device 200.
[0097] Multimedia component 208 includes a screen that provides an output interface between the device 200 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 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 the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 208 includes a front-facing camera and / or a rear-facing camera. When the device 200 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0098] Audio component 210 is configured to output and / or input audio signals. For example, audio component 210 includes a microphone (MIC) configured to receive external audio signals when device 200 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 204 or transmitted via communication component 216. In some embodiments, audio component 210 also includes a speaker for outputting audio signals.
[0099] I / O interface 212 provides an interface between processing component 202 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.
[0100] Sensor assembly 214 includes one or more sensors for providing status assessments of various aspects of device 200. For example, sensor assembly 214 may detect the on / off state of device 200, the relative positioning of components such as the display and keypad of device 200, changes in the position of device 200 or a component of device 200, the presence or absence of user contact with device 200, the orientation or acceleration / deceleration of device 200, and temperature changes of device 200. Sensor assembly 214 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 214 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0101] Communication component 216 is configured to facilitate wired or wireless communication between device 200 and other devices. Device 200 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 216 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 216 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.
[0102] In an exemplary embodiment, the apparatus 200 may 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 perform the methods described above.
[0103] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 204 including instructions, which can be executed by a processor 220 of the device 200 to perform the above-described method. 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 device, etc.
[0104] It is understood that in this disclosure, "multiple" refers to two or more, and other quantifiers are similar. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. The singular forms "a," "the," and "the" are also intended to include the plural forms unless the context clearly indicates otherwise.
[0105] It is further understood that the terms "first," "second," etc., are used to describe various types of information, but this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another, and do not indicate a specific order or degree of importance. In fact, the expressions "first," "second," etc., are completely interchangeable. For example, without departing from the scope of this disclosure, first information can also be referred to as second information, and similarly, second information can also be referred to as first information.
[0106] It is further understood that the terms “center,” “longitudinal,” “lateral,” “front,” “rear,” “up,” “down,” “left,” “right,” “vertical,” “horizontal,” “top,” “bottom,” “inner,” and “outer,” etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this embodiment and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation.
[0107] It can be further understood that, unless otherwise specified, "connection" includes both direct connections where no other components exist between the two parties and indirect connections where other components exist between them.
[0108] It is further understood that although operations are described in a specific order in the accompanying drawings in the embodiments of this disclosure, this should not be construed as requiring these operations to be performed in the specific order or serial order shown, or requiring all of the shown operations to be performed to obtain the desired result. In certain environments, multitasking and parallel processing may be advantageous.
[0109] 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 the invention that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein.
[0110] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A focusing method, characterized in that, include: In response to camera activation, the position information of the ranging target relative to the camera is determined by an ultra-wideband positioning signal, and the angle and distance corresponding to the ranging target in a first field of view are determined based on the position information. The first field of view is the field of view corresponding to the ranging range of the camera's ranging module, and the ranging target is a target within the ranging range, including targets captured by the camera. Determine the focus frame surrounding the focus target in the preview image, and map the focus frame onto the first field of view, and determine the angle range corresponding to the focus frame in the first field of view of the camera; Based on the angle range, the angle and distance corresponding to the ranging target, the focusing distance of the camera is adjusted so that the camera focuses on the focusing target.
2. The method according to claim 1, characterized in that, The location information includes the distance, pitch angle, and yaw angle of the ranging target relative to the camera; Determining the angle and distance corresponding to the ranging target in the first field of view based on the position information includes: Based on the distance, pitch angle, and yaw angle of the ranging target relative to the camera, the spatial coordinates of the ranging target in the reference coordinate system are determined. The reference coordinate system is a coordinate system established based on the camera. Based on the correspondence between the reference coordinate system and the first field of view, and the spatial coordinates of the ranging target in the reference coordinate system, the angle and distance of the ranging target in the first field of view are determined.
3. The method according to claim 1, characterized in that, The angle information in the first field of view corresponds to the angle information in the second field of view of the camera, and the second field of view is included in the first field of view. The angle information in the second field of view corresponds to the pixel coordinates in the preview image. The second field of view is the field of view corresponding to the shooting range of the camera. The step of mapping the focus frame onto the first field of view and determining the angle range corresponding to the focus frame in the first field of view of the camera includes: The pixel coordinates of the focusing frame in the preview image are determined, and the focusing frame is mapped to the second field of view according to the correspondence between the angle information in the second field of view and the pixel coordinates in the preview image and the pixel coordinates, thereby determining the angle range of the focusing frame in the second field of view. Based on the correspondence between the angle information in the first field of view and the angle information in the second field of view, and the angle range corresponding to the focusing frame in the second field of view, the angle range corresponding to the second field of view is mapped to the first field of view to determine the angle range corresponding to the focusing frame in the first field of view of the camera.
4. The method according to claim 1, characterized in that, The step of adjusting the camera's focusing distance based on the angle range, the angle and distance corresponding to the ranging target, includes: Determine the numerical relationship between the angle range and the corresponding angle of the ranging target, wherein the numerical relationship includes the angle corresponding to the ranging target being within the angle range and the angle corresponding to the ranging target not being within the angle range; In response to the angle corresponding to the ranging target being within the angle range, the ranging target with the corresponding angle within the angle range is determined as the target ranging target, the target distance is determined according to the distance corresponding to the target ranging target, and the focus distance of the camera is adjusted according to the target distance.
5. The method according to claim 4, characterized in that, Determining the target distance based on the distance corresponding to the target ranging target includes: In response to the fact that the target ranging target is a single entity, the distance corresponding to the target ranging target is determined as the target distance; In response to the presence of multiple target ranging targets, the minimum distance among the multiple distances corresponding to the multiple target ranging targets is determined, and the minimum distance is determined as the target distance.
6. The method according to claim 4, characterized in that, The method further includes: In response to the target angle not being within the specified angle range, the camera's focusing distance is adjusted using either phase-detection autofocus or contrast-detection autofocus.
7. A focusing device, characterized in that, include: A determining unit is configured to, in response to activating the camera, determine the position information of the ranging target relative to the camera via an ultra-wideband positioning signal, and determine the angle and distance corresponding to the ranging target in a first field of view based on the position information. The first field of view is the field of view corresponding to the ranging range of the camera's ranging module, and the ranging target is a target within the ranging range, including targets captured by the camera. A mapping unit is used to determine the focus frame surrounding the focus target in the preview image, and to map the focus frame to the first field of view, and to determine the angle range corresponding to the focus frame in the first field of view of the camera; The processing unit is used to adjust the focusing distance of the camera according to the angle range, the angle and distance corresponding to the ranging target, so that the camera focuses on the focusing target.
8. The apparatus according to claim 7, characterized in that, The location information includes the distance, pitch angle, and yaw angle of the ranging target relative to the camera; The determining unit determines the angle and distance corresponding to the ranging target in the first field of view based on the position information in the following manner: Based on the distance, pitch angle, and yaw angle of the ranging target relative to the camera, the spatial coordinates of the ranging target in the reference coordinate system are determined. The reference coordinate system is a coordinate system established based on the camera. Based on the correspondence between the reference coordinate system and the first field of view, and the spatial coordinates of the ranging target in the reference coordinate system, the angle and distance of the ranging target in the first field of view are determined.
9. The apparatus according to claim 7, characterized in that, The angle information in the first field of view corresponds to the angle information in the second field of view of the camera, and the second field of view is included in the first field of view. The angle information in the second field of view corresponds to the pixel coordinates in the preview image. The second field of view is the field of view corresponding to the shooting range of the camera. The mapping unit maps the focus frame onto the first field of view in the following manner to determine the angle range of the focus frame within the first field of view of the camera: The pixel coordinates of the focusing frame in the preview image are determined, and the focusing frame is mapped to the second field of view according to the correspondence between the angle information in the second field of view and the pixel coordinates in the preview image and the pixel coordinates, thereby determining the angle range of the focusing frame in the second field of view. Based on the correspondence between the angle information in the first field of view and the angle information in the second field of view, and the angle range corresponding to the focusing frame in the second field of view, the angle range corresponding to the second field of view is mapped to the first field of view to determine the angle range corresponding to the focusing frame in the first field of view of the camera.
10. The apparatus according to claim 7, characterized in that, The processing unit adjusts the camera's focusing distance according to the angle range, the angle and distance corresponding to the ranging target, in the following manner: Determine the numerical relationship between the angle range and the corresponding angle of the ranging target, wherein the numerical relationship includes the angle corresponding to the ranging target being within the angle range and the angle corresponding to the ranging target not being within the angle range; In response to the angle corresponding to the ranging target being within the angle range, the ranging target with the corresponding angle within the angle range is determined as the target ranging target, the target distance is determined according to the distance corresponding to the target ranging target, and the focus distance of the camera is adjusted according to the target distance.
11. The apparatus according to claim 10, characterized in that, The processing unit determines the target distance based on the distance corresponding to the target ranging target in the following manner: In response to the fact that the target ranging target is a single entity, the distance corresponding to the target ranging target is determined as the target distance; In response to the presence of multiple target ranging targets, the minimum distance among the multiple distances corresponding to the multiple target ranging targets is determined, and the minimum distance is determined as the target distance.
12. The apparatus according to claim 10, characterized in that, The processing unit is also used for: In response to the target angle not being within the specified angle range, the camera's focusing distance is adjusted using either phase-detection autofocus or contrast-detection autofocus.
13. An electronic device, characterized in that, include: processor: Memory used to store processor-executable instructions; The processor is configured to execute the focusing method according to any one of claims 1 to 6.
14. A storage medium, characterized in that, The storage medium stores instructions that, when executed by a processor, enable the processor to perform the focusing method according to any one of claims 1 to 6.