CN106534666A - Phase focusing method, device and terminal equipment - Google Patents
Phase focusing method, device and terminal equipment Download PDFInfo
- Publication number
- CN106534666A CN106534666A CN201610887611.1A CN201610887611A CN106534666A CN 106534666 A CN106534666 A CN 106534666A CN 201610887611 A CN201610887611 A CN 201610887611A CN 106534666 A CN106534666 A CN 106534666A
- Authority
- CN
- China
- Prior art keywords
- contrast
- scene
- image
- frame
- image frame
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
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
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Automatic Focus Adjustment (AREA)
- Studio Devices (AREA)
- Focusing (AREA)
Abstract
本申请公开了一种相位对焦方法、装置及终端设备。其中,该方法包括:在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值;如果相位检测数据的差值小于门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度;根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧;根据目标图像帧的合焦位置相应的调整镜头位置。通过本申请实施例,能够保证对焦的准确性,提高了对焦的速度。
The present application discloses a phase focusing method, device and terminal equipment. The method includes: during the phase focusing process, determining whether the difference of the phase detection data is less than a preset threshold value; if the difference of the phase detection data is less than the threshold value, performing image acquisition at a preset frequency and obtaining the scene contrast of each frame of the image; determining the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of the image; and adjusting the lens position accordingly according to the in-focus position of the target image frame. Through the embodiments of the present application, the accuracy of focusing can be guaranteed and the speed of focusing can be improved.
Description
技术领域technical field
本申请涉及成像技术领域,尤其涉及一种相位对焦方法、装置及终端设备。The present application relates to the field of imaging technology, and in particular to a phase focusing method, device and terminal equipment.
背景技术Background technique
随着终端设备的发展,是否配置拍照功能成为用户选择终端设备一个主要因素。用户对终端设备的拍照功能要求也越来越高,即能够快速得到清晰图像。With the development of terminal equipment, whether to configure the camera function has become a major factor for users to choose terminal equipment. Users also have higher and higher requirements for the camera function of terminal equipment, that is, they can quickly obtain clear images.
相位对焦由于其速度快,使用越来越多。然而,由于采集相位像素点容易受到躁点,外部光线不稳定等影响,导致相位数据输出不稳定,有时计算出的失焦位置不稳定,最终导致对焦过程变慢且准确性低。Phase focusing is used more and more because of its speed. However, because the acquisition phase pixels are easily affected by noise, unstable external light, etc., the phase data output is unstable, and sometimes the calculated out-of-focus position is unstable, which eventually leads to a slow and inaccurate focusing process.
发明内容Contents of the invention
本申请旨在至少在一定程度上解决相关技术中的技术问题之一。This application aims to solve one of the technical problems in the related art at least to a certain extent.
为此,本申请的一个目的在于提出一种相位对焦方法,该方法能够保证对焦的准确性,提高了对焦的速度。Therefore, an object of the present application is to propose a phase focusing method, which can ensure the accuracy of focusing and improve the speed of focusing.
本申请的第一个目的在于提出了一种相位对焦方法。The first purpose of the present application is to propose a phase focusing method.
本申请的第二个目的在于提出了一种相位对焦装置。The second purpose of the present application is to propose a phase focusing device.
本申请的第三个目的在于提出了一种终端设备。The third purpose of the present application is to provide a terminal device.
本申请的第四个目的在于提出了一种非临时性计算机可读存储介质。The fourth objective of the present application is to provide a non-transitory computer-readable storage medium.
本申请的第五个目的在于提出了一种计算机程序产品。The fifth object of the present application is to provide a computer program product.
为达上述目的,根据本申请第一方面实施例提出的一种相位对焦方法,包括以下步骤:To achieve the above purpose, a phase focusing method proposed according to the embodiment of the first aspect of the present application includes the following steps:
在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值;During the phase focusing process, it is judged whether the difference of the phase detection data is smaller than a preset threshold value;
如果所述相位检测数据的差值小于所述门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度;If the difference of the phase detection data is less than the threshold value, image acquisition is performed according to a preset frequency, and the scene contrast of each frame of image is acquired;
根据所述每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧;Determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image;
根据所述目标图像帧的合焦位置相应的调整镜头位置。The lens position is adjusted accordingly according to the in-focus position of the target image frame.
本申请实施例的相位对焦方法,首先在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值,接着在相位检测数据的差值小于门限值时按照预设频率进行图像采集,并获取每帧图像的场景对比度,然后根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。由此,能够保证对焦的准确性,提高了对焦的速度。In the phase focusing method of the embodiment of the present application, firstly, during the phase focusing process, it is judged whether the difference of the phase detection data is less than the preset threshold value, and then the phase detection data difference is less than the threshold value, and then it is performed according to the preset frequency. Image acquisition, and obtain the scene contrast of each frame of image, then determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image, and finally adjust the lens position according to the in-focus position of the target image frame. Therefore, the accuracy of focusing can be ensured, and the speed of focusing can be improved.
为达上述目的,根据本申请第一方面实施例提出的一种相位对焦装置,包括:To achieve the above purpose, a phase focusing device proposed according to the embodiment of the first aspect of the present application includes:
判断模块,用于在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值;A judging module, configured to judge whether the difference of the phase detection data is less than a preset threshold value during the phase focusing process;
采集模块,用于在所述相位检测数据的差值小于所述门限值时,按照预设频率进行图像采集;An acquisition module, configured to perform image acquisition according to a preset frequency when the difference of the phase detection data is less than the threshold value;
获取模块,用于获取每帧图像的场景对比度;An acquisition module, configured to acquire the scene contrast of each frame of image;
确定模块,用于根据所述每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧;A determining module, configured to determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image;
调整模块,用于根据所述目标图像帧的合焦位置相应的调整镜头位置。The adjustment module is configured to adjust the lens position correspondingly according to the in-focus position of the target image frame.
本申请实施例的相位对焦装置,首先在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值,接着在相位检测数据的差值小于门限值时按照预设频率进行图像采集,并获取每帧图像的场景对比度,然后根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。由此,能够保证对焦的准确性,提高了对焦的速度。In the phase focusing device of the embodiment of the present application, firstly, during the phase focusing process, it is judged whether the difference of the phase detection data is less than the preset threshold value, and then the phase detection data difference is smaller than the threshold value, and then the phase focusing is performed according to the preset frequency. Image acquisition, and obtain the scene contrast of each frame of image, then determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image, and finally adjust the lens position according to the in-focus position of the target image frame. Therefore, the accuracy of focusing can be ensured, and the speed of focusing can be improved.
为达上述目的,根据本申请第三方面实施例提出的一种终端设备,包括:壳体、处理器、存储器、电路板和电源电路,其中,所述电路板安置在所述壳体围成的空间内部,所述处理器和所述存储器设置在所述电路板上;所述电源电路,用于为终端设备的各个电路或器件供电;所述存储器用于存储可执行程序代码;所述处理器通过读取所述存储器中存储的可执行程序代码来运行与所述可执行程序代码对应的程序,以用于执行以下步骤:To achieve the above purpose, a terminal device according to the embodiment of the third aspect of the present application includes: a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is arranged in the housing to form a Inside the space, the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to each circuit or device of the terminal device; the memory is used to store executable program codes; the The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to perform the following steps:
在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值;During the phase focusing process, it is judged whether the difference of the phase detection data is smaller than a preset threshold value;
如果所述相位检测数据的差值小于所述门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度;If the difference of the phase detection data is less than the threshold value, image acquisition is performed according to a preset frequency, and the scene contrast of each frame of image is obtained;
根据所述每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧;Determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image;
根据所述目标图像帧的合焦位置相应的调整镜头位置。The lens position is adjusted accordingly according to the in-focus position of the target image frame.
本申请实施例的终端设备,首先在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值,接着在相位检测数据的差值小于门限值时按照预设频率进行图像采集,并获取每帧图像的场景对比度,然后根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。由此,能够保证对焦的准确性,提高了对焦的速度。The terminal device of the embodiment of the present application firstly determines whether the difference of the phase detection data is less than the preset threshold value during the phase focusing process, and then performs image processing according to the preset frequency when the difference of the phase detection data is less than the threshold value. Collect and obtain the scene contrast of each frame of image, then determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image, and finally adjust the lens position correspondingly according to the in-focus position of the target image frame. Therefore, the accuracy of focusing can be ensured, and the speed of focusing can be improved.
为达上述目的,根据本申请第四方面实施例提出的一种非临时性计算机可读存储介质,当所述存储介质中的指令由移动终端的处理器被执行时,使得移动终端能够执行一种相位对焦方法,所述方法包括:To achieve the above purpose, a non-transitory computer-readable storage medium is proposed according to the embodiment of the fourth aspect of the present application. When the instructions in the storage medium are executed by the processor of the mobile terminal, the mobile terminal can execute a A phase focusing method, said method comprising:
在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值;During the phase focusing process, it is judged whether the difference of the phase detection data is smaller than a preset threshold value;
如果所述相位检测数据的差值小于所述门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度;If the difference of the phase detection data is less than the threshold value, image acquisition is performed according to a preset frequency, and the scene contrast of each frame of image is obtained;
根据所述每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧;Determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image;
根据所述目标图像帧的合焦位置相应的调整镜头位置。The lens position is adjusted accordingly according to the in-focus position of the target image frame.
为达上述目的,根据本申请第五方面实施例提出的一种计算机程序产品,当所述计算机程序产品中的指令处理器执行时,执行一种相位对焦方法,所述方法包括:To achieve the above purpose, according to a computer program product proposed in an embodiment of the fifth aspect of the present application, when the instruction processor in the computer program product executes, a phase focusing method is executed, the method includes:
在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值;During the phase focusing process, it is judged whether the difference of the phase detection data is smaller than a preset threshold value;
如果所述相位检测数据的差值小于所述门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度;If the difference of the phase detection data is less than the threshold value, image acquisition is performed according to a preset frequency, and the scene contrast of each frame of image is acquired;
根据所述每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧;Determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image;
根据所述目标图像帧的合焦位置相应的调整镜头位置。The lens position is adjusted accordingly according to the in-focus position of the target image frame.
本申请附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到。Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application.
附图说明Description of drawings
本申请的上述和/或附加的方面和优点从结合下面附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, wherein:
图1是根据本申请一个实施例的相位对焦方法的流程图;FIG. 1 is a flowchart of a phase focusing method according to an embodiment of the present application;
图2是根据本申请另一个实施例的相位对焦方法的流程图;FIG. 2 is a flowchart of a phase focusing method according to another embodiment of the present application;
图3是根据本申请一个实施例的场景对比度的示意图;Fig. 3 is a schematic diagram of scene contrast according to an embodiment of the present application;
图4是根据本申请另一个实施例的场景对比度的示意图;Fig. 4 is a schematic diagram of scene contrast according to another embodiment of the present application;
图5是根据本申请又一个实施例的场景对比度的示意图;Fig. 5 is a schematic diagram of scene contrast according to another embodiment of the present application;
图6是根据本申请一个实施例的相位对焦装置的结构示意图;以及FIG. 6 is a schematic structural diagram of a phase focusing device according to an embodiment of the present application; and
图7是根据本申请一个实施例的终端设备的结构示意图。Fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
具体实施方式detailed description
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本申请,而不能理解为对本申请的限制。Embodiments of the present application are described in detail below, examples of which are shown in the drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the figures are exemplary, and are intended to explain the present application, and should not be construed as limiting the present application.
下面参考附图描述本申请实施例的相位对焦方法、装置及终端设备。The following describes the phase focusing method, device and terminal equipment according to the embodiments of the present application with reference to the accompanying drawings.
图1是根据本申请一个实施例的相位对焦方法的流程图。Fig. 1 is a flowchart of a phase focusing method according to an embodiment of the present application.
如图1所示,本申请实施例的相位对焦方法包括以下步骤:As shown in Figure 1, the phase focusing method of the embodiment of the present application includes the following steps:
步骤101,在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值。Step 101, during the phase focusing process, it is judged whether the difference of the phase detection data is smaller than a preset threshold value.
步骤102,如果相位检测数据的差值小于门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度。Step 102, if the difference of the phase detection data is smaller than the threshold value, image acquisition is performed according to a preset frequency, and the scene contrast of each frame of image is acquired.
具体地,本实施例提供的相位对焦方法被配置在具有拍摄功能的手机、电脑、智能佩戴设备等电子设备中。Specifically, the phase focusing method provided in this embodiment is configured in electronic devices such as mobile phones, computers, and smart wearable devices that have a camera function.
通常,为了获取清晰图像,需要通过照相机对焦机构变动物距和相距的位置,使被拍物成像清晰的过程即对焦。其中,相位对焦速度快、精度高,使用越来越多。然而,相位对焦中采集相位像素点容易受到躁点,外部光线不稳定等影响。存在对焦过程变慢且准确性低等问题。Usually, in order to obtain a clear image, it is necessary to change the object distance and the position of the distance through the camera focusing mechanism, and the process of making the subject image clear is focusing. Among them, phase focusing has fast speed and high precision, and it is used more and more. However, the acquisition of phase pixels in phase focusing is easily affected by noise, unstable external light, etc. There are problems such as slow focusing process and low accuracy.
为了解决上述问题,本申请实施例提出一种相位对焦方法。在相位对焦时,通过场景对比度统计比较辅助确定合焦位置,从而能够保证对焦的准确性,提高对焦的速度。In order to solve the above problem, an embodiment of the present application proposes a phase focusing method. During phase focusing, the focus position is assisted by scene contrast statistical comparison, so as to ensure the accuracy of focusing and improve the speed of focusing.
具体地,在相位对焦过程中,可以获取两个图像,由此可以得到上述两个图像的图像像素波形,并根据这两个图像的图像像素波形计算出相位检测数据的差值,根据相位检测数据的差值来进行相位对焦。Specifically, in the process of phase focusing, two images can be acquired, thereby the image pixel waveforms of the two images can be obtained, and the difference value of the phase detection data can be calculated according to the image pixel waveforms of the two images, and according to the phase detection The difference of the data is used for phase focusing.
可以理解的是,相位检测数据的差值趋近于零时才能获取最清晰的图像。然而,相位检测数据的差值不稳定,本申请在合焦时,不再参考相位检测数据的差值是否趋近于零,而是通过每帧图像的场景对比度来确定合焦位置。具体说明如下:It is understandable that the sharpest image can be obtained when the difference of the phase detection data approaches zero. However, the difference value of the phase detection data is unstable. When focusing, the present application no longer refers to whether the difference value of the phase detection data approaches zero, but determines the focus position according to the scene contrast of each frame of image. The specific instructions are as follows:
首先,判断相位检测数据的差值是否小于预设的门限值。当相位检测数据的差值小于门限值时,表示离合焦位置很近,从而可以按照预设频率进行图像采集,并获取每帧图像的场景对比度。First, it is judged whether the difference of the phase detection data is smaller than a preset threshold value. When the difference of the phase detection data is less than the threshold value, it means that the in-focus position is very close, so that the image acquisition can be performed according to the preset frequency, and the scene contrast of each frame of image can be obtained.
其中,预设的门限值可以根据实际应用需要进行选择设置。预设频率可以根据实际应用需要进行选择设置。Wherein, the preset threshold value can be selected and set according to actual application needs. The preset frequency can be selected and set according to actual application needs.
其中,获取每帧图像的场景对比度的方式有很多种,可以根据实际应用需要进行选择设置。Among them, there are many ways to obtain the scene contrast of each frame of image, which can be selected and set according to actual application needs.
具体地,在本示例中,可以通过获取每帧图像的像素等图像处理数据,按照预设算法对图像处理数据进行滤波处理获取每帧图像的场景对比度。其中,预设算法可以根据实际应用需要进行选择设置,例如卡尔曼滤波算法、中值滤波算法等。Specifically, in this example, image processing data such as pixels of each frame of image may be obtained, and the image processing data may be filtered according to a preset algorithm to obtain the scene contrast of each frame of image. Among them, the preset algorithm can be selected and set according to actual application needs, such as Kalman filter algorithm, median filter algorithm, and the like.
步骤103,根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧。Step 103: Determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image.
步骤104,根据目标图像帧的合焦位置相应的调整镜头位置。Step 104, adjust the lens position accordingly according to the in-focus position of the target image frame.
具体地,场景对比度越高表示图像越清晰,由此,需要确定场景对比度最大值对应的目标图像帧,从而目标图像帧对应的位置为合焦位置,最后根据合焦位置相应的调整镜头位置。Specifically, the higher the scene contrast, the clearer the image. Therefore, it is necessary to determine the target image frame corresponding to the maximum scene contrast, so that the position corresponding to the target image frame is the in-focus position, and finally adjust the lens position accordingly according to the in-focus position.
其中,确定场景对比度的最大值的方式有很多种,可以根据实际应用需要进行选择设置。举例说明如下:Among them, there are many ways to determine the maximum value of scene contrast, which can be selected and set according to actual application requirements. Examples are as follows:
第一种示例,可以通过获取所有图像帧的场景对比度,经过多轮比较得到场景对比度最大值。In the first example, the maximum value of the scene contrast can be obtained through multiple rounds of comparison by obtaining the scene contrast of all image frames.
第二种示例,可以通过爬坡算法,将当前图像帧的场景对比度与前后图像帧的场景对比度进行比较,如果当前图像帧的场景对比度与前后图像帧的场景对比度都大,并且场景对比度下降趋势满足一定值,将当前图像帧的场景对比度为场景对比度最大值。In the second example, the scene contrast of the current image frame can be compared with the scene contrast of the previous and subsequent image frames through the slope climbing algorithm. If the scene contrast of the current image frame is larger than that of the previous and subsequent image frames, and the scene contrast tends to decrease If a certain value is satisfied, the scene contrast of the current image frame is the maximum value of the scene contrast.
通过上述任一方式可以得到场景对比度最大值,由此,场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。The maximum value of the scene contrast can be obtained by any of the above methods, thus, the target image frame corresponding to the maximum value of the scene contrast, and finally the lens position is adjusted accordingly according to the in-focus position of the target image frame.
本申请实施例的相位对焦方法,首先在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值,接着在相位检测数据的差值小于门限值时按照预设频率进行图像采集,并获取每帧图像的场景对比度,然后根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。由此,能够保证对焦的准确性,提高了对焦的速度。In the phase focusing method of the embodiment of the present application, firstly, during the phase focusing process, it is judged whether the difference of the phase detection data is less than the preset threshold value, and then the phase detection data difference is less than the threshold value, and then it is performed according to the preset frequency. Image acquisition, and obtain the scene contrast of each frame of image, then determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image, and finally adjust the lens position according to the in-focus position of the target image frame. Therefore, the accuracy of focusing can be ensured, and the speed of focusing can be improved.
图2是根据本申请另一个实施例的相位对焦方法的流程图。Fig. 2 is a flowchart of a phase focusing method according to another embodiment of the present application.
如图2所示,本申请实施例的相位对焦方法包括以下步骤:As shown in Figure 2, the phase focusing method of the embodiment of the present application includes the following steps:
步骤201,在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值。Step 201, during the phase focusing process, it is judged whether the difference of the phase detection data is smaller than a preset threshold value.
步骤202,如果相位检测数据的差值小于门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度。Step 202 , if the difference of the phase detection data is smaller than the threshold value, image acquisition is performed according to a preset frequency, and the scene contrast of each frame of image is acquired.
需要说明的是,步骤S201-S202的描述与上述步骤S101-S102相对应,因此对的步骤S202-S202的描述参考上述步骤S101-S102的描述,在此不再赘述。It should be noted that the description of steps S201-S202 corresponds to the above-mentioned steps S101-S102, therefore, the description of the corresponding steps S202-S202 refers to the description of the above-mentioned steps S101-S102, which will not be repeated here.
步骤203,将在T周期时刻获取的第K个图像帧的第一场景对比度与在(T-1)周期时刻获取的第(K-1)个图像帧的第二场景对比度,以及与在(T+1)周期时刻获取的第(K+1)个图像帧的第三场景对比度分别进行比较。Step 203, the first scene contrast of the Kth image frame acquired at the T cycle time and the second scene contrast of the (K-1)th image frame acquired at the (T-1) cycle time, and with the ( The contrast of the third scene of the (K+1)th image frame acquired at the time of the T+1) period is compared respectively.
步骤204,如果获知第一场景对比度小于第二场景对比度,第三场景对比度小于第一场景对比度,且场景对比度下降趋势满足预设阈值,则确定第(K-1)个图像帧为目标图像帧。Step 204, if it is known that the contrast of the first scene is smaller than the contrast of the second scene, the contrast of the third scene is smaller than the contrast of the first scene, and the downward trend of scene contrast meets the preset threshold, then determine the (K-1)th image frame as the target image frame .
步骤205,如果获知第一场景对比度小于第二场景对比度,第三场景对比度大于第一场景对比度,则继续检测后续采集的图像帧的场景对比度的变化趋势,以确定目标图像帧。Step 205, if it is known that the contrast of the first scene is smaller than the contrast of the second scene and the contrast of the third scene is larger than the contrast of the first scene, continue to detect the change trend of the scene contrast of the subsequent image frames collected to determine the target image frame.
具体地,首先在T、T-1和T+1三个周期时刻分别获取第K个图像帧、第(K-1)个图像帧和第(K-1)个图像帧三个图像帧,三个图像帧分别对应的场景对比度为第一场景对比度、第二场景对比度和第三场景对比度三个场景对比度。Specifically, at first, three image frames of the Kth image frame, the (K-1)th image frame, and the (K-1)th image frame are respectively acquired at three cycle times of T, T-1, and T+1, The scene contrasts corresponding to the three image frames respectively are three scene contrasts of the first scene contrast, the second scene contrast and the third scene contrast.
进一步,将第一场景对比度分别与第二场景对比度和第三场景对比度进行比较,得到的结果有很多种情况。举例说明如下:Further, comparing the contrast ratio of the first scene with the contrast ratio of the second scene and the contrast ratio of the third scene respectively, there are many kinds of results obtained. Examples are as follows:
第一示例,第一场景对比度小于第二场景对比度,第三场景对比度小于第一场景对比度。In a first example, the contrast of the first scene is smaller than the contrast of the second scene, and the contrast of the third scene is smaller than the contrast of the first scene.
具体地,根据上述比较结果可以得到随着时间推移,场景对比度呈现下降趋势。为了保证判断的准确性,还需要确定场景对比度下降趋势满足预设阈值,从而确定场景对比度呈现下降趋势成立,由此将第(K-1)个图像帧作为目标图像帧。Specifically, according to the above comparison results, it can be obtained that the scene contrast presents a downward trend as time goes by. In order to ensure the accuracy of the judgment, it is also necessary to determine that the downward trend of the scene contrast satisfies the preset threshold, so as to determine that the downward trend of the scene contrast is established, and thus the (K-1)th image frame is taken as the target image frame.
图3是根据本申请一个实施例的场景对比度的示意图。如图3所示,可以确定第T-1周期时刻对应的A点是场景对比度最大值,其对应的是目标图像帧。Fig. 3 is a schematic diagram of scene contrast according to an embodiment of the present application. As shown in FIG. 3 , it can be determined that the point A corresponding to the T-1th cycle time is the maximum value of scene contrast, which corresponds to the target image frame.
第二示例,第一场景对比度小于第二场景对比度,第三场景对比度大于第一场景对比度。In a second example, the contrast of the first scene is smaller than the contrast of the second scene, and the contrast of the third scene is greater than the contrast of the first scene.
具体地,根据上述比较结果可以得到随着时间的推移,场景对比度呈现下降接着上升趋势。由此,不能直接目标图像帧。需要进一步分析,具体描述如下:Specifically, according to the above comparison results, it can be obtained that the scene contrast presents a trend of decreasing and then increasing as time goes by. Thus, image frames cannot be directly targeted. Further analysis is required, as described in detail below:
示例一,获取后续采集的图像帧的场景对比度,如果都小于第二场景对比度,则说明第T+1周期时刻可能由于抖动等影响导致其对应的场景对比度突然上升。由此,场景对比度呈现下降趋势,确定第(K-1)个图像帧为目标图像帧。Example 1: if the scene contrast of the subsequent acquired image frames is all lower than the second scene contrast, it means that the corresponding scene contrast may suddenly rise due to the influence of jitter at the moment of the T+1 period. Therefore, the scene contrast presents a downward trend, and the (K-1)th image frame is determined as the target image frame.
图4是根据本申请另一个实施例的场景对比度的示意图。如图4所示,可以确定第T-1周期时刻对应的A点是场景对比度最大值,其对应的是目标图像帧。Fig. 4 is a schematic diagram of scene contrast according to another embodiment of the present application. As shown in FIG. 4 , it can be determined that the point A corresponding to the T-1th cycle time is the maximum value of scene contrast, which corresponds to the target image frame.
示例二,获取后续采集的图像帧存在大于第二场景对比度的图像帧,则说明场景对比度还没呈现下降趋势,需要确定大于第二场景对比度的图像帧为目标图像帧。Example 2, if there is an image frame with a contrast greater than the second scene in the image frames acquired subsequently, it means that the scene contrast has not shown a downward trend, and it is necessary to determine the image frame with a contrast greater than the second scene as the target image frame.
图5是根据本申请又一个实施例的场景对比度的示意图。如图5所示,可以确定第T+2周期时刻对应的D点是场景对比度最大值,其对应的是目标图像帧。Fig. 5 is a schematic diagram of scene contrast according to another embodiment of the present application. As shown in FIG. 5 , it can be determined that the point D corresponding to the period T+2 is the maximum value of scene contrast, which corresponds to the target image frame.
第三种示例,第一场景对比度大于第二场景对比度,第三场景对比度小于第一场景对比度。In a third example, the contrast of the first scene is greater than the contrast of the second scene, and the contrast of the third scene is smaller than the contrast of the first scene.
具体地,上述比较结果不能直接确定场景对比度呈现下降趋势,是一种不能确定的情况,由此需要继续在每个周期时刻获取图像帧的场景对比度,重新获取新的场景对比度以比较得到目标图像帧。Specifically, the above comparison results cannot directly determine that the scene contrast presents a downward trend, which is an uncertain situation. Therefore, it is necessary to continue to obtain the scene contrast of the image frame at each cycle time, and re-acquire a new scene contrast to compare the obtained target image. frame.
步骤206,根据目标图像帧的合焦位置相应的调整镜头位置。Step 206, adjust the lens position accordingly according to the in-focus position of the target image frame.
需要说明的是,步骤S206的描述与上述步骤S104相对应,因此对的步骤S206的描述参考上述步骤S104的描述,在此不再赘述。It should be noted that the description of step S206 corresponds to the above-mentioned step S104, so for the description of step S206, refer to the description of the above-mentioned step S104, which will not be repeated here.
本申请实施例的相位对焦方法,首先在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值,接着在相位检测数据的差值小于门限值时按照预设频率进行图像采集,并获取每帧图像的场景对比度,然后根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。由此,能够保证对焦的准确性,提高了对焦的速度。In the phase focusing method of the embodiment of the present application, firstly, during the phase focusing process, it is judged whether the difference of the phase detection data is less than the preset threshold value, and then the phase detection data difference is less than the threshold value, and then it is performed according to the preset frequency. Image acquisition, and obtain the scene contrast of each frame of image, then determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image, and finally adjust the lens position according to the in-focus position of the target image frame. Therefore, the accuracy of focusing can be ensured, and the speed of focusing can be improved.
为了实现上述实施例,本申请提出一种相位对焦装置。In order to realize the above embodiments, the present application proposes a phase focusing device.
图6是根据本申请一个实施例的相位对焦装置的结构示意图。Fig. 6 is a schematic structural diagram of a phase focusing device according to an embodiment of the present application.
如图6所示,本申请实施例的相位对焦装置包括:判断模块61、采集模块62、获取模块63、确定模块64和调整模块65。As shown in FIG. 6 , the phase focusing device of the embodiment of the present application includes: a judgment module 61 , a collection module 62 , an acquisition module 63 , a determination module 64 and an adjustment module 65 .
其中,判断模块61用于在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值。Wherein, the judging module 61 is used for judging whether the difference of the phase detection data is smaller than a preset threshold value during the phase focusing process.
采集模块62用于在相位检测数据的差值小于门限值时,按照预设频率进行图像采集。The acquisition module 62 is configured to perform image acquisition according to a preset frequency when the difference of the phase detection data is less than a threshold value.
获取模块63用于获取每帧图像的场景对比度。The obtaining module 63 is used to obtain the scene contrast of each frame of image.
确定模块64用于根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧。The determination module 64 is configured to determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image.
调整模块65用于根据目标图像帧的合焦位置相应的调整镜头位置。The adjustment module 65 is used to adjust the lens position correspondingly according to the in-focus position of the target image frame.
具体地,首先,判断相位检测数据的差值是否小于预设的门限值。当相位检测数据的差值小于门限值时,表示离合焦位置很近,从而可以按照预设频率进行图像采集,并获取每帧图像的场景对比度。Specifically, firstly, it is judged whether the difference of the phase detection data is smaller than a preset threshold value. When the difference of the phase detection data is less than the threshold value, it means that the in-focus position is very close, so that the image acquisition can be performed according to the preset frequency, and the scene contrast of each frame of image can be obtained.
获取模块63用于获取每帧图像的图像处理数据,按照预设算法对图像处理数据进行滤波处理获取每帧图像的场景对比度。The obtaining module 63 is used to obtain image processing data of each frame of image, and filter the image processing data according to a preset algorithm to obtain scene contrast of each frame of image.
确定模块64用于将在T周期时刻获取的第K个图像帧的第一场景对比度与在(T-1)周期时刻获取的第(K-1)个图像帧的第二场景对比度,以及与在(T+1)周期时刻获取的第(K+1)个图像帧的第三场景对比度分别进行比较;The determination module 64 is used to compare the first scene contrast of the Kth image frame acquired at the T cycle time with the second scene contrast of the (K-1)th image frame acquired at the (T-1) cycle time, and the The third scene contrast of the (K+1)th image frame acquired at (T+1) cycle time is compared respectively;
如果获知第一场景对比度小于第二场景对比度,第三场景对比度小于第一场景对比度,且场景对比度下降趋势满足预设阈值,则确定第(K-1)个图像帧为目标图像帧。If it is known that the contrast of the first scene is smaller than the contrast of the second scene, the contrast of the third scene is smaller than the contrast of the first scene, and the downward trend of scene contrast meets the preset threshold, then determine the (K-1)th image frame as the target image frame.
确定模块还用于如果获知第一场景对比度小于第二场景对比度,第三场景对比度大于第一场景对比度,则继续检测后续采集的图像帧的场景对比度的变化趋势,以确定目标图像帧。The determination module is also used to continue to detect the change trend of the scene contrast of subsequent captured image frames to determine the target image frame if it is known that the first scene contrast is less than the second scene contrast and the third scene contrast is greater than the first scene contrast.
确定模块还用于如果后续采集的图像帧的场景对比度均小于第二场景对比度,则确定第(K-1)个图像帧为目标图像帧。The determining module is further configured to determine the (K-1)th image frame as the target image frame if the scene contrasts of the subsequently collected image frames are all smaller than the second scene contrast.
确定模块还用于如果后续采集的图像帧存在大于第二场景对比度的图像帧,则确定大于第二场景对比度的图像帧为目标图像帧。The determination module is further configured to determine that the image frame with a contrast greater than the second scene is the target image frame if there is an image frame with a contrast greater than the second scene in the subsequently collected image frames.
需要说明的是,前述对相位对焦方法实施例的解释说明也适用于该实施例的相位对焦装置,其实现原理类似,此处不再赘述。It should be noted that the foregoing explanations of the phase focusing method embodiment are also applicable to the phase focusing device of this embodiment, and its implementation principle is similar, so details are not repeated here.
本申请实施例的相位对焦装置,首先在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值,接着在相位检测数据的差值小于门限值时按照预设频率进行图像采集,并获取每帧图像的场景对比度,然后根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。由此,能够保证对焦的准确性,提高了对焦的速度。In the phase focusing device of the embodiment of the present application, firstly, during the phase focusing process, it is judged whether the difference of the phase detection data is less than the preset threshold value, and then the phase detection data difference is smaller than the threshold value, and then the phase focusing is performed according to the preset frequency. Image acquisition, and obtain the scene contrast of each frame of image, then determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image, and finally adjust the lens position according to the in-focus position of the target image frame. Therefore, the accuracy of focusing can be ensured, and the speed of focusing can be improved.
图7是根据本申请一个实施例的终端设备的结构示意图。Fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
参见图7,终端设备1000可以包括以下一个或多个组件:处理器1001,存储器1002,电源电路1003,多媒体组件1004,音频组件1005,输入/输出(I/O)的接口1006,传感器组件1007,以及通信组件1008。7, terminal device 1000 may include one or more of the following components: processor 1001, memory 1002, power circuit 1003, multimedia component 1004, audio component 1005, input/output (I/O) interface 1006, sensor component 1007 , and a communication component 1008 .
电源电路1003,用于为终端设备的各个电路或器件供电;存储器1002用于存储可执行程序代码;处理器1001通过读取存储器1002中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:The power supply circuit 1003 is used to supply power to various circuits or devices of the terminal device; the memory 1002 is used to store executable program codes; the processor 1001 reads the executable program codes stored in the memory 1002 to run the program to perform the following steps:
在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值。During the phase focusing process, it is judged whether the difference of the phase detection data is smaller than a preset threshold value.
如果相位检测数据的差值小于门限值,则按照预设频率进行图像采集,并获取每帧图像的场景对比度。If the difference of the phase detection data is less than the threshold value, image acquisition is performed according to a preset frequency, and the scene contrast of each frame of image is obtained.
根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧。The target image frame corresponding to the maximum value of the scene contrast is determined according to the scene contrast of each frame of image.
根据目标图像帧的合焦位置相应的调整镜头位置。Adjust the lens position accordingly according to the in-focus position of the target image frame.
需要说明的是,前述对相位对焦方法实施例的解释说明也适用于该实施例的终端设备,其实现原理类似,此处不再赘述。It should be noted that the foregoing explanations of the phase focusing method embodiment are also applicable to the terminal device of this embodiment, and its implementation principles are similar, so details are not repeated here.
本申请实施例的终端设备,首先在相位对焦过程中,判断相位检测数据的差值是否小于预设的门限值,接着在相位检测数据的差值小于门限值时按照预设频率进行图像采集,并获取每帧图像的场景对比度,然后根据每帧图像的场景对比度确定与场景对比度的最大值对应的目标图像帧,最后根据目标图像帧的合焦位置相应的调整镜头位置。由此,能够保证对焦的准确性,提高了对焦的速度。The terminal device of the embodiment of the present application firstly determines whether the difference of the phase detection data is less than the preset threshold value during the phase focusing process, and then performs image processing according to the preset frequency when the difference of the phase detection data is less than the threshold value. Collect and obtain the scene contrast of each frame of image, then determine the target image frame corresponding to the maximum value of the scene contrast according to the scene contrast of each frame of image, and finally adjust the lens position correspondingly according to the in-focus position of the target image frame. Therefore, the accuracy of focusing can be ensured, and the speed of focusing can be improved.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。In addition, the terms "first" and "second" are used for descriptive purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of these features. In the description of the present application, "plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of this specification, descriptions with reference to the terms "one embodiment", "some embodiments", "example", "specific examples", or "some examples" mean that specific features described in connection with the embodiment or example , structure, material or characteristic is included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the described specific features, structures, materials or characteristics may be combined in any suitable manner in any one or more embodiments or examples. In addition, those skilled in the art can combine and combine different embodiments or examples and features of different embodiments or examples described in this specification without conflicting with each other.
尽管上面已经示出和描述了本申请的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本申请的限制,本领域的普通技术人员在本申请的范围内可以对上述实施例进行变化、修改、替换和变型。Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limitations on the present application, and those skilled in the art can make the above-mentioned The embodiments are subject to changes, modifications, substitutions and variations.
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610887611.1A CN106534666A (en) | 2016-10-11 | 2016-10-11 | Phase focusing method, device and terminal equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610887611.1A CN106534666A (en) | 2016-10-11 | 2016-10-11 | Phase focusing method, device and terminal equipment |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN106534666A true CN106534666A (en) | 2017-03-22 |
Family
ID=58331234
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610887611.1A Pending CN106534666A (en) | 2016-10-11 | 2016-10-11 | Phase focusing method, device and terminal equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106534666A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108537836A (en) * | 2018-04-12 | 2018-09-14 | 维沃移动通信有限公司 | A kind of depth data acquisition methods and mobile terminal |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2003295047A (en) * | 2002-04-05 | 2003-10-15 | Canon Inc | Imaging device and imaging system |
| CN101086600A (en) * | 2006-06-09 | 2007-12-12 | 索尼株式会社 | Imaging apparatus, imaging apparatus control method, and computer program |
| CN101184163A (en) * | 2006-11-17 | 2008-05-21 | 索尼株式会社 | imaging device |
| CN101907815A (en) * | 2009-06-05 | 2010-12-08 | 佳能株式会社 | Image pickup apparatus and control method thereof |
| CN102687052A (en) * | 2009-12-22 | 2012-09-19 | 佳能株式会社 | Camera |
| CN105938243A (en) * | 2016-06-29 | 2016-09-14 | 华南理工大学 | Multi-magnification microscope fast focusing method applied to TFT-LCD detection |
-
2016
- 2016-10-11 CN CN201610887611.1A patent/CN106534666A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2003295047A (en) * | 2002-04-05 | 2003-10-15 | Canon Inc | Imaging device and imaging system |
| CN101086600A (en) * | 2006-06-09 | 2007-12-12 | 索尼株式会社 | Imaging apparatus, imaging apparatus control method, and computer program |
| CN101184163A (en) * | 2006-11-17 | 2008-05-21 | 索尼株式会社 | imaging device |
| CN101907815A (en) * | 2009-06-05 | 2010-12-08 | 佳能株式会社 | Image pickup apparatus and control method thereof |
| CN102687052A (en) * | 2009-12-22 | 2012-09-19 | 佳能株式会社 | Camera |
| CN105938243A (en) * | 2016-06-29 | 2016-09-14 | 华南理工大学 | Multi-magnification microscope fast focusing method applied to TFT-LCD detection |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108537836A (en) * | 2018-04-12 | 2018-09-14 | 维沃移动通信有限公司 | A kind of depth data acquisition methods and mobile terminal |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102724399B (en) | Automatic setting of zoom, aperture and shutter speed based on scene depth map | |
| CN107258077B (en) | System and method for continuous autofocus (CAF) | |
| EP2613518B1 (en) | Video signal processing apparatus | |
| CN105874776B (en) | Image processing device and method | |
| CN108270967B (en) | Automatic focusing method and electronic device for executing the same | |
| US20150043826A1 (en) | Image processing apparatus, image processing method, and program | |
| CN110941076B (en) | Control apparatus, image pickup apparatus, control method, and storage medium | |
| CN104253939A (en) | Method for adjusting focusing position and electronic device | |
| US20170289472A1 (en) | Image processing apparatus, image processing method, and storage medium | |
| JP2011508268A5 (en) | ||
| JP2011508268A (en) | Method and apparatus with depth map generation | |
| CN103095983A (en) | Image signal processing device | |
| CN103384998A (en) | Imaging device, imaging method, program, and program storage medium | |
| TWI549504B (en) | Image capturing device and auto-focus compensation method thereof | |
| TW201501533A (en) | Method and electronic device for adjusting focus position | |
| CN103763458B (en) | A kind of scene-change detecting method and device | |
| CN106488137A (en) | Dual camera focusing method, device and terminal equipment | |
| JP6447840B2 (en) | Image device, method for automatic focusing in an image device, and corresponding computer program | |
| JP5968379B2 (en) | Image processing apparatus and control method thereof | |
| US9489721B2 (en) | Image processing apparatus, image processing method, and storage medium | |
| US9716822B2 (en) | Direction aware autofocus | |
| CN106454100A (en) | Focusing method and device and mobile terminal | |
| US9912858B2 (en) | Image capturing apparatus and control method thereof | |
| CN106657758B (en) | Photographing method, device and terminal device | |
| CN106412435A (en) | Focusing method, device and mobile terminal |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170322 |
|
| RJ01 | Rejection of invention patent application after publication |