WO2022000258A1 - Focusing method and apparatus, electronic device, and computer readable medium - Google Patents

Focusing method and apparatus, electronic device, and computer readable medium Download PDF

Info

Publication number
WO2022000258A1
WO2022000258A1 PCT/CN2020/099221 CN2020099221W WO2022000258A1 WO 2022000258 A1 WO2022000258 A1 WO 2022000258A1 CN 2020099221 W CN2020099221 W CN 2020099221W WO 2022000258 A1 WO2022000258 A1 WO 2022000258A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
focus
target
focus information
lens position
Prior art date
Application number
PCT/CN2020/099221
Other languages
French (fr)
Chinese (zh)
Inventor
郑子翔
韩守谦
梁大奖
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/099221 priority Critical patent/WO2022000258A1/en
Publication of WO2022000258A1 publication Critical patent/WO2022000258A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules

Definitions

  • the embodiments of the present application relate to the field of cameras, and in particular, to a focusing method, an apparatus, an electronic device, and a computer-readable medium.
  • Contrast Detection Auto Focus is a commonly used focusing method. Through contrast focusing, the camera's automatic focusing can be achieved, eliminating the user's manual focusing process and providing convenience for users.
  • the lens position and the index information (such as contrast) of the focus area in the image are usually combined into one coordinate point, and curve fitting is performed through several coordinate points to determine the highest curve. point, so that the lens position corresponding to the highest point is taken as the lens position when focusing is achieved.
  • the disadvantage of the prior art is that there is usually equipment shake during the shooting process, and equipment shake occurs when the image is sampled at the lens position corresponding to any of the above coordinate points, which will affect the accuracy of curve fitting and further affect the accuracy of the curve fitting.
  • the embodiments of the present application propose a focusing method, an apparatus, an electronic device, and a computer-readable medium, so as to solve the technical problem of low focusing accuracy in the prior art.
  • an embodiment of the present application provides a focusing method, including:
  • the focusing information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
  • the candidate focus information is screened out
  • the lens is controlled to move to the lens position to complete focusing.
  • an embodiment of the present application provides a focusing device, including:
  • an acquisition unit configured to acquire focus information when the lens samples multiple frames of images in the focusing process, where the focus information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
  • a screening unit configured to screen out candidate focus information based on the device shake information
  • a determining unit configured to determine the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information
  • the control unit is configured to control the lens to move to the lens position to complete focusing.
  • an embodiment of the present application provides an electronic device, including: a processor and a memory;
  • the memory for storing program instructions
  • the processor executes the program instructions stored in the memory, and when the program instructions are executed, the processor is configured to perform the following steps:
  • the focusing information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
  • the candidate focus information is screened out
  • the lens is controlled to move to the lens position to complete focusing.
  • an embodiment of the present application provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the focusing method as in the first method.
  • the focusing method, device, electronic device, and computer-readable medium provided in the embodiments of the present application improve the accuracy of lens position determination when focusing is achieved, thereby effectively improving the focusing accuracy.
  • Fig. 2 is the schematic diagram of the index information curve and the device jitter information curve of the present application when the image acquisition device is stable;
  • FIG. 3 is a schematic diagram of an index information curve and a device jitter information curve when the image acquisition device shakes according to the present application;
  • Fig. 4 is the flow chart of the process of selecting target focusing information to determine the lens position when focusing in the focusing method of the present application;
  • FIG. 5 is a flowchart of a process of determining the lens position when in-focus in the focusing method of the present application
  • FIG. 6 is a schematic diagram of a curve constructed based on the coordinates of the target focus information of the present application.
  • FIG. 7 is a flowchart of another embodiment of the focusing method of the present application.
  • FIG. 8 is a flowchart of a process of compensating index information in the focusing method of the present application.
  • FIG. 9 is a schematic structural diagram of an embodiment of the focusing device of the present application.
  • FIG. 10 is a schematic structural diagram of an embodiment of the electronic device of the present application.
  • FIG. 1 shows a flowchart of a focusing method according to the present application.
  • the execution subject of the focusing method may be an image processing device in an image acquisition device.
  • the above-mentioned image acquisition device may be any device having an image acquisition function such as a camera, and the above-mentioned image processing apparatus may be implemented as software or a combination of software and hardware.
  • the above-mentioned image acquisition may include a lens, a focusing motor, an image sensor, etc.
  • the light reflected by the object passes through the above-mentioned lens and then converges on the above-mentioned image sensor, and the above-mentioned image sensor converts the optical signal into an electrical signal to form an image containing the above-mentioned object.
  • the above-mentioned focusing motor may include a driving component such as a driving shaft, etc., for driving the above-mentioned lens to move.
  • the flow of the focusing method includes the following steps:
  • Step 101 Acquire focusing information when the lens samples multiple frames of images in the focusing process.
  • the image acquisition device in the process of photographing a scene, usually needs to focus.
  • the motor can drive the lens to move, thereby changing the object distance, so that the clarity of the captured scene in the image sampled by the lens changes continuously.
  • the object in the image sampled during the focusing process will experience a process from blurring to clear and then blurred, wherein the position of the lens when the above-mentioned object is the clearest can be regarded as the position of the lens when the focus is achieved.
  • the focus information may include device shake information, lens position information, and index information of the focus area in the image.
  • the device shake information may be information for characterizing the degree of shaking of the image capturing device.
  • the information can be a numerical value. The greater the degree of device jitter, the greater the value.
  • other forms can also be used for representation, such as letters, etc., which are not limited here.
  • the equipment shake information can be collected by sensors installed in the image collection equipment.
  • the lens position information can be used to represent the position of the lens, for example, the moving range of the lens from the initial position to the farthest moving position can be expressed as a numerical interval. Any position of the lens within the moving range can be mapped to a certain value in the value interval, and the value can be used as lens position information. In addition, the distance of the lens from the initial position can also be directly used as the lens position information, or other forms of lens position information can be used as required to represent the lens position.
  • the focus area in an image can refer to the area enclosed by the focus frame.
  • the focus frame is usually a rectangular frame with a preset size, such as a rectangle frame of 150 ⁇ 150 pixels.
  • the focus area contains 150 ⁇ 150 pixels, and each pixel has a pixel value, so the focus area can correspond to a 150 ⁇ 150 pixel.
  • pixel matrix The index information of the focus area in the image may be information used to measure the clarity of the object in the focus area in the image, such as contrast, contrast filtered by various filtering algorithms, and the like. The larger the index information, the higher the clarity of the subject in the focus area.
  • the index information can be calculated according to the pixel matrix. This embodiment does not limit the calculation method of the index information.
  • the device shake information may be collected by an inertial sensor.
  • the inertial sensor can be installed inside the image acquisition device and communicated with the above-mentioned executive body.
  • An inertial sensor is a sensor that detects and measures acceleration, tilt, shock, vibration, rotation, and multi-degree-of-freedom motion.
  • various types of inertial sensors such as a speed sensor and an inertial measurement unit (Inertial measurement unit, IMU), may be used to collect device jitter information.
  • IMU inertial measurement unit
  • the acceleration sensor can collect and output the accelerations of the three axes of X, Y, and Z in the three-dimensional rectangular coordinate system, and the above-mentioned equipment shaking information can be the sum of the accelerations of each axis collected by the above-mentioned acceleration sensor.
  • the accelerations of the X-axis, Y-axis, and Z-axis are recorded as ax, ay, and az, respectively, and the equipment shake information is recorded as acce, there are:
  • the value of the device jitter information acce is 0.
  • the device shake information acce when the device shake information acce is less than a certain preset value, it may be considered that the image capturing device tends to be in a relatively stable state. At this time, the error of the index information caused by the jitter of the image device can be ignored.
  • a schematic diagram of the index information curve and the device jitter information curve can be seen in FIG. 2 . As shown in FIG. 2 , when the device jitter information is less than the preset value, the indicator information curve is a nearly smooth curve.
  • the device jitter information acce When the device jitter information acce is greater than or equal to the above preset value, it can be considered that the image acquisition device has relatively obvious jitter, and a schematic diagram of the index information curve and the device jitter information curve can be seen in FIG. 3 .
  • the index information when the device jitter information acce is greater than the preset value, the index information will be significantly reduced, and the index information curve is not a nearly smooth curve. If the curve fitting is performed based on the points where the index information fluctuates significantly, it will cause a large deviation in the finally determined lens position when in-focus, which will eventually lead to unclear focus.
  • the working frequency of the acceleration sensor needs to be greater than the sampling frequency of the image frame, so as to ensure that the corresponding device shake information can be obtained when each frame of image is sampled.
  • the operating frequency of the acceleration sensor may be multiple times, such as 3 to 5 times, of the sampling frequency of the image frame.
  • the image acquisition device works at 30fps (Frames Per Second, the number of frames transmitted per second), and the working frequency of the acceleration sensor is at 90hz (Hertz)
  • three pieces of device jitter information can be obtained during the sampling process of one frame of image. They are device jitter information acce1, device jitter information acce2 and device jitter information acce3 respectively.
  • device jitter information acce1 device jitter information acce2
  • device acce3 respectively.
  • mean means to take the average.
  • the index information of the focus area is determined through the following steps: first, use a finite impulse response (Finite Impulse Response, FIR) filter or a wireless impulse response (Infinite Impulse Response, IIR) filter Filter the focus area of the device to obtain the filtering result map. Then, the contrast of the above-mentioned filtering result map is determined as the index information.
  • FIR Finite Impulse Response
  • IIR Intelligent Impulse Response
  • Image filtering can alter or enhance images. Through filtering, some features can be emphasized or some unwanted parts in the image can be removed, thereby improving the accuracy of the index information.
  • finite impulse response filters may include, but are not limited to, Sobel operators, Laplacian operators, and the like.
  • Sobel operator can be constructed as a 3 ⁇ 3 weight matrix.
  • the focus area may be a rectangular area, such as a rectangular area containing n ⁇ n pixels. Each pixel corresponds to a pixel value, so the focus area can be regarded as an n ⁇ n pixel value matrix.
  • the filtered result graph after filtering can be obtained.
  • the contrast of the filtering result map can be determined as index information.
  • the wireless impulse response filter is generated by:
  • the first step is to convert the focus area into a frequency domain signal through Fourier Transformation (FT).
  • FT Fourier Transformation
  • the focus area is in the spatial domain, which is also called the image space, the spatial domain or the pixel domain.
  • the focus area is converted into a frequency domain signal, that is, the frequency spectrum of the focus area.
  • the spectrum can represent the energy gradient of an image.
  • the frequency of an image is an indicator that characterizes the intensity of grayscale changes in an image, and is the gradient of grayscale in plane space. For example, a large area of desert is an area with slow grayscale changes in the image, and the corresponding frequency value is very low; while for the edge area where the surface attribute changes violently, it is an area with a sharp grayscale change in the image, and the corresponding frequency value higher.
  • the physical meaning of Fourier transform can be immediately transformed from the gray distribution function of the image to the frequency distribution function of the image.
  • the second step is to normalize the above frequency domain signal. For example, normalizing to [0, 1] adjusts the amplitude of the spectrum to [0, 1] for easy data analysis.
  • the third step is to determine the target frequency band based on the distribution of the frequency domain signal.
  • the frequency band where the frequency domain signals are aggregated can be used as the target frequency band.
  • this frequency band can be used as the target frequency band.
  • the fourth step is to set the filter based on the target frequency band.
  • the filter setting can be made based on the target frequency band, so that it can strengthen the signal in the target frequency band and weaken the signal in other frequency bands to highlight the target. data in the frequency band.
  • a filter set up in this way is an infinite impulse response filter.
  • the filter may first be converted by using the Taylor formula, so that the pixel matrix of the focus area is processed by the converted filter. Since the infinite impulse response filter is set by analyzing the frequency domain signal of the focus area, it can capture features such as energy gradient that cannot be captured in the spatial domain, so that the index information can more accurately characterize the focus effect.
  • Step 102 based on the device shake information, screen out candidate focus information.
  • the device shake information can be used to indicate the degree of the device shake, it is necessary to filter out the focus information when the device is stable or slightly shaken, that is, filter out the focus information when the shake is large, so as to improve the data accuracy. accuracy.
  • focus information whose device shake information is less than a first preset threshold may be determined as candidate focus information.
  • the first preset threshold here may be preset according to a large number of experiments and data statistics, and the specific value thereof is not limited in this embodiment.
  • the device jitter information is greater than or equal to the first preset threshold, it may be considered that the degree of device jitter is relatively large.
  • the index information of the focus area in the image has a large error. Using the index information at this time to calculate the lens position when focusing is often inaccurate, so the focus information at this time can be ignored.
  • the candidate focus information may also be screened in combination with lens position information and device shake information. Specifically, since the larger the index information, the higher the clarity of the focus area, the better the focusing effect, and the closer the lens position is to the position when the focus is achieved. Therefore, the focusing information with the largest index information can be used as the reference focusing information first.
  • the lens position corresponding to the above-mentioned reference focus information can be used as the first reference position, and the distance between the lens position corresponding to each focus information and the above-mentioned first reference position can be detected.
  • the lens position corresponding to the reference focus information is the lens position indicated by the lens position information in the reference focus information.
  • the lens position corresponding to each focus information is the lens position indicated by the lens position information in the focus information. The greater the distance between the lens position corresponding to a certain focus information and the first reference position, the farther the lens position corresponding to the focus information is from the position when focusing is achieved, and the lower the accuracy of the index information in the focus information, the lower the accuracy of the index information in the focus information. The less referential the focus information is.
  • focus information whose distance is less than the second preset threshold and whose device shake information is less than the first preset threshold is determined as candidate focus information.
  • the second preset threshold here can also be preset according to a large number of experiments and data statistics, and the specific value thereof is not limited.
  • the accuracy of the candidate focus information can be further improved.
  • the candidate focus information is not limited to be screened based on the device shake information, and may also be screened based on other information or combined with other information at the same time. For example, filtering may be performed based on the image of the focus area, and the image of the focus area may be filtered to determine whether the contrast of the focus area is greater than a predetermined value. If the contrast of the focus area is greater than the preset value, it can be considered that the focus information at this time is collected when the focus is close to being achieved, and thus the focus information at this time can be used as the candidate focus information.
  • Step 103 Determine the lens position when focusing is achieved based on the lens position information and index information in the candidate focus information.
  • the execution subject may select a preset number of candidate focus information as target focus information, and determine the lens position when focusing is achieved based on the lens position information and index information in the target focus information.
  • a preset number of candidate focus information may first be selected as target focus information in various ways. For example, it can be randomly selected, or it can be selected according to a preset rule. The above-mentioned preset number can be preset as required, for example, three can be set. Then, the lens position information and index information in each target focus information can be used as a coordinate point, and curve fitting can be performed based on each coordinate point, so as to determine the lens position when focusing is achieved according to the corresponding coordinates of the highest point of the curve (that is, the peak point). .
  • the lens position when in-focus can be determined according to the following sub-steps S11 to S13:
  • Sub-step S11 the candidate focus information with the largest index information is used as the first target focus information.
  • the candidate focusing information with the largest index information can be used as one of the target focusing information, which can be called here. Focus information for the first target.
  • sub-step S12 the lens position corresponding to the first target focus information is used as the second reference position, and each candidate focus information whose lens position is adjacent to the second reference position is used as the second target focus information respectively.
  • the second reference position is the lens position closest to the focus achieved. If the distance between the lens position corresponding to a certain candidate focus information and the second reference position is smaller, it means The closer the lens position corresponding to the candidate focus information is to the lens position when focusing is achieved, the higher the accuracy of the index information in the candidate focus information, and thus the higher the referability of the candidate focus information. Therefore, each candidate focus information whose lens position is adjacent to the second reference position is the most referable focus information among the remaining candidate reference information, so each candidate focus information whose lens position is adjacent to the second reference position can be classified into respectively as the second target focus information. Further, from the candidate focus information, the first target focus information and each second target focus information are selected. Thus, three target focus information can be obtained.
  • Sub-step S13 Determine the lens position when focusing is achieved based on the lens position information and index information in the first target focus information and the second target focus information.
  • the lens position information and index information in each target focus information can be used as coordinate points, and a curve can be drawn based on each coordinate point. Fitting, so as to determine the lens position when focusing is achieved according to the corresponding coordinates of the highest point (ie the peak point) of the curve.
  • the above-mentioned execution subject may also detect whether the device shake information in each target focus information satisfies a preset condition. For each target focus information that does not meet the above preset conditions, any focus information adjacent to the target focus information may be used as new target focus information. After the target focus information is replaced, the step of detecting whether the device shake information in each target focus information satisfies the preset conditions can be re-executed, so as to detect whether the new target focus information needs to be further replaced until all the devices in the target focus information The jitter information all meet the preset conditions.
  • the preset conditions here can be used to distinguish the target focus information collected when the device is stable and the target focus information collected when the device is slightly shaken.
  • the preset condition is a preset value. That is, when the device shake information in the target focus information is less than a preset value, the device is stable; when the device shake information in the target focus information is greater than or equal to the preset value, the device shakes slightly. For example, when the device shake information in the target focus information is less than 0.5, the device can be considered stable; when the device shake information in the target focus information is greater than or equal to 0.5, it can be considered that the device shakes slightly.
  • the index information may deviate from the accurate value when the image acquisition device is in a state of slight shaking, further processing, such as replacement, needs to be performed on the target focus information with slight shaking. In this way, the accuracy of the index information in the target focusing information can be improved, thereby improving the accuracy of focusing.
  • the lens when in-focus can be determined according to the following sub-steps S21 to S23. Location:
  • Sub-step S21 taking the lens position information in each target focus information as the abscissa and the index information as the ordinate, and constructing a curve based on the coordinates of each target focus information.
  • the curve here is usually a parabola.
  • FIG. 6 shows a schematic diagram of a curve constructed based on coordinates of target focus information. As shown in FIG. 6 , the horizontal axis represents lens position information, the vertical axis represents index information, and points A, B, and C are coordinates of different target focus information. Since the parabola can be fitted by knowing the coordinates of the three points, the parabola shown in Figure 4 can be determined by knowing the coordinates of the three points A, B, and C.
  • the abscissa of the apex (ie the peak point) of the curve is determined.
  • the process of constructing the curve is the process of fitting the curve expression. Therefore, the vertex coordinates can be determined by calculating the maximum value of the curve expression value.
  • the curve is a parabola
  • a is a non-zero number
  • b is any numerical value.
  • Sub-step S23 the lens position indicated by the abscissa of the vertex is determined as the lens position when focusing is achieved.
  • Step 104 controlling the lens to move to the lens position when focusing is achieved, so as to complete focusing.
  • the focus motor can be controlled to drive the lens to move to the position of the lens when the focus is achieved, so as to complete the focus.
  • the method provided by the above-mentioned embodiments of the present application first obtains the focus information when the lens samples each frame of images during the focusing process, then selects the candidate focus information based on the device shake information in the focus information, and then selects a preset number of candidate focus information.
  • the information is used as target focus information, and based on the lens position information and index information in each target focus information, the lens position when focusing is determined, so as to control the lens to move to the lens position to complete the focus.
  • the shaking of the device is taken into account, which improves the accuracy of determining the position of the lens when the focus is achieved, thereby effectively improving the accuracy of the focusing.
  • the flow of the focusing method includes the following steps:
  • Step 701 Acquire focusing information when the lens samples multiple frames of images in the focusing process.
  • step 701 for the specific implementation principle and process of step 701, reference may be made to step 101 in the corresponding embodiment of FIG. 1, and details are not described herein again.
  • Step 702 based on the device shake information, screen out candidate focus information.
  • step 702 for the specific implementation principle and process of step 702, reference may be made to step 102 in the corresponding embodiment of FIG. 1, and details are not described herein again.
  • Step 703 Select a preset number of candidate focus information as target focus information.
  • step 703 for the specific implementation principle and process of step 703, reference may be made to step 103 in the embodiment corresponding to FIG. 1, and details are not described herein again.
  • Step 704 Detect whether the device shake information in the focus information of each target satisfies a preset condition.
  • the target focus information is the focus information that the image acquisition device is in a stable state or a slightly shaking state.
  • the index information may deviate from the accurate value due to the shaking, so further processing needs to be performed on the slightly shaking target focus information.
  • the executing subject of the focusing method can detect whether the device shake information in the focusing information of each target satisfies a preset condition. For example, it can be detected whether the device shake information in the focus information of each target is smaller than a predetermined steady state threshold (eg, 0.5). For a certain target focus information, if the device shake information in the target focus information is less than the steady state threshold, it may be considered that the target focus information and the device shake information in the target focus information meet the preset conditions.
  • the target focus information that satisfies the preset condition can be considered as the focus information collected in a stable state.
  • the device shake information in the target focus information is greater than or equal to the steady state threshold, it may be considered that the target focus information and the device shake information in the target focus information do not meet the preset conditions.
  • the target focus information that does not meet the preset conditions can be considered as focus information collected when the device is slightly shaken.
  • Step 705 in response to the existence of target focus information that does not meet the preset condition, count the number of target focus information that does not meet the preset condition.
  • Step 706, in response to the above-mentioned quantity being less than or equal to the third preset threshold, perform compensation for the index information in the target focus information that does not meet the preset condition.
  • the third preset threshold may be set according to actual needs.
  • the third preset threshold may be set to 1. If only one target focus information does not meet the preset condition, it can be considered that only one target focus information is collected when the device shakes slightly, and at this time, the index information in the target focus information can be compensated. Since the index information is used to represent the sharpness of the focus area, when the device shakes, the sharpness will be reduced. Therefore, the index information can be compensated by increasing the index information.
  • a compensation value may be set to increase the index information by adding the index information to the compensation value.
  • the compensation value can be a fixed value or a variable value.
  • the compensation value can be set after analyzing a large amount of historical data. For example, multiple sets of index information collected at the same lens position may be obtained, and each set of index information may include index information collected when the device shakes slightly and index information collected when the lens is stable. Then, the difference between the two index information in each group is calculated, and the average value of the difference is used as the compensation value.
  • the compensation value may be determined based on device jitter information.
  • the larger the device jitter information the larger the compensation value.
  • the smaller the device jitter information the smaller the compensation value.
  • the compensation value can be set to be proportional to the device jitter information.
  • the compensation value here can be a number greater than 0.
  • a compensation coefficient may be set, and the index information may be increased by multiplying the index information by the compensation coefficient.
  • the compensation coefficient can also be a fixed value or a variable value.
  • the compensation coefficient can be set after analyzing a large amount of historical data. For example, multiple sets of index information collected at the same lens position may be obtained, and each set of index information may include index information collected when the device shakes slightly and index information collected when the lens is stable. Then, the ratio of the index information collected when the lens is stable and the index information collected when the device is slightly shaken in each group is calculated, and the average value of the ratios is used as the compensation coefficient.
  • the compensation coefficient may be determined based on device jitter information.
  • the larger the device jitter information the larger the compensation coefficient.
  • the smaller the device jitter information the smaller the compensation coefficient.
  • the compensation coefficient can be set to be proportional to the device jitter information.
  • the compensation coefficient here may be a number greater than 1.
  • each target focus information that does not meet the above preset conditions may be used as the focus information to be processed, and referring to FIG. 8 , the following sub-steps S31 to S35 are used to process the above-mentioned to-be-processed information.
  • the index information in the focus information is compensated:
  • a compensation coefficient is determined based on the device shake information in the focus information to be processed.
  • Sub-step S32 determining the maximum value of the index information in the acquired focus information.
  • Sub-step S33 Determine the difference between the index information in the focus information to be processed and the above-mentioned maximum value.
  • the product of the compensation coefficient and the difference is used as the compensation value.
  • the maximum value of the index information in the acquired focus information is 10
  • the index information in the to-be-processed focus information is 6
  • the difference between the index information in the to-be-processed focus information and the above-mentioned maximum value is 4.
  • the above compensation coefficient 0.5 can be multiplied by the difference 4 to obtain 2, and the compensation value is set to 2.
  • Sub-step S35 Compensate the index information in the focus information to be processed based on the compensation value.
  • the index information in the focus information to be processed may be compensated by adding the compensation value to the index information in the focus information to be processed.
  • This compensation value calculation method can ensure that the compensated index information should be smaller than the maximum value of the index information in the acquired focus information, so that the value of the compensated index information can be more reasonable and accurate.
  • step 707 may be directly executed. If the amount of target focus information that does not meet the preset condition is greater than the above-mentioned third preset threshold, it may be considered that too much target focus information is collected when the subject is slightly shaken. To avoid unclear focus, the focus operation can be re-executed at this time.
  • Step 707 Determine the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target.
  • step 707 for the specific implementation principle and process of step 707, reference may be made to step 103 in the corresponding embodiment of FIG. 1, and details are not repeated here.
  • Step 708 controlling the lens to move to the lens position when focusing is achieved, so as to complete focusing.
  • step 708 for the specific implementation principle and process of step 708, reference may be made to step 103 in the corresponding embodiment of FIG. 1, and details are not repeated here.
  • the error of the index information when the device is slightly shaken can be reduced or eliminated, thereby making the index information more accurate .
  • Determining the lens position when focusing is achieved based on the compensated index information can improve the accuracy of the calculation, thereby improving the accuracy of focusing.
  • the present application provides an embodiment of a focusing device, which corresponds to the method embodiment shown in FIG. 9 .
  • the focusing device in this embodiment includes: an obtaining unit 901 configured to obtain focusing information when the lens samples each frame of image during the focusing process.
  • the focusing information includes equipment shake information, lens position information, and focusing area in the image. index information;
  • the screening unit 902 is configured to filter out candidate focus information based on the device shake information;
  • the determination unit 903 is configured to determine, based on the lens position information and the index information in the candidate focus information, The position of the lens when focusing;
  • the control unit 904 is configured to control the lens to move to the position of the lens to complete focusing.
  • the foregoing device jitter information is collected by an inertial sensor.
  • the inertial sensor includes an acceleration sensor
  • the device shaking information is the sum of the accelerations of each axis collected by the acceleration sensor.
  • the above-mentioned device jitter information is a numerical value representing the degree of device jitter; and, the above-mentioned screening unit is further configured to: determine the focus information whose device jitter information is less than the first preset threshold. is the candidate focus information.
  • the above-mentioned device shake information is a numerical value representing the degree of device shake; and the above-mentioned screening unit is further configured to: take the focus information with the largest index information as the reference focus information, and use the above Referring to the lens position corresponding to the focus information as the first reference position, detect the distance between the lens position corresponding to each focus information and the above-mentioned first reference position; set the focus whose distance is less than the second preset threshold and the device shake information is less than the first preset threshold information is determined as candidate focus information.
  • the above determining unit is further configured to: use the candidate focus information with the largest index information as the first target focus information; use the lens position corresponding to the first target focus information as the first target focus information For the second reference position, each candidate focus information whose lens position is adjacent to the second reference position is used as the second target focus information, respectively; from the candidate focus information, the above-mentioned first target focus information and each second target focus information are selected. Further, based on the lens position information and index information in the first target focus information and each second target focus information, the lens position when focusing is achieved is determined.
  • the above determination unit is further configured to: select a preset number of candidate focus information as target focus information, and based on the lens position information and index information in each target focus information, Determines the lens position when focus is achieved.
  • the above-mentioned apparatus further includes: a first detection unit, configured to detect whether the device jitter information in the focus information of each target satisfies a preset condition; a statistics unit, configured to respond to There is target focus information that does not meet the above preset conditions, and counts the number of target focus information that does not meet the above preset conditions; the compensation unit is configured to respond to the above number being less than or equal to a third preset threshold value, and to not meet the above predetermined thresholds.
  • the index information in the target focus information of the set condition is compensated.
  • the compensation unit is further configured to: take each target focus information that does not meet the above preset conditions as the focus information to be processed, and perform the following steps: based on the focus to be processed equipment shake information in the information, determine the compensation coefficient; determine the maximum value of the index information in the acquired focus information; determine the difference between the index information in the above-mentioned to-be-processed focus information and the above-mentioned maximum value; The product of the values is used as a compensation value; based on the compensation value, the index information in the focus information to be processed is compensated.
  • the above-mentioned apparatus further includes: a first execution unit configured to re-execute the focusing operation in response to the above-mentioned number being greater than the above-mentioned third preset threshold.
  • the above-mentioned apparatus further includes: a second detection unit, configured to detect whether the device jitter information in the focus information of each target satisfies a preset condition; a second execution unit, configured to For each target focus information that does not meet the above preset conditions, use any focus information adjacent to the target focus information as new target focus information, and re-execute the above-mentioned detection of whether the device shake information in each target focus information meets the preset requirements.
  • a second detection unit configured to detect whether the device jitter information in the focus information of each target satisfies a preset condition
  • a second execution unit configured to For each target focus information that does not meet the above preset conditions, use any focus information adjacent to the target focus information as new target focus information, and re-execute the above-mentioned detection of whether the device shake information in each target focus information meets the preset requirements.
  • the above determination unit is further configured to: take the device shake information in the focus information of each target as the abscissa, and use the lens position information as the ordinate, based on the focus information of each target coordinate to construct a curve; determine the ordinate of the vertex of the above-mentioned curve; determine the lens position indicated by the ordinate of the above-mentioned vertex as the lens position when focusing is achieved.
  • the index information of the focus area is determined through the following steps: filtering the focus area by using a finite impulse response filter or a wireless impulse response filter to obtain a filter result graph;
  • the contrast ratio is determined as the indicator information.
  • the above-mentioned finite impulse response filter includes a Sobel operator or a Laplacian operator.
  • the above-mentioned wireless impulse response filter is generated by the following steps: converting the focus area into a frequency-domain signal through Fourier transform; normalizing the above-mentioned frequency-domain signal; The distribution of the frequency domain signal, determine the target frequency band; based on the above target frequency band, set the filter.
  • the focusing method provided by the above-mentioned embodiments of the present application first obtains the focusing information when the lens samples each frame of images during the focusing process, then selects the candidate focusing information based on the device shake information in the focusing information, and then selects a preset number of candidates
  • the focus information is used as target focus information, and based on the lens position information and index information in each target focus information, the lens position when focusing is determined, so as to control the lens to move to the lens position to complete the focus.
  • the shaking of the device is taken into account, which improves the accuracy of determining the position of the lens when the focus is achieved, thereby effectively improving the accuracy of the focusing.
  • the present application provides an embodiment of an electronic device, which corresponds to the method embodiment shown in FIG. 1 .
  • the electronic device may include: a processor 1001 and a memory 1002 .
  • the above-mentioned memory 1001 can be used to store program instructions.
  • the above-mentioned processor 1002 can be used to execute the program instructions stored in the above-mentioned memory.
  • the above-mentioned processor can be used to perform the following steps: acquiring the focusing information when the lens samples each frame of images in the focusing process, and the focusing The information includes equipment shake information, lens position information, and index information of the focus area in the image; based on the equipment shake information, candidate focus information is screened; based on the lens position information and the index information in the candidate focus information, the The lens position when focusing; control the lens to move to the lens position to complete focusing.
  • determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information includes: selecting a preset number of candidate focus information as target focus information, and based on The lens position information and index information in the focus information of each target determine the lens position when focusing is achieved.
  • the device jitter information is collected by an inertial sensor.
  • the inertial sensor includes an acceleration sensor
  • the device shaking information is the sum of accelerations of each axis collected by the acceleration sensor.
  • the device jitter information is a numerical value representing the degree of device jitter; and the filtering out candidate focus information based on the device jitter information includes: setting the device jitter information to be smaller than the first Focus information of a preset threshold is determined as candidate focus information.
  • the device jitter information is a numerical value representing the degree of device jitter; and the selection of candidate focus information based on the device jitter information includes: selecting the focus information with the largest index information As the reference focus information, the lens position corresponding to the reference focus information is used as the first reference position, and the distance between the lens position corresponding to each focus information and the first reference position is detected; the distance is smaller than the second preset threshold and the device shakes Focus information whose information is less than the first preset threshold is determined as candidate focus information.
  • the selecting a preset number of candidate focus information as the target focus information includes: using the candidate focus information with the largest index information as the first target focus information; The lens position corresponding to the target focus information is used as the second reference position, and each candidate focus information whose lens position is adjacent to the second reference position is used as the second target focus information; from the candidate focus information, the first target is selected Focus information and each second target focus information.
  • the processor before determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, the processor is further configured to perform the following steps: Detecting whether the device shake information in each target focus information meets a preset condition; in response to the existence of target focus information that does not meet the preset condition, count the number of target focus information that does not meet the preset condition; in response to the The number is less than or equal to the third preset threshold, and the index information in the target focus information that does not meet the preset condition is compensated.
  • the compensating the index information in the target focus information that does not meet the preset condition includes: compensating each target focus information that does not meet the preset condition As the focus information to be processed, the following steps are performed: based on the device shake information in the focus information to be processed, determine a compensation coefficient; determine the maximum value of the index information in the focus information obtained; determine the focus information in the focus information to be processed. The difference between the index information and the maximum value; the product of the compensation coefficient and the difference is used as a compensation value; the index information in the focus information to be processed is compensated based on the compensation value.
  • the processor is further configured to perform the following step: in response to the number being greater than the predetermined condition The third preset threshold is set, and the focusing operation is re-executed.
  • the processor before determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, the processor is further configured to perform the following steps: Detecting whether the device shake information in each target focus information satisfies a preset condition; for each target focus information that does not meet the preset condition, take any focus information adjacent to the target focus information as new target focus information, Re-execute the step of detecting whether the device shake information in the focus information of each target satisfies the preset condition.
  • the determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target includes: taking the device shake information in the focus information of each target as The abscissa, taking the lens position information as the ordinate, constructs a curve based on the coordinates of the focus information of each target; determining the ordinate of the vertex of the curve; determining the position of the lens indicated by the ordinate of the vertex as the focus lens position.
  • the index information of the focus area is determined by the following steps: filtering the focus area by using a finite impulse response filter or a wireless impulse response filter to obtain a filter result graph; The contrast of the graph is determined as index information.
  • the finite impulse response filter includes a Sobel operator or a Laplacian operator.
  • the wireless impulse response filter is generated by the following steps: converting the focus area into a frequency domain signal through Fourier transform; normalizing the frequency domain signal ; Determine the target frequency band based on the distribution of the frequency domain signal; set the filter based on the target frequency band.
  • the electronic device provided by the above-mentioned embodiment of the present application first obtains the focus information when the lens samples each frame of images during the focusing process, then selects candidate focus information based on the device shake information in the focus information, and then selects a preset number of focus information.
  • the candidate focus information is used as target focus information, and based on the lens position information and index information in each target focus information, the lens position when focus is achieved is determined, so as to control the lens to move to the lens position to complete the focus.
  • the shaking of the device is taken into account, which improves the accuracy of determining the position of the lens when the focus is achieved, thereby effectively improving the accuracy of the focusing.
  • the description is relatively simple, and for related parts, please refer to the partial description of the method embodiment.
  • Embodiments of the present application further provide a computer-readable medium, where a computer program is stored on the computer-readable medium.
  • a computer program is stored on the computer-readable medium.
  • the embodiments of the present application may be provided as a method, an apparatus, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable media having computer-usable program code embodied therein, including but not limited to disk storage, CD-ROM, optical storage, and the like.
  • These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal equipment to operate in a particular manner, such that the instructions stored in the computer readable memory result in an article of manufacture comprising instruction means, the The instruction means implement the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Automatic Focus Adjustment (AREA)
  • Studio Devices (AREA)

Abstract

The embodiments of the present application disclose a focusing method and apparatus, an electronic device, and a computer readable medium. Said method comprises: acquiring focus information when a lens samples multiple frames of images during a focusing process, the focus information comprising device shake information, lens position information and index information of focusing regions in the multiple frames of images; on the basis of the device shake information, obtaining, by screening, candidate focus information; on the basis of the lens position information and the index information in the candidate focus information, determining a lens position during focusing; and controlling the lens to move to the lens position so as to complete focusing. The implementation improves the accuracy of focusing.

Description

对焦方法、装置、电子设备和计算机可读介质Focusing method, apparatus, electronic device and computer readable medium 技术领域technical field
本申请实施例涉及相机领域,具体涉及一种对焦方法、装置、电子设备和计算机可读介质。The embodiments of the present application relate to the field of cameras, and in particular, to a focusing method, an apparatus, an electronic device, and a computer-readable medium.
背景技术Background technique
反差对焦(Contrast Detection Auto Focus,CDAF)是一种常用的对焦方法,通过反差对焦,可以实现相机的自动对焦,免除用户手动对焦的过程,为用户提供便利。Contrast Detection Auto Focus (CDAF) is a commonly used focusing method. Through contrast focusing, the camera's automatic focusing can be achieved, eliminating the user's manual focusing process and providing convenience for users.
现有技术中,在通过反差对焦寻找最佳镜头位置时,通常将镜头位置和图像中对焦区域的指标信息(如对比度)组合为一个坐标点,通过若干坐标点进行曲线拟合,确定曲线最高点,从而将该最高点对应的镜头位置作为合焦时的镜头位置。In the prior art, when looking for the best lens position through contrast focusing, the lens position and the index information (such as contrast) of the focus area in the image are usually combined into one coordinate point, and curve fitting is performed through several coordinate points to determine the highest curve. point, so that the lens position corresponding to the highest point is taken as the lens position when focusing is achieved.
现有技术的不足之处在于,在拍摄过程中通常存在设备抖动的情况,在上述任一坐标点对应的镜头位置采样图像时发生设备抖动,均会影响曲线拟合的精准性,并进一步影响对合焦时的镜头位置判定的准确性,从而导致对焦的准确性较低。The disadvantage of the prior art is that there is usually equipment shake during the shooting process, and equipment shake occurs when the image is sampled at the lens position corresponding to any of the above coordinate points, which will affect the accuracy of curve fitting and further affect the accuracy of the curve fitting. The accuracy of the lens position determination when focusing is achieved, resulting in lower focusing accuracy.
发明内容SUMMARY OF THE INVENTION
本申请实施例提出了对焦方法、装置、电子设备和计算机可读介质,以解决现有技术中对焦的准确性较低技术问题。The embodiments of the present application propose a focusing method, an apparatus, an electronic device, and a computer-readable medium, so as to solve the technical problem of low focusing accuracy in the prior art.
第一方面,本申请实施例提供了一种对焦方法,包括:In a first aspect, an embodiment of the present application provides a focusing method, including:
获取对焦过程中镜头采样多帧图像时的对焦信息,所述对焦信息包括设备抖动信息、镜头位置信息和多帧图像中的对焦区域的指标信息;Acquire focusing information when the lens samples multiple frames of images in the focusing process, where the focusing information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
基于设备抖动信息,筛选出候选对焦信息;Based on the device shake information, the candidate focus information is screened out;
基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information;
控制所述镜头移动至所述镜头位置,以完成对焦。The lens is controlled to move to the lens position to complete focusing.
第二方面,本申请实施例提供了一种对焦装置,包括:In a second aspect, an embodiment of the present application provides a focusing device, including:
获取单元,被配置成获取对焦过程中镜头采样多帧图像时的对焦信息,所述对焦信息包括设备抖动信息、镜头位置信息和所述多帧图像中的对焦区域的指标信息;an acquisition unit, configured to acquire focus information when the lens samples multiple frames of images in the focusing process, where the focus information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
筛选单元,被配置成基于设备抖动信息,筛选出候选对焦信息;a screening unit, configured to screen out candidate focus information based on the device shake information;
确定单元,被配置成基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;a determining unit, configured to determine the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information;
控制单元,被配置成控制所述镜头移动至所述镜头位置,以完成对焦。The control unit is configured to control the lens to move to the lens position to complete focusing.
第三方面,本申请实施例提供了一种电子设备,包括:处理器和存储器;In a third aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
所述存储器,用于存储程序指令;the memory for storing program instructions;
所述处理器,执行所述存储器存储的程序指令,当程序指令被执行时,所述处理器用于执行如下步骤:The processor executes the program instructions stored in the memory, and when the program instructions are executed, the processor is configured to perform the following steps:
获取对焦过程中镜头采样多帧图像时的对焦信息,所述对焦信息包括设备抖动信息、镜头位置信息和多帧图像中对焦区域的指标信息;Acquire focusing information when the lens samples multiple frames of images in the focusing process, where the focusing information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
基于设备抖动信息,筛选出候选对焦信息;Based on the device shake information, the candidate focus information is screened out;
基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information;
控制所述镜头移动至所述镜头位置,以完成对焦。The lens is controlled to move to the lens position to complete focusing.
第四方面,本申请实施例提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方法中的对焦方法。In a fourth aspect, an embodiment of the present application provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the focusing method as in the first method.
本申请实施例提供的对焦方法、装置、电子设备和计算机可读介质,提高了对合焦时的镜头位置判定的准确性,从而有效提高了对焦的准确性。The focusing method, device, electronic device, and computer-readable medium provided in the embodiments of the present application improve the accuracy of lens position determination when focusing is achieved, thereby effectively improving the focusing accuracy.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1是本申请的对焦方法的一个实施例的流程图;1 is a flowchart of an embodiment of the focusing method of the present application;
图2是本申请的在图像采集设备稳定时指标信息曲线与设备抖动信息曲线的示意图;Fig. 2 is the schematic diagram of the index information curve and the device jitter information curve of the present application when the image acquisition device is stable;
图3是本申请的在图像采集设备抖动时指标信息曲线与设备抖动信息曲线的示意图;3 is a schematic diagram of an index information curve and a device jitter information curve when the image acquisition device shakes according to the present application;
图4是本申请的对焦方法中选取目标对焦信息来确定合焦时的镜头位置的过程的流程图;Fig. 4 is the flow chart of the process of selecting target focusing information to determine the lens position when focusing in the focusing method of the present application;
图5是本申请的对焦方法中确定合焦时的镜头位置的过程的流程图;5 is a flowchart of a process of determining the lens position when in-focus in the focusing method of the present application;
图6是本申请的基于目标对焦信息的坐标所构建的曲线的示意图;6 is a schematic diagram of a curve constructed based on the coordinates of the target focus information of the present application;
图7是本申请的对焦方法的又一个实施例的流程图;FIG. 7 is a flowchart of another embodiment of the focusing method of the present application;
图8是本申请的对焦方法中对指标信息进行补偿的过程的流程图;8 is a flowchart of a process of compensating index information in the focusing method of the present application;
图9是本申请的对焦装置的一个实施例的结构示意图;9 is a schematic structural diagram of an embodiment of the focusing device of the present application;
图10是本申请的电子设备的一个实施例的结构示意图。FIG. 10 is a schematic structural diagram of an embodiment of the electronic device of the present application.
具体实施例specific embodiment
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
请参考图1,其示出了根据本申请的对焦方法的流程图。该对焦方法的执行主体可以为图像采集设备中的图像处理装置。可以理解的是,上述图像采集设备可以为相机等任意具有图像采集功能的设备,上述图像处理装置可以实现为软件、或者软件和硬件的组合。Please refer to FIG. 1 , which shows a flowchart of a focusing method according to the present application. The execution subject of the focusing method may be an image processing device in an image acquisition device. It can be understood that the above-mentioned image acquisition device may be any device having an image acquisition function such as a camera, and the above-mentioned image processing apparatus may be implemented as software or a combination of software and hardware.
上述图像采集可以包括镜头、对焦电机、图像传感器等,物体反射的光经过上述镜头后会聚在上述图像传感器,上述图像传感器将光信号转换为电信号,形成包含有上述物体的图像。上述对焦电机可以包括驱动部件如驱动轴等,用于驱动上述镜头移动。The above-mentioned image acquisition may include a lens, a focusing motor, an image sensor, etc. The light reflected by the object passes through the above-mentioned lens and then converges on the above-mentioned image sensor, and the above-mentioned image sensor converts the optical signal into an electrical signal to form an image containing the above-mentioned object. The above-mentioned focusing motor may include a driving component such as a driving shaft, etc., for driving the above-mentioned lens to move.
该对焦方法的流程包括以下步骤:The flow of the focusing method includes the following steps:
步骤101,获取对焦过程中镜头采样多帧图像时的对焦信息。Step 101: Acquire focusing information when the lens samples multiple frames of images in the focusing process.
在本实施例中,图像采集设备在对一景物进行拍摄的过程中,通常需要进行对焦。在对焦过程中,电机可以驱动镜头移动,从而改变物距,使被拍摄的景物在镜头采样的图像中的清晰程度不断变化。通常,对焦过程中采样的图像中的物体会经历从模糊到清晰再到模糊的过程,其中上述物体最清晰时镜头所在的位置可认为是合焦时的镜头位置。In this embodiment, in the process of photographing a scene, the image acquisition device usually needs to focus. During the focusing process, the motor can drive the lens to move, thereby changing the object distance, so that the clarity of the captured scene in the image sampled by the lens changes continuously. Usually, the object in the image sampled during the focusing process will experience a process from blurring to clear and then blurred, wherein the position of the lens when the above-mentioned object is the clearest can be regarded as the position of the lens when the focus is achieved.
在对焦过程中,镜头采样每一帧图像时,对焦方法的执行主体均可获取到相应 的对焦信息。对焦信息可包括设备抖动信息、镜头位置信息和图像中对焦区域的指标信息。During the focusing process, when the lens samples each frame of image, the execution subject of the focusing method can obtain the corresponding focusing information. The focus information may include device shake information, lens position information, and index information of the focus area in the image.
设备抖动信息可以是用于表征图像采集设备的抖动程度的信息。例如,该信息可以是数值。设备抖动程度越大,则数值越大。此外,还可以采用其他形式进行表征,如字母等,此处不作限定。设备抖动信息可通过图像采集设备所安装的传感器采集。The device shake information may be information for characterizing the degree of shaking of the image capturing device. For example, the information can be a numerical value. The greater the degree of device jitter, the greater the value. In addition, other forms can also be used for representation, such as letters, etc., which are not limited here. The equipment shake information can be collected by sensors installed in the image collection equipment.
镜头位置信息可以用于表征镜头的位置,例如,可将镜头由初始位置至最远移动位置的移动范围表示为一数值区间。镜头在该移动范围内的任一位置均可映射至该数值区间中的某一数值,该数值可作为镜头位置信息。此外,也可直接将镜头距初始位置的距离作为镜头位置信息,或根据需要采用其他形式的镜头位置信息以表征镜头位置。The lens position information can be used to represent the position of the lens, for example, the moving range of the lens from the initial position to the farthest moving position can be expressed as a numerical interval. Any position of the lens within the moving range can be mapped to a certain value in the value interval, and the value can be used as lens position information. In addition, the distance of the lens from the initial position can also be directly used as the lens position information, or other forms of lens position information can be used as required to represent the lens position.
图像中的对焦区域可以指对焦框所包围的区域。对焦框通常为一预设大小的矩形框,如150×150像素的矩形框,此时对焦区域包含150×150个像素点,各像素点具有像素值,因而对焦区域可对应一个150×150的像素矩阵。图像中对焦区域的指标信息,可以是用于衡量图像中对焦区域中的对象的清晰程度的信息,如对比度、通过各种滤波算法滤波后的对比度等。指标信息越大,则对焦区域中的对象的清晰程度越高。指标信息可依据像素矩阵计算得到。本实施例对指标信息计算方式不作限定。The focus area in an image can refer to the area enclosed by the focus frame. The focus frame is usually a rectangular frame with a preset size, such as a rectangle frame of 150×150 pixels. At this time, the focus area contains 150×150 pixels, and each pixel has a pixel value, so the focus area can correspond to a 150×150 pixel. pixel matrix. The index information of the focus area in the image may be information used to measure the clarity of the object in the focus area in the image, such as contrast, contrast filtered by various filtering algorithms, and the like. The larger the index information, the higher the clarity of the subject in the focus area. The index information can be calculated according to the pixel matrix. This embodiment does not limit the calculation method of the index information.
在本实施例的一些可选的实现方式中,设备抖动信息可通过惯性传感器(inertial sensor)采集。惯性传感器可安装于图像采集设备的内部,并与上述执行主体通信连接。惯性传感器是一种检测和测量加速度、倾斜、冲击、振动、旋转和多自由度运动的传感器。本实施例可采用速度传感器、惯性测量单元(Inertial measurement unit,IMU)等各种类型的惯性传感器采集设备抖动信息。In some optional implementations of this embodiment, the device shake information may be collected by an inertial sensor. The inertial sensor can be installed inside the image acquisition device and communicated with the above-mentioned executive body. An inertial sensor is a sensor that detects and measures acceleration, tilt, shock, vibration, rotation, and multi-degree-of-freedom motion. In this embodiment, various types of inertial sensors, such as a speed sensor and an inertial measurement unit (Inertial measurement unit, IMU), may be used to collect device jitter information.
以加速度传感器为例,加速度传感器可以采集并输出三维直角坐标系中X,Y,Z三个轴向的加速度,上述设备抖动信息可以为上述加速度传感器所采集的各轴向的加速度之和。具体地,将X轴向、Y轴向、Z轴向的加速度分别记作ax、ay、az,将设备抖动信息记为acce,则有:Taking the acceleration sensor as an example, the acceleration sensor can collect and output the accelerations of the three axes of X, Y, and Z in the three-dimensional rectangular coordinate system, and the above-mentioned equipment shaking information can be the sum of the accelerations of each axis collected by the above-mentioned acceleration sensor. Specifically, the accelerations of the X-axis, Y-axis, and Z-axis are recorded as ax, ay, and az, respectively, and the equipment shake information is recorded as acce, there are:
acce=|ax|+|ay|+|az|acce=|ax|+|ay|+|az|
理想状态下,即图像采集设备不抖动的情况下,设备抖动信息acce的值为0。设备抖动信息acce的值越大,表示图像采集设备抖动越剧烈。In an ideal state, that is, when the image acquisition device does not vibrate, the value of the device jitter information acce is 0. The larger the value of the device jitter information acce, the more severe the jitter of the image acquisition device.
在一些示例中,在设备抖动信息acce小于某一预设值时,可认为图像采集设备趋于相对稳定状态。此时,由于图像设备抖动造成的指标信息的误差可忽略不计,此时指标信息曲线与设备抖动信息曲线的示意图可参见图2。如图2所示,设备抖动信息均小于预设值时,指标信息曲线是一条接近平滑的曲线。In some examples, when the device shake information acce is less than a certain preset value, it may be considered that the image capturing device tends to be in a relatively stable state. At this time, the error of the index information caused by the jitter of the image device can be ignored. In this case, a schematic diagram of the index information curve and the device jitter information curve can be seen in FIG. 2 . As shown in FIG. 2 , when the device jitter information is less than the preset value, the indicator information curve is a nearly smooth curve.
当设备抖动信息acce大于或等于上述预设值时,可认为图像采集设备发生了较为明显的抖动,此时指标信息曲线与设备抖动信息曲线的示意图可参见图3。如图3所示,在设备抖动信息acce大于预设值时,指标信息会发生明显减小,指标信息曲线不是一条接近平滑的曲线。若基于指标信息发生明显波动的点进行曲线拟合,将会导致最终确定出的合焦时的镜头位置出现较大偏差,进而最终导致对焦不清晰。When the device jitter information acce is greater than or equal to the above preset value, it can be considered that the image acquisition device has relatively obvious jitter, and a schematic diagram of the index information curve and the device jitter information curve can be seen in FIG. 3 . As shown in FIG. 3 , when the device jitter information acce is greater than the preset value, the index information will be significantly reduced, and the index information curve is not a nearly smooth curve. If the curve fitting is performed based on the points where the index information fluctuates significantly, it will cause a large deviation in the finally determined lens position when in-focus, which will eventually lead to unclear focus.
需要说明的是,加速度传感器的工作频率需大于图像帧采样频率,从而保证在每一帧图像采样时,均能够获取到对应的设备抖动信息。It should be noted that the working frequency of the acceleration sensor needs to be greater than the sampling frequency of the image frame, so as to ensure that the corresponding device shake information can be obtained when each frame of image is sampled.
在本实施例的一些可选的实现方式中,加速度传感器的工作频率可以是图像帧采样频率的多倍,如3至5倍。通过此设定,能够在一帧图像采样过程中,统计多个相对更小间隔的时间的设备抖动信息,从而得到更加精准的设备抖动信息。In some optional implementations of this embodiment, the operating frequency of the acceleration sensor may be multiple times, such as 3 to 5 times, of the sampling frequency of the image frame. Through this setting, during the sampling process of one frame of image, the device jitter information of a plurality of relatively smaller intervals can be counted, so as to obtain more accurate device jitter information.
例如,当图像采集设备工作在30fps(Frames Per Second,每秒传输帧数)时,加速度传感器的工作频率在90hz(赫兹),则可以在一帧图像采样过程中,得到3个设备抖动信息,分别为设备抖动信息acce1、设备抖动信息acce2和设备抖动信息acce3。通过对这3个设备抖动信息求平均值,可得到更加精准的设备抖动信息acce=mean(acce1,acce2,acce3)。其中,mean表示取平均。For example, when the image acquisition device works at 30fps (Frames Per Second, the number of frames transmitted per second), and the working frequency of the acceleration sensor is at 90hz (Hertz), three pieces of device jitter information can be obtained during the sampling process of one frame of image. They are device jitter information acce1, device jitter information acce2 and device jitter information acce3 respectively. By averaging the three pieces of equipment jitter information, more accurate equipment jitter information acce=mean(acce1, acce2, acce3) can be obtained. Among them, mean means to take the average.
在本实施例的一些可选的实现方式中,对焦区域的指标信息通过如下步骤确定:首先,利用有限脉冲响应(Finite Impulse Response,FIR)滤波器或者无线脉冲响应(Infinite Impulse Response,IIR)滤波器对焦区域进行滤波,得到滤波结果图。而后,将上述滤波结果图的对比度确定为指标信息。图像滤波可以更改或者增强图像。通过滤波,可以强调一些特征或者去除图像中一些不需要的部分,从而提高指标信息的精确性。In some optional implementations of this embodiment, the index information of the focus area is determined through the following steps: first, use a finite impulse response (Finite Impulse Response, FIR) filter or a wireless impulse response (Infinite Impulse Response, IIR) filter Filter the focus area of the device to obtain the filtering result map. Then, the contrast of the above-mentioned filtering result map is determined as the index information. Image filtering can alter or enhance images. Through filtering, some features can be emphasized or some unwanted parts in the image can be removed, thereby improving the accuracy of the index information.
在一些示例中,有限脉冲响应滤波器可以包括但不限于索贝尔算子、拉普拉斯算子等。以索贝尔算子为例,索贝尔算子可以被构建为3×3的权重矩阵。对焦区域可以是一个矩形区域,如包含n×n个像素点的矩形区域。每个像素点对应一个像素值,因而可将对焦区域视为n×n的像素值矩阵。通过索贝尔算子与n×n的像素值进行卷积计算,即可得到滤波后的滤波结果图。从而,可将滤波结果图的对比度确定为指标信息。In some examples, finite impulse response filters may include, but are not limited to, Sobel operators, Laplacian operators, and the like. Taking the Sobel operator as an example, the Sobel operator can be constructed as a 3×3 weight matrix. The focus area may be a rectangular area, such as a rectangular area containing n×n pixels. Each pixel corresponds to a pixel value, so the focus area can be regarded as an n×n pixel value matrix. By performing convolution calculation with the Sobel operator and the pixel value of n×n, the filtered result graph after filtering can be obtained. Thus, the contrast of the filtering result map can be determined as index information.
在一些示例中,无线脉冲响应滤波器通过如下步骤生成:In some examples, the wireless impulse response filter is generated by:
第一步,通过傅里叶变换(Fourier Transformation,FT),将对焦区域转换为频域信号。在傅里叶变换前,对焦区域处于空间域(spatial domain),空间域又称图像空间(image space)、空域或像素域。通过傅立叶变换后,对焦区域被转换为频域信号,即对焦区域的频谱。频谱可以表示图像的能量梯度。将对焦区域变换到频域,能够得到对焦区域的频谱函数统计特性,如低频、中频、高频的分量统计等。由此,有利于进行图像处理和计算。The first step is to convert the focus area into a frequency domain signal through Fourier Transformation (FT). Before the Fourier transform, the focus area is in the spatial domain, which is also called the image space, the spatial domain or the pixel domain. After Fourier transform, the focus area is converted into a frequency domain signal, that is, the frequency spectrum of the focus area. The spectrum can represent the energy gradient of an image. By transforming the focus area into the frequency domain, the statistical characteristics of the spectral function of the focus area can be obtained, such as the component statistics of low frequency, intermediate frequency and high frequency. Thereby, image processing and calculation are facilitated.
图像的频率是表征图像中灰度变化剧烈程度的指标,是灰度在平面空间上的梯度。如:大面积的沙漠在图像中是一片灰度变化缓慢的区域,对应的频率值很低;而对于地表属性变换剧烈的边缘区域在图像中是一片灰度变化剧烈的区域,对应的频率值较高。傅立叶变换的物理意义可立即为将图像的灰度分布函数变换为图像的频率分布函数。The frequency of an image is an indicator that characterizes the intensity of grayscale changes in an image, and is the gradient of grayscale in plane space. For example, a large area of desert is an area with slow grayscale changes in the image, and the corresponding frequency value is very low; while for the edge area where the surface attribute changes violently, it is an area with a sharp grayscale change in the image, and the corresponding frequency value higher. The physical meaning of Fourier transform can be immediately transformed from the gray distribution function of the image to the frequency distribution function of the image.
第二步,对上述频域信号进行归一化。例如,归一化到[0,1],可将频谱的振幅调整与[0,1],便于进行数据分析。The second step is to normalize the above frequency domain signal. For example, normalizing to [0, 1] adjusts the amplitude of the spectrum to [0, 1] for easy data analysis.
第三步,基于频域信号的分布,确定目标频段。The third step is to determine the target frequency band based on the distribution of the frequency domain signal.
此处,可将频域信号聚集的频段作为目标频段。例如,频域信号的分布表现为在某一频段内频域信号聚集,在该频段外频域信号稀疏,则可将该频段作为目标频段。Here, the frequency band where the frequency domain signals are aggregated can be used as the target frequency band. For example, if the distribution of frequency-domain signals shows that the frequency-domain signals are aggregated within a certain frequency band, and the frequency-domain signals are sparse outside the frequency band, this frequency band can be used as the target frequency band.
第四步,基于目标频段,设置滤波器。The fourth step is to set the filter based on the target frequency band.
由于滤波器能够强调一些数据或者去除一些不需要的数据,因而,此处可以基于目标频段进行滤波器设置,使之能够将目标频段中的信号进行加强,把其他频段信号弱化,以突显出目标频段内的数据。Since the filter can emphasize some data or remove some unnecessary data, the filter setting can be made based on the target frequency band, so that it can strengthen the signal in the target frequency band and weaken the signal in other frequency bands to highlight the target. data in the frequency band.
通过这种方式设置的滤波器为无限脉冲响应滤波器。在基于该滤波器进行对焦区域的滤波时,可首先通过泰勒公式将该滤波器进行转换,从而通过转换后的滤波器对对焦区域的像素矩阵进行处理。由于无限脉冲响应滤波器通过对对焦区域的频域信号分析后设定,因而能够捕捉到空间域中无法捕捉到的能量梯度等特征,使指标信息能够更为准确地表征对焦效果。A filter set up in this way is an infinite impulse response filter. When filtering the focus area based on the filter, the filter may first be converted by using the Taylor formula, so that the pixel matrix of the focus area is processed by the converted filter. Since the infinite impulse response filter is set by analyzing the frequency domain signal of the focus area, it can capture features such as energy gradient that cannot be captured in the spatial domain, so that the index information can more accurately characterize the focus effect.
步骤102,基于设备抖动信息,筛选出候选对焦信息。 Step 102, based on the device shake information, screen out candidate focus information.
在本实施例中,由于设备抖动信息可用于指示设备抖动程度的大小,因而需筛选出设备稳定时或者轻微抖动时的对焦信息,即过滤掉因抖动较大时的对焦信息,以提高数据的准确性。In this embodiment, since the device shake information can be used to indicate the degree of the device shake, it is necessary to filter out the focus information when the device is stable or slightly shaken, that is, filter out the focus information when the shake is large, so as to improve the data accuracy. accuracy.
以设备抖动信息是表征设备抖动程度的数值为例,在本实施例的一些可选的实现方式中,可以将设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。此处的第一预设阈值可根据大量试验和数据统计进行预先设定,本实施例对其具体数值不作限定。当设备抖动信息大于或等于第一预设阈值时,可认为设备抖动程度较大。在设备抖动程度较大时,图像中对焦区域的指标信息误差较大,使用此时的指标信息计算合焦时的镜头位置往往准确性较低,因而可将此时的对焦信息忽略。Taking the device shake information as a numerical value representing the degree of device shake as an example, in some optional implementations of this embodiment, focus information whose device shake information is less than a first preset threshold may be determined as candidate focus information. The first preset threshold here may be preset according to a large number of experiments and data statistics, and the specific value thereof is not limited in this embodiment. When the device jitter information is greater than or equal to the first preset threshold, it may be considered that the degree of device jitter is relatively large. When the degree of device shake is large, the index information of the focus area in the image has a large error. Using the index information at this time to calculate the lens position when focusing is often inaccurate, so the focus information at this time can be ignored.
在本实施例的一些可选的实现方式中,还可结合镜头位置信息和设备抖动信息,筛选候选对焦信息。具体地,由于指标信息越大,对焦区域的清晰程度越高,对焦效果越好,镜头位置越接近合焦时的位置,因而可首先将指标信息最大的对焦信息作参考对焦信息。In some optional implementation manners of this embodiment, the candidate focus information may also be screened in combination with lens position information and device shake information. Specifically, since the larger the index information, the higher the clarity of the focus area, the better the focusing effect, and the closer the lens position is to the position when the focus is achieved. Therefore, the focusing information with the largest index information can be used as the reference focusing information first.
而后,可将上述参考对焦信息对应的镜头位置作为第一参考位置,检测各对焦信息对应的镜头位置与上述第一参考位置的距离。其中,参考对焦信息对应的镜头位置即为参考对焦信息中的镜头位置信息所指示的镜头位置。每一对焦信息对应的镜头位置即为该对焦信息中的镜头位置信息所指示的镜头位置。某一对焦信息对应的镜头位置与第一参考位置的距离越大,则表示该对焦信息对应的镜头位置与合焦时的位置越远,该对焦信息中的指标信息的准确性越低,该对焦信息的可参考性越低。反之,某一对焦信息对应的镜头位置与第一参考位置的距离越小,则表示该对焦信息对应的镜头位置与合焦时的位置越近,该对焦信息中的指标信息的准确性越高,该对焦信息的可参考性越高。Then, the lens position corresponding to the above-mentioned reference focus information can be used as the first reference position, and the distance between the lens position corresponding to each focus information and the above-mentioned first reference position can be detected. The lens position corresponding to the reference focus information is the lens position indicated by the lens position information in the reference focus information. The lens position corresponding to each focus information is the lens position indicated by the lens position information in the focus information. The greater the distance between the lens position corresponding to a certain focus information and the first reference position, the farther the lens position corresponding to the focus information is from the position when focusing is achieved, and the lower the accuracy of the index information in the focus information, the lower the accuracy of the index information in the focus information. The less referential the focus information is. Conversely, the smaller the distance between the lens position corresponding to a certain focus information and the first reference position, the closer the lens position corresponding to the focus information is to the position when the focus is achieved, and the higher the accuracy of the index information in the focus information. , the referenceability of the focus information is higher.
最后,将距离小于第二预设阈值且设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。此处的第二预设阈值也可以根据大量试验和数据统计预先设定,其具体数值不作限定。Finally, focus information whose distance is less than the second preset threshold and whose device shake information is less than the first preset threshold is determined as candidate focus information. The second preset threshold here can also be preset according to a large number of experiments and data statistics, and the specific value thereof is not limited.
通过同时结合镜头位置信息和设备抖动信息筛选候选对焦信息,可进一步提高候选对焦信息准确性。By screening the candidate focus information in combination with the lens position information and the device shake information at the same time, the accuracy of the candidate focus information can be further improved.
需要说明的是,候选对焦信息不限于基于设备抖动信息筛选,还可以基于其他信息或同时结合其他信息进行筛选。例如,可基于对焦区域的图像进行筛选,可对对焦区域的图像进行滤波,确定对焦区域的对比度是否大于某一预设值。若对焦区域的对比度大于该预设值,则可以认为此时的对焦信息在接近合焦时采集,因而可将此时的对焦信息作为候选对焦信息。It should be noted that the candidate focus information is not limited to be screened based on the device shake information, and may also be screened based on other information or combined with other information at the same time. For example, filtering may be performed based on the image of the focus area, and the image of the focus area may be filtered to determine whether the contrast of the focus area is greater than a predetermined value. If the contrast of the focus area is greater than the preset value, it can be considered that the focus information at this time is collected when the focus is close to being achieved, and thus the focus information at this time can be used as the candidate focus information.
步骤103,基于候选对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。Step 103: Determine the lens position when focusing is achieved based on the lens position information and index information in the candidate focus information.
在一个实施例中,上述执行主体可以选取预设数量的候选对焦信息作为目标对焦信息,并基于目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。具体地,可以首先按照各种方式选取预设数量的候选对焦信息作为目标对焦信息。例如,可以随机选取,也可以按照某一预设规则选取等。上述预设数量可以根据需要预先设定,如可设定为3个。而后,可以将每一个目标对焦信息中的镜头位置信息和指标信息作为一个坐标点,基于各坐标点进行曲线拟合,从而根据曲线最高点(即峰值点)对应坐标确定合焦时的镜头位置。In one embodiment, the execution subject may select a preset number of candidate focus information as target focus information, and determine the lens position when focusing is achieved based on the lens position information and index information in the target focus information. Specifically, a preset number of candidate focus information may first be selected as target focus information in various ways. For example, it can be randomly selected, or it can be selected according to a preset rule. The above-mentioned preset number can be preset as required, for example, three can be set. Then, the lens position information and index information in each target focus information can be used as a coordinate point, and curve fitting can be performed based on each coordinate point, so as to determine the lens position when focusing is achieved according to the corresponding coordinates of the highest point of the curve (that is, the peak point). .
在另一个实施例中,参见图4示出的选取目标对焦信息来确定合焦时的镜头位置的过程的流程图,可以按照如下子步骤S11至子步骤S13确定合焦时的镜头位置:In another embodiment, referring to the flowchart of the process of selecting target focus information to determine the lens position when in-focus shown in FIG. 4 , the lens position when in-focus can be determined according to the following sub-steps S11 to S13:
子步骤S11,将指标信息最大的候选对焦信息作为第一目标对焦信息。Sub-step S11, the candidate focus information with the largest index information is used as the first target focus information.
由于指标信息越大,对焦区域的清晰程度越高,对焦效果越好,镜头位置越接近合焦时的位置,因而可将指标信息最大的候选对焦信息作为其中一个目标对焦信息,此处可称为第一目标对焦信息。Since the larger the index information, the higher the clarity of the focus area, the better the focusing effect, and the closer the lens position is to the position when the focus is achieved. Therefore, the candidate focusing information with the largest index information can be used as one of the target focusing information, which can be called here. Focus information for the first target.
子步骤S12,将第一目标对焦信息对应的镜头位置作为第二参考位置,将镜头位置与第二参考位置相邻的各候选对焦信息分别作为第二目标对焦信息。In sub-step S12, the lens position corresponding to the first target focus information is used as the second reference position, and each candidate focus information whose lens position is adjacent to the second reference position is used as the second target focus information respectively.
在所筛选出的候选对焦信息对应的镜头位置中,第二参考位置为最接近合焦时的镜头位置,若某一候选对焦信息对应的镜头位置与第二参考位置的距离越小,则表示该候选对焦信息对应的镜头位置与合焦时的镜头位置越近,该候选对焦信息中的指标信息的准确性越高,因而该候选对焦信息的可参考性越高。由此,镜头位置与第二参考位置相邻的各候选对焦信息,为剩余候选参考信息中最具可参考性的对焦信息,因而可将镜头位置与第二参考位置相邻的各候选对焦信息分别作为第二目标对焦信息。进一步地,从候选对焦信息中,选取第一目标对焦信息和各第二目标对焦信息。由此,可得到三个目标对焦信息。Among the lens positions corresponding to the selected candidate focus information, the second reference position is the lens position closest to the focus achieved. If the distance between the lens position corresponding to a certain candidate focus information and the second reference position is smaller, it means The closer the lens position corresponding to the candidate focus information is to the lens position when focusing is achieved, the higher the accuracy of the index information in the candidate focus information, and thus the higher the referability of the candidate focus information. Therefore, each candidate focus information whose lens position is adjacent to the second reference position is the most referable focus information among the remaining candidate reference information, so each candidate focus information whose lens position is adjacent to the second reference position can be classified into respectively as the second target focus information. Further, from the candidate focus information, the first target focus information and each second target focus information are selected. Thus, three target focus information can be obtained.
子步骤S13,基于第一目标对焦信息和各第二目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。Sub-step S13: Determine the lens position when focusing is achieved based on the lens position information and index information in the first target focus information and the second target focus information.
此处,与上述实施例类似地,可以分别将各目标对焦信息(包括第一目标对焦信息和各第二目标对焦信息)中的镜头位置信息和指标信息作为坐标点,基于各坐标点进行曲线拟合,从而根据曲线最高点(即峰值点)对应坐标确定合焦时的镜头位置。Here, similar to the above-mentioned embodiment, the lens position information and index information in each target focus information (including the first target focus information and each second target focus information) can be used as coordinate points, and a curve can be drawn based on each coordinate point. Fitting, so as to determine the lens position when focusing is achieved according to the corresponding coordinates of the highest point (ie the peak point) of the curve.
可选的,在使用目标对焦信息确定合焦时的镜头位置之前,上述执行主体还可以检测各目标对焦信息中的设备抖动信息是否满足预设条件。对于不满足上述预设条件的每一个目标对焦信息,可以将与该目标对焦信息邻近的任一对焦信息作为新的目标对焦信息。在目标对焦信息替换后,可重新执行检测各目标对焦信息中的设备抖动信息是否满足预设条件的步骤,从而检测是否需要对新的目标对焦信息进行进一步替换,直至全部目标对焦信息中的设备抖动信息均满足预设条件。Optionally, before using the target focus information to determine the position of the lens when focusing is achieved, the above-mentioned execution subject may also detect whether the device shake information in each target focus information satisfies a preset condition. For each target focus information that does not meet the above preset conditions, any focus information adjacent to the target focus information may be used as new target focus information. After the target focus information is replaced, the step of detecting whether the device shake information in each target focus information satisfies the preset conditions can be re-executed, so as to detect whether the new target focus information needs to be further replaced until all the devices in the target focus information The jitter information all meet the preset conditions.
此处的预设条件可用于分辨出设备稳定时采集的目标对焦信息和设备轻微抖动时采集的目标对焦信息。在一实施方式中,预设条件为一预设值。也就是说,当目标对焦信息中的设备抖动信息小于一预设置时,设备稳定;当目标对焦信息中的设备抖动信息大于或等于预设值时,设备轻微抖动。例如,当目标对焦信息中的设备抖动信息小于0.5时,可认为设备稳定;当目标对焦信息中的设备抖动信息大于或等于0.5时,可认为设备轻微抖动。由于图像采集设备处于轻微抖动状态时,可能会造成指标信息偏离准确值,因此需要对产生轻微抖动的目标对焦信息进行进一步处理,如替换。由此,可以提高目标对焦信息中的指标信息的准确性,从而提高对焦的准确性。The preset conditions here can be used to distinguish the target focus information collected when the device is stable and the target focus information collected when the device is slightly shaken. In one embodiment, the preset condition is a preset value. That is, when the device shake information in the target focus information is less than a preset value, the device is stable; when the device shake information in the target focus information is greater than or equal to the preset value, the device shakes slightly. For example, when the device shake information in the target focus information is less than 0.5, the device can be considered stable; when the device shake information in the target focus information is greater than or equal to 0.5, it can be considered that the device shakes slightly. Since the index information may deviate from the accurate value when the image acquisition device is in a state of slight shaking, further processing, such as replacement, needs to be performed on the target focus information with slight shaking. In this way, the accuracy of the index information in the target focusing information can be improved, thereby improving the accuracy of focusing.
可选的,参见图5示出的确定合焦位置的过程的流程图,基于目标对焦信息中的镜头位置信息和指标信息,具体可以按照如下子步骤S21至子步骤S23确定合焦时的镜头位置:Optionally, referring to the flowchart of the process of determining the in-focus position shown in FIG. 5 , based on the lens position information and index information in the target focusing information, specifically, the lens when in-focus can be determined according to the following sub-steps S21 to S23. Location:
子步骤S21,将各目标对焦信息中的镜头位置信息作为横坐标,将指标信息作为纵坐标,基于各目标对焦信息的坐标,构建曲线。此处的曲线通常为抛物线。图6示出了基于目标对焦信息的坐标所构建曲线的示意图。如图6所示,横轴表示镜头位置信息,纵轴表示指标信息,点A、B、C为不同目标对焦信息的坐标。由于已知三点坐标即可拟合出抛物线,因而已知A、B、C三点的坐标,即可确定出如图4所示的抛物线。Sub-step S21, taking the lens position information in each target focus information as the abscissa and the index information as the ordinate, and constructing a curve based on the coordinates of each target focus information. The curve here is usually a parabola. FIG. 6 shows a schematic diagram of a curve constructed based on coordinates of target focus information. As shown in FIG. 6 , the horizontal axis represents lens position information, the vertical axis represents index information, and points A, B, and C are coordinates of different target focus information. Since the parabola can be fitted by knowing the coordinates of the three points, the parabola shown in Figure 4 can be determined by knowing the coordinates of the three points A, B, and C.
子步骤S22,确定曲线的顶点(即峰值点)的横坐标。实践中,构建曲线的过程即为拟合曲线表达式的过程。因而可通过对曲线表达值求最大值的方式,确定出顶点坐标。例如,曲线为抛物线,抛物线表达式为y=ax 2+bx+c,则当x=b/2a时,y为最大值。其中,a为非零的数,b为任一数值。 In sub-step S22, the abscissa of the apex (ie the peak point) of the curve is determined. In practice, the process of constructing the curve is the process of fitting the curve expression. Therefore, the vertex coordinates can be determined by calculating the maximum value of the curve expression value. For example, the curve is a parabola, and the parabola expression is y=ax 2 +bx+c, then when x=b/2a, y is the maximum value. Among them, a is a non-zero number, and b is any numerical value.
子步骤S23,将顶点的横坐标所指示的镜头位置,确定为合焦时的镜头位置。Sub-step S23, the lens position indicated by the abscissa of the vertex is determined as the lens position when focusing is achieved.
步骤104,控制镜头移动至合焦时的镜头位置,以完成对焦。 Step 104, controlling the lens to move to the lens position when focusing is achieved, so as to complete focusing.
在本实施例中,在确定出合焦时的镜头位置后,可以控制对焦电机驱动镜头移动到合焦时的镜头位置,从而完成对焦。In this embodiment, after determining the position of the lens when the focus is achieved, the focus motor can be controlled to drive the lens to move to the position of the lens when the focus is achieved, so as to complete the focus.
本申请的上述实施例提供的方法,通过首先获取对焦过程中镜头采样各帧图像时的对焦信息,而后基于对焦信息中的设备抖动信息,筛选出候选对焦信息,之后选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置,从而控制上述镜头移动至上述镜头位置,以完成对焦。在确定合焦时的镜头位置的过程中考虑到了设备抖动情况,提高了对合焦时的镜头位置判定的准确性,从而有效提高了对焦的准确性。The method provided by the above-mentioned embodiments of the present application first obtains the focus information when the lens samples each frame of images during the focusing process, then selects the candidate focus information based on the device shake information in the focus information, and then selects a preset number of candidate focus information. The information is used as target focus information, and based on the lens position information and index information in each target focus information, the lens position when focusing is determined, so as to control the lens to move to the lens position to complete the focus. In the process of determining the position of the lens when the focus is achieved, the shaking of the device is taken into account, which improves the accuracy of determining the position of the lens when the focus is achieved, thereby effectively improving the accuracy of the focusing.
进一步参考图7,其示出了根据本申请的对焦方法的流程图。该对焦方法的流程,包括以下步骤:With further reference to FIG. 7, a flowchart of a focusing method according to the present application is shown. The flow of the focusing method includes the following steps:
步骤701,获取对焦过程中镜头采样多帧图像时的对焦信息。Step 701: Acquire focusing information when the lens samples multiple frames of images in the focusing process.
本实施例中,步骤701的具体实现原理和过程可以参见图1对应实施例中的步骤101,此处不再赘述。In this embodiment, for the specific implementation principle and process of step 701, reference may be made to step 101 in the corresponding embodiment of FIG. 1, and details are not described herein again.
步骤702,基于设备抖动信息,筛选出候选对焦信息。 Step 702, based on the device shake information, screen out candidate focus information.
本实施例中,步骤702的具体实现原理和过程可以参见图1对应实施例中的步骤102,此处不再赘述。In this embodiment, for the specific implementation principle and process of step 702, reference may be made to step 102 in the corresponding embodiment of FIG. 1, and details are not described herein again.
步骤703,选取预设数量的候选对焦信息作为目标对焦信息。Step 703: Select a preset number of candidate focus information as target focus information.
本实施例中,步骤703的具体实现原理和过程可以参见图1对应实施例中的步骤103,此处不再赘述。In this embodiment, for the specific implementation principle and process of step 703, reference may be made to step 103 in the embodiment corresponding to FIG. 1, and details are not described herein again.
步骤704,检测各目标对焦信息中的设备抖动信息是否满足预设条件。Step 704: Detect whether the device shake information in the focus information of each target satisfies a preset condition.
在本实施例中,由于目标对焦信息从候选对焦信息中选出,因而目标对焦信息均为图像采集设备处于稳定状态或者轻微抖动状态的对焦信息。然而,即使图像采集设备处于轻微抖动状态时,仍可能会由于抖动造成指标信息偏离准确值,因此需要对产生轻微抖动的目标对焦信息进行进一步处理。在处理之前,需要首先基于设备抖动信息筛选出这些在轻微抖动时采集的目标对焦信息。In this embodiment, since the target focus information is selected from the candidate focus information, the target focus information is the focus information that the image acquisition device is in a stable state or a slightly shaking state. However, even when the image acquisition device is in a state of slight shaking, the index information may deviate from the accurate value due to the shaking, so further processing needs to be performed on the slightly shaking target focus information. Before processing, it is necessary to filter out the target focus information collected when the device shakes slightly based on the device shake information.
具体地,对焦方法的执行主体可以检测各目标对焦信息中的设备抖动信息是否满足预设条件。例如,可分别检测各目标对焦信息中的设备抖动信息是否小于某一预先设定的稳定状态阈值(如0.5)。对于某一目标对焦信息,若该目标对焦信息中的设备抖动信息小于稳定状态阈值,则可认为该目标对焦信息以及该目标对焦信息中的设备抖动信息满足预设条件。满足预设条件的目标对焦信息,可认为是在稳定状态时采集的对焦信息。反之,若该目标对焦信息中的设备抖动信息大于或等于稳定状态阈值,则可认为该目标对焦信息以及该目标对焦信息中的设备抖动信息不满足预设条件。不满足预设条件的目标对焦信息,可认为是在设备处于轻微抖动时采集的对焦信息。Specifically, the executing subject of the focusing method can detect whether the device shake information in the focusing information of each target satisfies a preset condition. For example, it can be detected whether the device shake information in the focus information of each target is smaller than a predetermined steady state threshold (eg, 0.5). For a certain target focus information, if the device shake information in the target focus information is less than the steady state threshold, it may be considered that the target focus information and the device shake information in the target focus information meet the preset conditions. The target focus information that satisfies the preset condition can be considered as the focus information collected in a stable state. Conversely, if the device shake information in the target focus information is greater than or equal to the steady state threshold, it may be considered that the target focus information and the device shake information in the target focus information do not meet the preset conditions. The target focus information that does not meet the preset conditions can be considered as focus information collected when the device is slightly shaken.
步骤705,响应于存在不满足预设条件的目标对焦信息,统计不满足预设条件的目标对焦信息的数量。 Step 705, in response to the existence of target focus information that does not meet the preset condition, count the number of target focus information that does not meet the preset condition.
步骤706,响应于上述数量小于或等于第三预设阈值,对不满足预设条件的目标 对焦信息中的指标信息进行补偿。 Step 706, in response to the above-mentioned quantity being less than or equal to the third preset threshold, perform compensation for the index information in the target focus information that does not meet the preset condition.
在本实施例中,第三预设阈值可根据实际需要进行设定。例如,可将第三预设阈值设置为1。若仅有一个目标对焦信息不满足预设条件,可认为仅有一个目标对焦信息在设备轻微抖动时采集,此时可对该目标对焦信息中的指标信息进行补偿。由于指标信息用于表征对焦区域的清晰程度,设备抖动时会导致清晰程度降低,因而可通过增大指标信息的方式,对指标信息进行补偿。In this embodiment, the third preset threshold may be set according to actual needs. For example, the third preset threshold may be set to 1. If only one target focus information does not meet the preset condition, it can be considered that only one target focus information is collected when the device shakes slightly, and at this time, the index information in the target focus information can be compensated. Since the index information is used to represent the sharpness of the focus area, when the device shakes, the sharpness will be reduced. Therefore, the index information can be compensated by increasing the index information.
作为一个示例,可设置补偿值,通过将指标信息与补偿值相加的方式增大指标信息。补偿值可以是固定值或可变值。As an example, a compensation value may be set to increase the index information by adding the index information to the compensation value. The compensation value can be a fixed value or a variable value.
当补偿值是固定值时,该补偿值可根据对大量历史数据进行分析后设定。例如,可获取多组在同一镜头位置下采集的指标信息,每组指标信息可包括设备轻微抖动时采集的指标信息和镜头稳定时采集的指标信息。而后,计算每组中的两个指标信息的差值,将差值的平均值作为补偿值。When the compensation value is a fixed value, the compensation value can be set after analyzing a large amount of historical data. For example, multiple sets of index information collected at the same lens position may be obtained, and each set of index information may include index information collected when the device shakes slightly and index information collected when the lens is stable. Then, the difference between the two index information in each group is calculated, and the average value of the difference is used as the compensation value.
当补偿值是可变值时,该补偿值可基于设备抖动信息确定。设备抖动信息越大,补偿值越大。设备抖动信息越小,补偿值越小。例如,可将补偿值与设备抖动信息设置为正比关系。此处的补偿值可以是大于0的数。When the compensation value is a variable value, the compensation value may be determined based on device jitter information. The larger the device jitter information, the larger the compensation value. The smaller the device jitter information, the smaller the compensation value. For example, the compensation value can be set to be proportional to the device jitter information. The compensation value here can be a number greater than 0.
作为又一示例,可设置补偿系数,通过将指标信息与补偿系数相乘的方式增大指标信息。补偿系数也可以是固定值或可变值。As yet another example, a compensation coefficient may be set, and the index information may be increased by multiplying the index information by the compensation coefficient. The compensation coefficient can also be a fixed value or a variable value.
当补偿系数是固定值时,该补偿系数可根据对大量历史数据进行分析后设定。例如,可获取多组在同一镜头位置下采集的指标信息,每组指标信息可包括设备轻微抖动时采集的指标信息和镜头稳定时采集的指标信息。而后,计算每组中在镜头稳定时采集的指标信息与在设备轻微抖动时采集的指标信息的比值,将比值的平均值作为补偿系数。When the compensation coefficient is a fixed value, the compensation coefficient can be set after analyzing a large amount of historical data. For example, multiple sets of index information collected at the same lens position may be obtained, and each set of index information may include index information collected when the device shakes slightly and index information collected when the lens is stable. Then, the ratio of the index information collected when the lens is stable and the index information collected when the device is slightly shaken in each group is calculated, and the average value of the ratios is used as the compensation coefficient.
当补偿系数是可变值时,该补偿系数可基于设备抖动信息确定。设备抖动信息越大,补偿系数越大。设备抖动信息越小,补偿系数越小。例如,可将补偿系数与设备抖动信息设置为正比关系。此处的补偿系数可以是大于1的数。When the compensation coefficient is a variable value, the compensation coefficient may be determined based on device jitter information. The larger the device jitter information, the larger the compensation coefficient. The smaller the device jitter information, the smaller the compensation coefficient. For example, the compensation coefficient can be set to be proportional to the device jitter information. The compensation coefficient here may be a number greater than 1.
在本实施例的一些可选的实现方式中,可将不满足上述预设条件的每一个目标对焦信息作为待处理对焦信息,并参见图8,通过如下子步骤S31至子步骤S35上述对待处理对焦信息中的指标信息进行补偿:In some optional implementation manners of this embodiment, each target focus information that does not meet the above preset conditions may be used as the focus information to be processed, and referring to FIG. 8 , the following sub-steps S31 to S35 are used to process the above-mentioned to-be-processed information. The index information in the focus information is compensated:
子步骤S31,基于待处理对焦信息中的设备抖动信息,确定补偿系数。此处的补偿系数可以是设备抖动信息与某一预设值的乘积。例如,若设备抖动信息在[0.5,1.5]数值范围内,则预设值为0.5。当待处理对焦信息中的设备抖动信息为1时,补偿系数即为1×0.5=0.5。In sub-step S31, a compensation coefficient is determined based on the device shake information in the focus information to be processed. The compensation coefficient here may be the product of the device jitter information and a certain preset value. For example, if the device jitter information is in the range of [0.5, 1.5], the default value is 0.5. When the device shake information in the focus information to be processed is 1, the compensation coefficient is 1×0.5=0.5.
子步骤S32,确定所获取的对焦信息中的指标信息的最大值。Sub-step S32, determining the maximum value of the index information in the acquired focus information.
子步骤S33,确定待处理对焦信息中的指标信息与上述最大值的差值。Sub-step S33: Determine the difference between the index information in the focus information to be processed and the above-mentioned maximum value.
子步骤S34,将补偿系数与差值的乘积作为补偿值。作为示例,所获取的对焦信息中的指标信息的最大值为10,待处理对焦信息中的指标信息为6,则待处理对焦信息中的指标信息与上述最大值的差值为4。此时,可将上述补偿系数0.5与差值4相乘,得到2,并将补偿值设置为2。In sub-step S34, the product of the compensation coefficient and the difference is used as the compensation value. As an example, the maximum value of the index information in the acquired focus information is 10, the index information in the to-be-processed focus information is 6, and the difference between the index information in the to-be-processed focus information and the above-mentioned maximum value is 4. At this time, the above compensation coefficient 0.5 can be multiplied by the difference 4 to obtain 2, and the compensation value is set to 2.
子步骤S35,基于补偿值对待处理对焦信息中的指标信息进行补偿。例如,可以通过将补偿值与待处理对焦信息中的指标信息相加的方式,对待处理对焦信息中的指标信息进行补偿。Sub-step S35: Compensate the index information in the focus information to be processed based on the compensation value. For example, the index information in the focus information to be processed may be compensated by adding the compensation value to the index information in the focus information to be processed.
这种补偿值计算方式可保证补偿后的指标信息应小于所获取的对焦信息中的指标信息的最大值,因而能够使补偿后的指标信息的数值更为合理和准确。This compensation value calculation method can ensure that the compensated index information should be smaller than the maximum value of the index information in the acquired focus information, so that the value of the compensated index information can be more reasonable and accurate.
需要说明的是,若各目标对焦信息均满足预设条件,可直接执行步骤707。若不 满足预设条件的目标对焦信息的数量大于上述第三预设阈值,则可认为处于轻微抖动时采集的目标对焦信息过多,为避免造成对焦不清晰,此时可重新执行对焦操作。It should be noted that, if each target focus information satisfies the preset condition, step 707 may be directly executed. If the amount of target focus information that does not meet the preset condition is greater than the above-mentioned third preset threshold, it may be considered that too much target focus information is collected when the subject is slightly shaken. To avoid unclear focus, the focus operation can be re-executed at this time.
步骤707,基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。Step 707: Determine the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target.
本实施例中,步骤707的具体实现原理和过程可以参见图1对应实施例中的步骤103,此处不再赘述。In this embodiment, for the specific implementation principle and process of step 707, reference may be made to step 103 in the corresponding embodiment of FIG. 1, and details are not repeated here.
步骤708,控制镜头移动至合焦时的镜头位置,以完成对焦。 Step 708, controlling the lens to move to the lens position when focusing is achieved, so as to complete focusing.
本实施例中,步骤708的具体实现原理和过程可以参见图1对应实施例中的步骤103,此处不再赘述。In this embodiment, for the specific implementation principle and process of step 708, reference may be made to step 103 in the corresponding embodiment of FIG. 1, and details are not repeated here.
本申请的上述实施例提供的方法,通过对不满足预设条件的目标对焦信息中的指标信息进行补偿,可以减小或消除设备轻微抖动时的指标信息的误差,从而使指标信息更为准确。基于补偿后的指标信息确定合焦时的镜头位置,可提高计算的准确性,从而提高对焦的准确性。In the method provided by the above embodiments of the present application, by compensating the index information in the target focus information that does not meet the preset conditions, the error of the index information when the device is slightly shaken can be reduced or eliminated, thereby making the index information more accurate . Determining the lens position when focusing is achieved based on the compensated index information can improve the accuracy of the calculation, thereby improving the accuracy of focusing.
进一步参考图9,作为对上述各图所示方法的实现,本申请提供了一种对焦装置的一个实施例,该装置实施例与图9所示的方法实施例相对应。Further referring to FIG. 9 , as an implementation of the methods shown in the above figures, the present application provides an embodiment of a focusing device, which corresponds to the method embodiment shown in FIG. 9 .
如图9所示,本实施例的对焦装置包括:获取单元901,被配置获取对焦过程中镜头采样各帧图像时的对焦信息,上述对焦信息包括设备抖动信息、镜头位置信息和图像中对焦区域的指标信息;筛选单元902,被配置成基于设备抖动信息,筛选出候选对焦信息;确定单元903,被配置成基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;控制单元904,被配置成控制上述镜头移动至上述镜头位置,以完成对焦。As shown in FIG. 9 , the focusing device in this embodiment includes: an obtaining unit 901 configured to obtain focusing information when the lens samples each frame of image during the focusing process. The focusing information includes equipment shake information, lens position information, and focusing area in the image. index information; the screening unit 902 is configured to filter out candidate focus information based on the device shake information; the determination unit 903 is configured to determine, based on the lens position information and the index information in the candidate focus information, The position of the lens when focusing; the control unit 904 is configured to control the lens to move to the position of the lens to complete focusing.
在本实施例的一些可选的实现方式中,上述设备抖动信息通过惯性传感器采集。In some optional implementation manners of this embodiment, the foregoing device jitter information is collected by an inertial sensor.
在本实施例的一些可选的实现方式中,上述惯性传感器包括加速度传感器,上述设备抖动信息为上述加速度传感器所采集的各轴向的加速度之和。In some optional implementations of this embodiment, the inertial sensor includes an acceleration sensor, and the device shaking information is the sum of the accelerations of each axis collected by the acceleration sensor.
在本实施例的一些可选的实现方式中,上述设备抖动信息为表征设备抖动程度的数值;以及,上述筛选单元,进一步被配置成:将设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。In some optional implementations of this embodiment, the above-mentioned device jitter information is a numerical value representing the degree of device jitter; and, the above-mentioned screening unit is further configured to: determine the focus information whose device jitter information is less than the first preset threshold. is the candidate focus information.
在本实施例的一些可选的实现方式中,上述设备抖动信息为表征设备抖动程度的数值;以及,上述筛选单元,进一步被配置成:将指标信息最大的对焦信息作参考对焦信息,将上述参考对焦信息对应的镜头位置作为第一参考位置,检测各对焦信息对应的镜头位置与上述第一参考位置的距离;将距离小于第二预设阈值且设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。In some optional implementations of this embodiment, the above-mentioned device shake information is a numerical value representing the degree of device shake; and the above-mentioned screening unit is further configured to: take the focus information with the largest index information as the reference focus information, and use the above Referring to the lens position corresponding to the focus information as the first reference position, detect the distance between the lens position corresponding to each focus information and the above-mentioned first reference position; set the focus whose distance is less than the second preset threshold and the device shake information is less than the first preset threshold information is determined as candidate focus information.
在本实施例的一些可选的实现方式中,上述确定单元,进一步被配置成:将指标信息最大的候选对焦信息作为第一目标对焦信息;将上述第一目标对焦信息对应的镜头位置作为第二参考位置,将镜头位置与上述第二参考位置相邻的各候选对焦信息分别作为第二目标对焦信息;从候选对焦信息中,选取上述第一目标对焦信息和各第二目标对焦信息。进一步地,基于所述第一目标对焦信息和各第二目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。In some optional implementations of this embodiment, the above determining unit is further configured to: use the candidate focus information with the largest index information as the first target focus information; use the lens position corresponding to the first target focus information as the first target focus information For the second reference position, each candidate focus information whose lens position is adjacent to the second reference position is used as the second target focus information, respectively; from the candidate focus information, the above-mentioned first target focus information and each second target focus information are selected. Further, based on the lens position information and index information in the first target focus information and each second target focus information, the lens position when focusing is achieved is determined.
在本实施例的一些可选的实现方式中,上述确定单元,进一步被配置成:选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。In some optional implementations of this embodiment, the above determination unit is further configured to: select a preset number of candidate focus information as target focus information, and based on the lens position information and index information in each target focus information, Determines the lens position when focus is achieved.
在本实施例的一些可选的实现方式中,上述装置还包括:第一检测单元,被配置成检测各目标对焦信息中的设备抖动信息是否满足预设条件;统计单元,被配置 成响应于存在不满足上述预设条件的目标对焦信息,统计不满足上述预设条件的目标对焦信息的数量;补偿单元,被配置成响应于上述数量小于或等于第三预设阈值,对不满足上述预设条件的目标对焦信息中的指标信息进行补偿。In some optional implementations of this embodiment, the above-mentioned apparatus further includes: a first detection unit, configured to detect whether the device jitter information in the focus information of each target satisfies a preset condition; a statistics unit, configured to respond to There is target focus information that does not meet the above preset conditions, and counts the number of target focus information that does not meet the above preset conditions; the compensation unit is configured to respond to the above number being less than or equal to a third preset threshold value, and to not meet the above predetermined thresholds. The index information in the target focus information of the set condition is compensated.
在本实施例的一些可选的实现方式中,上述补偿单元,进一步被配置成:将不满足上述预设条件的每一个目标对焦信息作为待处理对焦信息,执行如下步骤:基于上述待处理对焦信息中的设备抖动信息,确定补偿系数;确定所获取的对焦信息中的指标信息的最大值;确定上述待处理对焦信息中的指标信息与上述最大值的差值;将上述补偿系数与上述差值的乘积作为补偿值;基于上述补偿值对上述待处理对焦信息中的指标信息进行补偿。In some optional implementations of this embodiment, the compensation unit is further configured to: take each target focus information that does not meet the above preset conditions as the focus information to be processed, and perform the following steps: based on the focus to be processed equipment shake information in the information, determine the compensation coefficient; determine the maximum value of the index information in the acquired focus information; determine the difference between the index information in the above-mentioned to-be-processed focus information and the above-mentioned maximum value; The product of the values is used as a compensation value; based on the compensation value, the index information in the focus information to be processed is compensated.
在本实施例的一些可选的实现方式中,上述装置还包括:第一执行单元,被配置成响应于上述数量大于上述第三预设阈值,重新执行对焦操作。In some optional implementations of this embodiment, the above-mentioned apparatus further includes: a first execution unit configured to re-execute the focusing operation in response to the above-mentioned number being greater than the above-mentioned third preset threshold.
在本实施例的一些可选的实现方式中,上述装置还包括:第二检测单元,被配置成检测各目标对焦信息中的设备抖动信息是否满足预设条件;第二执行单元,被配置成对于不满足上述预设条件的每一个目标对焦信息,将与该目标对焦信息邻近的任一对焦信息作为新的目标对焦信息,重新执行上述检测各目标对焦信息中的设备抖动信息是否满足预设条件的步骤。In some optional implementations of this embodiment, the above-mentioned apparatus further includes: a second detection unit, configured to detect whether the device jitter information in the focus information of each target satisfies a preset condition; a second execution unit, configured to For each target focus information that does not meet the above preset conditions, use any focus information adjacent to the target focus information as new target focus information, and re-execute the above-mentioned detection of whether the device shake information in each target focus information meets the preset requirements. Conditional steps.
在本实施例的一些可选的实现方式中,上述确定单元,进一步被配置成:将各目标对焦信息中的设备抖动信息作为横坐标,将镜头位置信息作为纵坐标,基于各目标对焦信息的坐标,构建曲线;确定上述曲线的顶点的纵坐标;将上述顶点的纵坐标所指示的镜头位置,确定为合焦时的镜头位置。In some optional implementations of this embodiment, the above determination unit is further configured to: take the device shake information in the focus information of each target as the abscissa, and use the lens position information as the ordinate, based on the focus information of each target coordinate to construct a curve; determine the ordinate of the vertex of the above-mentioned curve; determine the lens position indicated by the ordinate of the above-mentioned vertex as the lens position when focusing is achieved.
在本实施例的一些可选的实现方式中,对焦区域的指标信息通过如下步骤确定:利用有限脉冲响应滤波器或者无线脉冲响应滤波器对焦区域进行滤波,得到滤波结果图;将上述滤波结果图的对比度确定为指标信息。In some optional implementations of this embodiment, the index information of the focus area is determined through the following steps: filtering the focus area by using a finite impulse response filter or a wireless impulse response filter to obtain a filter result graph; The contrast ratio is determined as the indicator information.
在本实施例的一些可选的实现方式中,上述有限脉冲响应滤波器包括索贝尔算子或拉普拉斯算子。In some optional implementations of this embodiment, the above-mentioned finite impulse response filter includes a Sobel operator or a Laplacian operator.
在本实施例的一些可选的实现方式中,上述无线脉冲响应滤波器通过如下步骤生成:通过傅里叶变换,将对焦区域转换为频域信号;对上述频域信号进行归一化;基于频域信号的分布,确定目标频段;基于上述目标频段,设置滤波器。In some optional implementations of this embodiment, the above-mentioned wireless impulse response filter is generated by the following steps: converting the focus area into a frequency-domain signal through Fourier transform; normalizing the above-mentioned frequency-domain signal; The distribution of the frequency domain signal, determine the target frequency band; based on the above target frequency band, set the filter.
本申请的上述实施例提供的对焦方法,通过首先获取对焦过程中镜头采样各帧图像时的对焦信息,而后基于对焦信息中的设备抖动信息,筛选出候选对焦信息,之后选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置,从而控制上述镜头移动至上述镜头位置,以完成对焦。在确定合焦时的镜头位置的过程中考虑到了设备抖动情况,提高了对合焦时的镜头位置判定的准确性,从而有效提高了对焦的准确性。The focusing method provided by the above-mentioned embodiments of the present application first obtains the focusing information when the lens samples each frame of images during the focusing process, then selects the candidate focusing information based on the device shake information in the focusing information, and then selects a preset number of candidates The focus information is used as target focus information, and based on the lens position information and index information in each target focus information, the lens position when focusing is determined, so as to control the lens to move to the lens position to complete the focus. In the process of determining the position of the lens when the focus is achieved, the shaking of the device is taken into account, which improves the accuracy of determining the position of the lens when the focus is achieved, thereby effectively improving the accuracy of the focusing.
作为对上述图1所示方法的实现,本申请提供了一种电子设备的一个实施例,该实施例与图1所示的方法实施例相对应。该电子设备具体可以包括:处理器1001和存储器1002。As an implementation of the above method shown in FIG. 1 , the present application provides an embodiment of an electronic device, which corresponds to the method embodiment shown in FIG. 1 . Specifically, the electronic device may include: a processor 1001 and a memory 1002 .
上述存储器1001,可以用于存储程序指令。The above-mentioned memory 1001 can be used to store program instructions.
上述处理器1002,可以用于执行上述存储器存储的程序指令,当程序指令被执行时,上述处理器可以用于执行如下步骤:获取对焦过程中镜头采样各帧图像时的对焦信息,所述对焦信息包括设备抖动信息、镜头位置信息和图像中对焦区域的指标信息;基于设备抖动信息,筛选出候选对焦信息;基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;控制所述镜头移动至所 述镜头位置,以完成对焦。在一个实施方式中,基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置,包括:选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。The above-mentioned processor 1002 can be used to execute the program instructions stored in the above-mentioned memory. When the program instructions are executed, the above-mentioned processor can be used to perform the following steps: acquiring the focusing information when the lens samples each frame of images in the focusing process, and the focusing The information includes equipment shake information, lens position information, and index information of the focus area in the image; based on the equipment shake information, candidate focus information is screened; based on the lens position information and the index information in the candidate focus information, the The lens position when focusing; control the lens to move to the lens position to complete focusing. In one embodiment, determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information includes: selecting a preset number of candidate focus information as target focus information, and based on The lens position information and index information in the focus information of each target determine the lens position when focusing is achieved.
在本实施例的一些可选的实现方式中,所述设备抖动信息通过惯性传感器采集。In some optional implementation manners of this embodiment, the device jitter information is collected by an inertial sensor.
在本实施例的一些可选的实现方式中,述惯性传感器包括加速度传感器,所述设备抖动信息为所述加速度传感器所采集的各轴向的加速度之和。In some optional implementations of this embodiment, the inertial sensor includes an acceleration sensor, and the device shaking information is the sum of accelerations of each axis collected by the acceleration sensor.
在本实施例的一些可选的实现方式中,所述设备抖动信息为表征设备抖动程度的数值;以及,所述基于设备抖动信息,筛选出候选对焦信息,包括:将设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。In some optional implementations of this embodiment, the device jitter information is a numerical value representing the degree of device jitter; and the filtering out candidate focus information based on the device jitter information includes: setting the device jitter information to be smaller than the first Focus information of a preset threshold is determined as candidate focus information.
在本实施例的一些可选的实现方式中,所述设备抖动信息为表征设备抖动程度的数值;以及,所述基于设备抖动信息,筛选出候选对焦信息,包括:将指标信息最大的对焦信息作参考对焦信息,将所述参考对焦信息对应的镜头位置作为第一参考位置,检测各对焦信息对应的镜头位置与所述第一参考位置的距离;将距离小于第二预设阈值且设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。In some optional implementations of this embodiment, the device jitter information is a numerical value representing the degree of device jitter; and the selection of candidate focus information based on the device jitter information includes: selecting the focus information with the largest index information As the reference focus information, the lens position corresponding to the reference focus information is used as the first reference position, and the distance between the lens position corresponding to each focus information and the first reference position is detected; the distance is smaller than the second preset threshold and the device shakes Focus information whose information is less than the first preset threshold is determined as candidate focus information.
在本实施例的一些可选的实现方式中,所述选取预设数量的候选对焦信息作为目标对焦信息,包括:将指标信息最大的候选对焦信息作为第一目标对焦信息;将所述第一目标对焦信息对应的镜头位置作为第二参考位置,将镜头位置与所述第二参考位置相邻的各候选对焦信息分别作为第二目标对焦信息;从候选对焦信息中,选取所述第一目标对焦信息和各第二目标对焦信息。In some optional implementations of this embodiment, the selecting a preset number of candidate focus information as the target focus information includes: using the candidate focus information with the largest index information as the first target focus information; The lens position corresponding to the target focus information is used as the second reference position, and each candidate focus information whose lens position is adjacent to the second reference position is used as the second target focus information; from the candidate focus information, the first target is selected Focus information and each second target focus information.
在本实施例的一些可选的实现方式中,在所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置之前,所述处理器进一步用于执行如下步骤:检测各目标对焦信息中的设备抖动信息是否满足预设条件;响应于存在不满足所述预设条件的目标对焦信息,统计不满足所述预设条件的目标对焦信息的数量;响应于所述数量小于或等于第三预设阈值,对不满足所述预设条件的目标对焦信息中的指标信息进行补偿。In some optional implementations of this embodiment, before determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, the processor is further configured to perform the following steps: Detecting whether the device shake information in each target focus information meets a preset condition; in response to the existence of target focus information that does not meet the preset condition, count the number of target focus information that does not meet the preset condition; in response to the The number is less than or equal to the third preset threshold, and the index information in the target focus information that does not meet the preset condition is compensated.
在本实施例的一些可选的实现方式中,所述对不满足所述预设条件的目标对焦信息中的指标信息进行补偿,包括:将不满足所述预设条件的每一个目标对焦信息作为待处理对焦信息,执行如下步骤:基于所述待处理对焦信息中的设备抖动信息,确定补偿系数;确定所获取的对焦信息中的指标信息的最大值;确定所述待处理对焦信息中的指标信息与所述最大值的差值;将所述补偿系数与所述差值的乘积作为补偿值;基于所述补偿值对所述待处理对焦信息中的指标信息进行补偿。In some optional implementations of this embodiment, the compensating the index information in the target focus information that does not meet the preset condition includes: compensating each target focus information that does not meet the preset condition As the focus information to be processed, the following steps are performed: based on the device shake information in the focus information to be processed, determine a compensation coefficient; determine the maximum value of the index information in the focus information obtained; determine the focus information in the focus information to be processed. The difference between the index information and the maximum value; the product of the compensation coefficient and the difference is used as a compensation value; the index information in the focus information to be processed is compensated based on the compensation value.
在本实施例的一些可选的实现方式中,在所述统计不满足所述预设条件的目标对焦信息的数量之后,所述处理器进一步用于执行如下步骤:响应于所述数量大于所述第三预设阈值,重新执行对焦操作。In some optional implementations of this embodiment, after the counting of the number of target focusing information that does not meet the preset condition, the processor is further configured to perform the following step: in response to the number being greater than the predetermined condition The third preset threshold is set, and the focusing operation is re-executed.
在本实施例的一些可选的实现方式中,在所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置之前,所述处理器进一步用于执行如下步骤:检测各目标对焦信息中的设备抖动信息是否满足预设条件;对于不满足所述预设条件的每一个目标对焦信息,将与该目标对焦信息邻近的任一对焦信息作为新的目标对焦信息,重新执行所述检测各目标对焦信息中的设备抖动信息是否满足预设条件的步骤。In some optional implementations of this embodiment, before determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, the processor is further configured to perform the following steps: Detecting whether the device shake information in each target focus information satisfies a preset condition; for each target focus information that does not meet the preset condition, take any focus information adjacent to the target focus information as new target focus information, Re-execute the step of detecting whether the device shake information in the focus information of each target satisfies the preset condition.
在本实施例的一些可选的实现方式中,所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置,包括:将各目标对焦信息中的设备抖动信息作为横坐标,将镜头位置信息作为纵坐标,基于各目标对焦信息的坐标,构建 曲线;确定所述曲线的顶点的纵坐标;将所述顶点的纵坐标所指示的镜头位置,确定为合焦时的镜头位置。In some optional implementations of this embodiment, the determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target includes: taking the device shake information in the focus information of each target as The abscissa, taking the lens position information as the ordinate, constructs a curve based on the coordinates of the focus information of each target; determining the ordinate of the vertex of the curve; determining the position of the lens indicated by the ordinate of the vertex as the focus lens position.
在本实施例的一些可选的实现方式中,对焦区域的指标信息通过如下步骤确定:利用有限脉冲响应滤波器或者无线脉冲响应滤波器对焦区域进行滤波,得到滤波结果图;将所述滤波结果图的对比度确定为指标信息。In some optional implementations of this embodiment, the index information of the focus area is determined by the following steps: filtering the focus area by using a finite impulse response filter or a wireless impulse response filter to obtain a filter result graph; The contrast of the graph is determined as index information.
在本实施例的一些可选的实现方式中,所述有限脉冲响应滤波器包括索贝尔算子或拉普拉斯算子。In some optional implementations of this embodiment, the finite impulse response filter includes a Sobel operator or a Laplacian operator.
在本实施例的一些可选的实现方式中,所述无线脉冲响应滤波器通过如下步骤生成:通过傅里叶变换,将对焦区域转换为频域信号;对所述频域信号进行归一化;基于频域信号的分布,确定目标频段;基于所述目标频段,设置滤波器。In some optional implementations of this embodiment, the wireless impulse response filter is generated by the following steps: converting the focus area into a frequency domain signal through Fourier transform; normalizing the frequency domain signal ; Determine the target frequency band based on the distribution of the frequency domain signal; set the filter based on the target frequency band.
本申请的上述实施例所提供的电子设备,通过首先获取对焦过程中镜头采样各帧图像时的对焦信息,而后基于对焦信息中的设备抖动信息,筛选出候选对焦信息,之后选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置,从而控制所述镜头移动至所述镜头位置,以完成对焦。在确定合焦时的镜头位置的过程中考虑到了设备抖动情况,提高了对合焦时的镜头位置判定的准确性,从而有效提高了对焦的准确性。The electronic device provided by the above-mentioned embodiment of the present application first obtains the focus information when the lens samples each frame of images during the focusing process, then selects candidate focus information based on the device shake information in the focus information, and then selects a preset number of focus information. The candidate focus information is used as target focus information, and based on the lens position information and index information in each target focus information, the lens position when focus is achieved is determined, so as to control the lens to move to the lens position to complete the focus. In the process of determining the position of the lens when the focus is achieved, the shaking of the device is taken into account, which improves the accuracy of determining the position of the lens when the focus is achieved, thereby effectively improving the accuracy of the focusing.
对于电子设备实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the electronic device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the partial description of the method embodiment.
本申请实施例还提供一种计算机可读介质,计算机可读介质上存储有计算机程序,该计算机程序被处理器执行时实现上述对焦方法的实施例的各个过程,且能达到相同的技术效果。为避免重复,该计算机程序被处理器执行时实现上述各方法的实施例的各个过程,这里不再赘述。Embodiments of the present application further provide a computer-readable medium, where a computer program is stored on the computer-readable medium. When the computer program is executed by a processor, each process of the above-mentioned embodiments of the focusing method can be achieved, and the same technical effect can be achieved. In order to avoid repetition, when the computer program is executed by the processor, each process of the embodiments of the above-mentioned methods is implemented, which will not be repeated here.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments may be referred to each other.
本领域内的技术人员应明白,本申请的实施例可提供为方法、装置、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可读介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It should be understood by those skilled in the art that the embodiments of the present application may be provided as a method, an apparatus, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable media having computer-usable program code embodied therein, including but not limited to disk storage, CD-ROM, optical storage, and the like.
本申请是参照根据本申请的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to the present application. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal equipment to produce a machine that causes the instructions to be executed by the processor of the computer or other programmable data processing terminal equipment Means are created for implementing the functions specified in the flow or flows of the flowcharts and/or the blocks or blocks of the block diagrams.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal equipment to operate in a particular manner, such that the instructions stored in the computer readable memory result in an article of manufacture comprising instruction means, the The instruction means implement the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个 流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing terminal equipment, so that a series of operational steps are performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby executing on the computer or other programmable terminal equipment The instructions executed on the above provide steps for implementing the functions specified in the flowchart or blocks and/or the block or blocks of the block diagrams.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。While the preferred embodiments of the present application have been described, additional changes and modifications to these embodiments may occur to those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be construed to include the preferred embodiment and all changes and modifications that fall within the scope of this application.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should also be noted that in this document, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply these entities or that there is any such actual relationship or sequence between operations. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or terminal device comprising a list of elements includes not only those elements, but also a non-exclusive list of elements. other elements, or also include elements inherent to such a process, method, article or terminal equipment. Without further limitation, an element defined by the phrase "comprises a..." does not preclude the presence of additional identical elements in the process, method, article or terminal device comprising said element.
以上对本申请所提供的...方法、装置、电子设备和计算机可读介质,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The methods, apparatuses, electronic devices and computer-readable media provided by the present application have been described in detail above. The principles and implementations of the present application are described with specific examples. The descriptions of the above embodiments are only It is used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there will be changes in the specific embodiments and application scope. The contents of the description should not be construed as limiting the application.

Claims (46)

  1. 一种对焦方法,其特征在于,所述方法包括:A focusing method, characterized in that the method comprises:
    获取对焦过程中镜头采样多帧图像时的对焦信息,所述对焦信息包括设备抖动信息、镜头位置信息和所述多帧图像中的对焦区域的指标信息;Acquire focusing information when the lens samples multiple frames of images in the focusing process, where the focusing information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
    基于所述设备抖动信息,筛选出候选对焦信息;based on the device shake information, screening out candidate focus information;
    基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information;
    控制所述镜头移动至所述镜头位置,以完成对焦。The lens is controlled to move to the lens position to complete focusing.
  2. 根据权利要求1所述的方法,其特征在于,所述设备抖动信息通过惯性传感器采集;以及所述指标信息用于指示所述多帧图像中的所述对焦区域的对象的清晰程度。The method according to claim 1, wherein the device shake information is collected by an inertial sensor; and the index information is used to indicate the sharpness of the object in the focus area in the multi-frame image.
  3. 根据权利要求2所述的方法,其特征在于,所述惯性传感器包括加速度传感器,所述设备抖动信息为所述加速度传感器所采集的各轴向的加速度之和。The method according to claim 2, wherein the inertial sensor comprises an acceleration sensor, and the device shaking information is the sum of the accelerations of each axis collected by the acceleration sensor.
  4. 根据权利要求1所述的方法,其特征在于,所述设备抖动信息为表征设备抖动程度的数值;以及,The method according to claim 1, wherein the equipment jitter information is a numerical value representing the degree of equipment jitter; and,
    所述基于设备抖动信息,筛选出候选对焦信息,包括:The selection of candidate focus information based on the device shake information includes:
    将设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。Focus information whose device shake information is less than the first preset threshold is determined as candidate focus information.
  5. 根据权利要求1所述的方法,其特征在于,所述设备抖动信息为表征设备抖动程度的数值;以及,The method according to claim 1, wherein the equipment jitter information is a numerical value representing the degree of equipment jitter; and,
    所述基于设备抖动信息,筛选出候选对焦信息,包括:The selection of candidate focus information based on the device shake information includes:
    将指标信息最大的对焦信息作参考对焦信息,将所述参考对焦信息对应的镜头位置作为第一参考位置,检测各对焦信息对应的镜头位置与所述第一参考位置的距离;The focus information with the largest index information is used as the reference focus information, the lens position corresponding to the reference focus information is used as the first reference position, and the distance between the lens position corresponding to each focus information and the first reference position is detected;
    将距离小于第二预设阈值且设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。Focus information whose distance is less than the second preset threshold and whose device shake information is less than the first preset threshold is determined as candidate focus information.
  6. 根据权利要求1所述的方法,其特征在于,所述基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置,包括:The method according to claim 1, wherein the determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information comprises:
    将指标信息最大的候选对焦信息作为第一目标对焦信息;The candidate focus information with the largest index information is used as the first target focus information;
    将所述第一目标对焦信息对应的镜头位置作为第二参考位置,将镜头位置与所述第二参考位置相邻的各候选对焦信息分别作为第二目标对焦信息;The lens position corresponding to the first target focus information is used as the second reference position, and each candidate focus information whose lens position is adjacent to the second reference position is respectively used as the second target focus information;
    基于所述第一目标对焦信息和各第二目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。Based on the lens position information and index information in the first target focus information and each second target focus information, the lens position when focusing is achieved is determined.
  7. 根据权利要求1所述的方法,其特征在于,所述基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置,包括:The method according to claim 1, wherein the determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information comprises:
    选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置。A preset number of candidate focus information is selected as target focus information, and based on the lens position information and the index information in each target focus information, the lens position when focusing is achieved is determined.
  8. 根据权利要求7所述的方法,其特征在于,在所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置之前,所述方法还包括:The method according to claim 7, wherein before determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, the method further comprises:
    检测各目标对焦信息中的设备抖动信息是否满足预设条件;Detect whether the device shake information in the focus information of each target meets the preset condition;
    响应于存在不满足所述预设条件的目标对焦信息,统计不满足所述预设条件的目标对焦信息的数量;In response to the existence of target focus information that does not meet the preset condition, count the number of target focus information that does not meet the preset condition;
    响应于所述数量小于或等于第三预设阈值,对不满足所述预设条件的目标对焦信息中的指标信息进行补偿。In response to the number being less than or equal to the third preset threshold, the index information in the target focus information that does not satisfy the preset condition is compensated.
  9. 根据权利要求8所述的方法,其特征在于,所述对不满足所述预设条件的目标对焦信息中的指标信息进行补偿,包括:The method according to claim 8, wherein the compensating the index information in the target focus information that does not meet the preset condition comprises:
    将不满足所述预设条件的每一个目标对焦信息作为待处理对焦信息,执行如下步骤:Take each target focus information that does not meet the preset conditions as the focus information to be processed, and perform the following steps:
    基于所述待处理对焦信息中的设备抖动信息,确定补偿系数;determining a compensation coefficient based on the device shake information in the focus information to be processed;
    确定所获取的对焦信息中的指标信息的最大值;determining the maximum value of the index information in the acquired focus information;
    确定所述待处理对焦信息中的指标信息与所述最大值的差值;determining the difference between the index information in the focus information to be processed and the maximum value;
    将所述补偿系数与所述差值的乘积作为补偿值;taking the product of the compensation coefficient and the difference as a compensation value;
    基于所述补偿值对所述待处理对焦信息中的指标信息进行补偿。The index information in the focus information to be processed is compensated based on the compensation value.
  10. 根据权利要求8所述的方法,其特征在于,在所述统计不满足所述预设条件的目标对焦信息的数量之后,所述方法还包括:The method according to claim 8, wherein after the counting the number of target focusing information that does not meet the preset condition, the method further comprises:
    响应于所述数量大于所述第三预设阈值,重新执行对焦操作。In response to the number being greater than the third preset threshold, the focusing operation is re-performed.
  11. 根据权利要求7所述的方法,其特征在于,在所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置之前,所述方法还包括:The method according to claim 7, wherein before determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, the method further comprises:
    检测各目标对焦信息中的设备抖动信息是否满足预设条件;Detect whether the device shake information in the focus information of each target meets the preset condition;
    对于不满足所述预设条件的每一个目标对焦信息,将与该目标对焦信息邻近的任一对焦信息作为新的目标对焦信息,重新执行所述检测各目标对焦信息中的设备抖动信息是否满足预设条件的步骤。For each target focus information that does not meet the preset conditions, use any focus information adjacent to the target focus information as new target focus information, and re-execute the detection of whether the device shake information in each target focus information meets the requirements Pre-conditional steps.
  12. 根据权利要求7所述的方法,其特征在于,所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置,包括:The method according to claim 7, wherein determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, comprising:
    将各目标对焦信息中的镜头位置信息作为横坐标,将指标信息作为纵坐标,基于各目标对焦信息的坐标,构建曲线;Taking the lens position information in the focus information of each target as the abscissa and the index information as the ordinate, and constructing a curve based on the coordinates of the focus information of each target;
    确定所述曲线的顶点的横坐标;determining the abscissa of the apex of the curve;
    将所述顶点的横坐标所指示的镜头位置,确定为合焦时的镜头位置。The lens position indicated by the abscissa of the vertex is determined as the lens position when focusing is achieved.
  13. 根据权利要求1所述的方法,其特征在于,对焦区域的指标信息通过如下步骤确定:The method according to claim 1, wherein the index information of the focus area is determined by the following steps:
    利用有限脉冲响应滤波器或者无线脉冲响应滤波器对焦区域进行滤波,得到滤波结果图;Use the finite impulse response filter or the wireless impulse response filter to filter the focus area, and obtain the filtering result map;
    将所述滤波结果图的对比度确定为指标信息。The contrast of the filtering result map is determined as index information.
  14. 根据权利要求13所述的方法,其特征在于,所述有限脉冲响应滤波器包括索贝尔算子或拉普拉斯算子。The method of claim 13, wherein the finite impulse response filter comprises a Sobel operator or a Laplacian operator.
  15. 根据权利要求13所述的方法,其特征在于,所述无线脉冲响应滤波器通过如下步骤生成:The method of claim 13, wherein the wireless impulse response filter is generated by the following steps:
    通过傅里叶变换,将对焦区域转换为频域信号;Convert the focus area to a frequency domain signal through Fourier transform;
    对所述频域信号进行归一化;normalizing the frequency domain signal;
    基于频域信号的分布,确定目标频段;Determine the target frequency band based on the distribution of the frequency domain signal;
    基于所述目标频段,设置滤波器。Based on the target frequency band, a filter is set.
  16. 一种对焦装置,其特征在于,所述装置包括:A focusing device, characterized in that the device comprises:
    获取单元,被配置成获取对焦过程中镜头采样多帧图像时的对焦信息,所述对焦信息包括设备抖动信息、镜头位置信息和所述多帧图像中的对焦区域的指标信息;an acquisition unit, configured to acquire focus information when the lens samples multiple frames of images in the focusing process, where the focus information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
    筛选单元,被配置成基于所述设备抖动信息,筛选出候选对焦信息;a screening unit, configured to screen out candidate focus information based on the device shake information;
    确定单元,被配置成基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;a determining unit, configured to determine the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information;
    控制单元,被配置成控制所述镜头移动至所述镜头位置,以完成对焦。The control unit is configured to control the lens to move to the lens position to complete focusing.
  17. 根据权利要求16所述的装置,其特征在于,所述设备抖动信息通过惯性传感器采集;以及所述指标信息用于指示所述多帧图像中的所述对焦区域的对象的清晰程度。The apparatus according to claim 16, wherein the device shake information is collected by an inertial sensor; and the index information is used to indicate the sharpness of the object in the focus area in the multi-frame image.
  18. 根据权利要求17所述的装置,其特征在于,所述惯性传感器包括加速度传感器,所述设备抖动信息为所述加速度传感器所采集的各轴向的加速度之和。The device according to claim 17, wherein the inertial sensor comprises an acceleration sensor, and the device shaking information is the sum of the accelerations of each axis collected by the acceleration sensor.
  19. 根据权利要求16所述的装置,其特征在于,所述设备抖动信息为表征设备抖动程度的数值;以及,The apparatus according to claim 16, wherein the equipment jitter information is a numerical value representing the degree of equipment jitter; and,
    所述筛选单元,进一步被配置成:The screening unit is further configured to:
    将设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。Focus information whose device shake information is less than the first preset threshold is determined as candidate focus information.
  20. 根据权利要求16所述的装置,其特征在于,所述设备抖动信息为表征设备抖动程度的数值;以及,The apparatus according to claim 16, wherein the equipment jitter information is a numerical value representing the degree of equipment jitter; and,
    所述筛选单元,进一步被配置成:The screening unit is further configured to:
    将指标信息最大的对焦信息作参考对焦信息,将所述参考对焦信息对应的镜头位置作为第一参考位置,检测各对焦信息对应的镜头位置与所述第一参考位置的距离;The focus information with the largest index information is used as the reference focus information, the lens position corresponding to the reference focus information is used as the first reference position, and the distance between the lens position corresponding to each focus information and the first reference position is detected;
    将距离小于第二预设阈值且设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。Focus information whose distance is less than the second preset threshold and whose device shake information is less than the first preset threshold is determined as candidate focus information.
  21. 根据权利要求16所述的装置,其特征在于,所述确定单元,进一步被配置成:The apparatus according to claim 16, wherein the determining unit is further configured to:
    将指标信息最大的候选对焦信息作为第一目标对焦信息;The candidate focus information with the largest index information is used as the first target focus information;
    将所述第一目标对焦信息对应的镜头位置作为第二参考位置,将镜头位置与所述第二参考位置相邻的各候选对焦信息分别作为第二目标对焦信息;The lens position corresponding to the first target focus information is used as the second reference position, and each candidate focus information whose lens position is adjacent to the second reference position is respectively used as the second target focus information;
    基于所述第一目标对焦信息和各第二目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。Based on the lens position information and index information in the first target focus information and the second target focus information, the lens position when focusing is achieved is determined.
  22. 根据权利要求16所述的装置,其特征在于,所述确定单元,进一步被配置成:The apparatus according to claim 16, wherein the determining unit is further configured to:
    选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置。A preset number of candidate focus information is selected as target focus information, and based on the lens position information and the index information in each target focus information, the lens position when focusing is achieved is determined.
  23. 根据权利要求22所述的装置,其特征在于,所述装置还包括:The apparatus of claim 22, wherein the apparatus further comprises:
    第一检测单元,被配置成检测各目标对焦信息中的设备抖动信息是否满足预设条件;a first detection unit, configured to detect whether the device shake information in the focus information of each target satisfies a preset condition;
    统计单元,被配置成响应于存在不满足所述预设条件的目标对焦信息,统计不满足所述预设条件的目标对焦信息的数量;a counting unit, configured to count the number of target focusing information that does not meet the preset condition in response to the presence of target focusing information that does not meet the preset condition;
    补偿单元,被配置成响应于所述数量小于或等于第三预设阈值,对不满足所述预设条件的目标对焦信息中的指标信息进行补偿。The compensation unit is configured to compensate the index information in the target focus information that does not satisfy the preset condition in response to the number being less than or equal to the third preset threshold.
  24. 根据权利要求23所述的装置,其特征在于,所述补偿单元,进一步被配置成:The apparatus of claim 23, wherein the compensation unit is further configured to:
    将不满足所述预设条件的每一个目标对焦信息作为待处理对焦信息,执行如下步骤:Take each target focus information that does not meet the preset conditions as the focus information to be processed, and perform the following steps:
    基于所述待处理对焦信息中的设备抖动信息,确定补偿系数;determining a compensation coefficient based on the device shake information in the focus information to be processed;
    确定所获取的对焦信息中的指标信息的最大值;determining the maximum value of the index information in the acquired focus information;
    确定所述待处理对焦信息中的指标信息与所述最大值的差值;determining the difference between the index information in the focus information to be processed and the maximum value;
    将所述补偿系数与所述差值的乘积作为补偿值;taking the product of the compensation coefficient and the difference as a compensation value;
    基于所述补偿值对所述待处理对焦信息中的指标信息进行补偿。The index information in the focus information to be processed is compensated based on the compensation value.
  25. 根据权利要求23所述的装置,其特征在于,所述装置还包括:The apparatus of claim 23, wherein the apparatus further comprises:
    第一执行单元,被配置成响应于所述数量大于所述第三预设阈值,重新执行对焦操作。The first execution unit is configured to re-execute the focusing operation in response to the number being greater than the third preset threshold.
  26. 根据权利要求22所述的装置,其特征在于,所述装置还包括:The apparatus of claim 22, wherein the apparatus further comprises:
    第二检测单元,被配置成检测各目标对焦信息中的设备抖动信息是否满足预设条件;a second detection unit, configured to detect whether the device shake information in the focus information of each target satisfies a preset condition;
    第二执行单元,被配置成对于不满足所述预设条件的每一个目标对焦信息,将与该目标对焦信息邻近的任一对焦信息作为新的目标对焦信息,重新执行所述检测各目标对焦信息中的设备抖动信息是否满足预设条件的步骤。The second execution unit is configured to, for each target focus information that does not meet the preset condition, use any focus information adjacent to the target focus information as new target focus information, and re-execute the detection of each target focus The steps of whether the equipment jitter information in the information meets the preset conditions.
  27. 根据权利要求22所述的装置,其特征在于,所述确定单元,进一步被配置成:The device according to claim 22, wherein the determining unit is further configured to:
    将各目标对焦信息中的设备抖动信息作为横坐标,将镜头位置信息作为纵坐标,基于各目标对焦信息的坐标,构建曲线;Taking the device shake information in the focus information of each target as the abscissa and the lens position information as the ordinate, and constructing a curve based on the coordinates of the focus information of each target;
    确定所述曲线的顶点的纵坐标;determining the ordinate of the vertex of the curve;
    将所述顶点的纵坐标所指示的镜头位置,确定为合焦时的镜头位置。The lens position indicated by the ordinate of the vertex is determined as the lens position when focusing is achieved.
  28. 根据权利要求16所述的装置,其特征在于,对焦区域的指标信息通过如下步骤确定:The device according to claim 16, wherein the index information of the focus area is determined by the following steps:
    利用有限脉冲响应滤波器或者无线脉冲响应滤波器对焦区域进行滤波,得到滤波结果图;Use the finite impulse response filter or the wireless impulse response filter to filter the focus area, and obtain the filtering result map;
    将所述滤波结果图的对比度确定为指标信息。The contrast of the filtering result map is determined as index information.
  29. 根据权利要求28所述的装置,其特征在于,所述有限脉冲响应滤波器包括索贝尔算子或拉普拉斯算子。The apparatus of claim 28, wherein the finite impulse response filter comprises a Sobel operator or a Laplacian operator.
  30. 根据权利要求28所述的装置,其特征在于,所述无线脉冲响应滤波器通过如下步骤生成:The apparatus of claim 28, wherein the wireless impulse response filter is generated by the steps of:
    通过傅里叶变换,将对焦区域转换为频域信号;Convert the focus area to a frequency domain signal through Fourier transform;
    对所述频域信号进行归一化;normalizing the frequency domain signal;
    基于频域信号的分布,确定目标频段;Determine the target frequency band based on the distribution of the frequency domain signal;
    基于所述目标频段,设置滤波器。Based on the target frequency band, a filter is set.
  31. 一种电子设备,其特征在于,包括:处理器和存储器;An electronic device, comprising: a processor and a memory;
    所述存储器,用于存储程序指令;the memory for storing program instructions;
    所述处理器,执行所述存储器存储的程序指令,当程序指令被执行时,所述处理器用于执行如下步骤:The processor executes the program instructions stored in the memory, and when the program instructions are executed, the processor is configured to perform the following steps:
    获取对焦过程中镜头采样多帧图像时的对焦信息,所述对焦信息包括设备抖动信息、镜头位置信息和所述多帧图像中对焦区域的指标信息;Acquire focusing information when the lens samples multiple frames of images in the focusing process, where the focusing information includes device shake information, lens position information, and index information of the focus area in the multiple frames of images;
    基于所述设备抖动信息,筛选出候选对焦信息;based on the device shake information, screening out candidate focus information;
    基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置;determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information;
    控制所述镜头移动至所述镜头位置,以完成对焦。The lens is controlled to move to the lens position to complete focusing.
  32. 根据权利要求31所述的电子设备,其特征在于,所述设备抖动信息通过惯性传感器采集;以及所述指标信息用于指示所述多帧图像中的所述对焦区域的对象的清晰程度。The electronic device according to claim 31, wherein the device shake information is collected by an inertial sensor; and the index information is used to indicate the sharpness of the object in the focus area in the multi-frame image.
  33. 根据权利要求32所述的电子设备,其特征在于,所述惯性传感器包括加速度传感器,所述设备抖动信息为所述加速度传感器所采集的各轴向的加速度之和。The electronic device according to claim 32, wherein the inertial sensor comprises an acceleration sensor, and the device shaking information is the sum of accelerations of each axis collected by the acceleration sensor.
  34. 根据权利要求31所述的电子设备,其特征在于,所述设备抖动信息为表征设备抖动程度的数值;以及,The electronic device according to claim 31, wherein the device jitter information is a numerical value representing the degree of device jitter; and,
    所述基于设备抖动信息,筛选出候选对焦信息,包括:The selection of candidate focus information based on the device shake information includes:
    将设备抖动信息小于第一预设阈值的对焦信息确定为候选对焦信息。Focus information whose device shake information is less than the first preset threshold is determined as candidate focus information.
  35. 根据权利要求31所述的电子设备,其特征在于,所述设备抖动信息为表征设备抖动程度的数值;以及,The electronic device according to claim 31, wherein the device jitter information is a numerical value representing the degree of device jitter; and,
    所述基于设备抖动信息,筛选出候选对焦信息,包括:The selection of candidate focus information based on the device shake information includes:
    将指标信息最大的对焦信息作参考对焦信息,将所述参考对焦信息对应的镜头位置作为第一参考位置,检测各对焦信息对应的镜头位置与所述第一参考位置的距离;The focus information with the largest index information is used as the reference focus information, the lens position corresponding to the reference focus information is used as the first reference position, and the distance between the lens position corresponding to each focus information and the first reference position is detected;
    将距离小于第二预设阈值且设备抖动信息小于第一预设阈值的对焦信息确定为 候选对焦信息。Focus information whose distance is less than the second preset threshold and whose device shake information is less than the first preset threshold is determined as candidate focus information.
  36. 根据权利要求31所述的电子设备,其特征在于,所述基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置,包括:The electronic device according to claim 31, wherein the determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information comprises:
    将指标信息最大的候选对焦信息作为第一目标对焦信息;The candidate focus information with the largest index information is used as the first target focus information;
    将所述第一目标对焦信息对应的镜头位置作为第二参考位置,将镜头位置与所述第二参考位置相邻的各候选对焦信息分别作为第二目标对焦信息;Taking the lens position corresponding to the first target focus information as the second reference position, and using each candidate focus information whose lens position is adjacent to the second reference position as the second target focus information;
    基于所述第一目标对焦信息和各第二目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置。Based on the lens position information and index information in the first target focus information and the second target focus information, the lens position when focusing is achieved is determined.
  37. 根据权利要求31所述的电子设备,其特征在于,所述基于所述候选对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置,包括:The electronic device according to claim 31, wherein the determining the lens position when focusing is achieved based on the lens position information and the index information in the candidate focus information comprises:
    选取预设数量的候选对焦信息作为目标对焦信息,并基于各目标对焦信息中的所述镜头位置信息和所述指标信息,确定合焦时的镜头位置。A preset number of candidate focus information is selected as target focus information, and based on the lens position information and the index information in each target focus information, the lens position when focusing is achieved is determined.
  38. 根据权利要求37所述的电子设备,其特征在于,在所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置之前,所述处理器进一步用于执行如下步骤:The electronic device according to claim 37, wherein before determining the lens position when focusing is achieved based on the lens position information and the index information in the focus information of each target, the processor is further configured to perform the following steps :
    检测各目标对焦信息中的设备抖动信息是否满足预设条件;Detect whether the device shake information in the focus information of each target meets the preset condition;
    响应于存在不满足所述预设条件的目标对焦信息,统计不满足所述预设条件的目标对焦信息的数量;In response to the existence of target focus information that does not meet the preset condition, count the number of target focus information that does not meet the preset condition;
    响应于所述数量小于或等于第三预设阈值,对不满足所述预设条件的目标对焦信息中的指标信息进行补偿。In response to the number being less than or equal to the third preset threshold, the index information in the target focus information that does not satisfy the preset condition is compensated.
  39. 根据权利要求38所述的电子设备,其特征在于,所述对不满足所述预设条件的目标对焦信息中的指标信息进行补偿,包括:The electronic device according to claim 38, wherein the compensating the index information in the target focus information that does not meet the preset condition comprises:
    将不满足所述预设条件的每一个目标对焦信息作为待处理对焦信息,执行如下步骤:Take each target focus information that does not meet the preset conditions as the focus information to be processed, and perform the following steps:
    基于所述待处理对焦信息中的设备抖动信息,确定补偿系数;determining a compensation coefficient based on the device shake information in the focus information to be processed;
    确定所获取的对焦信息中的指标信息的最大值;determining the maximum value of the index information in the acquired focus information;
    确定所述待处理对焦信息中的指标信息与所述最大值的差值;determining the difference between the index information in the focus information to be processed and the maximum value;
    将所述补偿系数与所述差值的乘积作为补偿值;taking the product of the compensation coefficient and the difference as a compensation value;
    基于所述补偿值对所述待处理对焦信息中的指标信息进行补偿。The index information in the focus information to be processed is compensated based on the compensation value.
  40. 根据权利要求38所述的电子设备,其特征在于,在所述统计不满足所述预设条件的目标对焦信息的数量之后,所述处理器进一步用于执行如下步骤:The electronic device according to claim 38, wherein after counting the number of target focusing information that does not meet the preset condition, the processor is further configured to perform the following steps:
    响应于所述数量大于所述第三预设阈值,重新执行对焦操作。In response to the number being greater than the third preset threshold, the focusing operation is re-performed.
  41. 根据权利要求37所述的电子设备,其特征在于,在所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置之前,所述处理器进一步用于执行如下步骤:The electronic device according to claim 37, wherein, before determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, the processor is further configured to perform the following steps :
    检测各目标对焦信息中的设备抖动信息是否满足预设条件;Detect whether the device shake information in the focus information of each target meets the preset condition;
    对于不满足所述预设条件的每一个目标对焦信息,将与该目标对焦信息邻近的任一对焦信息作为新的目标对焦信息,重新执行所述检测各目标对焦信息中的设备 抖动信息是否满足预设条件的步骤。For each target focus information that does not meet the preset conditions, use any focus information adjacent to the target focus information as new target focus information, and re-execute the detection of whether the device shake information in each target focus information meets the requirements Pre-conditional steps.
  42. 根据权利要求37所述的电子设备,其特征在于,所述基于各目标对焦信息中的镜头位置信息和指标信息,确定合焦时的镜头位置,包括:The electronic device according to claim 37, wherein the determining the lens position when focusing is achieved based on the lens position information and index information in the focus information of each target, comprising:
    将各目标对焦信息中的设备抖动信息作为横坐标,将镜头位置信息作为纵坐标,基于各目标对焦信息的坐标,构建曲线;Taking the device shake information in the focus information of each target as the abscissa and the lens position information as the ordinate, and constructing a curve based on the coordinates of the focus information of each target;
    确定所述曲线的顶点的纵坐标;determining the ordinate of the vertex of the curve;
    将所述顶点的纵坐标所指示的镜头位置,确定为合焦时的镜头位置。The lens position indicated by the ordinate of the vertex is determined as the lens position when focusing is achieved.
  43. 根据权利要求31所述的电子设备,其特征在于,对焦区域的指标信息通过如下步骤确定:The electronic device according to claim 31, wherein the index information of the focus area is determined by the following steps:
    利用有限脉冲响应滤波器或者无线脉冲响应滤波器对焦区域进行滤波,得到滤波结果图;Use the finite impulse response filter or the wireless impulse response filter to filter the focus area, and obtain the filtering result map;
    将所述滤波结果图的对比度确定为指标信息。The contrast of the filtering result map is determined as index information.
  44. 根据权利要求43所述的电子设备,其特征在于,所述有限脉冲响应滤波器包括索贝尔算子或拉普拉斯算子。The electronic device of claim 43, wherein the finite impulse response filter comprises a Sobel operator or a Laplacian operator.
  45. 根据权利要求43所述的电子设备,其特征在于,所述无线脉冲响应滤波器通过如下步骤生成:The electronic device of claim 43, wherein the wireless impulse response filter is generated by the following steps:
    通过傅里叶变换,将对焦区域转换为频域信号;Convert the focus area to a frequency domain signal through Fourier transform;
    对所述频域信号进行归一化;normalizing the frequency domain signal;
    基于频域信号的分布,确定目标频段;Determine the target frequency band based on the distribution of the frequency domain signal;
    基于所述目标频段,设置滤波器。Based on the target frequency band, a filter is set.
  46. 一种计算机可读介质,其特征在于,所述计算机可读介质中存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-15中任一所述的方法。A computer-readable medium, characterized in that a computer program is stored in the computer-readable medium, and when the computer program is executed by a processor, the method according to any one of claims 1-15 is implemented.
PCT/CN2020/099221 2020-06-30 2020-06-30 Focusing method and apparatus, electronic device, and computer readable medium WO2022000258A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/099221 WO2022000258A1 (en) 2020-06-30 2020-06-30 Focusing method and apparatus, electronic device, and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/099221 WO2022000258A1 (en) 2020-06-30 2020-06-30 Focusing method and apparatus, electronic device, and computer readable medium

Publications (1)

Publication Number Publication Date
WO2022000258A1 true WO2022000258A1 (en) 2022-01-06

Family

ID=79317852

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/099221 WO2022000258A1 (en) 2020-06-30 2020-06-30 Focusing method and apparatus, electronic device, and computer readable medium

Country Status (1)

Country Link
WO (1) WO2022000258A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015152749A (en) * 2014-02-14 2015-08-24 キヤノン株式会社 Imaging device and control method of the same
CN106603915A (en) * 2016-12-14 2017-04-26 广东欧珀移动通信有限公司 Control method, control device and electronic device
CN107124557A (en) * 2017-05-31 2017-09-01 广东欧珀移动通信有限公司 Focusing method, device, computer-readable recording medium and terminal
CN107613194A (en) * 2017-08-24 2018-01-19 努比亚技术有限公司 A kind of focusing method, mobile terminal and computer-readable recording medium
CN107809590A (en) * 2017-11-08 2018-03-16 青岛海信移动通信技术股份有限公司 A kind of photographic method and device
CN108259759A (en) * 2018-03-20 2018-07-06 北京小米移动软件有限公司 focusing method, device and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015152749A (en) * 2014-02-14 2015-08-24 キヤノン株式会社 Imaging device and control method of the same
CN106603915A (en) * 2016-12-14 2017-04-26 广东欧珀移动通信有限公司 Control method, control device and electronic device
CN107124557A (en) * 2017-05-31 2017-09-01 广东欧珀移动通信有限公司 Focusing method, device, computer-readable recording medium and terminal
CN107613194A (en) * 2017-08-24 2018-01-19 努比亚技术有限公司 A kind of focusing method, mobile terminal and computer-readable recording medium
CN107809590A (en) * 2017-11-08 2018-03-16 青岛海信移动通信技术股份有限公司 A kind of photographic method and device
CN108259759A (en) * 2018-03-20 2018-07-06 北京小米移动软件有限公司 focusing method, device and storage medium

Similar Documents

Publication Publication Date Title
JP5522757B2 (en) Camera, system having camera, method of operating camera, and method of deconvolving recorded image
CN105933594B (en) Control equipment, picture pick-up device and control method
KR101228978B1 (en) Main face choosing device, method for controlling same, and image capturing apparatus
US8520083B2 (en) Method of removing an artefact from an image
CN105578048B (en) A kind of quick focusing method and device, mobile terminal
US20160163056A1 (en) Depth calculation device, imaging apparatus, and depth calculation method
CN101895682B (en) Image processing apparatus and image processing method
JP4957134B2 (en) Distance measuring device
JP5979553B2 (en) Image processing apparatus, imaging apparatus, and image processing method
JP6101074B2 (en) Optical apparatus, image blur correction apparatus, imaging apparatus, control method therefor, program, and storage medium
EP2360638A1 (en) Method, system and computer program product for obtaining a point spread function using motion information
Shih Autofocus survey: a comparison of algorithms
WO2011158498A1 (en) Image capture device and image capture method
US20100033617A1 (en) System and method to generate depth data using edge detection
TW201103316A (en) Two-dimensional polynomial model for depth estimation based on two-picture matching
US8624986B2 (en) Motion robust depth estimation using convolution and wavelet transforms
JP2007020167A (en) Method of deblurring image captured by imaging apparatus provided with image sensor array for capturing image during exposure and at least one motion sensor, imaging apparatus, method of deblurring image, and computer-readable medium
US10116857B2 (en) Focus adjustment apparatus, control method of focus adjustment apparatus, and imaging apparatus
CN110324536B (en) Image change automatic sensing focusing method for microscope camera
WO2022000258A1 (en) Focusing method and apparatus, electronic device, and computer readable medium
CN105446056B (en) Automatic focusing mechanism and method
WO2021217427A1 (en) Image processing method and apparatus, photographing device, movable platform, and storage medium
JP2015228113A (en) Image processor and image processing method
CN105791666B (en) Automatic focusing mechanism
JPH05150154A (en) Automatic focus adjustment device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20942839

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20942839

Country of ref document: EP

Kind code of ref document: A1