Focusing method, device, computer device and storage medium

By obtaining the estimated object distance and object distance curve of the target object, the focusing range is determined and the focusing position is searched using the Fibonacci method, which solves the problem of low focusing efficiency in the existing technology and realizes a fast and accurate focusing process.

CN116582750BActive Publication Date: 2026-02-06ZHEJIANG HUACHUANG VISION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310447768.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-19
Publication Date
2026-02-06
Estimated Expiration
2043-04-19

AI Technical Summary

Technical Problem

Existing technologies have low focusing efficiency and lack guidance in the focusing process, resulting in excessively long search times.

Method used

By obtaining the estimated object distance of the target object, a focal value curve and an object distance curve are established, multiple first focal positions and focal ranges are determined, and the Fibonacci method is used to search for a second focal position within the focal range to meet the preset conditions.

Benefits of technology

It improves focusing efficiency, shortens the search process, and reduces the overhead of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116582750B_ABST
    Figure CN116582750B_ABST
Patent Text Reader

Abstract

The application relates to a focusing method and device, a computer device and a storage medium. The method comprises the following steps: obtaining an estimated object distance of a target object; obtaining a corresponding focus value curve based on the estimated object distance, and determining a plurality of first focusing positions based on a peak point of the focus value curve; obtaining a corresponding farthest object distance curve and a nearest object distance curve based on the estimated object distance, and determining a focusing range based on a real-time zoom ratio, the farthest object distance curve and the nearest object distance curve; searching for a second focusing position based on the plurality of first focusing positions and the focusing range, wherein a focus value of the second focusing position for imaging the target object satisfies a preset condition. Through the application, the technical problem of low focusing efficiency in the related art is solved, the search process is shortened, the computing resource overhead is reduced, and the focusing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer vision, and in particular, to a focusing method and device, a computer device, and a storage medium. BACKGROUND

[0002] With the continuous development of computer vision technology, the imaging requirements in the fields of video conferencing and security monitoring are also increasingly high. In order to improve the imaging accuracy, focusing is generally performed by methods such as contrast focusing and phase focusing. Among them, contrast focusing is similar to the hill climbing algorithm, which generally starts from an unknown distance and an unknown direction to gradually find the focus point with the maximum focus point value each time the focusing starts.

[0003] In order to improve the focusing effect, the hill climbing algorithm with variable step search is generally used in the search process of the focusing peak value in the related technology, and the search of the entire focusing process is completed by changing the focusing step, so as to quickly determine the focusing peak value. However, in the process of searching by changing the step in the related technology, it is often necessary to start from an unknown position, which leads to a lack of guidance in the search of the focusing position in the focusing process, and the focusing process is long. Therefore, the focusing efficiency in the related technology is low.

[0004] At present, there is no effective solution to the technical problem of low focusing efficiency in the related technology. SUMMARY

[0005] Therefore, it is necessary to provide a focusing method, device, computer device, and storage medium capable of improving the focusing efficiency to solve the above technical problems.

[0006] In a first aspect, the present application provides a focusing method, which comprises:

[0007] obtaining an estimated object distance of a target object;

[0008] obtaining a corresponding focus value curve based on the estimated object distance, and determining a plurality of first focusing positions based on a peak point of the focus value curve;

[0009] obtaining a corresponding farthest object distance curve and a nearest object distance curve based on the estimated object distance, and determining a focusing range based on a real-time zoom ratio, the farthest object distance curve, and the nearest object distance curve;

[0010] searching for a second focusing position based on the plurality of first focusing positions and the focusing range, wherein a focus point value of the target object imaged by the second focusing position satisfies a preset condition.

[0011] In one of the embodiments, the method further comprises, before the step of obtaining the corresponding focus value curve based on the estimated object distance:

[0012] obtaining a plurality of reference object distances;

[0013] A corresponding focus value curve is established based on each of the reference distances, and a mean point of the focus value curve is determined based on the reference distances.

[0014] In one of the embodiments, a first distance between two adjacent first focus positions is positively correlated with a second distance, the first distance being a distance between the two adjacent first focus positions, and the second distance being a distance from at least one of the two adjacent first focus positions to the peak point.

[0015] In one of the embodiments, the determining of the first focus positions based on the peak point of the focus value curve comprises:

[0016] Based on each focus value in the focus value curve, a search step corresponding to each focus position is determined.

[0017] Based on the search steps corresponding to the focus positions, the first focus positions are determined.

[0018] In one of the embodiments, the obtaining of the farthest distance curve and the nearest distance curve based on the estimated distance comprises:

[0019] Based on the estimated distance, an estimated farthest distance and an estimated nearest distance are determined.

[0020] The farthest distance curve is obtained based on the estimated farthest distance, and the nearest distance curve is obtained based on the estimated nearest distance.

[0021] In one of the embodiments, the determining of the focus range based on the real-time zoom ratio, the farthest distance curve and the nearest distance curve comprises:

[0022] Based on the real-time zoom ratio and the farthest distance curve, a farthest limit of the focus position is determined, and based on the real-time zoom ratio and the nearest distance curve, a nearest limit of the focus position is determined.

[0023] Based on the farthest limit and the nearest limit, the focus range is determined.

[0024] In one of the embodiments, the searching of the second focus position based on the first focus positions and the focus range comprises:

[0025] Based on the Fibonacci method, the second focus position is determined from the first focus positions in the focus range.

[0026] In a second aspect, the application further provides a focusing device, which comprises:

[0027] an object distance acquisition module, configured to acquire an estimated object distance of a target object;

[0028] a first position determination module, configured to acquire a corresponding focal point value curve based on the estimated object distance, and determine a plurality of first focusing positions based on a peak point of the focal point value curve;

[0029] a range determination module, configured to acquire a corresponding farthest object distance curve and a closest object distance curve based on the estimated object distance, and determine a focusing range based on a real-time zoom ratio, the farthest object distance curve and the closest object distance curve;

[0030] a second position determination module, configured to search for a second focusing position based on the plurality of first focusing positions and the focusing range, the second focusing position satisfying a preset condition for a focal point value of an image of the target object.

[0031] In a third aspect, the present application further provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0032] acquire an estimated object distance of a target object;

[0033] acquire a corresponding focal point value curve based on the estimated object distance, and determine a plurality of first focusing positions based on a peak point of the focal point value curve;

[0034] acquire a corresponding farthest object distance curve and a closest object distance curve based on the estimated object distance, and determine a focusing range based on a real-time zoom ratio, the farthest object distance curve and the closest object distance curve;

[0035] search for a second focusing position based on the plurality of first focusing positions and the focusing range, the second focusing position satisfying a preset condition for a focal point value of an image of the target object.

[0036] In a fourth aspect, the present application further provides a computer readable storage medium. The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:

[0037] acquire an estimated object distance of a target object;

[0038] acquire a corresponding focal point value curve based on the estimated object distance, and determine a plurality of first focusing positions based on a peak point of the focal point value curve;

[0039] acquire a corresponding farthest object distance curve and a closest object distance curve based on the estimated object distance, and determine a focusing range based on a real-time zoom ratio, the farthest object distance curve and the closest object distance curve;

[0040] The second focus position is searched based on the plurality of first focus positions and the focus range, and a focus value of the second focus position imaging the target object satisfies a preset condition.

[0041] The application provides a focusing method, device, computer equipment and storage medium. The method comprises: obtaining an estimated object distance of a target object; obtaining a corresponding focus value curve based on the estimated object distance, and determining a plurality of first focus positions based on a peak point of the focus value curve; obtaining a corresponding farthest object distance curve and nearest object distance curve based on the estimated object distance, and determining a focus range based on a real-time zoom ratio, the farthest object distance curve and the nearest object distance curve; and searching for a second focus position based on the plurality of first focus positions and the focus range, wherein a focus value of the second focus position imaging the target object satisfies a preset condition. The focus value curve and the object distance curve are obtained based on the estimated object distance, thereby assisting in determining the plurality of first focus positions and the focus range. The focus range is used to assist in guiding in the process of searching for the plurality of first focus positions, thereby avoiding searching for invalid first focus positions outside the focus range, solving the technical problem of low focusing efficiency in the related art, shortening the search process, reducing the computational resource overhead, and improving the focusing efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0042] Figure 1 is an application environment diagram of a focusing method of an embodiment of the application;

[0043] Figure 2 is a flowchart of the focusing method of an embodiment of the application;

[0044] Figure 3 is a diagram of a focus value curve of an embodiment of the application;

[0045] Figure 4 is a diagram of a step curve of an embodiment of the application;

[0046] Figure 5 is a diagram of an object distance curve of an embodiment of the application;

[0047] Figure 6 is a Fibonacci method focusing path diagram of an embodiment of the application;

[0048] Figure 7 is a flowchart of the focusing method of another embodiment of the application;

[0049] Figure 8 is a structural block diagram of a focusing device of an embodiment of the application;

[0050] Figure 9 is an internal structure diagram of a computer equipment of an embodiment of the application. DETAILED DESCRIPTION

[0051] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.

[0052] The focusing method provided by the embodiments of the present application can be applied to the application environment as shown in Figure 1 The terminal 102 communicates with the server 104 through a network. The data storage system can store data required to be processed by the server 104. The data storage system can be integrated on the server 104, or placed on a cloud or other network server. The terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0053] In the related art, the search process of the contrast focusing is similar to the hill climbing algorithm, that is, the motor searches from the near focus to the far focus, calculates all the imaging differences in the process, obtains the maximum difference, and then returns the motor to the place of the maximum difference, that is, the focus point. In the contrast focusing process, the point with the clearest image is the point with the maximum contrast. The camera drives the lens to change the focus point along the axis pointing to the subject, obtains the image at each focus point, obtains the pixel brightness value and the sum of the brightness of all pixels, and then obtains the difference between the sum of the pixel brightness values of the image obtained at the next focus point and the sum of the pixel brightness values of the image obtained at the current focus point, that is, the contrast value between the two focus points. The contrast selects the position with the maximum contrast value, and drives the lens to place the focus point at the focus point with the maximum contrast value, that is, the correct focus point position is obtained. Whether the focus is achieved is determined according to the maximum contrast value, and thus the focusing process is completed. When reflected on the user display screen, it is a search process from blur to clarity and then to blur, and finally to clarity.

[0054] Please refer to Figure 2 , Figure 2 is a flowchart of the focusing method of an embodiment of the present application.

[0055] In one embodiment, as shown in Figure 2 , the focusing method comprises:

[0056] S202: Obtain the estimated object distance of the target object.

[0057] Specifically, an estimated object distance between the camera and the target object is obtained. The target object is the shooting object, and the estimated object distance is the measurement distance, which can be the physical distance between the lens and the target object.

[0058] For example, the physical distance between the lens and the target object can be measured by laser ranging, Time of Flight Measurement (TOF), Phase Detection Auto Focus (PDAF), and space calibration in the embodiment, as the estimated object distance in the embodiment.

[0059] S204: Obtain a corresponding focus value curve based on the estimated object distance, and determine a plurality of first focusing positions based on the peak point of the focus value curve.

[0060] Specifically, the focus value curve corresponding to the estimated object distance is obtained. In the focusing system, a plurality of reference object distances and a plurality of corresponding focus value curves are pre-set, and the focus value curve corresponding to the reference object distance closest to the estimated object distance is obtained.

[0061] In the embodiment, the focus value curve is a corresponding relationship curve between the focus value based on the imaging gradient or contrast and the focusing position, which is counted by the image signal processing system. It can be understood that when the target object is focused at a fixed distance, the focus value of the imaging and the focusing position always present a corresponding relationship of a bell-shaped curve, and the peak point of the bell-shaped curve is the best focusing position, i.e., the lens focusing position.

[0062] Specifically, after obtaining the focus value curve, a plurality of first focusing positions are determined according to the peak point of the focus value curve, as the search positions in the contrast focusing process, i.e., the imaging positions of the focus plane driven by the focusing motor. The first focusing positions can take the peak point as the distribution center. It can be understood that in the contrast focusing process, each first focusing position is searched in turn to determine the focusing position with the highest imaging accuracy.

[0063] S206: Obtain a corresponding farthest object distance curve and a nearest object distance curve based on the estimated object distance, and determine a focusing range based on the real-time zoom ratio, the farthest object distance curve, and the nearest object distance curve.

[0064] Specifically, after obtaining the estimated object distance of the target object, the farthest object distance and the nearest object distance of the target object are calculated according to the estimated object distance and the depth of field, and then the farthest object distance curve and the nearest object distance curve are obtained. According to the real-time zoom ratio at the current time point, the focusing position in the farthest object distance curve is determined as the farthest limit, and the focusing position in the nearest object distance curve is determined as the nearest limit, so as to obtain the focusing range composed of the farthest limit and the nearest limit.

[0065] In the embodiment, the object distance curve is a zoom tracking curve at a fixed object distance, which is used to measure the correspondence between zoom and focus. It can be understood that when the lens zooms from wide angle to telephoto, the focal length of the lens gradually increases, and the angle of view gradually decreases. For an object at a fixed distance, in order to maintain the clarity of the image, the image sensor, i.e., the in-focus plane, should also move as the focal length changes when the zoom changes from wide angle to telephoto. Since the focal length of the zoom lens is achieved by a zoom motor, the image sensor is moved by a focus motor, so the object distance curve essentially reflects the correspondence between the zoom motor position and the focus motor position.

[0066] In the embodiment, a plurality of reference object distances and corresponding object distance curves are pre-set, and after the farthest object distance and the nearest object distance are obtained, the reference object distance closest to the farthest object distance and the reference object distance closest to the nearest object distance are obtained, and then the farthest object distance curve and the nearest object distance curve are obtained.

[0067] S208: Search for a second focus position based on the plurality of first focus positions and the focus range, the second focus position being a focus point value of the target object meeting a preset condition.

[0068] Specifically, after the first focus positions and the focus range are obtained, the first focus positions in the focus range that meet the preset condition are searched for as the second focus position. The preset condition is a point with a high focus point value, and preferably a point with the highest focus point value, i.e., the clearest image.

[0069] In the embodiment, the focus point value curve and the object distance curve are obtained based on the estimated object distance, which assists in determining the plurality of first focus positions and the focus range, and assists in guiding the search for the plurality of first focus positions within the focus range, thereby avoiding searching for invalid first focus positions outside the focus range, solving the technical problem of low focus efficiency in the related art, shortening the search process, reducing the computational resource overhead, and improving the focus efficiency.

[0070] In another embodiment, before obtaining the corresponding focus point value curve based on the estimated object distance, the method further includes:

[0071] Step 1: Obtain a plurality of reference object distances.

[0072] Step 2: Establish a corresponding focus point value curve based on each reference object distance, respectively, and the mean point of the focus point value curve is determined based on the reference object distance.

[0073] Specifically, before the focus value curve according to the estimated object distance is acquired, a plurality of reference object distances and a plurality of corresponding focus value curves are established in advance, so that the focus value curve corresponding to the same or the closest reference object distance can be directly acquired according to the estimated object distance curve.

[0074] Specifically, in the establishing process, a plurality of reference object distances are first set, and then contrastive focusing is performed under each reference object distance to collect the numerical correspondence between each focusing position and the corresponding focus value, and the focus value curve under the reference object distance is formed through curve fitting.

[0075] Please refer to Figure 3 , Figure 3 is a schematic diagram of the focus value curve of an embodiment of the present application.

[0076] Exemplarily, as shown in Figure 3 , the horizontal coordinate is the focusing position of the lens, and the vertical coordinate is the focus value. The focus value and the focusing position of the lens satisfy a normal distribution relationship, so the focus value curve presents a bell-shaped curve in the change trend. The expression of the normal distribution is as follows:

[0077]

[0078] In the normal distribution expression, there are two parameters: mean μ and standard deviation σ, σ 2 When μ = 0 and σ = 1, the above normal distribution curve satisfies the relationship of the standard normal distribution, and the expression of the standard normal distribution curve is as follows:

[0079]

[0080] Exemplarily, in the embodiment, when the above parameters are determined, since the estimated object distance is between the farthest object distance and the closest object distance, the above mean μ can be determined based on the estimated object distance, so that the expression of the focus value curve is obtained as follows:

[0081]

[0082] Where x is the focusing position, and f(x) is the focus value.

[0083] In the embodiment, the correspondence between a plurality of reference object distances and a plurality of focus value curves is established in advance, so that the corresponding focus value curve can be directly acquired according to the estimated object distance in the actual focusing process, thereby improving the acquisition speed of the focus value curve and further improving the focusing efficiency.

[0084] In another embodiment, the first distance between the two adjacent first focusing positions and the second distance between the two adjacent first focusing positions are in a positive correlation relationship. The first distance is the distance between the two adjacent first focusing positions, and the second distance is the distance between at least one of the two adjacent first focusing positions and the peak point. In another embodiment, the first distance between the two adjacent first focusing positions and the second distance between the two adjacent first focusing positions are in a positive correlation relationship. The first distance is the distance between the two adjacent first focusing positions, and the second distance is the distance between at least one of the two adjacent first focusing positions and the peak point.

[0085] Specifically, taking the distance between two adjacent first focus positions as the first distance, and taking the distance from at least one of the two first focus positions to the peak point as the second distance, the first distance increases with the increase of the second distance, that is, the first distance and the second distance present a positive correlation.

[0086] It can be understood that the closer the focus position is to the peak point, the higher the focus value is, and the clearer the imaging result is. Therefore, the focus positions searched should be more dense near the peak point, and the focus positions searched should be more and more sparse away from the peak point.

[0087] In the embodiment, the focus positions searched should be more dense near the peak point, and the focus positions searched should be more and more sparse away from the peak point, so that the search step is adjusted according to the distance from the peak point, avoiding the local maximum value caused by too small step selection, and the peak point oscillation caused by too large step selection, thereby realizing fast focusing and improving the focusing efficiency.

[0088] In another embodiment, determining the plurality of first focus positions based on the peak point of the focus value curve comprises:

[0089] Step 1: determining the search step of each focus position corresponding to each focus value in the focus value curve;

[0090] Step 2: determining the plurality of first focus positions based on the plurality of search steps corresponding to the plurality of focus positions.

[0091] Specifically, the search step of the corresponding focus position is determined based on each focus value in the focus value curve; after determining the plurality of search steps corresponding to the plurality of focus positions, the corresponding first focus position is determined based on the search step of each position. After determining the first focus position, searching is performed according to the first focus position to quickly approach the focus position.

[0092] Please refer to Figure 4 , Figure 4 which is a schematic diagram of the step curve of an embodiment of the present application.

[0093] Exemplarily, the reciprocal of each focus value in the focus value curve is obtained as the search step of the corresponding focus position. The reciprocal of the focus value curve is taken to obtain the step curve as shown in Figure 4 The expression of the step curve is as follows:

[0094]

[0095] It can be understood that the first focus position in the embodiment is preferably set as: the closer to the peak point, the denser the search focus position is, and the farther away from the peak point, the sparser the search focus position is. Therefore, the search step is smaller near the peak point, and the search step is larger away from the peak point. After taking the reciprocal of the focus value curve, the closer to the peak point, the smaller the step is, and the farther away from the peak point, the larger the step is. Therefore, the step of the corresponding focus position can be determined by the reciprocal of the focus value.

[0096] The embodiment determines the search step through the focus value curve, and then determines the first focus position based on the search step. The determination manner of the search step is simple, and the closer to the peak point, the smaller the step is, and the farther away from the peak point, the larger the step is, thereby improving the determination efficiency of the first focus position and the focusing efficiency.

[0097] In another embodiment, the corresponding farthest object distance curve and the closest object distance curve are obtained based on the estimated object distance, and the focusing range is determined based on the real-time zoom ratio, the farthest object distance curve and the closest object distance curve.

[0098] Step 1: determining the estimated farthest object distance and the estimated closest object distance based on the estimated object distance;

[0099] Step 2: obtaining the corresponding farthest object distance curve based on the estimated farthest object distance, and obtaining the corresponding closest object distance curve based on the estimated closest object distance.

[0100] Specifically, after obtaining the estimated object distance, the corresponding foreground depth and background depth under the estimated object distance are first calculated, and then the estimated farthest object distance and the estimated closest object distance are calculated according to the estimated object distance, the foreground depth and the background depth.

[0101] Exemplarily, the calculation manner of the foreground depth ΔL1 and the background depth ΔL2 is as follows:

[0102]

[0103]

[0104] Wherein, δ is the diameter of the circle of confusion, F is the aperture value, f is the focal length, and L is the focusing distance (the sum of the estimated object distance and the image distance).

[0105] Specifically, after the estimated farthest object distance and the estimated closest object distance are calculated, the same or the closest reference object distance is obtained, and the corresponding farthest object distance curve and the closest object distance curve are obtained, and then the focusing range is obtained.

[0106] In another embodiment, the focusing range is determined based on the real-time zoom ratio, the farthest object distance curve and the closest object distance curve.

[0107] Step 1: determining the farthest limit of the focus position based on the real-time zoom ratio and the farthest distance curve, and determining the nearest limit of the focus position based on the real-time zoom ratio and the nearest distance curve;

[0108] Step 2: determining the focus range based on the farthest limit and the nearest limit.

[0109] Referring to Figure 5 , Figure 5 is a schematic diagram of a distance curve of an embodiment of the present application.

[0110] Specifically, as Figure 5 indicated, when the zoom lens changes from wide angle to telephoto, the angle of view of the lens also changes. In response to the change in focal length, the focal plane needs to move from the far end to the near end, and the image distance is adjusted to ensure the clarity of the image.

[0111] Specifically, as Figure 5 indicated, for the current real-time zoom ratio, the farthest limit and the nearest limit of the corresponding focus position are determined by the farthest distance curve and the nearest distance curve respectively, thereby obtaining the focus range. Therefore, the expression of the step curve is as follows:

[0112] (farthest limit≤x≤nearest limit)

[0113] The embodiment quickly determines the focus range through the farthest distance curve and the nearest distance curve, thereby shortening the determination time of the focus range and the search process in the focusing process, and further improving the focusing efficiency.

[0114] In another embodiment, searching for a second focus position based on the plurality of first focus positions and the focus range comprises:

[0115] Determining the second focus position among the plurality of first focus positions in the focus range based on the Fibonacci method.

[0116] Specifically, in the embodiment, the plurality of first focus positions in the focus range are searched by the Fibonacci method to obtain the second focus position with the clearest image.

[0117] Exemplarily, in the search process, if the current first focus position is on the left side of the second focus position, the search continues to the right; if the current first focus position is on the right side of the second focus position, the search continues to the left. When the focal point value first shows a downward trend, the search is reversed, and the second focus position is determined by focusing through the Fibonacci method.

[0118] Referring to Figure 6 , Figure 6Fig. 1 is a schematic diagram of a Fibonacci method for focusing according to an embodiment of the present application.

[0119] As shown in Fig. 1, in the process of focusing by the Fibonacci method, the search is sequentially performed from position 1 to position 7, i.e., from the outside to the inside, and then the second focusing position is obtained. Figure 6

[0120] As shown in Fig. 1, in the process of searching, the focus value corresponding to the first focusing position first increases and then decreases. In each search process, the function interval is [the current first focusing position, the last first focusing position], and the search precision can be set to 1 step. Based on the estimated object distance, it can be ensured that the search interval is within the depth of field of the lens, and the imaging within the depth of field is always clear, thereby achieving the effect of no-sensation focusing.

[0121] In this embodiment, the Fibonacci method is used for fast focusing, thereby improving the determination efficiency of the second focusing position and improving the focusing efficiency.

[0122] As shown in Fig. 2, Figure 7 Figure 7 Fig. 3 is a schematic diagram of a focusing method according to another embodiment of the present application.

[0123] In another embodiment, as shown in Fig. 3, the focusing method comprises the following steps. Figure 7

[0124] It should be understood that, although each step in the flowchart involved in each of the above embodiments is shown in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.

[0125] ​​​Based on the same inventive concept, the embodiments of the present application also provide a focusing device for implementing the focusing method described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more focusing device embodiments provided below can refer to the limitations of the focusing method described above, which will not be repeated here.

[0126] In one embodiment, as shown in Figure 8 a focusing device is provided, comprising:

[0127] The object distance acquisition module 10 is configured to acquire an estimated object distance of a target object.

[0128] The first position determination module 20 is configured to acquire a corresponding focal point value curve based on the estimated object distance, and determine a plurality of first focusing positions based on a peak point of the focal point value curve.

[0129] The first position determination module 20 is further configured to determine a search step length corresponding to each focusing position based on each focal point value in the focal point value curve.

[0130] The plurality of first focusing positions are determined based on the plurality of search step lengths corresponding to the plurality of focusing positions.

[0131] The range determination module 30 is configured to acquire a corresponding farthest object distance curve and a closest object distance curve based on the estimated object distance, and determine a focusing range based on a real-time zoom ratio, the farthest object distance curve and the closest object distance curve.

[0132] The range determination module 30 is further configured to determine an estimated farthest object distance and an estimated closest object distance based on the estimated object distance.

[0133] The corresponding farthest object distance curve is acquired based on the estimated farthest object distance, and the corresponding closest object distance curve is acquired based on the estimated closest object distance.

[0134] The range determination module 30 is further configured to determine a farthest limit of the focusing position based on the real-time zoom ratio and the farthest object distance curve, and determine a closest limit of the focusing position based on the real-time zoom ratio and the closest object distance curve.

[0135] The focusing range is determined based on the farthest limit and the closest limit.

[0136] The second position determination module 40 is configured to search for a second focusing position based on the plurality of first focusing positions and the focusing range, and the focal point value of the second focusing position for imaging the target object satisfies a preset condition.

[0137] The second position determination module 40 is further configured to determine the second focusing position among the plurality of first focusing positions within the focusing range based on the Fibonacci method.

[0138] The focusing device further comprises a focal point value curve establishing module;

[0139] The focal point value curve establishing module is configured to acquire a plurality of reference object distances;

[0140] A corresponding focal point value curve is established based on each reference object distance respectively, and a mean point of the focal point value curve is determined based on the reference object distance.

[0141] The modules in the focusing device can be realized by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to the modules.

[0142] In an embodiment, a computer device is provided, which can be a terminal, and an internal structure diagram of the computer device can be as shown in Figure 9 The computer device comprises a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The communication interface of the computer device is configured to perform wired or wireless communication with an external terminal. The wireless communication can be achieved through WIFI, mobile cellular network, NFC (near field communication), or other technologies. The computer program is executed by the processor to implement a focusing method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball, or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0143] Those skilled in the art can understand that Figure 9 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can comprise more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0144] In an embodiment, a computer device is provided, which comprises a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the following steps:

[0145] Acquire an estimated object distance of a target object;

[0146] obtaining a corresponding focus value curve based on the estimated object distance, and determining a plurality of first focusing positions based on a peak point of the focus value curve;

[0147] obtaining a corresponding farthest object distance curve and a closest object distance curve based on the estimated object distance, and determining a focusing range based on the real-time zoom ratio, the farthest object distance curve and the closest object distance curve;

[0148] searching for a second focusing position based on the plurality of first focusing positions and the focusing range, the second focusing position satisfying a preset condition for a focus value of an image of the target object.

[0149] In one embodiment, a computer readable storage medium is provided, and a computer program is stored on the computer readable storage medium. The computer program is executed by a processor to implement the following steps:

[0150] obtaining an estimated object distance of a target object;

[0151] obtaining a corresponding focus value curve based on the estimated object distance, and determining a plurality of first focusing positions based on a peak point of the focus value curve;

[0152] obtaining a corresponding farthest object distance curve and a closest object distance curve based on the estimated object distance, and determining a focusing range based on the real-time zoom ratio, the farthest object distance curve and the closest object distance curve;

[0153] searching for a second focusing position based on the plurality of first focusing positions and the focusing range, the second focusing position satisfying a preset condition for a focus value of an image of the target object.

[0154] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.

[0155] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0156] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.

[0157] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A focusing method, characterized in that, The method includes: Obtain the estimated distance to the target object; Based on the estimated object distance, the corresponding focal value curve is obtained, and multiple first focusing positions are determined based on the peak point of the focal value curve; multiple reference object distances and corresponding multiple focal value curves are preset in the focusing system; Based on the estimated object distance, the corresponding farthest object distance curve and the nearest object distance curve are obtained, and the focus range is determined based on the real-time zoom ratio, the farthest object distance curve, and the nearest object distance curve. A second focusing position is searched based on multiple first focusing positions and the focusing range, and the focus value of the second focusing position for imaging the target object meets a preset condition; Searching for a second focus position based on multiple first focus positions and the focus range includes: Search among the multiple first focusing positions within the focusing range for a focusing position that meets a preset condition, and use it as a second focusing position.

2. The focusing method according to claim 1, characterized in that, Before obtaining the corresponding focal value curve based on the estimated object distance, the process also includes: Obtain multiple reference object distances; Each focal value curve is established based on each reference object distance, and the mean point of the focal value curve is determined based on the reference object distance.

3. The focusing method according to claim 1, characterized in that, The first distance and the second distance between two adjacent first focusing positions are positively correlated. The first distance is the distance between two adjacent first focusing positions, and the second distance is the distance from at least one of the two adjacent first focusing positions to the peak point.

4. The focusing method according to claim 1, characterized in that, Determining multiple first focal positions based on the peak points of the focal value curve includes: Based on each focal value in the focal value curve, determine the search step size corresponding to each focal position; Based on the multiple search steps corresponding to the multiple focal positions, multiple first focal positions are determined.

5. The focusing method according to claim 1, characterized in that, The process of obtaining the corresponding farthest object distance curve and nearest object distance curve based on the estimated object distance includes: Based on the estimated object distance, determine the estimated farthest object distance and the estimated nearest object distance; The farthest object distance curve is obtained based on the estimated farthest object distance, and the nearest object distance curve is obtained based on the estimated nearest object distance.

6. The focusing method according to claim 1, characterized in that, The method of determining the focus range based on the real-time zoom ratio, the farthest object distance curve, and the nearest object distance curve includes: Based on the real-time zoom ratio and the farthest object distance curve, the farthest limit of the focus position is determined, and based on the real-time zoom ratio and the nearest object distance curve, the nearest limit of the focus position is determined. The focusing range is determined based on the farthest limit and the nearest limit.

7. The focusing method according to claim 1, characterized in that, The search for the second focus position based on multiple first focus positions and the focus range includes: The second focusing position is determined from among a plurality of first focusing positions within the focusing range based on the Fibonacci method.

8. A focusing device, characterized in that, The device includes: The object distance acquisition module is used to obtain the estimated object distance to the target object; The first position determination module is used to obtain the corresponding focal value curve based on the estimated object distance, and determine multiple first focusing positions based on the peak point of the focal value curve; the focusing system has multiple reference object distances and corresponding multiple focal value curves preset in advance; The range determination module is used to obtain the corresponding farthest object distance curve and the nearest object distance curve based on the estimated object distance, and to determine the focus range based on the real-time zoom ratio, the farthest object distance curve and the nearest object distance curve. The second position determination module is used to search for a second focus position based on multiple first focus positions and the focus range, wherein the focus value of the second focus position for imaging the target object meets a preset condition; Searching for a second focus position based on multiple first focus positions and the focus range includes: Search among the multiple first focusing positions within the focusing range for a focusing position that meets a preset condition, and use it as a second focusing position.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Automatic tracking and focusing method and system for integrated camera

    CN104079832A

  • Search range extension for depth assisted autofocus

    CN107257934A