WO2017107840A1 - 自动聚焦控制方法和装置 - Google Patents
自动聚焦控制方法和装置 Download PDFInfo
- Publication number
- WO2017107840A1 WO2017107840A1 PCT/CN2016/110128 CN2016110128W WO2017107840A1 WO 2017107840 A1 WO2017107840 A1 WO 2017107840A1 CN 2016110128 W CN2016110128 W CN 2016110128W WO 2017107840 A1 WO2017107840 A1 WO 2017107840A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- focus
- lens
- estimation value
- value
- current
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
- H04N23/673—Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method
Definitions
- the present invention relates to the field of focusing technologies, and in particular, to an automatic focus control method and apparatus.
- the automatic focusing technology based on digital image processing has gradually replaced the traditional autofocus method based on the ranging principle.
- the autofocus technology based on digital image processing uses a digital image processing algorithm to obtain a focus evaluation value that can determine the sharpness of the image, generally a high-frequency component value of the image data, and adopts certain algorithms and strategies according to the evaluation value.
- the focus motor of the control lens is moved to reach the focus position corresponding to the focus evaluation value, and a clear image is obtained.
- the autofocus algorithm in the prior art uses a fixed step size for searching the focus motor stroke, which not only wastes the focus time due to the slow focus speed, but also suffers from the problem of oscillation due to local poles.
- the object of the embodiments of the present invention is to solve at least the above problems, and to provide an automatic focus control method and an apparatus using the same.
- the embodiment of the present invention adopts the following technical solutions:
- the embodiment of the invention provides an automatic focus control method, which comprises the steps of:
- the drive is invoked to move the lens to the target focus position.
- an embodiment of the present invention further provides an auto focus control apparatus, including:
- a data acquisition module configured to acquire each image data of the object at a plurality of different focus positions between the lens and the object
- the estimated value calculation module is configured to calculate a corresponding focus estimation value for each of the plurality of focus positions based on the acquired image data and the preset first calculation rule;
- a focus position obtaining module configured to acquire a target focus position at which the focus estimation value reaches a maximum value based on the preset second rule
- a moving module configured to call the driving device to move the lens to the target focus position.
- a computer program comprising computer readable code
- the terminal device is caused to perform any of the above described auto focus control methods.
- a computer readable medium storing a computer program for performing any of the above described auto focus control methods.
- the embodiment of the invention has the following advantages:
- An embodiment of the present invention provides an auto focus control method for acquiring respective image data of an object at a plurality of different focus positions between a lens and an object; and based on a preset first step of a focus estimation value, for each focus position Each of the calculations calculates a corresponding focus estimation value; then, based on the preset second rule, the target focus position at which the focus estimation value reaches the maximum value is acquired, and the driving device is called to move the lens to the target focus position.
- the autofocus method according to the embodiment of the invention can realize fast autofocus and solve the problem of low focus precision, and has strong real-time performance, high reliability and practicability.
- FIG. 1 is a focus curve diagram of an autofocus control method in an embodiment of the present invention, showing a relationship between a focus position and a focus estimation value;
- FIG. 2 is a flow chart showing a procedure of an embodiment of an auto focus control method in an embodiment of the present invention
- FIG. 3 is a flow chart showing a procedure of an embodiment of an auto focus control method in an embodiment of the present invention.
- FIG. 4 is a structural block diagram of an embodiment of an autofocus control device in an embodiment of the present invention.
- FIG. 5 is a structural block diagram of a focus position acquisition module in an embodiment of an autofocus control apparatus according to an embodiment of the present invention
- FIG. 6 is a block diagram of a terminal device for performing a method according to an embodiment of the present invention.
- FIG. 7 is a storage unit of an embodiment of the present invention for holding or carrying program code that implements a method in accordance with an embodiment of the present invention.
- the method in the embodiment of the present invention is applied to an auto focus process when an image is taken by a camera or a camera.
- the method according to the embodiment of the present invention can also be applied to a mobile phone, a PAD, a portable multimedia player (PMP), a TV, and the like having a photographing function.
- PMP portable multimedia player
- FIG. 2 is a flowchart of a process of an embodiment of an automatic focus control method according to an embodiment of the present invention, which includes the steps of:
- the driving device driving lens of the embodiment of the present invention drives the lens to move between the lens and the object, and presets the unit step of the lens movement, that is, the moving speed, and stops based on a preset time interval.
- a lens acquiring corresponding image data of a current focus position of the lens, if the lens acquires each image data at a plurality of different focus positions, and calculating a corresponding focus estimation value, assuming that the plurality of focus positions include a target focus position,
- the target focus position is the focus position when the focus estimation value is maximum, and its plurality of sets of focus estimation values and their corresponding focus positions may form a focus graph as described in FIG.
- the driving device may be a stepping motor that is driven to rotate by a controller or a driver to drive the movement of the lens.
- the preset time interval and the unit step value of the initial movement of the lens may be pre-stored in a storage medium, wherein the storage medium may be a synchronous dynamic random access memory (SDRAM) or a multi-chip package (MCP). ) Memory or Dynamic Random Access Memory (DRAM).
- SDRAM synchronous dynamic random access memory
- MCP multi-chip package
- DRAM Dynamic Random Access Memory
- the step size moved by the lens refers to the distance that the lens moves from the focus position corresponding to the current movement to the first stop after the movement.
- the step length is generally expressed by the pulse number of a specific pulse width, so the specific value is related to the relevant parameters of the controller, the driver and the motor used, and the value of the step is still certain.
- the degree determines the real-time and robustness of the algorithm, so it must be determined experimentally according to the actual system composition.
- the general influence of this step on the whole method is that the step size is too small, which causes the autofocus process to take time and serious. At the beginning of the focus, it is easy to fall into the local pole; but the step size is too large, which makes it easy to cross the maximum value during the maximum value of the focus estimation. If the distance is too large, the algorithm used in this method cannot converge.
- the embodiment changes the distance between the lens and the object based on a certain time interval by calling the driving device, and acquires image data of a certain frame image at a focus position corresponding to the distance. Then, the image data is subjected to noise reduction, gamma correction, color filter array difference, color matrix processing, color by image signal processing means Color correction or color enhancement to improve image quality, and high-pass component data in a certain frequency band can be obtained by filtering and denoising the high-pass filter or band-pass filter.
- the method in an embodiment of the present invention further includes the following steps:
- image data corresponding to a plurality of different focus positions is acquired by the driving device moving lens, and in this step, corresponding focus is calculated for each of the plurality of focus positions based on the preset first calculation rule. estimated value.
- the preset first calculation rule is preset to be stored in a storage medium, where the storage medium may be a synchronous dynamic random access memory (SDRAM), a multi-chip package (MCP) memory, or a dynamic random access memory. (DRAM).
- SDRAM synchronous dynamic random access memory
- MCP multi-chip package
- DRAM dynamic random access memory
- the focus estimation value refers to a numerical estimation index representing the state of the characteristic portion and the contour portion of the clearly visible image. Therefore, the focus estimation value may calculate the focus estimation value by the edge enhancement of the difference in luminance data between adjacent pixels of the image, or may be calculated according to the gray value of the pixel, the reciprocal of the luminance, the dispersion of the luminance, and the like. Focus on the estimate.
- an algorithm corresponding to calculating a corresponding focus estimation value for each of a plurality of focus positions in the embodiment of the present invention is:
- the x is a horizontal high-frequency component value
- y is a vertical high-frequency component value.
- the algorithm accumulates all the horizontal x and vertical y high-frequency energy values of the current frame image data obtained from the data image to obtain the Focus on the estimate.
- the method in an embodiment of the present invention further includes the following steps:
- the step of acquiring the target focus position that the focus estimation value reaches the maximum value based on the preset second rule includes:
- the direction searching step determines the moving direction of the lens based on the magnitude relationship between the obtained current focus estimation value and the previous focus estimation value.
- the climbing step the calling driving device moves the camera with a variable specific step value in the moving direction, and acquires the second current focus estimation value after the moving;
- the direction searching step and the climbing step are performed cyclically to obtain a target focus position corresponding to the maximum value of the focus estimation value.
- the focus position indicating the current lens has not passed the target focus position corresponding to the maximum value of the focus estimation value, and may continue along
- the moving direction of the lens moves, the moving direction of the next step of the lens is the same as the current moving direction; conversely, when the acquired current focus estimated value is smaller than the previous focus estimated value, the focus position indicated by the current lens may be The target focus position corresponding to the maximum value of the focus estimation value; or the focus position described by the current lens A local pole has been crossed. Therefore, in this embodiment, it is further required to determine whether the current focus position is only a local pole that has passed.
- a focus estimation threshold is preset, and when it is determined in the direction searching step that the obtained current focus estimation value is smaller than the previous focus estimation value, The previous focus estimation value is compared with a preset focus estimation threshold.
- the previous focus estimation value is greater than or equal to the focus estimation threshold, the previous focus estimation value is not a local pole, indicating that the target focus position has been crossed.
- the moving direction of the next step of the lens is opposite to the current moving direction; otherwise, when the current primary focus estimation value is smaller than the focus estimation threshold, the previous focus estimation value is represented as a local pole, and the current moving direction of the lens is the next One step of moving direction.
- the focus estimation threshold corresponds to a scene corresponding to an object in the shot; wherein the scene is identified by a preset scene recognition algorithm. It is not difficult to understand that in this embodiment, a scene recognition algorithm is preset, and different scenes and focus estimation thresholds are stored in association. Specifically, in this embodiment, the image data of the image data, the change rule of the obtained focus estimation value, and the distribution condition are analyzed by the acquired image data to determine the scene of the current object.
- the previous focus estimation value and the preset are determined.
- the focus estimation threshold is compared.
- the previous focus estimation value is most likely to be a local pole, and the current moving direction of the lens is determined as the moving direction, and vice versa.
- the direction in which the lens moves It can accurately identify the local pole and avoid the problem of oscillation caused by falling into the local pole during the focusing process.
- the specific step value of the next move of the lens corresponds to the current focus estimation value, and is inversely related to the current focus estimation value, that is, when obtained The larger the focus estimation value, the smaller the moving step value of the next step of the lens; conversely, the smaller the focus estimation value obtained, the larger the moving step value of the next step of the lens. It is not difficult to understand that the method described in this embodiment can quickly find the maximum value of the focus estimation value, has high focusing accuracy, and can improve the focusing speed.
- the step size moved by the lens refers to the distance that the lens moves from the focus position corresponding to the current movement to the first stop after the movement.
- the step length is generally expressed by the pulse number of a specific pulse width, so the specific value is related to the relevant parameters of the controller, the driver and the motor used, and the value of the step is still certain.
- the degree determines the real-time and robustness of the algorithm, so it must be determined experimentally according to the actual system composition.
- the general influence of this step on the whole method is that the step size is too small, which causes the autofocus process to take time and serious.
- the step size is too large, which makes it easy to cross the maximum value during the maximum value of the focus estimation. If the distance is too large, the algorithm used in this method cannot converge. Therefore, the correspondence between the next step size of the lens movement and the current focus estimation value is set according to the current actual scene and the relevant parameters of the controller, the driver and the motor used.
- an embodiment of the method according to the embodiment of the present invention further includes the following steps:
- the driving device is called to move the lens to the target focus position.
- the driving device may be a stepping motor that is driven to rotate by a controller or a driver to drive the movement of the lens.
- the step of acquiring a target aggregation position at which the focus estimation value reaches a maximum value based on a preset second rule, and the step of the calling driving device moving the lens to the target focus position are performed in parallel .
- an embodiment of the present invention provides an automatic focus control method for acquiring respective image data of an object at a plurality of different focus positions between a lens and an object; and based on a preset first focus calculation value, Calculating a corresponding focus estimation value for each of the focus positions; then acquiring a target focus position at which the focus estimation value reaches the maximum value based on the preset second rule, and calling the driving device to move the lens to the target focus position .
- the autofocus method according to the embodiment of the invention can realize fast autofocus and solve the problem of low focus precision, and has strong real-time performance, high reliability and practicability.
- the focusing method determines the moving direction of the lens based on the magnitude relationship between the acquired current focus estimation value and the previous focus estimation value when searching for the target focus position where the focus estimation value reaches the maximum value; And invoking the driving device to move the camera with the variable specific step value in the moving direction, and the variable step value corresponds to the current focus estimation value, and is inversely related to the current focus estimation value, That is, the closer to the maximum value of the focus estimation value, the smaller the moving step value of the lens, so that the maximum value of the focus estimation value can be quickly found, the focusing accuracy is high, and the focusing speed can be improved.
- the previous focus estimation value and the preset focus estimation threshold value are used.
- the current primary focus estimation value is smaller than the focus estimation threshold, it is most likely that the previous focus estimation value is a local pole, and the current moving direction of the lens is determined as the moving direction, and vice versa. . It can accurately identify the local pole and avoid the problem of oscillation caused by falling into the local pole during the focusing process.
- the embodiment of the present invention further provides an apparatus using the above auto focus control method.
- the data acquisition module 11 includes an estimated value calculation 12, a focus position acquisition module 13 and Move module 14.
- the device according to the embodiment of the present invention is applied to a camera or a camera having an auto focus function.
- the device according to the embodiment of the present invention can also be applied to a mobile phone, a PAD, a portable multimedia player (PMP), a TV, and the like having a photographing function.
- PMP portable multimedia player
- TV Portable TV
- the embodiment of the present invention is exemplified by a digital camera as an example, but the embodiment does not constitute a limitation on the embodiment of the present invention.
- the specific functions implemented by each module are specifically disclosed below.
- the data acquisition module 11 is configured to acquire each image data of the object at a plurality of different focus positions between the lens and the object.
- the data acquiring module 11 moves the lens through the driving device therein. To get each image data. It is not difficult to understand that the driving device drives the lens to move between the lens and the object, and the unit step of the lens movement, that is, the moving speed, is preset, and the lens is stopped based on a preset time interval, and the data acquiring module 11 can be Obtaining corresponding image data of a current focus position of the lens, if the lens acquires each image data at a plurality of different focus positions, and calculates a corresponding focus estimation value, assuming that the plurality of focus positions include a target focus position, the target focus The position is the focus position at which the focus estimate is maximum, and its plurality of sets of focus estimates and their corresponding focus positions may form a focus profile as described in FIG.
- the driving device of the data acquiring module 11 may be a stepping motor that is driven to rotate by a controller or a driver to drive the movement of the lens. It is not difficult to understand that the preset time interval in the data acquisition module 11 and the unit step value of the initial movement of the lens may be pre-stored in a storage medium, wherein the storage medium may be a synchronous dynamic random access memory (SDRAM), Multi-chip package (MCP) memory or dynamic random access memory (DRAM).
- SDRAM synchronous dynamic random access memory
- MCP Multi-chip package
- DRAM dynamic random access memory
- the step size in which the lens moves in the data acquisition module 11 refers to the distance that the lens moves from the focus position corresponding to the current movement to the first stop after the movement.
- the step length is generally expressed by the pulse number of a specific pulse width, so the specific value is related to the relevant parameters of the controller, the driver and the motor used, and the value of the step is still certain.
- the degree determines the real-time and robustness of the algorithm, so it must be determined experimentally according to the actual system composition.
- the general influence of this step on the whole method is that the step size is too small, which causes the autofocus process to take time and serious. At the beginning of the focus, it is easy to fall into the local pole; but the step size is too large, which makes it easy to cross the maximum value during the maximum value of the focus estimation. If the distance is too large, the algorithm used in this method cannot converge.
- the data acquiring module 11 in this embodiment changes the distance between the lens and the object based on a certain time interval by calling the driving device, and acquires image data of a certain frame image at a focus position corresponding to the distance. Then, the data acquisition module 11 performs image reduction, gamma correction, color filter array difference, color matrix processing, color correction or color enhancement by the image signal processing device to improve image quality and pass high-pass filtering.
- the filter or the band-pass filter filters and denoises to obtain high-frequency component data of the object image data in a certain frequency band.
- the estimated value calculation module 12 is configured to calculate a correspondence for each of a plurality of focus positions based on each image data acquired by the foregoing data acquisition module 11 and a preset first calculation rule. Focus estimates.
- the foregoing data acquisition module 11 acquires image data corresponding to a plurality of different focus positions by the driving device moving lens, and the estimated value calculation module 12 is in a plurality of focus positions based on the preset first calculation rule. Each calculates a corresponding focus estimate.
- the preset first calculation rule is preset to be stored in a storage medium, where the storage medium may be a synchronous dynamic random access memory (SDRAM), a multi-chip package (MCP) memory, or a dynamic random access memory. (DRAM).
- SDRAM synchronous dynamic random access memory
- MCP multi-chip package
- DRAM dynamic random access memory
- the focus estimation value refers to a numerical estimation index representing the state of the characteristic portion and the contour portion of the clearly visible image. Therefore, the focus estimation value may calculate the focus estimation value by the edge enhancement of the difference in luminance data between adjacent pixels of the image, or may be calculated according to the gray value of the pixel, the reciprocal of the luminance, the dispersion of the luminance, and the like. Focus on the estimate.
- an algorithm corresponding to calculating a corresponding focus estimation value for each of a plurality of focus positions in the embodiment of the present invention is:
- the x is a horizontal high-frequency component value
- y is a vertical high-frequency component value.
- the algorithm accumulates all the horizontal x and vertical y high-frequency energy values of the current frame image data obtained from the data image to obtain the Focus on the estimate.
- the focus position obtaining module 13 is configured to acquire a target focus position where the focus estimation value reaches a maximum value based on the preset second rule.
- the focus position obtaining module 13 further includes:
- the direction searching unit 131 is configured to determine a moving direction of the lens based on a size relationship between the acquired current focus estimation value and a previous focus estimation value;
- a climbing unit 132 configured to call the driving device to move the camera with a variable specific step value in the moving direction, and acquire a second current focus estimation value after the moving;
- the target focus position obtaining unit 133 is configured to cyclically perform a corresponding operation of the direction searching unit and the climbing unit to acquire a target focus position corresponding to the maximum value of the focus estimation value.
- the direction searching unit 131 is further configured to: when the acquired current focus estimation value is greater than or equal to the previous focus estimation value, represent that the focus position of the current lens has not crossed the maximum value of the focus estimation value.
- the corresponding target focus position can also continue to move along the moving direction of the lens, and the moving direction of the next step of the lens is the same as the current moving direction; otherwise, when the acquired current focus estimated value is smaller than the previous focus estimated value
- the focus position characterizing the current shot may have crossed the target focus position corresponding to the maximum value of the focus estimate; or the focus position described by the current lens has crossed a local pole. Therefore, in this embodiment, it is further required to determine whether the current focus position is only a local pole that has passed.
- a focus estimation threshold is preset, and when the direction search unit 131 has determined that the acquired current focus estimation value is smaller than the previous focus estimation value, it needs to be compared.
- the previous focus estimation value is compared with a preset focus estimation threshold.
- the previous focus estimation value is greater than or equal to the focus estimation threshold, the previous focus estimation value is not a local pole, indicating that the target focus has been crossed.
- Position the next moving direction of the lens is opposite to the current moving direction; conversely, when the current primary focus estimation value is smaller than the focus estimation threshold, the previous focus estimation value is represented as a local pole, and the current moving direction of the lens is The next direction of movement.
- the focus estimation threshold corresponds to a scene corresponding to the object acquired in the data acquisition module 11; wherein the scene is identified by a preset scene recognition algorithm. It is not difficult to understand that in this embodiment, a scene recognition algorithm is preset, and different scenes and focus estimation thresholds are stored in association.
- the image data acquired by the data acquiring module 11 may be used, and the direction searching unit 131 analyzes the light intensity information of the image data, the variation law and the distribution of the obtained focus estimation values, to determine the field of the current object. view.
- the autofocus device in the process of determining the lens moving direction by the direction searching unit 131, when the acquired current focus estimation value is smaller than the previous focus estimation value, the previous focus is The estimated value is compared with a preset focus estimation threshold.
- the previous focus estimation value is most likely to be a local pole, and the current moving direction of the lens is determined as the movement.
- Direction and vice versa, change the direction in which the lens moves. That is to say, the device can recognize the local pole more accurately, and avoids the problem that the local pole is oscillated during the focusing process.
- the stepping unit 132 is also required to synchronously determine the moving step of the next step of the lens, and the target focus position acquiring unit 133 cyclically invokes the direction searching unit 131 and The climbing unit 132 performs a corresponding operation until the target focus position corresponding to the maximum value of the focus estimation value is acquired.
- the specific step value of the next movement of the lens determined by the climbing unit 132 corresponds to the current focus estimation value, and is opposite to the current focus estimation value. Correlation, that is, when the obtained focus estimation value is larger, the moving step value of the next step of the lens is smaller; conversely, when the obtained focus estimation value is smaller, the moving step value of the next step of the lens is larger. It is not difficult to understand that this embodiment can quickly find the maximum value of the focus estimation value, has high focusing accuracy, and can improve the focusing speed.
- the step size in which the lens moves in the climbing unit 132 refers to the distance moved by the lens from the focus position corresponding to the current movement to the first stop after the movement.
- the step length is generally expressed by the pulse number of a specific pulse width, so the specific value is related to the relevant parameters of the controller, the driver and the motor used, and the value of the step is still certain.
- the degree determines the real-time and robustness of the algorithm, so it must be determined experimentally according to the actual system composition.
- the general influence of this step on the whole method is that the step size is too small, which causes the autofocus process to take time and serious.
- the step size is too large, which makes it easy to cross the maximum value during the maximum value of the focus estimation. If the distance is too large, the algorithm used in this method cannot converge. Therefore, the correspondence between the next step size of the lens movement in the climbing unit 132 and the current focus estimation value is set according to the current actual scene and the relevant parameters of the controller, the driver and the motor used.
- the moving module 14 is configured to invoke a driving device to move the lens to the target focus position.
- the movement module 14 calls the driving device to move the lens to the target focus position.
- the driving device may be a stepping motor that is driven to rotate by a controller or a driver to drive the movement of the lens.
- the data acquisition module 13 and the mobile module 14 perform corresponding operations in parallel.
- the embodiment of the present invention provides an automatic focus control device, where the data acquisition module 11 acquires respective image data of an object at a plurality of different focus positions between the lens and the object; the estimated value calculation module 12 Calculating a corresponding focus estimate for each of each focus position based on a first calculation rule of the preset focus estimate The focus position acquisition module 13 then acquires the target focus position at which the focus estimation value reaches the maximum value based on the preset second rule, and the movement module 14 invokes the driving device to move the lens to the target focus position.
- the autofocus device according to the embodiment of the invention can realize fast autofocus and solve the problem of low focus precision, and has strong real-time performance, high reliability and practicability.
- the focusing method determines the moving direction of the lens based on the magnitude relationship between the acquired current focus estimation value and the previous focus estimation value when searching for the target focus position where the focus estimation value reaches the maximum value; And invoking the driving device to move the camera with the variable specific step value in the moving direction, and the variable step value corresponds to the current focus estimation value, and is inversely related to the current focus estimation value, That is, the closer to the maximum value of the focus estimation value, the smaller the moving step value of the lens, so that the maximum value of the focus estimation value can be quickly found, the focusing accuracy is high, and the focusing speed can be improved.
- the previous focus estimation value and the preset focus estimation threshold value are used.
- the current primary focus estimation value is smaller than the focus estimation threshold, it is most likely that the previous focus estimation value is a local pole, and the current moving direction of the lens is determined as the moving direction, and vice versa. . It can accurately identify the local pole and avoid the problem of oscillation caused by falling into the local pole during the focusing process.
- the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
- modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
- the modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
- any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
- Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
- Embodiments of embodiments of the invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
- a microprocessor or digital signal processor may be used in practice to implement some or all of the functionality of some or all of the components of an asynchronous login device in accordance with an embodiment of the present invention.
- Embodiments of the invention may also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
- a program implementing an embodiment of the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
- FIG. 6 illustrates a terminal device that can implement an auto focus control method according to an embodiment of the present invention.
- the terminal device conventionally includes a processor 610 and a computer program product or computer readable medium in the form of a memory 620.
- the memory 620 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
- Memory 620 has a memory space 630 for program code 631 for performing any of the method steps described above.
- storage space 630 for program code may include various program code 631 for implementing various steps in the above methods, respectively.
- the program code can be read from or written to one or more computer program products.
- Such computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
- Such a computer program product is typically a portable or fixed storage unit as described with reference to FIG.
- the storage unit may have a storage section, a storage space, and the like arranged similarly to the storage 620 in the terminal device of FIG.
- the program code can be compressed, for example, in an appropriate form.
- the storage unit comprises computer readable code 631', ie code that can be read by a processor, such as 610, which when executed by the terminal device causes the terminal device to perform each of the methods described above step.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Studio Devices (AREA)
- Automatic Focus Adjustment (AREA)
- Focusing (AREA)
Abstract
本发明涉及聚焦技术领域,尤其涉及一种自动聚焦控制方法和装置。所述方法包括有步骤:在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;基于获取的各个图像数据及预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值;基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置;调用驱动装置将镜头移动到所述目标聚焦位置。本发明实施例所述的自动聚焦方法,能实现快速自动聚焦及解决聚焦精度不高的问题,具有很强的实时性、很高的可靠性和实用性。
Description
本发明涉及聚焦技术领域,尤其涉及一种自动聚焦控制方法和装置。
由于光电图像传感器CCD和CMOS在图像视频领域的广泛应用,使得数字相机和摄像机在工程应用以及日常生活中已随处可见。无论是数字相机、还是摄像机,其主要功能就是获取清晰的图像,即通过调整镜头聚焦镜片组的位置来使图像的清晰度达到最佳。所以,聚焦技术已成为成像产品的关键,尤其是摄像机。
目前,基于数字图像处理的自动聚焦技术已逐渐取代了基于测距原理的传统自动聚焦方法。基于数字图像处理的自动聚焦技术利用某种数字图像处理算法,获取能判断图像清晰度的聚焦评价值,一般为图像数据的高频分量值,并根据这一评价值,采取一定的算法和策略控制镜头的聚焦电机移动以到达聚焦评价值对应的聚焦位置,获取清晰的图像。但是现有技术中的自动聚焦算法对聚焦电机行程的进行搜索时采用固定步长,不仅由于聚焦速度慢浪费了聚焦时间,且会陷入因局部极点出现震荡的问题。
【发明内容】
本发明实施例的目的旨在解决上述至少一个问题,提供了一种自动聚焦控制方法、及采用该方法的装置。
为实现该目的,本发明实施例采用如下技术方案:
本发明实施例提供了一种自动聚焦控制方法,其包括有步骤:
在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;
基于获取的各个图像数据及预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值;
基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置;
调用驱动装置将镜头移动到所述目标聚焦位置。
依据本发明实施例的另外一个方面,本发明实施例还提供了一种自动聚焦控制装置,其包括有:
数据获取模块,用于在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;
估计值计算模块,用于基于获取的各个图像数据及预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值;
聚焦位置获取模块,用于基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置;
移动模块,用于调用驱动装置将镜头移动到所述目标聚焦位置。
根据本发明实施例的又一个方面,提供了一种计算机程序,其包括计算机可读代码,
当所述计算机可读代码在终端设备上运行时,导致所述终端设备执行上述的任一个自动聚焦控制方法。
根据本发明实施例的再一个方面,提供了一种计算机可读介质,其中存储了执行上述的任一个自动聚焦控制方法的计算机程序。
与现有技术相比,本发明实施例具备如下优点:
本发明实施例提供了一种自动聚焦控制方法,在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;并基于预设的聚焦估计值第一计算规则,为每个聚焦位置中的每一个计算对应的聚焦估计值;然后再基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置,并调用驱动装置将镜头移动到所述目标聚焦位置。本发明实施例所述的自动聚焦方法,能实现快速自动聚焦及解决聚焦精度不高的问题,具有很强的实时性、很高的可靠性和实用性。
本发明实施例附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本发明实施例的实践了解到。
本发明上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:
图1是本发明实施例中自动聚焦控制方法中聚焦曲线图,其示出了聚焦位置和聚焦估计值之间的关系;
图2是本发明实施例中自动聚焦控制方法的一个实施例的程序流程图;
图3是本发明实施例中自动聚焦控制方法的一个实施例的程序流程图;
图4是本发明实施例中自动聚焦控制装置的一个实施例的结构框图;
图5是本发明实施例中自动聚焦控制装置的一个实施例中聚焦位置获取模块的结构框图;
图6是本发明实施例用于执行根据本发明实施例的方法的终端设备的框图;
图7是本发明实施例用于保持或者携带实现根据本发明实施例的方法的程序代码的存储单元。
下面结合附图和示例性实施例对本发明实施例作进一步地描述,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本发明实施例,而不能解释为对本发明实施例的限制。此外,如果已知技术的详细描述对于示出本发明实施例的特征是不必要的,则将其省略。
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本发明实施例的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。应该理
解,当我们称元件被“连接”或“耦接”到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。此外,这里使用的“连接”或“耦接”可以包括无线连接或无线耦接。这里使用的措辞“和/或”包括一个或更多个相关联的列出项的全部或任一单元和全部组合。
本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本发明实施例所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。
需要说明的是,本发明实施例所述方法是应用于相机或摄像机拍摄图像时自动聚焦过程。当然,本发明实施例所述方法也可应用于具有拍摄功能的手机、PAD、便携式多媒体播放器(PMP)、TV等设备。
参见附图2,为本发明实施例自动聚焦控制方法的一个实施例的程序流程图,其包括步骤:
S11,在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据。
需要说明的是,本发明实施例所述的驱动装置驱动镜头在镜头和对象之间移动,且预先设定有镜头移动的单位步长,即移动的速度,且基于一预设的时间间隔停止镜头,获取镜头的当前聚焦位置的对应图像数据,如果镜头在多个不同聚焦位置上获取各个图像数据,并计算其对应的聚焦估计值,假定该多个聚焦位置上包括有目标聚焦位置,该目标聚焦位置为聚焦估计值最大时的聚焦位置,则其多组聚焦估计值及其对应的聚焦位置可形成如图1所述的聚焦曲线图。需要说明的是,所述的驱动装置可以是步进电机,该步进电机受控制器或驱动器来驱动转动,进而来驱动镜头的移动。不难理解,所述预设的时间间隔和镜头初始移动的单位步长值可以预先存储在存储介质中,其中所述存储介质可以是同步动态随机存取存储器(SDRAM)、多芯片封装(MCP)存储器或动态随机存取存储器(DRAM)。
需要说明的是,该镜头所移动的步长是指镜头从当前开始移动时所对应的聚焦位置到移动后第一次停止这期间移动的距离。在实际的操作过程中,该步长一般用特定脉宽的脉冲数来表示,因此具体的数值跟所采用的控制器、驱动器和电机的相关参数有关,同时该步长的取值还在一定程度上决定着算法的实时性和鲁棒性,因此必须按照实际系统构成通过实验来确定,该步长对整个方法的一般影响是:步长太小,导致自动聚焦过程耗时严重,同时在聚焦开始阶段容易陷入局部极点;但是步长过大,导致在聚焦估计值得最大值搜索过程中很容易越过该最大值,如果越过的距离非常大,则导致本方法采用的算法无法收敛。
具体的,本实施例通过调用驱动装置基于一定的时间间隔改变镜头和对象之间的距离,在该距离所对应该的聚焦位置上获取某一帧图像的图像数据。然后,将所述图像数据通过图像信号处理装置执行降噪、伽马校正、色彩滤波阵列差值、色彩矩阵处理、色
彩校正或色彩增强来提高图像质量,并通过高通滤波器或带通滤波器滤波和去噪,可以得到该对象图像数据在一定频带下的高频分量数据。
进一步的,请参见附图2,本发明实施例一个实施例中所述方法还包括步骤:
S12,基于获取的各个图像数据及预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值。
不难理解,前述步骤中通过驱动装置移动镜头获取了对应于多个不同聚焦位置的图像数据,该步骤中基于预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值。其中,所述预设的第一计算规则,预设存储在存储介质中,其中所述存储介质可以是同步动态随机存取存储器(SDRAM)、多芯片封装(MCP)存储器或动态随机存取存储器(DRAM)。
需要说明的是,本发明实施例明所述的“聚焦估计值”是指代表清楚可见图像的特征部分和轮廓部分的状态的数值估计指数。因此,所述聚焦估计值可以通过边沿增强在图像相邻像素间的亮度数据的差别而计算聚焦估计值,或者,也可以根据像素的灰度值、亮度的倒数、亮度的离差等来计算聚焦估计值。
根据本发明实施例的一个实施例所揭示,本发明实施例中为多个聚焦位置中的每一个计算对应的聚焦估计值所对应的算法是:
所述x是指水平高频分量值,y是指垂直高频分量值,本算法是将数据图像所得的当前帧图像数据所有水平x和垂直y的高频能量值进行累加而得到所述的聚焦估计值。
进一步的,请参见附图2,本发明实施例一个实施例中所述方法还包括步骤:
S13,基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置。
具体的,请参见附图3,在本发明实施例的一个实施例中,所述基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置的步骤中,具体包括:
S131,方向查找步骤,基于获取的当前聚焦估计值与前一次聚焦估计值之间的大小关系,确定镜头的移动方向;
S132,爬坡步骤,调用驱动装置在该移动方向下以一可变的特定步长值移动摄像头,并获取移动后的第二当前聚焦估计值;
S133,循环执行该方向查找步骤和爬坡步骤,以获取该聚焦估计值的最大值对应的目标聚焦位置。
具体的,当获取的当前聚焦估计值大于或等于所述前一次聚焦估计值时,表征当前镜头所述的聚焦位置还没有越过聚焦估计值的最大值所对应的目标聚焦位置,还可以继续沿着该镜头的移动方向移动,则镜头下一步的移动方向与当前的移动方向相同;反之,当获取的当前聚焦估计值小于所述前一次聚焦估计值时,表征当前镜头所述的聚焦位置可能已经越过聚焦估计值的最大值对应的目标聚焦位置;或者当前镜头所述的聚焦位置
已越过一个局部极点。因此本实施例中还需要进一步的判断当前的聚焦位置是否只是越过了的局部极点。
具体的,在本发明实施例的一个步骤中,预先设置有聚焦估计阈值,当所述方向查找步骤中已判断得到获取的当前聚焦估计值小于所述前一次聚焦估计值时,还需要比较该前一次聚焦估计值与预设的聚焦估计阈值进行比较,当该前一次聚焦估计值大于或等于所述聚焦估计阈值时,表征该前一次聚焦估计值不是局部极点,说明已越过了目标聚焦位置,则镜头下一步的移动方向与当前的移动方向相反;反之,当前一次聚焦估计值小于所述聚焦估计阈值时,表征所述前一次聚焦估计值为局部极点,则镜头当前移动方向即为下一步的移动方向。
进一步的,在发明的一个实施例中,所述聚焦估计阈值与该镜头中的对象所对应的场景相对应;其中所述场景通过预设的场景识别算法来识别获取。不难理解,本实施例中预先设置有场景识别算法,以及相关联存储有不同场景及聚焦估计阈值。具体的,本实施例中可以通过获取的图像数据,分析该图像数据的光强信息、获得的聚焦估计值的变化规律和分布情况来判断当前对象的场景。
不难理解,本发明实施例所述的聚焦方法,在确定镜头移动方向的过程中,当获取的当前聚焦估计值小于所述前一次聚焦估计值时,对该前一次聚焦估计值与预设的聚焦估计阈值进行比较,当前一次聚焦估计值小于所述聚焦估计阈值时,表征该前一次聚焦估计值极可能为局部极点,将镜头的当前移动方向确定为所述的移动方向,反之才改变镜头移动的方向。能较精确的识别出局部极点,避免了在聚焦过程中陷入局部极点而发生震荡的问题。
进一步的,当在判定镜头下一步的移动方向时,还需要同步判定镜头下一步的移动步长,循环执行该方向查找步骤和爬坡步骤,直到获取该聚焦估计值的最大值对应的目标聚焦位置。具体的,在本发明实施例的一个实施例中,所述镜头下一步移动的特定步长值与所述当前聚焦估计值相对应,且与所述当前聚焦估计值反相关,即当得到的聚焦估计值越大,镜头下一步的移动步长值越小;反之,当得到的聚焦估计值越小,镜头下一步的移动步长值越大。不难理解,该实施例所述方法能快速查找到聚焦估计值的最大值,聚焦精度高,且能提高聚焦速度。
需要说明的是,该镜头所移动的步长是指镜头从当前开始移动时所对应的聚焦位置到移动后第一次停止这期间移动的距离。在实际的操作过程中,该步长一般用特定脉宽的脉冲数来表示,因此具体的数值跟所采用的控制器、驱动器和电机的相关参数有关,同时该步长的取值还在一定程度上决定着算法的实时性和鲁棒性,因此必须按照实际系统构成通过实验来确定,该步长对整个方法的一般影响是:步长太小,导致自动聚焦过程耗时严重,同时在聚焦开始阶段容易陷入局部极点;但是步长过大,导致在聚焦估计值得最大值搜索过程中很容易越过该最大值,如果越过的距离非常大,则导致本方法采用的算法无法收敛。因此,所述镜头移动的下一步步长与当前的聚焦估计值的对应关系,要根据当前的实际场景及采用的控制器、驱动器和电机的相关参数来设定。
进一步的,参见附图2,本发明实施例所述方法的一个实施例中还包括有步骤:
S14,调用驱动装置将镜头移动到所述目标聚焦位置。
不难理解,前述步骤中已通过预设的第二规则获取了聚焦估计值达到最大值的目标聚焦位置;该步骤中调用驱动装置将镜头移动到所述目标聚焦位置。需要说明的是,所述的驱动装置可以是步进电机,该步进电机受控制器或驱动器来驱动转动,进而来驱动镜头的移动。在实际的操作中,所述基于预设的第二规则获取聚焦估计值达到最大值的目标聚集位置的步骤,和所述调用驱动装置将镜头移动到所述目标聚焦位置的步骤是并行执行的。
综上所述,本发明实施例提供了一种自动聚焦控制方法,在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;并基于预设的聚焦估计值第一计算规则,为每个聚焦位置中的每一个计算对应的聚焦估计值;然后再基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置,并调用驱动装置将镜头移动到所述目标聚焦位置。本发明实施例所述的自动聚焦方法,能实现快速自动聚焦及解决聚焦精度不高的问题,具有很强的实时性、很高的可靠性和实用性。
本发明实施例所述的聚焦方法,在搜索聚焦估计值达到最大值的目标聚焦位置时,基于获取的当前聚焦估计值与前一次聚焦估计值之间的大小关系,来确定镜头的移动方向;及调用驱动装置在该移动方向下以一可变的特定步长值移动摄像头,且所述可变的步长值与所述当前聚焦估计值对应,且与所述当前聚焦估计值反相关,即越接近聚焦估计值的最大值,镜头的移动步长值越小,使得能快速查找到聚焦估计值的最大值,聚焦精度高,且能提高聚焦速度。
本发明实施例所述的聚焦方法,在确定镜头移动方向的过程中,当获取的当前聚焦估计值小于所述前一次聚焦估计值时,对该前一次聚焦估计值与预设的聚焦估计阈值进行比较,当前一次聚焦估计值小于所述聚焦估计阈值时,表征该前一次聚焦估计值极可能为局部极点,将镜头的当前移动方向确定为所述的移动方向,反之才改变镜头移动的方向。能较精确的识别出局部极点,避免了在聚焦过程中陷入局部极点而发生震荡的问题。
基于计算机的模块化思维,本发明实施例还提供了一种采用上述自动聚焦控制方法的装置,请参见附图4,其包括有数据获取模块11、估计值计算12、聚焦位置获取模块13和移动模块14。需要说明的是,本发明实施例所述装置是应用于具备自动聚焦功能的相机或摄像机。当然,本发明实施例所述装置也可应用于具有拍摄功能的手机、PAD、便携式多媒体播放器(PMP)、TV等设备。为方便说明,本发明实施例实施例以数字摄像机为例来示例性说明其具体实施方式,但是该实施例并不能构成对本发明实施例的限制。以下具体揭示各模块实现的具体功能。
所述数据获取模块11,用于在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据。
需要说明的是,本发明实施例所述的数据获取模块11通过其中的驱动装置移动镜头
来获取各个图像数据。不难理解,驱动装置驱动镜头在镜头和对象之间移动,且预先设定有镜头移动的单位步长,即移动的速度,且基于一预设的时间间隔停止镜头,数据获取模块11即可获取镜头的当前聚焦位置的对应图像数据,如果镜头在多个不同聚焦位置上获取各个图像数据,并计算其对应的聚焦估计值,假定该多个聚焦位置上包括有目标聚焦位置,该目标聚焦位置为聚焦估计值最大时的聚焦位置,则其多组聚焦估计值及其对应的聚焦位置可形成如图1所述的聚焦曲线图。需要说明的是,所述数据获取模块11的驱动装置可以是步进电机,该步进电机受控制器或驱动器来驱动转动,进而来驱动镜头的移动。不难理解,所述数据获取模块11中预设的时间间隔和镜头初始移动的单位步长值可以预先存储在存储介质中,其中所述存储介质可以是同步动态随机存取存储器(SDRAM)、多芯片封装(MCP)存储器或动态随机存取存储器(DRAM)。
需要说明的是,所述数据获取模块11中镜头所移动的步长是指镜头从当前开始移动时所对应的聚焦位置到移动后第一次停止这期间移动的距离。在实际的操作过程中,该步长一般用特定脉宽的脉冲数来表示,因此具体的数值跟所采用的控制器、驱动器和电机的相关参数有关,同时该步长的取值还在一定程度上决定着算法的实时性和鲁棒性,因此必须按照实际系统构成通过实验来确定,该步长对整个方法的一般影响是:步长太小,导致自动聚焦过程耗时严重,同时在聚焦开始阶段容易陷入局部极点;但是步长过大,导致在聚焦估计值得最大值搜索过程中很容易越过该最大值,如果越过的距离非常大,则导致本方法采用的算法无法收敛。
具体的,本实施例所述数据获取模块11通过调用驱动装置基于一定的时间间隔改变镜头和对象之间的距离,在该距离所对应该的聚焦位置上获取某一帧图像的图像数据。然后,所述数据获取模块11将所述图像数据通过图像信号处理装置执行降噪、伽马校正、色彩滤波阵列差值、色彩矩阵处理、色彩校正或色彩增强来提高图像质量,并通过高通滤波器或带通滤波器滤波和去噪,可以得到该对象图像数据在一定频带下的高频分量数据。
进一步的,请参见附图4,所述估计值计算模块12,用于基于前述数据获取模块11获取的各个图像数据及预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值。
不难理解,前述数据获取模块11通过驱动装置移动镜头获取了对应于多个不同聚焦位置的图像数据,所述估计值计算模块12基于预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值。其中,所述预设的第一计算规则,预设存储在存储介质中,其中所述存储介质可以是同步动态随机存取存储器(SDRAM)、多芯片封装(MCP)存储器或动态随机存取存储器(DRAM)。
需要说明的是,本发明实施例明所述的“聚焦估计值”是指代表清楚可见图像的特征部分和轮廓部分的状态的数值估计指数。因此,所述聚焦估计值可以通过边沿增强在图像相邻像素间的亮度数据的差别而计算聚焦估计值,或者,也可以根据像素的灰度值、亮度的倒数、亮度的离差等来计算聚焦估计值。
根据本发明实施例的一个实施例所揭示,本发明实施例中为多个聚焦位置中的每一个计算对应的聚焦估计值所对应的算法是:
所述x是指水平高频分量值,y是指垂直高频分量值,本算法是将数据图像所得的当前帧图像数据所有水平x和垂直y的高频能量值进行累加而得到所述的聚焦估计值。
进一步的,请参见附图4,所述聚焦位置获取模块13,用于基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置。
具体的,请参见附图5,在本发明实施例的一个实施例中,所述聚焦位置获取模块13,还包括有:
方向查找单元131,用于基于获取的当前聚焦估计值与前一次聚焦估计值之间的大小关系,确定镜头的移动方向;
爬坡单元132,用于调用驱动装置在该移动方向下以一可变的特定步长值移动摄像头,并获取移动后的第二当前聚焦估计值;
目标聚焦位置获取单元133,用于循环执行该方向查找单元和爬坡单元的相应操作,以获取该聚焦估计值的最大值对应的目标聚焦位置。
具体的,所述方向查找单元131,还用于当获取的当前聚焦估计值大于或等于所述前一次聚焦估计值时,表征当前镜头所述的聚焦位置还没有越过聚焦估计值的最大值所对应的目标聚焦位置,还可以继续沿着该镜头的移动方向移动,则镜头下一步的移动方向与当前的移动方向相同;反之,当获取的当前聚焦估计值小于所述前一次聚焦估计值时,表征当前镜头所述的聚焦位置可能已经越过聚焦估计值的最大值对应的目标聚焦位置;或者当前镜头所述的聚焦位置已越过一个局部极点。因此本实施例中还需要进一步的判断当前的聚焦位置是否只是越过了的局部极点。
具体的,在本发明实施例的一个实施例中,预先设置有聚焦估计阈值,当所述方向查找单元131已判断得到获取的当前聚焦估计值小于所述前一次聚焦估计值时,还需要比较该前一次聚焦估计值与预设的聚焦估计阈值进行比较,当该前一次聚焦估计值大于或等于所述聚焦估计阈值时,表征该前一次聚焦估计值不是局部极点,说明已越过了目标聚焦位置,则镜头下一步的移动方向与当前的移动方向相反;反之,当前一次聚焦估计值小于所述聚焦估计阈值时,表征所述前一次聚焦估计值为局部极点,则镜头当前移动方向即为下一步的移动方向。
进一步的,在发明的一个实施例中,所述聚焦估计阈值与数据获取模块11中获取的对象所对应的场景相对应;其中所述场景通过预设的场景识别算法来识别获取。不难理解,本实施例中预先设置有场景识别算法,以及相关联存储有不同场景及聚焦估计阈值。具体的,本实施例中可以通过数据获取模块11获取的图像数据,方向查找单元131分析该图像数据的光强信息、获得的聚焦估计值的变化规律和分布情况来判断当前对象的场
景。
不难理解,本发明实施例所述的自动聚焦装置,在方向查找单元131确定镜头移动方向的过程中,当获取的当前聚焦估计值小于所述前一次聚焦估计值时,对该前一次聚焦估计值与预设的聚焦估计阈值进行比较,当前一次聚焦估计值小于所述聚焦估计阈值时,表征该前一次聚焦估计值极可能为局部极点,将镜头的当前移动方向确定为所述的移动方向,反之才改变镜头移动的方向。即本装置能较精确的识别出局部极点,避免了在聚焦过程中陷入局部极点而发生震荡的问题。
进一步的,当方向查找单元131在判定镜头下一步的移动方向时,还需要采用爬坡单元132同步判定镜头下一步的移动步长,目标聚焦位置获取单元133循环调用所述方向查找单元131和爬坡单元132执行相应操作,直到获取该聚焦估计值的最大值对应的目标聚焦位置。
具体的,在本发明实施例的一个实施例中,所述爬坡单元132确定的镜头下一步移动的特定步长值与所述当前聚焦估计值相对应,且与所述当前聚焦估计值反相关,即当得到的聚焦估计值越大,镜头下一步的移动步长值越小;反之,当得到的聚焦估计值越小,镜头下一步的移动步长值越大。不难理解,该实施例能快速查找到聚焦估计值的最大值,聚焦精度高,且能提高聚焦速度。
需要说明的是,该爬坡单元132中镜头所移动的步长是指镜头从当前开始移动时所对应的聚焦位置到移动后第一次停止这期间移动的距离。在实际的操作过程中,该步长一般用特定脉宽的脉冲数来表示,因此具体的数值跟所采用的控制器、驱动器和电机的相关参数有关,同时该步长的取值还在一定程度上决定着算法的实时性和鲁棒性,因此必须按照实际系统构成通过实验来确定,该步长对整个方法的一般影响是:步长太小,导致自动聚焦过程耗时严重,同时在聚焦开始阶段容易陷入局部极点;但是步长过大,导致在聚焦估计值得最大值搜索过程中很容易越过该最大值,如果越过的距离非常大,则导致本方法采用的算法无法收敛。因此,所述爬坡单元132中镜头移动的下一步步长与当前的聚焦估计值的对应关系,要根据当前的实际场景及采用的控制器、驱动器和电机的相关参数来设定。
进一步的,参见附图4,所述移动模块14,用于调用驱动装置将镜头移动到所述目标聚焦位置。
不难理解,前述聚焦位置获取模块13中已通过预设的第二规则获取了聚焦估计值达到最大值的目标聚焦位置;该移动模块14调用驱动装置将镜头移动到所述目标聚焦位置。需要说明的是,所述的驱动装置可以是步进电机,该步进电机受控制器或驱动器来驱动转动,进而来驱动镜头的移动。在实际的操作中,所述数据获取模块13和移动模块14并行执行对应的操作。
综上所述,本发明实施例提供了一种自动聚焦控制装置,所述数据获取模块11在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;所述估计值计算模块12基于预设的聚焦估计值第一计算规则,为每个聚焦位置中的每一个计算对应的聚焦估计
值;然后所述聚焦位置获取模块13再基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置,所述移动模块14调用驱动装置将镜头移动到所述目标聚焦位置。本发明实施例所述的自动聚焦装置,能实现快速自动聚焦及解决聚焦精度不高的问题,具有很强的实时性、很高的可靠性和实用性。
本发明实施例所述的聚焦方法,在搜索聚焦估计值达到最大值的目标聚焦位置时,基于获取的当前聚焦估计值与前一次聚焦估计值之间的大小关系,来确定镜头的移动方向;及调用驱动装置在该移动方向下以一可变的特定步长值移动摄像头,且所述可变的步长值与所述当前聚焦估计值对应,且与所述当前聚焦估计值反相关,即越接近聚焦估计值的最大值,镜头的移动步长值越小,使得能快速查找到聚焦估计值的最大值,聚焦精度高,且能提高聚焦速度。
本发明实施例所述的聚焦方法,在确定镜头移动方向的过程中,当获取的当前聚焦估计值小于所述前一次聚焦估计值时,对该前一次聚焦估计值与预设的聚焦估计阈值进行比较,当前一次聚焦估计值小于所述聚焦估计阈值时,表征该前一次聚焦估计值极可能为局部极点,将镜头的当前移动方向确定为所述的移动方向,反之才改变镜头移动的方向。能较精确的识别出局部极点,避免了在聚焦过程中陷入局部极点而发生震荡的问题。
在此处所提供的说明书中,虽然说明了大量的具体细节。然而,能够理解,本发明实施例的实施例可以在没有这些具体细节的情况下实践。在一些实施例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
虽然上面已经示出了本发明实施例的一些示例性实施例,但是本领域的技术人员将理解,在不脱离本发明实施例的原理或精神的情况下,可以对这些示例性实施例做出改变,本发明实施例的范围由权利要求及其等同物限定。
对于装置实施方式而言,由于其与方法实施方式基本相似,所以描述的比较简单,相关之处参见方法实施方式的部分说明即可。
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明实施例也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明实施例的内容,并且上面对特定语言所做的描述是为了披露本发明实施例的最佳实施方式。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明实施例的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明实施例的示例性实施例的描述中,本发明实施例的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明实施例要求比在每个权利要求中所明确记载的特征更多
的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明实施例的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明实施例的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本发明实施例的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例实施例的异步登录设备中的一些或者全部部件的一些或者全部功能。本发明实施例还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明实施例的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
例如,图6示出了可以实现根据本发明实施例的一种自动聚焦控制方法的终端设备。该终端设备传统上包括处理器610和以存储器620形式的计算机程序产品或者计算机可读介质。存储器620可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器620具有用于执行上述方法中的任何方法步骤的程序代码631的存储空间630。例如,用于程序代码的存储空间630可以包括分别用于实现上面的方法中的各种步骤的各个程序代码631。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图7所述的便携式或者固定存储单元。该存储单元可以具有与图6的终端设备中的存储器620类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括计算机可读代码631’,即可以由例如诸如610之类的处理器读取的代码,这些代码当由终端设备运行时,导致该终端设备执行上面所描述的方法中的各个步骤。
应该注意的是上述实施例对本发明实施例进行说明而不是对本发明实施例进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明实施例可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明实施例的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明实施例的范围,对本发明实施例所做的公开是说明性的,而非限制性的,本发明实施例的范围由所附权利要求书限定。
Claims (12)
- 一种自动聚焦控制方法,其特征在于,包括有步骤:在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;基于获取的各个图像数据及预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值;基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置;调用驱动装置将镜头移动到所述目标聚焦位置。
- 根据权利要求1所述的方法,其特征在于,所述基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置的步骤,包括:方向查找步骤,基于获取的当前聚焦估计值与前一次聚焦估计值之间的大小关系,确定镜头的移动方向;爬坡步骤,调用驱动装置在该移动方向下以一可变的特定步长值移动摄像头,并获取移动后的第二当前聚焦估计值;循环执行该方向查找步骤和爬坡步骤,以获取该聚焦估计值的最大值对应的目标聚焦位置。
- 根据权利要求2所述的方法,其特征在于:所述可变的特定步长值与所述当前聚焦估计值对应,且与所述当前聚焦估计值反相关。
- 根据权利要求2所述的方法,其特征在于,所述基于获取的当前聚焦估计值与前一次聚焦估计值之间的大小关系,确定镜头的移动方向的步骤,包括:当获取的当前聚焦估计值大于所述前一次聚焦估计值时,确定镜头的当前移动方向为所述的移动方向;反之,当获取的当前聚焦估计值小于所述前一次聚焦估计值时,将与镜头的当前移动方向相反的方向确定为所述的移动方向。
- 根据权利要求4所述的方法,其特征在于,所述当获取的当前聚焦估计值小于所述前一次聚焦估计值时,将与镜头的当前移动方向相反的方向确定为所述的移动方向的步骤中,还包括:当获取的当前聚焦估计值小于所述前一次聚焦估计值时,对该前一次聚焦估计值与预设的聚焦估计阈值进行比较;当前一次聚焦估计值大于或等于所述聚焦估计阈值时,将与镜头的当前移动方向相反的方向确定为所述的移动方向;反之,当前一次聚焦估计值小于所述聚焦估计阈值时,将镜头的当前移动方向确定为所述的移动方向。
- 根据权利要求5所述的方法,其特征在于:所述聚焦估计阈值与该镜头中的对象所对应的场景相对应;其中所述场景通过预设的场景识别算法来识别获得。
- 根据权利要求1所述的方法,其特征在于,所述在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据的步骤,还包括:调用驱动装置改变镜头和对象间的距离,在该距离所对应的聚焦位置上获取所述各个图像数据。
- 根据权利要求7所述的方法,其特征在于,所述调用驱动装置改变镜头和对象间的距离的步骤中,还包括:调用驱动装置基于一定的时间间隔改变镜头和对象间的距离。
- 根据权利要求1所述的方法,其特征在于,所述在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据的步骤,包括:在镜头和对象之间多个不同聚焦位置上,获取该对象在一定频带下的各个图像数据。
- 一种自动聚焦控制装置,其特征在于,包括有:数据获取模块,用于在镜头和对象之间多个不同聚焦位置上获取对象的各个图像数据;估计值计算模块,用于基于获取的各个图像数据及预设的第一计算规则,为多个聚焦位置中的每一个计算对应的聚焦估计值;聚焦位置获取模块,用于基于预设的第二规则获取聚焦估计值达到最大值的目标聚焦位置;移动模块,用于调用驱动装置将镜头移动到所述目标聚焦位置。
- 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在终端设备上运行时,导致所述终端设备执行根据权利要求1-9中的任一个所述的自动聚焦控制方法。
- 一种计算机可读介质,其中存储了如权利要求11所述的计算机程序。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510981262.5A CN105430277B (zh) | 2015-12-23 | 2015-12-23 | 自动聚焦控制方法和装置 |
CN201510981262.5 | 2015-12-23 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017107840A1 true WO2017107840A1 (zh) | 2017-06-29 |
Family
ID=55508180
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/110128 WO2017107840A1 (zh) | 2015-12-23 | 2016-12-15 | 自动聚焦控制方法和装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105430277B (zh) |
WO (1) | WO2017107840A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114302053A (zh) * | 2021-11-24 | 2022-04-08 | 影石创新科技股份有限公司 | 摄像设备的镜头对焦方法、装置、摄像设备及存储介质 |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105430277B (zh) * | 2015-12-23 | 2019-08-20 | 北京奇虎科技有限公司 | 自动聚焦控制方法和装置 |
CN106603922A (zh) * | 2016-12-23 | 2017-04-26 | 信利光电股份有限公司 | 一种距离可调的虹膜识别模组及系统 |
CN109379582A (zh) * | 2018-10-29 | 2019-02-22 | 信利光电股份有限公司 | 一种定焦摄像模组的检测方法、装置、设备及存储介质 |
CN114697531A (zh) * | 2020-12-30 | 2022-07-01 | 深圳中科飞测科技股份有限公司 | 聚焦方法及系统、设备和存储介质 |
CN113556470B (zh) * | 2021-09-18 | 2021-12-31 | 浙江宇视科技有限公司 | 一种镜头的调焦方法、装置、计算机设备和存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2010049005A1 (en) * | 2008-10-31 | 2010-05-06 | Hewlett-Packard Development Company, L.P. | A method and digital imaging appliance for selecting a focus setting with a normalized figure-of-merit |
CN101790043A (zh) * | 2009-01-22 | 2010-07-28 | 华为终端有限公司 | 一种自动聚焦控制的方法及其装置 |
CN102253569A (zh) * | 2011-01-17 | 2011-11-23 | 深圳市保千里电子有限公司 | 一种摄像机聚焦的方法及装置 |
CN104580917A (zh) * | 2015-01-29 | 2015-04-29 | 广东本致科技有限公司 | 一种快速自动聚焦方法及装置 |
CN105049723A (zh) * | 2015-07-13 | 2015-11-11 | 南京工程学院 | 基于离焦量差异定性分析的自动对焦方法 |
CN105430277A (zh) * | 2015-12-23 | 2016-03-23 | 北京奇虎科技有限公司 | 自动聚焦控制方法和装置 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103048766B (zh) * | 2013-01-24 | 2015-07-22 | 华为技术有限公司 | 自动聚焦方法和装置 |
-
2015
- 2015-12-23 CN CN201510981262.5A patent/CN105430277B/zh not_active Expired - Fee Related
-
2016
- 2016-12-15 WO PCT/CN2016/110128 patent/WO2017107840A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2010049005A1 (en) * | 2008-10-31 | 2010-05-06 | Hewlett-Packard Development Company, L.P. | A method and digital imaging appliance for selecting a focus setting with a normalized figure-of-merit |
CN101790043A (zh) * | 2009-01-22 | 2010-07-28 | 华为终端有限公司 | 一种自动聚焦控制的方法及其装置 |
CN102253569A (zh) * | 2011-01-17 | 2011-11-23 | 深圳市保千里电子有限公司 | 一种摄像机聚焦的方法及装置 |
CN104580917A (zh) * | 2015-01-29 | 2015-04-29 | 广东本致科技有限公司 | 一种快速自动聚焦方法及装置 |
CN105049723A (zh) * | 2015-07-13 | 2015-11-11 | 南京工程学院 | 基于离焦量差异定性分析的自动对焦方法 |
CN105430277A (zh) * | 2015-12-23 | 2016-03-23 | 北京奇虎科技有限公司 | 自动聚焦控制方法和装置 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114302053A (zh) * | 2021-11-24 | 2022-04-08 | 影石创新科技股份有限公司 | 摄像设备的镜头对焦方法、装置、摄像设备及存储介质 |
CN114302053B (zh) * | 2021-11-24 | 2023-12-05 | 影石创新科技股份有限公司 | 摄像设备的镜头对焦方法、装置、摄像设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN105430277A (zh) | 2016-03-23 |
CN105430277B (zh) | 2019-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017107839A1 (zh) | 摄像头快速自动聚焦方法及装置 | |
WO2017107841A1 (zh) | 摄像头自动聚焦控制方法及装置 | |
WO2017107840A1 (zh) | 自动聚焦控制方法和装置 | |
WO2020259179A1 (zh) | 对焦方法、电子设备和计算机可读存储介质 | |
WO2016049889A1 (zh) | 一种自动对焦方法、装置及电子设备 | |
US9066002B2 (en) | System and method for utilizing enhanced scene detection in a depth estimation procedure | |
US20170064184A1 (en) | Focusing system and method | |
JP5453573B2 (ja) | 撮像装置、撮像方法およびプログラム | |
WO2017107770A1 (zh) | 变倍跟踪曲线的校正方法和装置 | |
JP2004077959A (ja) | 焦点調節方法およびカメラ | |
CA2796543C (en) | System and method for performing depth estimation utilizing defocused pillbox images | |
JP5392198B2 (ja) | 測距装置及び撮像装置 | |
JP2004325517A (ja) | 撮像装置 | |
CN112261292B (zh) | 图像获取方法、终端、芯片及存储介质 | |
EP3213502B1 (en) | Time extension for image frame processing | |
JP2016197202A (ja) | 焦点調節装置、その制御方法、および制御プログラム、並びに撮像装置 | |
US20130141537A1 (en) | Methodology For Performing Depth Estimation With Defocused Images Under Extreme Lighting Conditions | |
US20160142616A1 (en) | Direction aware autofocus | |
JP5873336B2 (ja) | 焦点調節装置 | |
US8994846B2 (en) | Image processing apparatus and image processing method for detecting displacement between images having different in-focus positions | |
JP2019083580A (ja) | 画像処理装置、画像処理方法、プログラム | |
WO2017097009A1 (zh) | 自动聚焦 | |
WO2021207945A1 (zh) | 对焦控制方法、装置、设备、可移动平台和存储介质 | |
US11115582B2 (en) | Imaging control apparatus, imaging apparatus, and recording medium | |
TWI637210B (zh) | 影像擷取裝置及其快速對焦方法 |
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: 16877651 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: 16877651 Country of ref document: EP Kind code of ref document: A1 |