WO2018019122A1 - Focusing method, terminal, and computer storage medium - Google Patents

Focusing method, terminal, and computer storage medium Download PDF

Info

Publication number
WO2018019122A1
WO2018019122A1 PCT/CN2017/092457 CN2017092457W WO2018019122A1 WO 2018019122 A1 WO2018019122 A1 WO 2018019122A1 CN 2017092457 W CN2017092457 W CN 2017092457W WO 2018019122 A1 WO2018019122 A1 WO 2018019122A1
Authority
WO
WIPO (PCT)
Prior art keywords
roi
target image
preset
phase difference
image
Prior art date
Application number
PCT/CN2017/092457
Other languages
French (fr)
Chinese (zh)
Inventor
王乔明
Original Assignee
努比亚技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 努比亚技术有限公司 filed Critical 努比亚技术有限公司
Publication of WO2018019122A1 publication Critical patent/WO2018019122A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/02Constructional features of telephone sets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/02Constructional features of telephone sets
    • H04M1/0202Portable telephone sets, e.g. cordless phones, mobile phones or bar type handsets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/672Focus control based on electronic image sensor signals based on the phase difference signals

Abstract

Embodiments of the present invention disclose a focusing method, a terminal, and a computer storage medium. The method comprises: collecting a first image by an image sensor and performing initial focusing on the first image by adopting an initial ROI region; determining validity of a first ROI target image corresponding to the initial ROI region, the first ROI target image being a part of the first image; if it is determined that the first ROI target image is invalid, determining, according to a preset priority, a first ROI region from n preset ROI regions and a second ROI target image corresponding to the first ROI region to be valid, in which the second ROI target image is a part of the first image, the first ROI target image and the second ROI target image are not completely the same, and n is a preset value and is greater than 1; and determining a current phase difference corresponding to the first ROI region and focusing according to the current phase difference.

Description

一种对焦方法、终端和计算机存储介质Focusing method, terminal and computer storage medium
相关申请的交叉引用Cross-reference to related applications
本申请基于申请号为201610614042.3、申请日为2016年07月29日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。The present application is filed on the basis of the Chinese Patent Application No. PCT Application No.
技术领域Technical field
本发明涉及信息处理领域中的图像处理技术,尤其涉及一种对焦方法、终端和计算机存储介质。The present invention relates to image processing technologies in the field of information processing, and more particularly to a focusing method, a terminal, and a computer storage medium.
背景技术Background technique
随着移动终端的快速发展和逐渐普及,移动终端已成为人们日常生活中不可或缺的工具之一,带有摄像装置的移动终端更是广受用户青睐。为了获得更好的拍摄体验,人们对移动终端的拍照功能的要求也越来越高,不仅要求提高摄像装置像素,还要求提高摄像装置的拍摄速度。其中,拍摄速度主要由对焦方式决定。With the rapid development and popularization of mobile terminals, mobile terminals have become an indispensable tool in people's daily life, and mobile terminals with camera devices are widely favored by users. In order to obtain a better shooting experience, people have higher and higher requirements for the camera function of the mobile terminal, which not only requires an increase in the pixels of the camera device, but also requires an increase in the shooting speed of the camera device. Among them, the shooting speed is mainly determined by the focus mode.
目前,市面上的移动终端大多数采用反差式对焦方式或相位对焦方式,通过驱动马达带动镜片的来回移动来准确地找出目标对焦位置。然而不论采用哪种对焦方式,都必须对目标对焦位置的范围一定,当需对焦的对象较小时,采用上述对焦方式是无法聚焦的。At present, most mobile terminals on the market adopt contrast contrast or phase focusing, and drive the motor to move the lens back and forth to accurately find the target focus position. However, regardless of the focus mode, the range of the target focus position must be fixed. When the subject to be focused is small, the above focus mode cannot be focused.
发明内容Summary of the invention
为解决上述技术问题,本发明实施例期望提供一种对焦方法、终端和计算机存储介质,能够在保证大小不一的物体的对焦准确的基础上,提高 对焦的效率。In order to solve the above technical problem, embodiments of the present invention are expected to provide a focusing method, a terminal, and a computer storage medium, which can improve on the basis of ensuring accurate focusing of objects of different sizes. The efficiency of focusing.
本发明实施例的技术方案是这样实现的:The technical solution of the embodiment of the present invention is implemented as follows:
本发明实施例提供了一种对焦方法,包括:Embodiments of the present invention provide a focusing method, including:
通过图像传感器采集第一图像,采用初始感兴趣区域(ROI,Region Of Interest)区域对所述第一图像进行初始对焦;Acquiring a first image by an image sensor, and initially focusing the first image by using a region of interest (ROI) region;
判断所述初始ROI区域对应的第一ROI目标图像的有效性,所述第一ROI目标图像为所述第一图像的部分图像;Determining validity of the first ROI target image corresponding to the initial ROI region, the first ROI target image being a partial image of the first image;
若判断出所述第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,所述第一ROI区域对应的第二ROI目标图像有效,所述第二ROI目标图像为所述第一图像的部分图像,所述第一ROI目标图像与所述第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;If it is determined that the first ROI target image is invalid, the first ROI region is determined from the n preset ROI regions according to the preset priority, and the second ROI target image corresponding to the first ROI region is valid, The second ROI target image is a partial image of the first image, the first ROI target image is not exactly the same as the second ROI target image, wherein n is a preset value, n is greater than or equal to 1;
确定所述第一ROI区域对应的当前相位差值,并根据所述当前相位差值实现对焦。Determining a current phase difference value corresponding to the first ROI region, and performing focusing according to the current phase difference value.
在一实施例中,判断ROI区域对应的ROI目标图像的有效性的方法,包括:In an embodiment, a method for determining validity of an ROI target image corresponding to an ROI region includes:
计算所述ROI区域对应的可信度值;Calculating a credibility value corresponding to the ROI region;
比较所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性。Comparing the credibility value with a preset threshold value, and determining, according to the comparison result, the validity of the ROI target image corresponding to the ROI region.
在一实施例中,所述比较所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性,包括:In an embodiment, the comparing the reliability value with the size of the preset threshold, determining, according to the comparison result, the validity of the ROI target image corresponding to the ROI region, including:
若所述可信度值小于预设阈值,则判定所述ROI目标图像无效;If the credibility value is less than a preset threshold, determining that the ROI target image is invalid;
若所述可信度值大于等于所述预设阈值,则判定所述ROI目标图像有效。If the credibility value is greater than or equal to the preset threshold, it is determined that the ROI target image is valid.
在一实施例中,所述确定所述第一ROI区域对应的当前相位差值,包 括:In an embodiment, the determining a current phase difference value corresponding to the first ROI area, the packet include:
根据所述第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出所述当前相位差值。And determining the current phase difference value according to a distance between the first pixel corresponding to the second ROI target image and the preset masking pixel.
在一实施例中,所述根据所述当前相位差值实现对焦,包括:In an embodiment, the achieving focus according to the current phase difference value comprises:
检测所述当前相位差值是否属于预设的相位差值范围,所述预设的相位差值范围为触发终端实现相位对焦的相位差值范围;Detecting whether the current phase difference value belongs to a preset phase difference value range, where the preset phase difference value range is a range of phase difference values for triggering the terminal to achieve phase focusing;
若检测出所述当前相位差值不属于所述预设的相位差值范围,则将拍摄马达移动至与所述当前相位差值对应的目标对焦范围内;If it is detected that the current phase difference value does not belong to the preset phase difference value range, moving the photographing motor to a target focus range corresponding to the current phase difference value;
在所述目标对焦范围内调节所述拍摄马达的位置,以在所述第一ROI区域内确定目标对焦位置,从而实现对焦。Adjusting a position of the photographing motor within the target focus range to determine a target focus position within the first ROI region, thereby achieving focusing.
在一实施例中,所述采用初始ROI区域对所述第一图像进行初始对焦,包括:In an embodiment, the initial focusing of the first image by using an initial ROI region includes:
接收到拍照指令时,在显示区域中输出初始ROI区域对应的区域标识,基于所述初始ROI区域对应的区域标识对所述第一图像进行初始对焦。When the photographing instruction is received, the area identifier corresponding to the initial ROI area is outputted in the display area, and the first image is initially focused based on the area identifier corresponding to the initial ROI area.
在一实施例中,所述初始ROI区域为预先设置的区域,或者,基于输入操作确定的期望聚焦的区域。In an embodiment, the initial ROI area is a pre-set area, or an area of desired focus determined based on an input operation.
在一实施例中,所述n个预设ROI区域中每个预设ROI区域的预设优先级与对应预设ROI区域的尺寸大小相关联。In an embodiment, the preset priority of each of the preset ROI regions of the n preset ROI regions is associated with the size of the corresponding preset ROI region.
在一实施例中,所述按照预设优先级,从n个预设ROI区域中确定第一ROI区域,包括:In an embodiment, the determining, by the preset priority, the first ROI area from the n preset ROI areas, including:
按照预设优先级的顺序,依次对所述n个ROI区域对应的ROI目标图像进行有效性的判断,判定出一个ROI区域对应的ROI目标图像有效时,将所述ROI区域确定为第一ROI区域。Determining validity of the ROI target image corresponding to the n ROI regions in sequence according to a preset priority, and determining that the ROI target image corresponding to one ROI region is valid, determining the ROI region as the first ROI region.
本发明实施例还提供了一种终端,包括:The embodiment of the invention further provides a terminal, including:
采集单元,配置为通过图像传感器采集第一图像; An acquisition unit configured to acquire a first image by using an image sensor;
对焦单元,配置为采用初始ROI区域对所述采集单元采集的第一图像进行初始对焦;a focusing unit configured to perform initial focusing on the first image acquired by the collecting unit by using an initial ROI area;
判断单元,配置为判断所述初始ROI区域对应的第一ROI目标图像的有效性,所述第一ROI目标图像为所述第一图像的部分图像;a determining unit, configured to determine validity of the first ROI target image corresponding to the initial ROI region, where the first ROI target image is a partial image of the first image;
所述确定单元,配置为若所述判断单元判断出所述第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,所述第一ROI区域对应的第二ROI目标图像有效,所述第二ROI目标图像为所述第一图像的部分图像,所述第一ROI目标图像与所述第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;以及确定所述第一ROI区域对应的当前相位差值;The determining unit is configured to: if the determining unit determines that the first ROI target image is invalid, determine a first ROI region from the n preset ROI regions according to a preset priority, the first ROI region Corresponding second ROI target image is valid, the second ROI target image is a partial image of the first image, and the first ROI target image is not completely identical to the second ROI target image, wherein n is a pre- Setting a value, n is greater than or equal to 1; and determining a current phase difference value corresponding to the first ROI region;
所述对焦单元,还配置为根据所述确定单元确定的所述当前相位差值实现对焦。The focusing unit is further configured to achieve focusing according to the current phase difference value determined by the determining unit.
在一实施例中,所述终端还包括:计算单元;In an embodiment, the terminal further includes: a computing unit;
所述计算单元,配置为计算所述ROI区域对应的可信度值;The calculating unit is configured to calculate a credibility value corresponding to the ROI region;
所述判断单元,配置为比较所述计算单元计算的所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性。The determining unit is configured to compare the value of the credibility value calculated by the calculating unit with a preset threshold, and determine the validity of the ROI target image corresponding to the ROI region based on the comparison result.
在一实施例中,所述判断单元,还配置为若所述可信度值小于预设阈值,判定所述ROI目标图像无效;若所述可信度值大于等于所述预设阈值,判定所述ROI目标图像有效。In an embodiment, the determining unit is further configured to: if the credibility value is less than a preset threshold, determine that the ROI target image is invalid; if the credibility value is greater than or equal to the preset threshold, determine The ROI target image is valid.
在一实施例中,所述确定单元,配置为根据所述第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出所述当前相位差值。In an embodiment, the determining unit is configured to determine the current phase difference value according to a distance between a first pixel corresponding to the second ROI target image and a preset masking pixel.
在一实施例中,所述终端还包括:检测单元和位移单元;In an embodiment, the terminal further includes: a detecting unit and a displacement unit;
所述检测单元,配置为检测所述当前相位差值是否属于预设的相位差值范围,所述预设的相位差值范围为触发终端实现相位对焦的相位差值范 围;The detecting unit is configured to detect whether the current phase difference value belongs to a preset phase difference value range, where the preset phase difference value range is a phase difference value that triggers the terminal to achieve phase focusing Wai
所述位移单元,配置为若所述检测单元检测出所述当前相位差值不属于所述预设的相位差值范围,则将拍摄马达移动至与所述当前相位差值对应的目标对焦范围内;The displacement unit is configured to move the photographing motor to a target focus range corresponding to the current phase difference value if the detecting unit detects that the current phase difference value does not belong to the preset phase difference value range Inside;
所述对焦单元,配置为在所述目标对焦范围内调节所述拍摄马达的位置,以在所述第一ROI区域内确定目标对焦位置,从而实现对焦。The focusing unit is configured to adjust a position of the photographing motor within the target focus range to determine a target in-focus position in the first ROI region, thereby achieving focusing.
在一实施例中,所述对焦单元,配置为接收到拍照指令时,在显示区域中输出初始ROI区域对应的区域标识,基于所述初始ROI区域对应的区域标识对所述第一图像进行初始对焦。In an embodiment, the focusing unit is configured to output an area identifier corresponding to the initial ROI area in the display area when the photographing instruction is received, and initialize the first image based on the area identifier corresponding to the initial ROI area. Focus.
在一实施例中,所述初始ROI区域为预先设置的区域,或者,基于输入操作确定的期望聚焦的区域。In an embodiment, the initial ROI area is a pre-set area, or an area of desired focus determined based on an input operation.
在一实施例中,所述n个预设ROI区域中每个预设ROI区域的预设优先级与对应预设ROI区域的尺寸大小相关联。In an embodiment, the preset priority of each of the preset ROI regions of the n preset ROI regions is associated with the size of the corresponding preset ROI region.
在一实施例中,所述确定单元,配置为按照预设优先级的顺序,依次对所述n个ROI区域对应的ROI目标图像进行有效性的判断,判定出一个ROI区域对应的ROI目标图像有效时,将所述ROI区域确定为第一ROI区域。In an embodiment, the determining unit is configured to sequentially determine validity of the ROI target image corresponding to the n ROI regions according to a preset priority order, and determine an ROI target image corresponding to one ROI region. When valid, the ROI area is determined as the first ROI area.
本发明实施例还提供了一种终端,包括:处理器和用于存储能够在处理器上运行的计算机程序的存储器;其中,所述处理器用于运行所述计算机程序时,执行本发明实施例所述的对焦方法的步骤。An embodiment of the present invention further provides a terminal, including: a processor and a memory for storing a computer program capable of running on a processor; wherein the processor is configured to execute the computer program, execute an embodiment of the present invention The steps of the focusing method.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例所述的对焦方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the focusing method according to the embodiment of the invention.
本发明实施例提供的对焦方法、终端和计算机存储介质,通过图像传感器采集第一图像,采用初始ROI区域对第一图像进行初始对焦;判断初 始ROI区域对应的第一ROI目标图像的有效性,该第一ROI目标图像为第一图像的部分图像;若判断出第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,该第一ROI区域对应的第二ROI目标图像有效,该第二ROI目标图像为第一图像的部分图像,第一ROI目标图像与第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;确定第一ROI区域对应的当前相位差值,并根据该当前相位差值实现对焦。采用上述技术实现方案,由于终端在进行拍照时,设置了多个预设ROI区域对第一图像进行对焦,采用本发明实施例的技术方案,终端可以在对不同大小的物体或对象进行拍照时,自适应的进行不同预设ROI区域的调整,从而采用不同预设ROI区域对应的不同可信度对不同的物体进行对焦调整,以保证在大小不一的物体的对焦准确的基础上,提高对焦的效率。The focusing method, the terminal and the computer storage medium provided by the embodiment of the invention collect the first image by using the image sensor, and initially focus the first image by using the initial ROI region; The validity of the first ROI target image corresponding to the initial ROI region, the first ROI target image is a partial image of the first image; if it is determined that the first ROI target image is invalid, according to the preset priority, from the n presets The first ROI area is determined in the ROI area, and the second ROI target image corresponding to the first ROI area is valid, the second ROI target image is a partial image of the first image, and the first ROI target image and the second ROI target image are incomplete The same, wherein n is a preset value, n is greater than or equal to 1; determining a current phase difference value corresponding to the first ROI region, and achieving focusing according to the current phase difference value. With the above-mentioned technical implementation, when the terminal performs a photographing, a plurality of preset ROI regions are set to focus on the first image, and the technical solution of the embodiment of the present invention can be used when the terminal can take photos of objects or objects of different sizes. Adjusting the ROI area of different presets adaptively, so as to adjust the focus of different objects with different credibility corresponding to different preset ROI areas, so as to ensure that the focus of objects of different sizes is improved on the basis of accurate focus. The efficiency of focusing.
附图说明DRAWINGS
图1为实现本发明各个实施例一种可选的终端的硬件结构示意图;1 is a schematic structural diagram of hardware of an optional terminal for implementing various embodiments of the present invention;
图2为本发明的移动终端能够操作的通信系统;2 is a communication system that the mobile terminal of the present invention can operate;
图3为本发明实施例提供的一种对焦方法的流程图一;FIG. 3 is a flowchart 1 of a focusing method according to an embodiment of the present invention;
图4为本发明实施例提供的一种对焦指令操作示意图;4 is a schematic diagram of operation of a focus command according to an embodiment of the present invention;
图5为本发明实施例提供的一种设置初始ROI区域的界面示意图;FIG. 5 is a schematic diagram of an interface for setting an initial ROI area according to an embodiment of the present disclosure;
图6为本发明实施例提供的一种示例性的多个ROI区域的示意图;FIG. 6 is a schematic diagram of an exemplary multiple ROI area according to an embodiment of the present invention; FIG.
图7为本发明实施例提供的一种对焦方法的流程图二;FIG. 7 is a second flowchart of a focusing method according to an embodiment of the present invention;
图8为本发明实施例提供的一种终端的结构示意图一;FIG. 8 is a schematic structural diagram 1 of a terminal according to an embodiment of the present disclosure;
图9为本发明实施例提供的一种终端的结构示意图二;FIG. 9 is a schematic structural diagram 2 of a terminal according to an embodiment of the present disclosure;
图10为本发明实施例提供的一种终端的结构示意图三;FIG. 10 is a schematic structural diagram 3 of a terminal according to an embodiment of the present disclosure;
图11为本发明实施例提供的一种终端的结构示意图四。 FIG. 11 is a schematic structural diagram 4 of a terminal according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described in the following with reference to the accompanying drawings.
现在将参考附图描述实现本发明各个实施例的移动终端。在后续的描述中,使用用于表示元件的诸如“模块”、“部件”或“单元”的后缀仅为了有利于本发明的说明,其本身并没有特定的意义。因此,“模块”与“部件”可以混合地使用。A mobile terminal embodying various embodiments of the present invention will now be described with reference to the accompanying drawings. In the following description, the use of suffixes such as "module", "component" or "unit" for indicating an element is merely an explanation for facilitating the present invention, and does not have a specific meaning per se. Therefore, "module" and "component" can be used in combination.
需要说明的是,本发明实施例提供的一种对焦方法可应用于终端,例如计算机或移动终端等可以使用浏览器的电子设备。It should be noted that the focusing method provided by the embodiment of the present invention can be applied to a terminal, such as a computer or a mobile terminal, and the like, which can use a browser.
其中,移动终端可以以各种形式来实施。例如,本发明中描述的终端可以包括诸如移动电话、智能电话、笔记本电脑、数字广播接收器、个人数字助理(PDA)、平板电脑(PAD)、便携式多媒体播放器(PMP)、导航装置等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。下面,假设终端是移动终端。然而,本领域技术人员将理解的是,除了特别用于移动目的的元件之外,根据本发明的实施方式的构造也能够应用于固定类型的终端。Among them, the mobile terminal can be implemented in various forms. For example, the terminals described in the present invention may include, for example, mobile phones, smart phones, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), navigation devices, and the like. Mobile terminals and fixed terminals such as digital TVs, desktop computers, and the like. In the following, it is assumed that the terminal is a mobile terminal. However, those skilled in the art will appreciate that configurations in accordance with embodiments of the present invention can be applied to fixed type terminals in addition to components that are specifically for mobile purposes.
图1为实现本发明各个实施例一种可选的移动终端的硬件结构示意。FIG. 1 is a schematic diagram showing the hardware structure of an optional mobile terminal that implements various embodiments of the present invention.
移动终端1可以包括无线通信单元110、音频/视频(A/V)输入单元120、用户输入单元130、感测单元140、输出单元150、存储器160、接口单元170、控制器180和电源单元190等等。图1示出了具有各种组件的移动终端,但是应理解的是,并不要求实施所有示出的组件。可以替代地实施更多或更少的组件。将在下面详细描述移动终端的元件。The mobile terminal 1 may include a wireless communication unit 110, an audio/video (A/V) input unit 120, a user input unit 130, a sensing unit 140, an output unit 150, a memory 160, an interface unit 170, a controller 180, and a power supply unit 190. and many more. Figure 1 illustrates a mobile terminal having various components, but it should be understood that not all illustrated components are required to be implemented. More or fewer components can be implemented instead. The elements of the mobile terminal will be described in detail below.
无线通信单元110通常包括一个或多个组件,其允许移动终端1与无线通信系统或网络之间的无线电通信。例如,无线通信单元110可以包括移动通信模块112、无线互联网模块113、短程通信模块114和位置信息模 块115中的至少一个。 Wireless communication unit 110 typically includes one or more components that permit radio communication between mobile terminal 1 and a wireless communication system or network. For example, the wireless communication unit 110 may include a mobile communication module 112, a wireless internet module 113, a short-range communication module 114, and a location information module. At least one of the blocks 115.
移动通信模块112将无线电信号发送到基站(例如,接入点、节点B等等)、外部终端以及服务器中的至少一个和/或从其接收无线电信号。这样的无线电信号可以包括语音通话信号、视频通话信号、或者根据文本和/或多媒体消息发送和/或接收的各种类型的数据。The mobile communication module 112 transmits the radio signals to and/or receives radio signals from at least one of a base station (e.g., an access point, a Node B, etc.), an external terminal, and a server. Such radio signals may include voice call signals, video call signals, or various types of data transmitted and/or received in accordance with text and/or multimedia messages.
无线互联网模块113支持移动终端100的无线互联网接入。无线互联网模块113可以内部或外部地耦接到终端。无线互联网模块113所涉及的无线互联网接入技术可以包括无线局域网(WLAN)、无线相容性认证(Wi-Fi)、无线宽带(Wibro)、全球微波互联接入(Wimax)、高速下行链路分组接入(HSDPA)等等。The wireless internet module 113 supports wireless internet access of the mobile terminal 100. The wireless internet module 113 can be internally or externally coupled to the terminal. The wireless internet access technologies involved in the wireless internet module 113 may include wireless local area network (WLAN), wireless compatibility authentication (Wi-Fi), wireless broadband (Wibro), global microwave interconnection access (Wimax), and high speed downlink. Packet Access (HSDPA) and more.
短程通信模块114是用于支持短程通信的模块。短程通信技术的一些示例包括蓝牙TM、射频识别(RFID)、红外数据协会(IrDA)、超宽带(UWB)、紫蜂TM等等。The short range communication module 114 is a module for supporting short range communication. Some examples of short-range communication technology include Bluetooth TM, a radio frequency identification (RFID), infrared data association (IrDA), ultra wideband (UWB), ZigBee, etc. TM.
位置信息模块115是用于检查或获取移动终端的位置信息的模块。位置信息模块的典型示例是全球定位系统(GPS)模块。根据当前的技术,GPS模块计算来自三个或更多卫星的距离信息和准确的时间信息并且对于计算的信息应用三角测量法,从而根据经度、纬度和高度准确地计算三维当前位置信息。当前,用于计算位置和时间信息的方法使用三颗卫星并且通过使用另外的一颗卫星校正计算出的位置和时间信息的误差。此外,GPS模块能够通过实时地连续计算当前位置信息来计算速度信息。The location information module 115 is a module for checking or acquiring location information of the mobile terminal. A typical example of a location information module is a Global Positioning System (GPS) module. According to current technology, the GPS module calculates distance information and accurate time information from three or more satellites and applies triangulation to the calculated information to accurately calculate three-dimensional current position information based on longitude, latitude, and altitude. Currently, the method for calculating position and time information uses three satellites and corrects the calculated position and time information errors by using another satellite. Further, the GPS module can calculate the speed information by continuously calculating the current position information in real time.
A/V输入单元120用于接收音频或视频信号。A/V输入单元120可以包括相机121,相机121对在视频捕获模式或图像捕获模式中由图像捕获装置获得的静态图片或视频的图像数据进行处理。处理后的图像帧可以显示在显示单元151上。经相机121处理后的图像帧可以存储在存储器160(或其它存储介质)中或者经由无线通信单元110进行发送,可以根据移动终 端的构造提供两个或更多相机121。The A/V input unit 120 is for receiving an audio or video signal. The A/V input unit 120 may include a camera 121 that processes image data of still pictures or video obtained by an image capturing device in a video capturing mode or an image capturing mode. The processed image frame can be displayed on the display unit 151. The image frames processed by the camera 121 may be stored in the memory 160 (or other storage medium) or transmitted via the wireless communication unit 110, and may be transmitted according to the mobile terminal. The configuration of the end provides two or more cameras 121.
用户输入单元130可以根据用户输入的命令生成键输入数据以控制移动终端的各种操作。用户输入单元130允许用户输入各种类型的信息,并且可以包括键盘、锅仔片、触摸板(例如,检测由于被接触而导致的电阻、压力、电容等等的变化的触敏组件)、滚轮、摇杆等等。特别地,当触摸板以层的形式叠加在显示单元151上时,可以形成触摸屏。The user input unit 130 may generate key input data according to a command input by the user to control various operations of the mobile terminal. The user input unit 130 allows the user to input various types of information, and may include a keyboard, a pot, a touch pad (eg, a touch sensitive component that detects changes in resistance, pressure, capacitance, etc. due to contact), a scroll wheel , rocker, etc. In particular, when the touch panel is superimposed on the display unit 151 in the form of a layer, a touch screen can be formed.
感测单元140检测移动终端1的当前状态,(例如,移动终端1的打开或关闭状态)、移动终端1的位置、用户对于移动终端1的接触(即,触摸输入)的有无、移动终端1的取向、移动终端1的加速或减速移动和方向等等,并且生成用于控制移动终端1的操作的命令或信号。例如,当移动终端1实施为滑动型移动电话时,感测单元140可以感测该滑动型电话是打开还是关闭。另外,感测单元140能够检测电源单元190是否提供电力或者接口单元170是否与外部装置耦接。感测单元140可以包括接近传感器141将在下面结合触摸屏来对此进行描述。The sensing unit 140 detects the current state of the mobile terminal 1 (eg, the open or closed state of the mobile terminal 1), the location of the mobile terminal 1, the presence or absence of contact (ie, touch input) by the user with the mobile terminal 1, and the mobile terminal. The orientation of 1, the acceleration or deceleration movement and direction of the mobile terminal 1, and the like, and generates a command or signal for controlling the operation of the mobile terminal 1. For example, when the mobile terminal 1 is implemented as a slide type mobile phone, the sensing unit 140 can sense whether the slide type phone is turned on or off. In addition, the sensing unit 140 can detect whether the power supply unit 190 provides power or whether the interface unit 170 is coupled to an external device. Sensing unit 140 may include proximity sensor 141 which will be described below in connection with a touch screen.
接口单元170用作至少一个外部装置与移动终端1连接可以通过的接口。例如,外部装置可以包括有线或无线头戴式耳机端口、外部电源(或电池充电器)端口、有线或无线数据端口、存储卡端口、用于连接具有识别模块的装置的端口、音频输入/输出(I/O)端口、视频I/O端口、耳机端口等等。识别模块可以是存储用于验证用户使用移动终端1的各种信息并且可以包括用户识别模块(UIM)、客户识别模块(SIM)、通用客户识别模块(USIM)等等。另外,具有识别模块的装置(下面称为“识别装置”)可以采取智能卡的形式,因此,识别装置可以经由端口或其它连接装置与移动终端1连接。接口单元170可以用于接收来自外部装置的输入(例如,数据信息、电力等等)并且将接收到的输入传输到移动终端1内的一个或多个元件或者可以用于在移动终端和外部装置之间传输数据。 The interface unit 170 serves as an interface through which at least one external device can connect with the mobile terminal 1. For example, the external device may include a wired or wireless headset port, an external power (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, and an audio input/output. (I/O) port, video I/O port, headphone port, and more. The identification module may be stored to verify various information used by the user using the mobile terminal 1 and may include a User Identification Module (UIM), a Customer Identification Module (SIM), a Universal Customer Identification Module (USIM), and the like. In addition, the device having the identification module (hereinafter referred to as "identification device") may take the form of a smart card, and thus the identification device may be connected to the mobile terminal 1 via a port or other connection device. The interface unit 170 can be configured to receive input (eg, data information, power, etc.) from an external device and transmit the received input to one or more components within the mobile terminal 1 or can be used in the mobile terminal and external device Transfer data between.
另外,当移动终端1与外部底座连接时,接口单元170可以用作允许通过其将电力从底座提供到移动终端1的路径或者可以用作允许从底座输入的各种命令信号通过其传输到移动终端的路径。从底座输入的各种命令信号或电力可以用作用于识别移动终端是否准确地安装在底座上的信号。输出单元150被构造为以视觉、音频和/或触觉方式提供输出信号(例如,音频信号、视频信号、警报信号、振动信号等等)。输出单元150可以包括显示单元151等等。In addition, when the mobile terminal 1 is connected to the external base, the interface unit 170 may function as a path through which power is supplied from the base to the mobile terminal 1 or may be used as a variety of command signals allowed to be input from the base to be transmitted to the mobile The path to the terminal. Various command signals or power input from the base can be used as signals for identifying whether the mobile terminal is accurately mounted on the base. Output unit 150 is configured to provide an output signal (eg, an audio signal, a video signal, an alarm signal, a vibration signal, etc.) in a visual, audio, and/or tactile manner. The output unit 150 may include a display unit 151 and the like.
显示单元151可以显示在移动终端1中处理的信息。例如,当移动终端1处于电话通话模式时,显示单元151可以显示与通话或其它通信(例如,文本消息收发、多媒体文件下载等等)相关的用户界面(UI)或图形用户界面(GUI)。当移动终端1处于视频通话模式或者图像捕获模式时,显示单元151可以显示捕获的图像和/或接收的图像、示出视频或图像以及相关功能的UI或GUI等等。The display unit 151 can display information processed in the mobile terminal 1. For example, when the mobile terminal 1 is in the phone call mode, the display unit 151 can display a user interface (UI) or a graphical user interface (GUI) related to a call or other communication (eg, text messaging, multimedia file download, etc.). When the mobile terminal 1 is in the video call mode or the image capturing mode, the display unit 151 may display a captured image and/or a received image, a UI or GUI showing a video or image and related functions, and the like.
同时,当显示单元151和触摸板以层的形式彼此叠加以形成触摸屏时,显示单元151可以用作输入装置和输出装置。显示单元151可以包括液晶显示器(LCD)、薄膜晶体管LCD(TFT-LCD)、有机发光二极管(OLED)显示器、柔性显示器、三维(3D)显示器等等中的至少一种。这些显示器中的一些可以被构造为透明状,以允许用户从外部观看,这可以称为透明显示器,典型的透明显示器可以例如为TOLED(透明有机发光二极管)显示器等等。根据特定想要的实施方式,移动终端1可以包括两个或更多显示单元(或其它显示装置),例如,移动终端可以包括外部显示单元(未示出)和内部显示单元(未示出)。触摸屏可用于检测触摸输入压力以及触摸输入位置和触摸输入面积。Meanwhile, when the display unit 151 and the touch panel are superposed on each other in the form of a layer to form a touch screen, the display unit 151 can function as an input device and an output device. The display unit 151 may include at least one of a liquid crystal display (LCD), a thin film transistor LCD (TFT-LCD), an organic light emitting diode (OLED) display, a flexible display, a three-dimensional (3D) display, and the like. Some of these displays may be configured to be transparent to allow a user to view from the outside, which may be referred to as a transparent display, and a typical transparent display may be, for example, a TOLED (Transparent Organic Light Emitting Diode) display or the like. According to a particular desired embodiment, the mobile terminal 1 may comprise two or more display units (or other display devices), for example, the mobile terminal may comprise an external display unit (not shown) and an internal display unit (not shown) . The touch screen can be used to detect touch input pressure as well as touch input position and touch input area.
存储器160可以存储由控制器180执行的处理和控制操作的软件程序等等,或者可以暂时地存储己经输出或将要输出的数据(例如,电话簿、 消息、静态图像、视频等等)。而且,存储器160可以存储关于当触摸施加到触摸屏时输出的各种方式的振动和音频信号的数据。The memory 160 may store a software program or the like that performs processing and control operations performed by the controller 180, or may temporarily store data that has been output or is to be output (for example, a phone book, Messages, still images, videos, etc.). Moreover, the memory 160 can store data regarding vibrations and audio signals of various manners that are output when a touch is applied to the touch screen.
存储器160可以包括至少一种类型的存储介质,所述存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等等。而且,移动终端1可以与通过网络连接执行存储器160的存储功能的网络存储装置协作。The memory 160 may include at least one type of storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory (RAM), a static random access memory ( SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like. Moreover, the mobile terminal 1 can cooperate with a network storage device that performs a storage function of the memory 160 through a network connection.
控制器180通常控制移动终端的总体操作。例如,控制器180执行与语音通话、数据通信、视频通话等等相关的控制和处理。另外,控制器180可以包括用于再现(或回放)多媒体数据的多媒体模块181,多媒体模块181可以构造在控制器180内,或者可以构造为与控制器180分离。控制器180可以执行模式识别处理,以将在触摸屏上执行的手写输入或者图片绘制输入识别为字符或图像。The controller 180 typically controls the overall operation of the mobile terminal. For example, the controller 180 performs the control and processing associated with voice calls, data communications, video calls, and the like. In addition, the controller 180 may include a multimedia module 181 for reproducing (or playing back) multimedia data, which may be constructed within the controller 180 or may be configured to be separate from the controller 180. The controller 180 may perform a pattern recognition process to recognize a handwriting input or a picture drawing input performed on the touch screen as a character or an image.
电源单元190在控制器180的控制下接收外部电力或内部电力并且提供操作各元件和组件所需的适当的电力。The power supply unit 190 receives external power or internal power under the control of the controller 180 and provides appropriate power required to operate the various components and components.
这里描述的各种实施方式可以以使用例如计算机软件、硬件或其任何组合的计算机可读介质来实施。对于硬件实施,这里描述的实施方式可以通过使用特定用途集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理装置(DSPD)、可编程逻辑装置(PLD)、现场可编程门阵列(FPGA)、处理器、控制器、微控制器、微处理器、被设计为执行这里描述的功能的电子单元中的至少一种来实施,在一些情况下,这样的实施方式可以在控制器180中实施。对于软件实施,诸如过程或功能的实施方式可以与允许执行至少一种功能或操作的单独的软件模块来实施。软件代码可以由以任何适当的编程语言编写的软件应用程序(或程序)来实施,软件代码可以 存储在存储器160中并且由控制器180执行。The various embodiments described herein can be implemented in a computer readable medium using, for example, computer software, hardware, or any combination thereof. For hardware implementations, the embodiments described herein may be through the use of application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays ( An FPGA, a processor, a controller, a microcontroller, a microprocessor, at least one of the electronic units designed to perform the functions described herein, in some cases, such an embodiment may be at the controller 180 Implemented in the middle. For software implementations, implementations such as procedures or functions may be implemented with separate software modules that permit the execution of at least one function or operation. The software code can be implemented by a software application (or program) written in any suitable programming language, the software code can It is stored in the memory 160 and executed by the controller 180.
至此,己经按照其功能描述了移动终端。下面,为了简要起见,将描述诸如折叠型、直板型、摆动型、滑动型移动终端等等的各种类型的移动终端中的滑动型移动终端作为示例。因此,本发明能够应用于任何类型的移动终端,并且不限于滑动型移动终端。So far, the mobile terminal has been described in terms of its function. Hereinafter, for the sake of brevity, a slide type mobile terminal among various types of mobile terminals such as a folding type, a bar type, a swing type, a slide type mobile terminal, and the like will be described as an example. Therefore, the present invention can be applied to any type of mobile terminal, and is not limited to a slide type mobile terminal.
如图1中所示的移动终端1可以被构造为利用经由帧或分组发送数据的诸如有线和无线通信系统以及基于卫星的通信系统来操作。The mobile terminal 1 as shown in FIG. 1 may be configured to operate using a communication system such as a wired and wireless communication system and a satellite-based communication system that transmits data via frames or packets.
现在将参考图2描述其中根据本发明的移动终端能够操作的通信系统。A communication system in which a mobile terminal according to the present invention can be operated will now be described with reference to FIG.
这样的通信系统可以使用不同的空中接口和/或物理层。例如,由通信系统使用的空中接口包括例如频分多址(FDMA)、时分多址(TDMA)、码分多址(CDMA)和通用移动通信系统(UMTS)(特别地,长期演进(LTE))、全球移动通信系统(GSM)等等。作为非限制性示例,下面的描述涉及CDMA通信系统,但是这样的教导同样适用于其它类型的系统。Such communication systems may use different air interfaces and/or physical layers. For example, air interfaces used by communication systems include, for example, Frequency Division Multiple Access (FDMA), Time Division Multiple Access (TDMA), Code Division Multiple Access (CDMA), and Universal Mobile Telecommunications System (UMTS) (in particular, Long Term Evolution (LTE)). ), Global System for Mobile Communications (GSM), etc. As a non-limiting example, the following description relates to a CDMA communication system, but such teachings are equally applicable to other types of systems.
参考图2,CDMA无线通信系统可以包括多个移动终端1、多个基站(BS)270、基站控制器(BSC)275和移动交换中心(MSC)280。MSC 280被构造为与公共电话交换网络(PSTN)290形成接口。MSC 280还被构造为与可以经由回程线路耦接到BS 270的BSC 275形成接口。回程线路可以根据若干己知的接口中的任一种来构造,所述接口包括例如E1/T1、ATM,IP、PPP、帧中继、HDSL、ADSL或xDSL。将理解的是,如图2中所示的系统可以包括多个BSC 2750。Referring to FIG. 2, a CDMA wireless communication system may include a plurality of mobile terminals 1, a plurality of base stations (BS) 270, a base station controller (BSC) 275, and a mobile switching center (MSC) 280. The MSC 280 is configured to interface with a public switched telephone network (PSTN) 290. The MSC 280 is also configured to interface with a BSC 275 that can be coupled to the BS 270 via a backhaul line. The backhaul line can be constructed in accordance with any of a number of well known interfaces including, for example, E1/T1, ATM, IP, PPP, Frame Relay, HDSL, ADSL, or xDSL. It will be appreciated that the system as shown in FIG. 2 may include multiple BSCs 2750.
每个BS 270可以服务一个或多个分区(或区域),由多向天线或指向特定方向的天线覆盖的每个分区放射状地远离BS 270。或者,每个分区可以由用于分集接收的两个或更多天线覆盖。每个BS 270可以被构造为支持多个频率分配,并且每个频率分配具有特定频谱(例如,1.25MHz,5MHz等等)。 Each BS 270 can serve one or more partitions (or regions), with each partition covered by a multi-directional antenna or an antenna pointing in a particular direction radially away from the BS 270. Alternatively, each partition may be covered by two or more antennas for diversity reception. Each BS 270 can be configured to support multiple frequency allocations, and each frequency allocation has a particular frequency spectrum (eg, 1.25 MHz, 5 MHz, etc.).
分区与频率分配的交叉可以被称为CDMA信道。BS 270也可以被称为基站收发器子系统(BTS)或者其它等效术语。在这样的情况下,术语“基站”可以用于笼统地表示单个BSC 275和至少一个BS 270。基站也可以被称为“蜂窝站”。或者,特定BS 270的各分区可以被称为多个蜂窝站。The intersection of partitioning and frequency allocation can be referred to as a CDMA channel. BS 270 may also be referred to as a Base Transceiver Subsystem (BTS) or other equivalent terminology. In such a case, the term "base station" can be used to generally mean a single BSC 275 and at least one BS 270. A base station can also be referred to as a "cell station." Alternatively, each partition of a particular BS 270 may be referred to as multiple cellular stations.
如图2中所示,广播发射器(BT)295将广播信号发送给在系统内操作的移动终端1。在图2中,示出了几个全球定位系统(GPS)卫星300,卫星300帮助定位多个移动终端1中的至少一个。As shown in FIG. 2, a broadcast transmitter (BT) 295 transmits a broadcast signal to the mobile terminal 1 operating within the system. In FIG. 2, several Global Positioning System (GPS) satellites 300 are shown that help locate at least one of a plurality of mobile terminals 1.
在图2中,描绘了多个卫星300,但是理解的是,可以利用任何数目的卫星获得有用的定位信息。作为图1中所示的位置信息模块115的GPS模块通常被构造为与卫星300配合以获得想要的定位信息。替代GPS跟踪技术或者在GPS跟踪技术之外,可以使用可以跟踪移动终端的位置的其它技术。另外,至少一个GPS卫星300可以选择性地或者额外地处理卫星DMB传输。In Figure 2, a plurality of satellites 300 are depicted, but it is understood that useful positioning information can be obtained using any number of satellites. The GPS module, which is the location information module 115 shown in Figure 1, is typically configured to cooperate with the satellite 300 to obtain the desired positioning information. Instead of GPS tracking technology or in addition to GPS tracking technology, other techniques that can track the location of the mobile terminal can be used. Additionally, at least one GPS satellite 300 can selectively or additionally process satellite DMB transmissions.
作为无线通信系统的一个典型操作,BS 270接收来自各种移动终端1的反向链路信号。移动终端1通常参与通话、消息收发和其它类型的通信。特定BS 270接收的每个反向链路信号被在特定BS 270内进行处理。获得的数据被转发给相关的BSC 275。BSC提供通话资源分配和包括BS 270之间的软切换过程的协调的移动管理功能。BSC 275还将接收到的数据路由到MSC 280,其提供用于与PSTN 290形成接口的额外的路由服务。类似地,PSTN 290与MSC 280形成接口,MSC与BSC 275形成接口,并且BSC 275相应地控制BS 270以将正向链路信号发送到移动终端1。As a typical operation of a wireless communication system, the BS 270 receives reverse link signals from various mobile terminals 1. The mobile terminal 1 typically participates in calls, messaging, and other types of communications. Each reverse link signal received by a particular BS 270 is processed within a particular BS 270. The obtained data is forwarded to the relevant BSC 275. The BSC provides call resource allocation and coordinated mobility management functions including a soft handoff procedure between the BSs 270. The BSC 275 also routes the received data to the MSC 280, which provides additional routing services for interfacing with the PSTN 290. Similarly, PSTN 290 interfaces with MSC 280, which forms an interface with BSC 275, and BSC 275 controls BS 270 accordingly to transmit forward link signals to mobile terminal 1.
基于上述移动终端硬件结构以及通信系统,提出本发明各个实施例。Various embodiments of the present invention are proposed based on the above-described mobile terminal hardware structure and communication system.
在对本发明实施例的对焦方法进行说明之前,首先对ROI进行说明。在机器视觉、图像处理中,从被处理的图像以方框、圆、椭圆、不规则多边形等方式勾勒出需要处理的区域,称为ROI。在Halcon、OpenCV、Matlab 等机器视觉软件上常用到各种算子(Operator)和函数来求得ROI,并进行图像的下一步处理。Before describing the focusing method of the embodiment of the present invention, the ROI will first be described. In machine vision and image processing, the area to be processed is outlined from the processed image in the form of a box, a circle, an ellipse, an irregular polygon, etc., called an ROI. In Halcon, OpenCV, Matlab Various machine operators (computers) and functions are commonly used to obtain the ROI, and the next step of the image processing is performed.
其中,在图像处理领域,ROI区域是从图像中选择的一个图像区域,这个区域是图像分析所关注的重点,圈定该区域以便进行进一步处理,使用ROI圈定目标图像,可以减少处理时间,增加精度。Among them, in the field of image processing, the ROI area is an image area selected from the image, which is the focus of image analysis, and the area is delineated for further processing, and the ROI is used to delineate the target image, which can reduce processing time and increase precision. .
实施例一 Embodiment 1
本发明实施例提供了一种对焦方法,如图3所示,该方法可以包括:An embodiment of the present invention provides a focusing method. As shown in FIG. 3, the method may include:
S101、通过图像传感器采集第一图像,采用初始ROI区域对该第一图像进行初始对焦。S101. Acquire a first image by using an image sensor, and perform initial focusing on the first image by using an initial ROI region.
需要说明的是,本发明实施例提供的一种对焦方法是在终端上进行拍照的场景下实现的。It should be noted that the focus method provided by the embodiment of the present invention is implemented in a scene in which a photograph is taken on a terminal.
对焦指使用例如照相机、摄像头等图像传感器时调整焦点距离。对焦也可称为对光、聚焦。通过照相机或终端上的相机应用调整焦点距离,也即调整物距和相距,使被拍物成像清晰的过程就是对焦。Focusing refers to adjusting the focus distance when using an image sensor such as a camera or a camera. Focusing can also be called focusing and focusing. The focus distance is adjusted by the camera application on the camera or the terminal, that is, the object distance and the distance are adjusted, so that the process of sharpening the object is focusing.
其中,相位对焦是通过检测图像的相位偏移量实现自动对焦的。在感光的图像传感器的位置放置一个由平行线条组成的网格板,线条相继为透光和不透光。网络板后适当位置上与光轴对称地放置两个受光元件。网络板在与光轴垂直方向上往复振动。当聚焦面与网络板重合时,通过网格板透光线条的光同时到达其后面的两个受光元件。而当离焦时,光束只能先后到达两个受光元件,于是它们的输出信号之间有相位差。有相位差的两个信号经电路处理后即可控制驱动马达来调节物镜的位置,使聚焦面与网格板的平面重合,从而实现自动对焦。Among them, phase focusing is achieved by detecting the phase shift amount of the image. A grid of parallel lines is placed at the position of the photosensitive image sensor, and the lines are successively transparent and opaque. Two light-receiving elements are placed symmetrically with respect to the optical axis at appropriate positions behind the network board. The network board reciprocates in a direction perpendicular to the optical axis. When the focusing surface coincides with the network board, the light passing through the grid plate transmits light to the two light receiving elements at the same time. When defocusing, the beam can only reach two light-receiving elements one after the other, so there is a phase difference between their output signals. After the two signals with phase difference are processed by the circuit, the driving motor can be controlled to adjust the position of the objective lens, so that the focal plane coincides with the plane of the grid plate, thereby achieving autofocus.
需要说明的是,本发明实施例中的终端上设置有图像传感器,该终端通过图像传感器采集第一图像,其中,第一图像为终端上的相机应用启动后,在终端的显示屏幕上预览到的图像。 It should be noted that, in the embodiment of the present invention, an image sensor is disposed on the terminal, and the terminal acquires a first image by using an image sensor, where the first image is previewed on the display screen of the terminal after the camera application on the terminal is started. Image.
作为一种实施方式,本发明实施例中的图像传感器可以为基于相位检测自动对焦(PDAF,Phase Detection Auto Focus)技术的传感器,简称PD传感器。As an embodiment, the image sensor in the embodiment of the present invention may be a sensor based on Phase Detection Auto Focus (PDAF) technology, which is referred to as a PD sensor.
在本发明实施例中,用户使用终端进行拍照,当用户点击相机应用以激活相机应用时,用户点击“拍摄按键”,即终端接收到拍照指令时,该终端的显示屏幕上出现初始ROI区域,即在显示区域中输出初始ROI区域对应的区域标识,该终端尝试基于初始ROI区域对应的区域标识对第一图像进行对焦。In the embodiment of the present invention, the user uses the terminal to take a photo. When the user clicks on the camera application to activate the camera application, the user clicks the “shooting button”, that is, when the terminal receives the photographing instruction, the initial ROI area appears on the display screen of the terminal. That is, the area identifier corresponding to the initial ROI area is output in the display area, and the terminal attempts to focus the first image based on the area identifier corresponding to the initial ROI area.
具体的,当用户想要拍照时便启动终端的拍摄装置,该拍摄装置可以是位于终端的第一表面的摄像头(例如前置摄像头)、位于终端的第二表面的摄像头(例如后置摄像头)或者位于终端的同一表面的两个摄像头等。Specifically, when the user wants to take a photo, the camera of the terminal is activated, and the camera may be a camera located on the first surface of the terminal (eg, a front camera), a camera located on the second surface of the terminal (eg, a rear camera) Or two cameras or the like located on the same surface of the terminal.
本实施例中,所述初始ROI区域为预先设置的区域,或者,基于输入操作确定的期望聚焦的区域。作为一种实施方式,如图4所示,当用户想要进行拍照时,可以用户可通过触发操作点击终端的显示屏幕中、用户期望聚焦的区域,以触发终端的拍摄装置进行基于操作的区域进行自动对焦,此时,终端的显示屏幕可基于操作的位置显示初始ROI区域,用户的触发操作使的终端接收到对焦指令,终端根据所述对焦指令开始进行对焦。作为另一种实施方式,终端中也可预先配置初始ROI区域,例如位于显示屏幕中心的区域。In this embodiment, the initial ROI area is a preset area, or an area of desired focus determined based on an input operation. As an embodiment, as shown in FIG. 4, when the user wants to take a photo, the user can click the area of the display screen of the terminal and the area that the user desires to focus on by triggering the operation to trigger the shooting device of the terminal to perform the operation-based area. Autofocusing is performed. At this time, the display screen of the terminal can display the initial ROI area based on the position of the operation, and the trigger operation of the user receives the focus command, and the terminal starts focusing according to the focus instruction. As another implementation manner, an initial ROI area may also be pre-configured in the terminal, such as an area located at the center of the display screen.
作为一种实施方式,本发明实施例中的初始ROI区域可通过在显示区域中输出的至少一个矩形框、圆形框或其他几何形状的闭合框标识,本发明实施例中对初始ROI区域对应的区域标识的形状不作限制。As an embodiment, the initial ROI area in the embodiment of the present invention may be identified by at least one rectangular frame, a circular frame, or another closed frame of the geometrical shape outputted in the display area, and corresponds to the initial ROI area in the embodiment of the present invention. The shape of the area logo is not limited.
需要说明的是,本发明实施例提供的对焦方法中是可以设置有n(n大于等于1)个ROI区域,从n个ROI区域中选定其中一个ROI区域作为初始ROI区域,具体的,初始ROI区域的大小选择可以是自动默认的,也可 以是用户手动设置的,如图5所示,用户可以在终端的设置应用中的相机设置界面的对焦功能中进行初始ROI区域的设置(自动默认or手动设置)。It should be noted that, in the focusing method provided by the embodiment of the present invention, n (n is greater than or equal to 1) ROI regions may be set, and one of the n ROI regions is selected as the initial ROI region, specifically, initial The size of the ROI area can be selected automatically or by default. Therefore, the user manually sets, as shown in FIG. 5, the user can perform the setting of the initial ROI area (automatic default or manual setting) in the focusing function of the camera setting interface in the setting application of the terminal.
需要说明的是,本发明实施例中的n个ROI区域的大小的参数设置也可以进行自动默认和手动设置的方式,前提是n个ROI区域的确定要基于PD传感器的性能来决定。It should be noted that the parameter setting of the size of the n ROI regions in the embodiment of the present invention may also be automatically defaulted and manually set, provided that the determination of the n ROI regions is determined based on the performance of the PD sensor.
S102、判断初始ROI区域对应的第一ROI目标图像的有效性,该第一ROI目标图像为第一图像的部分图像。S102. Determine validity of a first ROI target image corresponding to the initial ROI region, where the first ROI target image is a partial image of the first image.
终端采用初始ROI区域对该第一图像进行初始对焦之后,为了保证拍照的清晰度,终端对所述初始ROI区域对应的第一ROI目标图像的有效性进行判断,即对第一ROI目标图像的对焦效果进行判断,以便决定是否需要从n个ROI区域中重新选择ROI区域。After the terminal initially focuses the first image by using the initial ROI area, the terminal determines the validity of the first ROI target image corresponding to the initial ROI area, that is, the first ROI target image, in order to ensure the sharpness of the photograph. The focus effect is judged to determine whether it is necessary to reselect the ROI area from the n ROI areas.
需要说明的是,本发明实施例中的ROI目标图像的有效性是指与该ROI目标图像对应的ROI区域的PD值的有效性,其中,PD值是指相位差值。It should be noted that the validity of the ROI target image in the embodiment of the present invention refers to the validity of the PD value of the ROI region corresponding to the ROI target image, wherein the PD value refers to the phase difference value.
S103、若判断出第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,该第一ROI区域对应的第二ROI目标图像有效,该第二ROI目标图像为第一图像的部分图像,该第一ROI目标图像与该第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1。S103. If it is determined that the first ROI target image is invalid, determining a first ROI region from the n preset ROI regions according to a preset priority, where the second ROI target image corresponding to the first ROI region is valid, the second The ROI target image is a partial image of the first image, and the first ROI target image is not completely identical to the second ROI target image, wherein n is a preset value, and n is greater than or equal to 1.
终端判断初始ROI区域对应的第一ROI目标图像的有效性之后,若是该终端判断出初始ROI区域对应的第一ROI目标图像为无效的,则表征终端选用初始ROI区域的对焦效果是不好的,则终端可以按照预设优先级从已经设置好的n个预设ROI区域中确定一个ROI区域对应的ROI目标图像有效的,即从n个预设ROI区域中确定第一ROI区域,该第一ROI区域对应的第二ROI目标图像有效。After the terminal determines the validity of the first ROI target image corresponding to the initial ROI region, if the terminal determines that the first ROI target image corresponding to the initial ROI region is invalid, the focus effect of the initial ROI region is not good for the characterizing terminal. The terminal may determine, according to the preset priority, that the ROI target image corresponding to one ROI region is valid from the n preset ROI regions that have been set, that is, determine the first ROI region from the n preset ROI regions, where the first ROI region is determined. The second ROI target image corresponding to one ROI region is valid.
需要说明的是,本发明实施例中可以设置有n个ROI区域,该n个ROI 区域都是ROI区域不同或不完全重叠的区域。因此,第一ROI目标图像与第二ROI目标图像应该为第一图像的不同部分,但不排除有重叠的部分。It should be noted that, in the embodiment of the present invention, n ROI regions, the n ROIs may be disposed. Areas are areas where the ROI areas differ or do not overlap completely. Therefore, the first ROI target image and the second ROI target image should be different portions of the first image, but overlapping portions are not excluded.
作为一种实施方式,本发明实施例中的n个ROI区域的大小相对于第一图像,可以是小尺寸、中尺寸、大尺寸均具有的多个对焦窗口(ROI区域)。As an embodiment, the size of the n ROI regions in the embodiment of the present invention may be a plurality of focus windows (ROI regions) having a small size, a medium size, and a large size with respect to the first image.
需要说明的是,本发明实施例中的预设优先级是指n个ROI区域的优先级。It should be noted that the preset priority in the embodiment of the present invention refers to the priority of the n ROI areas.
作为一种实施方式,本发明实施例中,n个预设ROI区域的优先于与区域尺寸相关联;具体的,ROI区域的面积越小时,该ROI区域的优先级可越高。As an embodiment, in the embodiment of the present invention, the n preset ROI regions are prioritized to be associated with the region size; specifically, the smaller the area of the ROI region is, the higher the priority of the ROI region may be.
示例性的,如图6所示,假设有3个ROI区域,ROI区域1最小,ROI区域3最大,因此,上述3个ROI区域的预设优先级为:ROI区域1大于ROI区域2大于ROI区域3,终端在进行拍照的时候,会根据本发明实施例提供的对焦方式,与拍摄大小不同的物体时,选择不同的ROI区域实现较好的对焦。Exemplarily, as shown in FIG. 6 , it is assumed that there are three ROI regions, the ROI region 1 is the smallest, and the ROI region 3 is the largest. Therefore, the preset priority of the above three ROI regions is: the ROI region 1 is greater than the ROI region 2 is greater than the ROI. In the area 3, when the terminal performs photographing, according to the focusing mode provided by the embodiment of the present invention, when shooting an object with a different size, different ROI regions are selected to achieve better focusing.
具体的,终端按照预设优先级,从n个预设ROI区域中确定第一ROI区域可以为:终端按照预设优先级的顺序,依次对n个ROI区域对应的ROI目标图像进行有效性的判断,直至判定出一个ROI区域对应的ROI目标图像有效时,将所述ROI区域确定为第一ROI区域,即判断出第一ROI区域对应的第二ROI目标图像有效为止。Specifically, the determining, by the terminal according to the preset priority, the first ROI area from the n preset ROI areas may be: the terminal sequentially validating the ROI target images corresponding to the n ROI areas according to the preset priority order. It is determined that, when it is determined that the ROI target image corresponding to one ROI region is valid, the ROI region is determined as the first ROI region, that is, the second ROI target image corresponding to the first ROI region is determined to be valid.
需要说明的是,本发明实施例中的第一ROI目标图像和第二ROI目标图像的有效性的判断方法是一样的,也就是说,n个ROI区域对应的n个ROI目标图像的有效性的判断都是一样的。It should be noted that the method for determining the validity of the first ROI target image and the second ROI target image in the embodiment of the present invention is the same, that is, the validity of the n ROI target images corresponding to the n ROI regions. The judgment is the same.
本发明实施例中,终端判断ROI区域对应的ROI目标图像的有效性可以为:终端计算ROI区域对应的可信度值;比较可信度值与预设阈值的大 小,基于比较结果判定ROI区域对应的ROI目标图像的有效性;若可信度值小于预设阈值,则判定ROI目标图像无效;若可信度值大于等于预设阈值,则判定ROI目标图像有效。In the embodiment of the present invention, the terminal may determine that the validity of the ROI target image corresponding to the ROI region is: the terminal calculates the credibility value corresponding to the ROI region; and compares the credibility value with the preset threshold. Small, based on the comparison result, determining the validity of the ROI target image corresponding to the ROI region; if the reliability value is less than the preset threshold, determining that the ROI target image is invalid; if the reliability value is greater than or equal to the preset threshold, determining the ROI target image effective.
需要说明的是,本发明实施例中的可信度是指PD传感器输出的PD confidence level的数值,也就是说,表征了PD值可信大小的一个数据为可信度(即PD confidence level)。其中,PD confidence level的值越大,表征PD值的可信度越高。It should be noted that the credibility in the embodiment of the present invention refers to the value of the PD confidence level output by the PD sensor, that is, one data that represents the trusted size of the PD value is the confidence level (ie, PD confidence level). . Among them, the greater the value of PD confidence level, the higher the credibility of characterizing PD values.
S104、确定第一ROI区域对应的当前相位差值,并根据该当前相位差值实现对焦。S104. Determine a current phase difference value corresponding to the first ROI region, and perform focusing according to the current phase difference value.
终端按照预设优先级,从n个预设ROI区域中确定第一ROI区域之后,由于终端已经可以计算出ROI区域对应的可信度值了,因此,终端就可以通过可信度值判断ROI目标图像的有效性,即判断该ROI区域对应的PD值的有效性,当该PD值有效时,可以根据该PD值进行对焦。于是,终端在确定第一ROI对应的第二ROI图像有效后,该终端就确定第一ROI区域对应的当前相位差值,并根据该当前相位差值实现对焦。After determining the first ROI area from the n preset ROI areas according to the preset priority, the terminal can calculate the reliability value corresponding to the ROI area, so the terminal can judge the ROI by the credibility value. The validity of the target image, that is, the validity of the PD value corresponding to the ROI region, when the PD value is valid, the focus can be focused according to the PD value. Then, after determining that the second ROI image corresponding to the first ROI is valid, the terminal determines a current phase difference value corresponding to the first ROI region, and performs focusing according to the current phase difference value.
具体的,终端根据第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出当前相位差值;终端检测当前相位差值是否属于预设的相位差值范围,该预设的相位差值范围为触发终端实现相位对焦的相位差值范围;若检测出当前相位差值不属于预设的相位差值范围,终端则将拍摄马达移动至与当前相位差值对应的目标对焦范围内;终端在目标对焦范围内调节拍摄马达的位置,以在第一ROI区域内确定目标对焦位置,从而实现对焦。Specifically, the terminal determines a current phase difference according to a distance between the first pixel corresponding to the second ROI target image and the preset masking pixel, and the terminal detects whether the current phase difference belongs to a preset phase difference range, and the preset The phase difference range is set to a range of phase difference values for triggering the terminal to achieve phase focusing; if it is detected that the current phase difference value does not belong to the preset phase difference value range, the terminal moves the shooting motor to the target corresponding to the current phase difference value. Within the focus range; the terminal adjusts the position of the shooting motor within the target focus range to determine the target focus position within the first ROI area for focus.
实施例二Embodiment 2
本发明实施例提供了一种对焦方法,如图7所示,该方法可以包括:An embodiment of the present invention provides a focusing method. As shown in FIG. 7, the method may include:
S201、通过图像传感器采集第一图像,采用初始ROI区域对该第一图 像进行初始对焦。S201. Acquire a first image by using an image sensor, and adopt an initial ROI area to the first image. Like initial focus.
本步骤的详细过程的描述与前续实施例中的S101的描述过程一致,此处不再赘述。The description of the detailed process of this step is consistent with the description process of S101 in the previous embodiment, and details are not described herein again.
S202、计算初始ROI区域对应的初始可信度值。S202. Calculate an initial credibility value corresponding to the initial ROI region.
S203、比较初始可信度值与预设阈值的大小,基于比较结果判定初始ROI区域对应的第一ROI目标图像的有效性,该第一ROI目标图像为第一图像的部分图像。S203. Compare the initial credibility value with the size of the preset threshold, and determine, according to the comparison result, the validity of the first ROI target image corresponding to the initial ROI region, where the first ROI target image is a partial image of the first image.
终端采用初始ROI区域对该第一图像进行初始对焦之后,为了保证拍照的清晰度,于是,终端将会对设置的初始ROI区域对应的第一ROI目标图像的有效性进行判断,即对第一ROI目标图像的对焦效果进行判断,以便决定是否需要从n个ROI区域中重新进行选择。After the initial focus is performed on the first image by using the initial ROI area, in order to ensure the sharpness of the photograph, the terminal will judge the validity of the first ROI target image corresponding to the set initial ROI area, that is, the first The focus effect of the ROI target image is judged to determine whether it is necessary to reselect from the n ROI regions.
需要说明的是,本发明实施例中的ROI目标图像的有效性是指与该ROI目标图像对应的ROI区域的PD值的有效性,其中,PD值是指相位差值。It should be noted that the validity of the ROI target image in the embodiment of the present invention refers to the validity of the PD value of the ROI region corresponding to the ROI target image, wherein the PD value refers to the phase difference value.
具体的,若初始可信度值小于预设阈值,终端判定第一ROI目标图像无效;若初始可信度值大于等于预设阈值,终端判定第一ROI目标图像有效。Specifically, if the initial credibility value is less than the preset threshold, the terminal determines that the first ROI target image is invalid; if the initial credibility value is greater than or equal to the preset threshold, the terminal determines that the first ROI target image is valid.
S204、若判定第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,该第一ROI区域对应的第二ROI目标图像有效,该第二ROI目标图像为第一图像的部分图像,该第一ROI目标图像与该第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1。S204. If it is determined that the first ROI target image is invalid, determining a first ROI region from the n preset ROI regions according to a preset priority, where the second ROI target image corresponding to the first ROI region is valid, the second ROI The target image is a partial image of the first image, and the first ROI target image is not exactly the same as the second ROI target image, wherein n is a preset value, and n is greater than or equal to 1.
本步骤的详细过程的描述与前续实施例中的S103的描述过程一致,此处不再赘述。The description of the detailed process of this step is consistent with the description process of S103 in the previous embodiment, and details are not described herein again.
需要说明的是,终端判断出第二ROI目标图像有效性的方法为:终端计算第一ROI区域对应的第一可信度值,若第一可信度值小于预设阈值,终端判定第二ROI目标图像无效;若第一可信度值大于等于预设阈值,终 端判定第二ROI目标图像有效。It should be noted that, the method for determining, by the terminal, the validity of the second ROI target image is: the terminal calculates a first credibility value corresponding to the first ROI region, and if the first credibility value is less than a preset threshold, the terminal determines the second The ROI target image is invalid; if the first credibility value is greater than or equal to the preset threshold, the end The terminal determines that the second ROI target image is valid.
S205、根据第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出当前相位差值。S205. Determine a current phase difference value according to a distance between the first pixel corresponding to the second ROI target image and the preset masking pixel.
具体的,当终端接收到采用相位对焦的拍摄指令时,可以理解的是用户开启拍摄装置并对终端的处于摄像模式下的显示屏幕进行了点击操作(如图4所示),此时拍摄装置便获取在PD传感器上形成的两个图像(第二ROI目标图像和预设遮蔽图像)之间的当前相位差值。终端可以通过自带的相机程序来开启拍摄装置,也可以通过其他的应用程序来调用或开启拍摄装置,例如,社交软件、图像处理软件等应用程序。其中,相位对焦通过分离镜头和线性传感器将图像分离出2个图像,然后通过线性传感器检测出两个图像之间的距离,即两个图像之间的相位差值,最后通过相位检测的线性信号以及相位差值来判断当前的焦点位置是靠前还是靠后,并且准确的告诉摄像马达应该驱动镜片向哪个方向移动,并且在准确焦点位置的时候,相位对焦系统可以准确的知道当前已经处于合焦状态。Specifically, when the terminal receives the shooting instruction using phase focusing, it can be understood that the user turns on the shooting device and performs a click operation on the display screen of the terminal in the image capturing mode (as shown in FIG. 4 ), and the shooting device at this time The current phase difference value between the two images formed on the PD sensor (the second ROI target image and the preset mask image) is acquired. The terminal can open the camera through its own camera program, or use other applications to call or turn on the camera, such as social software, image processing software and other applications. Among them, the phase focusing separates the image into two images through the separation lens and the linear sensor, and then detects the distance between the two images through the linear sensor, that is, the phase difference between the two images, and finally the linear signal through the phase detection. And the phase difference value to determine whether the current focus position is front or back, and accurately tells the camera motor which direction the lens should be driven to move, and in the accurate focus position, the phase focus system can accurately know that the current focus is already Focus state.
S206、检测当前相位差值是否属于预设的相位差值范围,该预设的相位差值范围为触发终端实现相位对焦的相位差值范围。S206. Detect whether the current phase difference value belongs to a preset phase difference value range, where the preset phase difference value range is a phase difference value range in which the trigger terminal implements phase focusing.
具体的,终端检测当前相位差值是否属于预设的相位差值范围,该预设的相位差值范围为触发终端实现相位对焦的相位差值范围。由于相位对焦对环境中的光线和细节有一定的要求,因此不是在任何环境中都能使用相位对焦进行对焦,当环境中的光线和细节满足要求时便能触发终端采用相位对焦进行对焦,可以理解的是此时的相位差值能够触发相位对焦,此时的相位差值在预设的相位差值范围内。但是,当环境中的光线不是很足,细节不是很丰富时,此时的相位差值较小,未在预设的相位差值范围内,因此无法触发相位对焦。Specifically, the terminal detects whether the current phase difference value belongs to a preset phase difference value range, where the preset phase difference value range is a range of phase difference values that triggers the terminal to achieve phase focusing. Since phase focusing has certain requirements on the light and details in the environment, it is not possible to use phase focusing to focus in any environment. When the light and details in the environment meet the requirements, the terminal can be triggered by phase focusing. It is understood that the phase difference value at this time can trigger phase focusing, and the phase difference value at this time is within the preset phase difference value range. However, when the light in the environment is not very sufficient and the details are not very rich, the phase difference at this time is small and is not within the preset phase difference range, so phase focusing cannot be triggered.
S207、若检测出当前相位差值不属于预设的相位差值范围,则将拍摄 马达移动至与当前相位差值对应的目标对焦范围内。S207. If it is detected that the current phase difference value does not belong to the preset phase difference value range, the shooting will be performed. The motor moves to within the target focus range corresponding to the current phase difference.
作为一种实施方式,首先,当检测的结果为当前相位差值不属于预设的相位差值范围时,终端根据当前相位差值确定拍摄马达的移动信息。As an implementation manner, first, when the result of the detection is that the current phase difference value does not belong to the preset phase difference value range, the terminal determines the movement information of the photographing motor according to the current phase difference value.
本实施例中,当检测的结果为否时,即当前相位差值不属于预设的相位差值范围,可以理解的是当前相位差值无法触发终端采用相位对焦进行对焦。无论采用哪种对焦方式都需要确定拍摄马达的移动信息,即向哪个方向移动,移动多少距离,拍摄马达可以驱动镜片的移动,在拍摄的过程中,移动拍摄马达必将驱动镜片的移动,从而使镜片在准确的合焦位置处进行对焦,以完成拍摄。当能够采用相位对焦方式进行对焦时,拍摄装置直接根据当前相位差值将拍摄马达移动至合焦位置处。当采用反差式对焦方式进行对焦时,若镜片在后端,则拍摄马达先往前端移动然后再退回后端,以确定合焦位置;若镜片在前端,则拍摄马达先往后端移动然后再往前端移动,以确定合焦位置。In this embodiment, when the result of the detection is no, that is, the current phase difference value does not belong to the preset phase difference value range, it can be understood that the current phase difference value cannot trigger the terminal to use phase focusing to perform focusing. Regardless of which focusing method is used, it is necessary to determine the movement information of the shooting motor, that is, in which direction to move, how much distance to move, the shooting motor can drive the movement of the lens, and during the shooting process, the moving shooting motor must drive the movement of the lens, thereby Focus the lens at the exact focus position to complete the shot. When the focus can be performed by the phase focusing method, the photographing device directly moves the photographing motor to the focus position according to the current phase difference value. When using the contrast focus method to focus, if the lens is at the back end, the camera motor moves to the front end and then back to the back end to determine the focus position; if the lens is at the front end, the camera motor moves to the back end and then Move to the front to determine the focus position.
当检测的结果为否时,终端根据当前相位差值确定拍摄马达的移动信息,该移动信息包括移动方向和移动距离。终端根据当前相位差值的正负确定拍摄马达是往前端移动还是后端移动,作为一种实施方式,当当前相位差值为正时,拍摄马达往后端移动;当当前相位差值为负时,拍摄马达往前端移动。终端根据当前相位差值的绝对值确定拍摄马达的移动距离。When the result of the detection is negative, the terminal determines movement information of the photographing motor according to the current phase difference value, the movement information including a moving direction and a moving distance. The terminal determines whether the shooting motor moves to the front end or the back end according to the positive or negative of the current phase difference value. As an implementation manner, when the current phase difference value is positive, the shooting motor moves to the rear end; when the current phase difference value is When it is negative, the shooting motor moves to the front end. The terminal determines the moving distance of the photographing motor based on the absolute value of the current phase difference value.
其次,终端根据移动信息确定拍摄马达的目标对焦范围。Next, the terminal determines a target focus range of the photographing motor based on the movement information.
本实施例中,终端在确定移动方向之后便根据移动距离将拍摄马达移动到目标位置处,终端根据目标位置以及预设距离确定拍摄马达的目标对焦范围,该目标对焦范围的中点处为目标位置,将目标位置处前后距离为预设距离的范围作为目标对焦范围。其中,预设距离的数值较小,以使目标对焦范围相比反差式对焦的移动范围而言小得多,预设距离的具体值可由终端的制造厂商基于具体情况预先设定。 In this embodiment, after determining the moving direction, the terminal moves the shooting motor to the target position according to the moving distance, and the terminal determines the target focusing range of the shooting motor according to the target position and the preset distance, where the target is at the midpoint of the focusing range. The position is a range in which the front-rear distance at the target position is a preset distance as the target focus range. Wherein, the value of the preset distance is small, so that the target focus range is much smaller than the moving range of the contrast focus, and the specific value of the preset distance can be preset by the manufacturer of the terminal based on the specific situation.
最后,终端将拍摄马达移动至目标对焦范围内。Finally, the terminal moves the shooting motor to the target focus range.
本实施例中,一旦所述目标对焦范围确定,终端便将拍摄马达移动至目标对焦范围内,以方便终端的拍摄装置在目标对焦范围内查找目标对焦位置,即准确对焦的位置。In this embodiment, once the target focus range is determined, the terminal moves the photographing motor to the target focus range, so that the photographing device of the terminal can find the target focus position, that is, the position of accurate focus, within the target focus range.
S208、在目标对焦范围内调节拍摄马达的位置,以在第一ROI区域内确定目标对焦位置,从而实现对焦。S208. Adjust a position of the photographing motor within a target focus range to determine a target focus position in the first ROI region, thereby achieving focusing.
终端将拍摄马达移动至与当前相位差值对应的目标对焦范围内之后,由于当前相位差是针对第一ROI区域而言的,因此,目标对焦范围属于第一ROI区域,那么该终端目标对焦范围内调节拍摄马达的位置,可以在第一ROI区域内确定目标对焦位置,从而实现了对焦。After the terminal moves the photographing motor to the target focus range corresponding to the current phase difference value, since the current phase difference is for the first ROI region, the target focus range belongs to the first ROI region, and the target target focus range is By adjusting the position of the shooting motor internally, the target focus position can be determined in the first ROI area, thereby achieving focusing.
采用本发明实施例提供的对焦方法,对于小的物体,多个ROI区域可以准确的匹配到小的物体,从而实现聚焦;而对于中间是平坦区域的情况,多个ROI区域里面的小ROI区域的PD confidence level值是非常小的,所以会选取到较大的ROI区域,从而也可以轻松的对平坦区域实现聚焦,并且每个ROI区域的PD值和PD confidence level值都是由sensor直接输出,处理前基本不参与运算,所以运算效率上也是很高的。With the focusing method provided by the embodiment of the present invention, for a small object, multiple ROI regions can be accurately matched to a small object to achieve focusing; and for a case where the middle is a flat region, a small ROI region in multiple ROI regions is used. The PD confidence level value is very small, so the larger ROI area is selected, so that the flat area can be easily focused, and the PD value and PD confidence level value of each ROI area are directly output by the sensor. Basically, it does not participate in the calculation before processing, so the operation efficiency is also very high.
实施例三Embodiment 3
如图8所示,本发明实施例提供了一种终端1,该终端1可以包括:As shown in FIG. 8, the embodiment of the present invention provides a terminal 1, which may include:
采集单元10,配置为通过图像传感器采集第一图像;The collecting unit 10 is configured to acquire a first image by using an image sensor;
对焦单元11,配置为采用初始ROI区域对所述采集单元10采集的第一图像进行初始对焦;The focusing unit 11 is configured to perform initial focusing on the first image collected by the collecting unit 10 by using an initial ROI region;
判断单元12,配置为判断所述初始ROI区域对应的第一ROI目标图像的有效性,所述第一ROI目标图像为所述第一图像的部分图像;The determining unit 12 is configured to determine validity of the first ROI target image corresponding to the initial ROI region, where the first ROI target image is a partial image of the first image;
所述确定单元13,配置为若所述判断单元12判断出所述第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区 域,所述第一ROI区域对应的第二ROI目标图像有效,所述第二ROI目标图像为所述第一图像的部分图像,所述第一ROI目标图像与所述第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;以及确定所述第一ROI区域对应的当前相位差值;The determining unit 13 is configured to determine, according to the preset priority, the first ROI area from the n preset ROI areas, if the determining unit 12 determines that the first ROI target image is invalid. a second ROI target image corresponding to the first ROI region is valid, the second ROI target image is a partial image of the first image, and the first ROI target image and the second ROI target image are not The same is true, wherein n is a preset value, n is greater than or equal to 1; and determining a current phase difference value corresponding to the first ROI region;
所述对焦单元11,还配置为根据所述确定单元13确定的所述当前相位差值实现对焦。The focusing unit 11 is further configured to achieve focusing according to the current phase difference value determined by the determining unit 13.
作为一种实施方式,如图9所示,所述终端1还包括:计算单元14;As an embodiment, as shown in FIG. 9, the terminal 1 further includes: a computing unit 14;
所述计算单元14,配置为计算所述ROI区域对应的可信度值。The calculating unit 14 is configured to calculate a credibility value corresponding to the ROI region.
所述判断单元12,配置为比较所述计算单元14计算的所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性。The determining unit 12 is configured to compare the value of the credibility value calculated by the calculating unit 14 with a preset threshold, and determine the validity of the ROI target image corresponding to the ROI region based on the comparison result.
作为一种实施方式,所述判断单元12,还配置为若所述可信度值小于预设阈值,判定所述ROI目标图像无效;若所述可信度值大于等于所述预设阈值,判定所述ROI目标图像有效。As an implementation manner, the determining unit 12 is further configured to: if the credibility value is less than a preset threshold, determine that the ROI target image is invalid; if the credibility value is greater than or equal to the preset threshold, It is determined that the ROI target image is valid.
作为一种实施方式,所述确定单元13,配置为根据所述第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出所述当前相位差值。As an implementation manner, the determining unit 13 is configured to determine the current phase difference value according to a distance between a first pixel corresponding to the second ROI target image and a preset masking pixel.
作为一种实施方式,如图10所示,所述终端1还包括:检测单元15和位移单元16;As an embodiment, as shown in FIG. 10, the terminal 1 further includes: a detecting unit 15 and a displacement unit 16;
所述检测单元15,配置为检测所述当前相位差值是否属于预设的相位差值范围,所述预设的相位差值范围为触发终端实现相位对焦的相位差值范围;The detecting unit 15 is configured to detect whether the current phase difference value belongs to a preset phase difference value range, where the preset phase difference value range is a range of phase difference values for triggering the terminal to achieve phase focusing;
所述位移单元16,配置为若所述检测单元15检测出所述当前相位差值不属于所述预设的相位差值范围,则将拍摄马达移动至与所述当前相位差值对应的目标对焦范围内; The displacement unit 16 is configured to move the photographing motor to a target corresponding to the current phase difference value if the detecting unit 15 detects that the current phase difference value does not belong to the preset phase difference value range Within the focus range;
所述对焦单元11,配置为在所述目标对焦范围内调节所述拍摄马达的位置,以在所述第一ROI区域内确定目标对焦位置,从而实现对焦。The focusing unit 11 is configured to adjust a position of the photographing motor within the target focus range to determine a target focus position within the first ROI region, thereby achieving focusing.
如图11所示,在实际应用中,上述对焦单元11、判断单元12、确定单元13、计算单元14、检测单元15和位移单元16可由位于终端1上的处理器17实现,具体可通过中央处理器(CPU)、微处理器(MPU)、DSP或FPGA等实现,上述采集单元10可由终端1上的摄像头18实现,该终端1还可以包括存储器19,该存储器19可以通过系统总线110与处理器17连接,其中,存储器19用于存储可执行程序代码,该程序代码包括计算机操作指令,存储器19可能包含高速RAM存储器,也可能还包括非易失性存储器,例如,至少一个磁盘存储器。As shown in FIG. 11, in an actual application, the above-mentioned focusing unit 11, the determining unit 12, the determining unit 13, the calculating unit 14, the detecting unit 15, and the shifting unit 16 may be implemented by the processor 17 located on the terminal 1, specifically through the center. Implemented by a processor (CPU), a microprocessor (MPU), a DSP or an FPGA, etc., the above-mentioned acquisition unit 10 can be implemented by a camera 18 on the terminal 1, and the terminal 1 can further include a memory 19, which can be connected through the system bus 110. The processor 17 is connected, wherein the memory 19 is for storing executable program code, the program code comprising computer operating instructions, the memory 19 may comprise a high speed RAM memory, and possibly also a non-volatile memory, such as at least one disk memory.
需要说明的是:上述实施例提供的信息提醒装置在进行信息提醒时,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述处理分配由不同的程序模块完成,即将装置的内部结构划分成不同的程序模块,以完成以上描述的全部或者部分处理。另外,上述实施例提供的信息提醒装置与信息提醒方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that, when the information reminding device provided by the foregoing embodiment is used for the information reminding, only the division of each of the foregoing program modules is illustrated. In an actual application, the processing allocation may be completed by different program modules as needed. The internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the information reminding device and the information reminding method embodiment provided by the foregoing embodiments are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
本发明实施例还提供了一种终端,可参照图11所示,所述终端包括:处理器17和用于存储能够在处理器17上运行的计算机程序的存储器19;其中,所述处理器17用于运行所述计算机程序时,执行本发明实施例所述的对焦方法的步骤。具体的,所述处理器17用于运行所述计算机程序时,执行:通过图像传感器采集第一图像,采用初始感兴趣区域ROI区域对所述第一图像进行初始对焦;判断所述初始ROI区域对应的第一ROI目标图像的有效性,所述第一ROI目标图像为所述第一图像的部分图像;若判断出所述第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,所述第一ROI区域对应的第二ROI目标图像有效, 所述第二ROI目标图像为所述第一图像的部分图像,所述第一ROI目标图像与所述第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;确定所述第一ROI区域对应的当前相位差值,并根据所述当前相位差值实现对焦。The embodiment of the present invention further provides a terminal, as shown in FIG. 11, the terminal includes: a processor 17 and a memory 19 for storing a computer program capable of running on the processor 17, wherein the processor 17 is the step of performing the focusing method of the embodiment of the present invention when the computer program is run. Specifically, when the processor 17 is configured to run the computer program, the first image is acquired by an image sensor, and the first image is initially focused by using an initial region of interest ROI; and the initial ROI region is determined. Corresponding first ROI target image, the first ROI target image is a partial image of the first image; if it is determined that the first ROI target image is invalid, according to a preset priority, from n Determining a first ROI area in the preset ROI area, where the second ROI target image corresponding to the first ROI area is valid, The second ROI target image is a partial image of the first image, and the first ROI target image is not exactly the same as the second ROI target image, where n is a preset value, n is greater than or equal to 1; a current phase difference value corresponding to the first ROI region, and performing focusing according to the current phase difference value.
作为一种实施方式,所述处理器17用于运行所述计算机程序时,执行:计算所述ROI区域对应的可信度值;比较所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性。As an implementation manner, when the processor 17 is configured to run the computer program, performing: calculating a credibility value corresponding to the ROI region; comparing the credibility value with a preset threshold, based on comparing As a result, the validity of the ROI target image corresponding to the ROI region is determined.
作为一种实施方式,所述处理器17用于运行所述计算机程序时,执行:若所述可信度值小于预设阈值,则判定所述ROI目标图像无效;若所述可信度值大于等于所述预设阈值,则判定所述ROI目标图像有效。As an embodiment, when the processor 17 is configured to run the computer program, if the credibility value is less than a preset threshold, determining that the ROI target image is invalid; if the credibility value is If the preset threshold is greater than or equal to, the ROI target image is determined to be valid.
作为一种实施方式,所述处理器17用于运行所述计算机程序时,执行:根据所述第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出所述当前相位差值。As an embodiment, when the processor 17 is configured to run the computer program, determining, according to a distance between a first pixel corresponding to the second ROI target image and a preset masking pixel, determining the current Phase difference.
作为一种实施方式,所述处理器17用于运行所述计算机程序时,执行:检测所述当前相位差值是否属于预设的相位差值范围,所述预设的相位差值范围为触发终端实现相位对焦的相位差值范围;若检测出所述当前相位差值不属于所述预设的相位差值范围,则将拍摄马达移动至与所述当前相位差值对应的目标对焦范围内;在所述目标对焦范围内调节所述拍摄马达的位置,以在所述第一ROI区域内确定目标对焦位置,从而实现对焦。As an implementation manner, when the processor 17 is configured to run the computer program, it is executed to: detect whether the current phase difference value belongs to a preset phase difference value range, and the preset phase difference value range is a trigger. The terminal realizes a phase difference range of the phase focus; if it is detected that the current phase difference does not belong to the preset phase difference range, moving the shooting motor to a target focus range corresponding to the current phase difference Adjusting a position of the photographing motor within the target focus range to determine a target focus position within the first ROI region, thereby achieving focusing.
作为一种实施方式,所述处理器17用于运行所述计算机程序时,执行:接收到拍照指令时,在显示区域中输出初始ROI区域对应的区域标识,基于所述初始ROI区域对应的区域标识对所述第一图像进行初始对焦。As an embodiment, when the processor 17 is configured to execute the computer program, the processor 17 outputs: when receiving the photographing instruction, outputting an area identifier corresponding to the initial ROI area in the display area, based on the area corresponding to the initial ROI area. An initial focus is performed on the first image.
作为一种实施方式,所述处理器17用于运行所述计算机程序时,执行:按照预设优先级的顺序,依次对所述n个ROI区域对应的ROI目标图像进行有效性的判断,判定出一个ROI区域对应的ROI目标图像有效时,将所 述ROI区域确定为第一ROI区域。As an implementation manner, when the processor 17 is configured to run the computer program, performing: determining, according to a preset priority order, the validity of the ROI target image corresponding to the n ROI regions, and determining When an ROI target image corresponding to an ROI area is valid, The ROI area is determined as the first ROI area.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例所述的对焦方法。具体的,所述计算机可执行指令被执行时,实现:通过图像传感器采集第一图像,采用初始感兴趣区域ROI区域对所述第一图像进行初始对焦;判断所述初始ROI区域对应的第一ROI目标图像的有效性,所述第一ROI目标图像为所述第一图像的部分图像;若判断出所述第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,所述第一ROI区域对应的第二ROI目标图像有效,所述第二ROI目标图像为所述第一图像的部分图像,所述第一ROI目标图像与所述第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;确定所述第一ROI区域对应的当前相位差值,并根据所述当前相位差值实现对焦。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the focusing method according to the embodiment of the invention. Specifically, when the computer executable instruction is executed, the first image is acquired by the image sensor, and the first image is initially focused by using an initial region of interest ROI region; and the first ROI region is determined to be corresponding to the first image. The validity of the ROI target image, the first ROI target image is a partial image of the first image; if it is determined that the first ROI target image is invalid, according to a preset priority, from n preset ROI regions Determining a first ROI region, wherein a second ROI target image corresponding to the first ROI region is valid, the second ROI target image is a partial image of the first image, the first ROI target image and the first The two ROI target images are not identical, wherein n is a preset value, n is greater than or equal to 1; a current phase difference value corresponding to the first ROI region is determined, and focusing is performed according to the current phase difference value.
作为一种实施方式,所述计算机可执行指令被执行时,实现:计算所述ROI区域对应的可信度值;比较所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性。As an implementation manner, when the computer executable instruction is executed, the method is: calculating a credibility value corresponding to the ROI region; comparing the credibility value with a preset threshold, and determining the The validity of the ROI target image corresponding to the ROI region.
作为一种实施方式,所述计算机可执行指令被执行时,实现:若所述可信度值小于预设阈值,则判定所述ROI目标图像无效;若所述可信度值大于等于所述预设阈值,则判定所述ROI目标图像有效。As an embodiment, when the computer executable instruction is executed, if the credibility value is less than a preset threshold, determining that the ROI target image is invalid; if the credibility value is greater than or equal to the The preset threshold is used to determine that the ROI target image is valid.
作为一种实施方式,所述计算机可执行指令被执行时,实现:根据所述第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出所述当前相位差值。As an embodiment, when the computer executable instructions are executed, the current phase difference value is determined according to a distance between a first pixel corresponding to the second ROI target image and a preset shadow pixel.
作为一种实施方式,所述计算机可执行指令被执行时,实现:检测所述当前相位差值是否属于预设的相位差值范围,所述预设的相位差值范围为触发终端实现相位对焦的相位差值范围;若检测出所述当前相位差值不属于所述预设的相位差值范围,则将拍摄马达移动至与所述当前相位差值 对应的目标对焦范围内;在所述目标对焦范围内调节所述拍摄马达的位置,以在所述第一ROI区域内确定目标对焦位置,从而实现对焦。As an implementation manner, when the computer executable instruction is executed, it is implemented to: detect whether the current phase difference value belongs to a preset phase difference value range, and the preset phase difference value range is a trigger terminal to implement phase focusing a phase difference value range; if it is detected that the current phase difference value does not belong to the preset phase difference value range, moving the photographing motor to the current phase difference value Corresponding to the target focus range; adjusting the position of the photographing motor within the target focus range to determine a target focus position within the first ROI region, thereby achieving focusing.
作为一种实施方式,所述计算机可执行指令被执行时,实现:接收到拍照指令时,在显示区域中输出初始ROI区域对应的区域标识,基于所述初始ROI区域对应的区域标识对所述第一图像进行初始对焦。As an embodiment, when the computer executable instruction is executed, when the photographing instruction is received, the area identifier corresponding to the initial ROI area is output in the display area, and the area identifier corresponding to the initial ROI area is used to The first image is initially focused.
作为一种实施方式,所述计算机可执行指令被执行时,实现:按照预设优先级的顺序,依次对所述n个ROI区域对应的ROI目标图像进行有效性的判断,判定出一个ROI区域对应的ROI目标图像有效时,将所述ROI区域确定为第一ROI区域。As an implementation manner, when the computer executable instructions are executed, the method further determines, according to a preset priority order, the validity of the ROI target image corresponding to the n ROI regions, and determines an ROI region. When the corresponding ROI target image is valid, the ROI area is determined as the first ROI area.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个 流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The device is implemented in a flow chart A function specified in a block or blocks of a process or multiple processes and/or block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.
工业实用性Industrial applicability
本发明实施例的技术方案,终端可以在对不同大小的物体或对象进行拍照时,自适应的进行不同预设ROI区域的调整,从而采用不同预设ROI区域对应的不同可信度对不同的物体进行对焦调整,以保证在大小不一的物体的对焦准确的基础上,提高对焦的效率。 In the technical solution of the embodiment of the present invention, the terminal can adaptively adjust different preset ROI regions when taking photos of objects or objects of different sizes, so that different credibility corresponding to different preset ROI regions are used to different The object is adjusted in focus to ensure the focus efficiency is improved on the basis of accurate focus of objects of different sizes.

Claims (20)

  1. 一种对焦方法,包括:A focusing method comprising:
    通过图像传感器采集第一图像,采用初始感兴趣区域ROI区域对所述第一图像进行初始对焦;Acquiring a first image by an image sensor, and initially focusing the first image by using an initial region of interest ROI region;
    判断所述初始ROI区域对应的第一ROI目标图像的有效性,所述第一ROI目标图像为所述第一图像的部分图像;Determining validity of the first ROI target image corresponding to the initial ROI region, the first ROI target image being a partial image of the first image;
    若判断出所述第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,所述第一ROI区域对应的第二ROI目标图像有效,所述第二ROI目标图像为所述第一图像的部分图像,所述第一ROI目标图像与所述第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;If it is determined that the first ROI target image is invalid, the first ROI region is determined from the n preset ROI regions according to the preset priority, and the second ROI target image corresponding to the first ROI region is valid, The second ROI target image is a partial image of the first image, the first ROI target image is not exactly the same as the second ROI target image, wherein n is a preset value, n is greater than or equal to 1;
    确定所述第一ROI区域对应的当前相位差值,并根据所述当前相位差值实现对焦。Determining a current phase difference value corresponding to the first ROI region, and performing focusing according to the current phase difference value.
  2. 根据权利要求1所述的方法,其中,判断ROI区域对应的ROI目标图像的有效性的方法,包括:The method of claim 1, wherein the method for determining the validity of the ROI target image corresponding to the ROI region comprises:
    计算所述ROI区域对应的可信度值;Calculating a credibility value corresponding to the ROI region;
    比较所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性。Comparing the credibility value with a preset threshold value, and determining, according to the comparison result, the validity of the ROI target image corresponding to the ROI region.
  3. 根据权利要求2所述的方法,其中,所述比较所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性,包括:The method according to claim 2, wherein the comparing the reliability value with the size of the preset threshold, determining the validity of the ROI target image corresponding to the ROI region based on the comparison result, comprising:
    若所述可信度值小于预设阈值,则判定所述ROI目标图像无效;If the credibility value is less than a preset threshold, determining that the ROI target image is invalid;
    若所述可信度值大于等于所述预设阈值,则判定所述ROI目标图像有效。If the credibility value is greater than or equal to the preset threshold, it is determined that the ROI target image is valid.
  4. 根据权利要求1所述的方法,其中,所述确定所述第一ROI区域对 应的当前相位差值,包括:The method of claim 1 wherein said determining said first ROI region pair The current phase difference value that should be included, including:
    根据所述第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出所述当前相位差值。And determining the current phase difference value according to a distance between the first pixel corresponding to the second ROI target image and the preset masking pixel.
  5. 根据权利要求1所述的方法,其中,所述根据所述当前相位差值实现对焦,包括:The method of claim 1 wherein said achieving focus based on said current phase difference comprises:
    检测所述当前相位差值是否属于预设的相位差值范围,所述预设的相位差值范围为触发终端实现相位对焦的相位差值范围;Detecting whether the current phase difference value belongs to a preset phase difference value range, where the preset phase difference value range is a range of phase difference values for triggering the terminal to achieve phase focusing;
    若检测出所述当前相位差值不属于所述预设的相位差值范围,则将拍摄马达移动至与所述当前相位差值对应的目标对焦范围内;If it is detected that the current phase difference value does not belong to the preset phase difference value range, moving the photographing motor to a target focus range corresponding to the current phase difference value;
    在所述目标对焦范围内调节所述拍摄马达的位置,以在所述第一ROI区域内确定目标对焦位置,从而实现对焦。Adjusting a position of the photographing motor within the target focus range to determine a target focus position within the first ROI region, thereby achieving focusing.
  6. 根据权利要求1所述的方法,其中,所述采用初始ROI区域对所述第一图像进行初始对焦,包括:The method of claim 1 wherein said initial focusing of said first image using an initial ROI region comprises:
    接收到拍照指令时,在显示区域中输出初始ROI区域对应的区域标识,基于所述初始ROI区域对应的区域标识对所述第一图像进行初始对焦。When the photographing instruction is received, the area identifier corresponding to the initial ROI area is outputted in the display area, and the first image is initially focused based on the area identifier corresponding to the initial ROI area.
  7. 根据权利要求1至6任一项所述的方法,其中,所述初始ROI区域为预先设置的区域,或者,基于输入操作确定的期望聚焦的区域。The method according to any one of claims 1 to 6, wherein the initial ROI area is a preset area, or an area of desired focus determined based on an input operation.
  8. 根据权利要求1所述的方法,其中,所述n个预设ROI区域中每个预设ROI区域的预设优先级与对应预设ROI区域的尺寸大小相关联。The method according to claim 1, wherein a preset priority of each of the n preset ROI regions is associated with a size of a corresponding preset ROI region.
  9. 根据权利要求8所述的方法,其中,所述按照预设优先级,从n个预设ROI区域中确定第一ROI区域,包括:The method according to claim 8, wherein the determining the first ROI region from the n preset ROI regions according to a preset priority comprises:
    按照预设优先级的顺序,依次对所述n个ROI区域对应的ROI目标图像进行有效性的判断,判定出一个ROI区域对应的ROI目标图像有效时,将所述ROI区域确定为第一ROI区域。Determining validity of the ROI target image corresponding to the n ROI regions in sequence according to a preset priority, and determining that the ROI target image corresponding to one ROI region is valid, determining the ROI region as the first ROI region.
  10. 一种终端,包括: A terminal comprising:
    采集单元,配置为通过图像传感器采集第一图像;An acquisition unit configured to acquire a first image by using an image sensor;
    对焦单元,配置为采用初始ROI区域对所述采集单元采集的第一图像进行初始对焦;a focusing unit configured to perform initial focusing on the first image acquired by the collecting unit by using an initial ROI area;
    判断单元,配置为判断所述初始ROI区域对应的第一ROI目标图像的有效性,所述第一ROI目标图像为所述第一图像的部分图像;a determining unit, configured to determine validity of the first ROI target image corresponding to the initial ROI region, where the first ROI target image is a partial image of the first image;
    所述确定单元,配置为若所述判断单元判断出所述第一ROI目标图像无效,则按照预设优先级,从n个预设ROI区域中确定第一ROI区域,所述第一ROI区域对应的第二ROI目标图像有效,所述第二ROI目标图像为所述第一图像的部分图像,所述第一ROI目标图像与所述第二ROI目标图像不完全相同,其中,n为预设数值,n大于等于1;以及确定所述第一ROI区域对应的当前相位差值;The determining unit is configured to: if the determining unit determines that the first ROI target image is invalid, determine a first ROI region from the n preset ROI regions according to a preset priority, the first ROI region Corresponding second ROI target image is valid, the second ROI target image is a partial image of the first image, and the first ROI target image is not completely identical to the second ROI target image, wherein n is a pre- Setting a value, n is greater than or equal to 1; and determining a current phase difference value corresponding to the first ROI region;
    所述对焦单元,还配置为根据所述确定单元确定的所述当前相位差值实现对焦。The focusing unit is further configured to achieve focusing according to the current phase difference value determined by the determining unit.
  11. 根据权利要求10所述的终端,其中,所述终端还包括:计算单元;The terminal according to claim 10, wherein the terminal further comprises: a calculating unit;
    所述计算单元,配置为计算所述ROI区域对应的可信度值;The calculating unit is configured to calculate a credibility value corresponding to the ROI region;
    所述判断单元,配置为比较所述计算单元计算的所述可信度值与预设阈值的大小,基于比较结果判定所述ROI区域对应的所述ROI目标图像的有效性。The determining unit is configured to compare the value of the credibility value calculated by the calculating unit with a preset threshold, and determine the validity of the ROI target image corresponding to the ROI region based on the comparison result.
  12. 根据权利要求11所述的终端,其中,The terminal according to claim 11, wherein
    所述判断单元,还配置为若所述可信度值小于预设阈值,判定所述ROI目标图像无效;若所述可信度值大于等于所述预设阈值,判定所述ROI目标图像有效。The determining unit is further configured to determine that the ROI target image is invalid if the credibility value is less than a preset threshold, and determine that the ROI target image is valid if the credibility value is greater than or equal to the preset threshold. .
  13. 根据权利要求10所述的终端,其中,The terminal according to claim 10, wherein
    所述确定单元,配置为根据所述第二ROI目标图像对应的第一像素与预设遮蔽像素之间的距离,确定出所述当前相位差值。 The determining unit is configured to determine the current phase difference value according to a distance between a first pixel corresponding to the second ROI target image and a preset shadow pixel.
  14. 根据权利要求10所述的终端,其中,所述终端还包括:检测单元和位移单元;The terminal according to claim 10, wherein the terminal further comprises: a detecting unit and a displacement unit;
    所述检测单元,配置为检测所述当前相位差值是否属于预设的相位差值范围,所述预设的相位差值范围为触发终端实现相位对焦的相位差值范围;The detecting unit is configured to detect whether the current phase difference value belongs to a preset phase difference value range, where the preset phase difference value range is a range of phase difference values for triggering the terminal to achieve phase focusing;
    所述位移单元,配置为若所述检测单元检测出所述当前相位差值不属于所述预设的相位差值范围,则将拍摄马达移动至与所述当前相位差值对应的目标对焦范围内;The displacement unit is configured to move the photographing motor to a target focus range corresponding to the current phase difference value if the detecting unit detects that the current phase difference value does not belong to the preset phase difference value range Inside;
    所述对焦单元,配置为在所述目标对焦范围内调节所述拍摄马达的位置,以在所述第一ROI区域内确定目标对焦位置,从而实现对焦。The focusing unit is configured to adjust a position of the photographing motor within the target focus range to determine a target in-focus position in the first ROI region, thereby achieving focusing.
  15. 根据权利要求10所述的终端,其中,所述对焦单元,配置为接收到拍照指令时,在显示区域中输出初始ROI区域对应的区域标识,基于所述初始ROI区域对应的区域标识对所述第一图像进行初始对焦。The terminal according to claim 10, wherein the focusing unit is configured to: when receiving the photographing instruction, output an area identifier corresponding to the initial ROI area in the display area, based on the area identifier corresponding to the initial ROI area The first image is initially focused.
  16. 根据权利要求10至15任一项所述的终端,其中,所述初始ROI区域为预先设置的区域,或者,基于输入操作确定的期望聚焦的区域。The terminal according to any one of claims 10 to 15, wherein the initial ROI area is a preset area or an area of desired focus determined based on an input operation.
  17. 根据权利要求10所述的终端,其中,所述n个预设ROI区域中每个预设ROI区域的预设优先级与对应预设ROI区域的尺寸大小相关联。The terminal according to claim 10, wherein a preset priority of each of the n preset ROI regions is associated with a size of a corresponding preset ROI region.
  18. 根据权利要求17所述的终端,其中,所述确定单元,配置为按照预设优先级的顺序,依次对所述n个ROI区域对应的ROI目标图像进行有效性的判断,判定出一个ROI区域对应的ROI目标图像有效时,将所述ROI区域确定为第一ROI区域。The terminal according to claim 17, wherein the determining unit is configured to sequentially determine validity of the ROI target image corresponding to the n ROI regions according to a preset priority order, and determine an ROI region. When the corresponding ROI target image is valid, the ROI area is determined as the first ROI area.
  19. 一种终端,其特征在于,包括:处理器和用于存储能够在处理器上运行的计算机程序的存储器;A terminal, comprising: a processor and a memory for storing a computer program executable on the processor;
    其中,所述处理器用于运行所述计算机程序时,执行权利要求1至9任一项所述的对焦方法的步骤。 Wherein the processor is configured to perform the step of the focusing method according to any one of claims 1 to 9 when the computer program is run.
  20. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1至9任一项所述的对焦方法。 A computer storage medium having stored therein computer executable instructions for performing the focusing method of any one of claims 1 to 9.
PCT/CN2017/092457 2016-07-29 2017-07-11 Focusing method, terminal, and computer storage medium WO2018019122A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610614042.3A CN106060407A (en) 2016-07-29 2016-07-29 Focusing method and terminal
CN201610614042.3 2016-07-29

Publications (1)

Publication Number Publication Date
WO2018019122A1 true WO2018019122A1 (en) 2018-02-01

Family

ID=57195822

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/092457 WO2018019122A1 (en) 2016-07-29 2017-07-11 Focusing method, terminal, and computer storage medium

Country Status (2)

Country Link
CN (1) CN106060407A (en)
WO (1) WO2018019122A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113495301A (en) * 2020-03-20 2021-10-12 株式会社理光 Bandage inspection method, bandage inspection device, storage medium, and system

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106060407A (en) * 2016-07-29 2016-10-26 努比亚技术有限公司 Focusing method and terminal
CN108337424B (en) * 2017-01-17 2021-04-16 中兴通讯股份有限公司 Phase focusing method and device thereof
CN107133982B (en) * 2017-04-28 2020-05-15 Oppo广东移动通信有限公司 Depth map construction method and device, shooting equipment and terminal equipment
CN107257433B (en) 2017-06-16 2020-01-17 Oppo广东移动通信有限公司 Focusing method, device, terminal and computer readable storage medium
CN108184055A (en) * 2017-12-28 2018-06-19 上海传英信息技术有限公司 A kind of focusing method and focusing mechanism based on intelligent terminal
WO2020042126A1 (en) * 2018-08-30 2020-03-05 华为技术有限公司 Focusing apparatus, method and related device
CN109859186B (en) * 2019-01-31 2020-12-29 江苏理工学院 Lithium battery module positive and negative electrode detection method based on halcon
CN112866549B (en) * 2019-11-12 2022-04-12 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment and computer readable storage medium
CN112866552B (en) * 2019-11-12 2023-06-13 Oppo广东移动通信有限公司 Focusing method and device, electronic equipment and computer readable storage medium
CN112001387B (en) * 2020-09-18 2022-09-30 展讯半导体(南京)有限公司 Method and device for determining focusing area, terminal and storage medium
CN113923347A (en) * 2021-08-18 2022-01-11 影石创新科技股份有限公司 Automatic focusing method and device, shooting terminal and computer readable storage medium
CN117201935A (en) * 2022-05-25 2023-12-08 惠州Tcl移动通信有限公司 Lens focusing method, device, electronic equipment and computer readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103369240A (en) * 2012-04-06 2013-10-23 索尼公司 Imaging apparatus, focus control method, and program
CN103424952A (en) * 2012-05-15 2013-12-04 深圳中兴力维技术有限公司 Focusing region self-adaptive automatic focusing method and device
US20140176783A1 (en) * 2012-12-21 2014-06-26 Canon Kabushiki Kaisha Image capturing apparatus and method for controlling the same
CN104270562A (en) * 2014-08-15 2015-01-07 广东欧珀移动通信有限公司 Method and device for focusing when photographing
CN105516582A (en) * 2014-10-14 2016-04-20 奥林巴斯株式会社 Imaging device and control method for imaging device
CN106060407A (en) * 2016-07-29 2016-10-26 努比亚技术有限公司 Focusing method and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008276115A (en) * 2007-05-07 2008-11-13 Olympus Imaging Corp Digital camera and focus control program
CN104363376A (en) * 2014-11-28 2015-02-18 广东欧珀移动通信有限公司 Continuous focusing method, device and terminal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103369240A (en) * 2012-04-06 2013-10-23 索尼公司 Imaging apparatus, focus control method, and program
CN103424952A (en) * 2012-05-15 2013-12-04 深圳中兴力维技术有限公司 Focusing region self-adaptive automatic focusing method and device
US20140176783A1 (en) * 2012-12-21 2014-06-26 Canon Kabushiki Kaisha Image capturing apparatus and method for controlling the same
CN104270562A (en) * 2014-08-15 2015-01-07 广东欧珀移动通信有限公司 Method and device for focusing when photographing
CN105516582A (en) * 2014-10-14 2016-04-20 奥林巴斯株式会社 Imaging device and control method for imaging device
CN106060407A (en) * 2016-07-29 2016-10-26 努比亚技术有限公司 Focusing method and terminal

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113495301A (en) * 2020-03-20 2021-10-12 株式会社理光 Bandage inspection method, bandage inspection device, storage medium, and system

Also Published As

Publication number Publication date
CN106060407A (en) 2016-10-26

Similar Documents

Publication Publication Date Title
WO2018019122A1 (en) Focusing method, terminal, and computer storage medium
WO2018045945A1 (en) Focusing method and terminal, storage medium
WO2018019124A1 (en) Image processing method and electronic device and storage medium
CN106454121B (en) Double-camera shooting method and device
WO2017050115A1 (en) Image synthesis method
CN106412324B (en) Device and method for prompting focusing object
WO2017067526A1 (en) Image enhancement method and mobile terminal
CN106909274B (en) Image display method and device
US8780258B2 (en) Mobile terminal and method for generating an out-of-focus image
WO2018050014A1 (en) Focusing method, photographing device and storage medium
WO2017045650A1 (en) Picture processing method and terminal
WO2017020836A1 (en) Device and method for processing depth image by blurring
WO2016180325A1 (en) Image processing method and device
CN107071263B (en) Image processing method and terminal
WO2018019128A1 (en) Method for processing night scene image and mobile terminal
WO2017071475A1 (en) Image processing method, and terminal and storage medium
WO2018045961A1 (en) Image processing method, and terminal and storage medium
CN106911881B (en) Dynamic photo shooting device and method based on double cameras and terminal
WO2017012385A1 (en) Method and apparatus for rapidly starting application, and terminal
WO2017088618A1 (en) Picture synthesis method and device
CN106657782B (en) Picture processing method and terminal
CN106851125B (en) Mobile terminal and multiple exposure shooting method
WO2018050080A1 (en) Mobile terminal, picture processing method and computer storage medium
WO2017071542A1 (en) Image processing method and apparatus
WO2017071532A1 (en) Group selfie photography method and apparatus

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: 17833425

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 04/07/2019)

122 Ep: pct application non-entry in european phase

Ref document number: 17833425

Country of ref document: EP

Kind code of ref document: A1