CN107643578A - A kind of Atomatic focusing method, device and mobile terminal - Google Patents
A kind of Atomatic focusing method, device and mobile terminal Download PDFInfo
- Publication number
- CN107643578A CN107643578A CN201610587668.XA CN201610587668A CN107643578A CN 107643578 A CN107643578 A CN 107643578A CN 201610587668 A CN201610587668 A CN 201610587668A CN 107643578 A CN107643578 A CN 107643578A
- Authority
- CN
- China
- Prior art keywords
- focal length
- white point
- effective white
- effective
- point number
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 20
- 238000010586 diagram Methods 0.000 claims description 5
- 238000012163 sequencing technique Methods 0.000 claims 5
- 238000013507 mapping Methods 0.000 claims 4
- 241000255969 Pieris brassicae Species 0.000 claims 1
- 238000012360 testing method Methods 0.000 description 4
- 241000519995 Stachys sylvatica Species 0.000 description 3
- 229910052754 neon Inorganic materials 0.000 description 3
- GKAOGPIIYCISHV-UHFFFAOYSA-N neon atom Chemical compound [Ne] GKAOGPIIYCISHV-UHFFFAOYSA-N 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 125000001475 halogen functional group Chemical group 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Landscapes
- Photometry And Measurement Of Optical Pulse Characteristics (AREA)
Abstract
本发明实施例提供一种自动对焦方法、装置和移动终端,通过在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值;从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距;采用上述方案,在暗光环境下,在对点光源进行拍照时,从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距,有效白点个数最少的对焦区域所对应的焦距即为实际对焦最清晰的点,保证了对焦准确度,防止失焦现象发生,提升用户拍摄体验。
Embodiments of the present invention provide an autofocus method, device, and mobile terminal. By obtaining the number of effective white points in the focus area corresponding to different focal lengths in a dark light and point light source environment, the pixel brightness value of the effective white point is greater than or equal to the preset value. Set the brightness threshold; select the focal length corresponding to the focus area with the least number of effective white points from different focal lengths as the target focal length; adopt the above scheme, in a dark light environment, when taking pictures of point light sources, select the effective focal length from different focal lengths. The focal length corresponding to the focus area with the least number of white points is the target focal length, and the focal length corresponding to the focus area with the fewest number of effective white points is the point with the clearest focus, which ensures the accuracy of focus and prevents out-of-focus phenomena. Improve user shooting experience.
Description
技术领域technical field
本发明涉及通信领域,尤其涉及一种自动对焦方法、装置和移动终端。The present invention relates to the communication field, in particular to an automatic focusing method, device and mobile terminal.
背景技术Background technique
在暗光环境下,在对蜡烛、霓虹灯等点光源进行拍照时,参考图1,现有的对焦方法是将输入图像的对比度作为清晰度值,以清晰度值作为纵坐标、焦距作为横坐标创建焦点曲线,以焦点曲线上的最大点作为对焦点,该对焦点是伪对焦点,由于暗光环境下的点光源有光晕,实际对焦最清晰的点并不在焦点曲线的最大值处,而若继续采用以焦点曲线上的最大点作为对焦点的方式会造成对焦不准、拍照模糊的问题,影响用户拍摄体验。In a dark light environment, when taking pictures of point light sources such as candles and neon lights, refer to Figure 1. The existing focusing method is to use the contrast of the input image as the sharpness value, the sharpness value as the vertical coordinate, and the focal length as the horizontal coordinate Create a focus curve, and use the maximum point on the focus curve as the focus point. This focus point is a false focus point. Because the point light source in a dark environment has halos, the point with the clearest focus is not at the maximum value of the focus curve. However, if you continue to use the maximum point on the focus curve as the focus point, it will cause inaccurate focus and blurred pictures, which will affect the user's shooting experience.
针对上述问题,提出一种在暗光环境下,在对点光源进行拍照时,能够准确找准对焦点的方法和装置,是本领域技术人员亟待解决的技术问题。In view of the above problems, it is a technical problem to be solved urgently by those skilled in the art to propose a method and device that can accurately find the focusing point when taking pictures of point light sources in a dark environment.
发明内容Contents of the invention
本发明实施例主要解决的技术问题是,提供一种自动对焦方法、装置和移动终端,解决现有技术中,在暗光环境下,在对点光源进行拍照时,对焦不准、拍照模糊的问题。The main technical problem to be solved by the embodiments of the present invention is to provide an autofocus method, device and mobile terminal to solve the problem of inaccurate focus and blurred photographs when photographing a point light source in a dark environment in the prior art. question.
为解决上述技术问题,本发明实施例提供一种自动对焦方法,包括:In order to solve the above technical problems, an embodiment of the present invention provides an autofocus method, including:
在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值;In the environment of dark light and point light source, obtain the number of effective white points in the focus area corresponding to different focal lengths, and the pixel brightness value of the effective white point is greater than or equal to the preset brightness threshold;
从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距。From the different focal lengths, the focal length corresponding to the focal area with the least number of effective white points is selected as the target focal length.
为解决上述技术问题,本发明实施例提供一种自动对焦装置,包括:In order to solve the above technical problems, an embodiment of the present invention provides an autofocus device, including:
获取模块,用于在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值;The obtaining module is used to obtain the number of effective white points in the focus area corresponding to different focal lengths in the environment of dark light and point light source, and the pixel brightness value of the effective white point is greater than or equal to the preset brightness threshold;
选择模块,用于从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距。The selection module is configured to select, from different focal lengths, the focal length corresponding to the focal area with the least number of effective white points as the target focal length.
为解决上述技术问题,本发明实施例提供一种移动终端,包括上述的自动对焦装置。In order to solve the above technical problem, an embodiment of the present invention provides a mobile terminal, including the above-mentioned autofocus device.
为解决上述技术问题,本发明实施例还提供一种计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于执行前述的自动对焦方法。In order to solve the above technical problem, an embodiment of the present invention further provides a computer storage medium, in which computer executable instructions are stored, and the computer executable instructions are used to execute the aforementioned autofocus method.
本发明的有益效果是:The beneficial effects of the present invention are:
根据本发明实施例提供的自动对焦方法、装置和移动终端,通过在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值;从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距;采用上述方案,在暗光环境下,在对点光源进行拍照时,从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距,有效白点个数最少的对焦区域所对应的焦距即为实际对焦最清晰的点,保证了对焦准确度,防止失焦现象发生,提升用户拍摄体验。According to the autofocus method, device and mobile terminal provided by the embodiments of the present invention, by obtaining the number of effective white points in the focus area corresponding to different focal lengths in the dark light and point light source environment, the pixel brightness value of the effective white point is greater than or equal to the preset Set the brightness threshold; select the focal length corresponding to the focus area with the least number of effective white points from different focal lengths as the target focal length; adopt the above scheme, in a dark light environment, when taking pictures of point light sources, select the effective focal length from different focal lengths. The focal length corresponding to the focus area with the least number of white points is the target focal length, and the focal length corresponding to the focus area with the fewest number of effective white points is the point with the clearest focus, which ensures the accuracy of focus and prevents out-of-focus phenomena. Improve user shooting experience.
附图说明Description of drawings
图1为现有技术中焦距与清晰度值的曲线关系图;Fig. 1 is the curve relationship diagram of focal length and sharpness value in the prior art;
图2为本发明实施例一提供的一种自动对焦方法的流程图;FIG. 2 is a flow chart of an autofocus method provided by Embodiment 1 of the present invention;
图3为本发明实施例一、二提供的一种焦距与有效白点个数的曲线关系图;Fig. 3 is a curve relationship diagram between a focal length and the number of effective white spots provided by Embodiments 1 and 2 of the present invention;
图4为本发明实施例二提供的一种自动对焦装置的示意图。FIG. 4 is a schematic diagram of an autofocus device provided by Embodiment 2 of the present invention.
具体实施方式detailed description
下面通过具体实施方式结合附图对本发明实施例作进一步详细说明。Embodiments of the present invention will be further described in detail below through specific implementation methods in conjunction with the accompanying drawings.
实施例一Embodiment one
在暗光环境下,在对点光源进行拍照时,为了保证对焦准确度,防止失焦现象发生,本实施例提供一种自动对焦方法,请参见图2,包括以下步骤:In a dark environment, in order to ensure focus accuracy and prevent out-of-focus phenomena when taking pictures of point light sources, this embodiment provides an autofocus method, as shown in Figure 2, which includes the following steps:
S101:在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值。S101: In a dark light and point light source environment, obtain the number of effective white points in the focus area corresponding to different focal lengths, and the pixel brightness value of the effective white point is greater than or equal to a preset brightness threshold.
为了避免出现误判的情况,保证准确性,针对对焦区域中出现的散落白点则将其排除,散落的白点不是有效白点;有效白点的判断标准包括:每个白点在其m*n像素的邻域内的白点个数大于等于第一预设数量阈值。In order to avoid misjudgment and ensure accuracy, the scattered white points in the focus area are excluded, and the scattered white points are not effective white points; the criteria for judging effective white points include: each white point is within its m * The number of white dots in the neighborhood of n pixels is greater than or equal to a first preset number threshold.
其中,第一预设数量阈值可以是(m*n-1)/2或者(m*n)/2,表示在m*n像素区域内,有一半以上的白点的像素亮度值大于等于预设亮度阈值。Wherein, the first preset quantity threshold can be (m*n-1)/2 or (m*n)/2, which means that in the m*n pixel area, there are more than half of the pixel brightness values of the white points greater than or equal to the preset Set the brightness threshold.
其中,像素亮度值的取值范围为0到255。预设亮度阈值优选为230,m和n可以相等,也可以不等,m*n优选为5*5,第一预设数量阈值优选为12。Wherein, the value range of the pixel brightness value is 0 to 255. The preset brightness threshold is preferably 230, m and n may be equal or different, m*n is preferably 5*5, and the first preset number threshold is preferably 12.
例如,参见表1,表1为当前白点在其5*5像素邻域内各个白点的像素亮度值,当前白点的像素亮度值为255,当前白点为表1中位于中心位置的点,即第三行第三列的点。由于当前白点的像素亮度值255大于预设亮度阈值230,并且在其5*5像素邻域内,满足一半以上的白点的像素亮度值大于预设亮度阈值230,所以可以判断当前白点是有效白点。For example, see Table 1. Table 1 shows the pixel brightness value of each white point in the 5*5 pixel neighborhood of the current white point. The pixel brightness value of the current white point is 255. The current white point is the point in the center of Table 1. , that is, the point in the third row and third column. Since the pixel brightness value 255 of the current white point is greater than the preset brightness threshold 230, and within its 5*5 pixel neighborhood, the pixel brightness values of more than half of the white points are greater than the preset brightness threshold 230, so it can be judged that the current white point is Effective white point.
表1Table 1
在获取不同焦距对应的对焦区域中有效白点个数之前,还包括:判断对焦区域当前显示画面是否是点光源环境;判断对焦区域当前显示画面是否是点光源环境包括:调节焦距,统计不同焦距对应的对焦区域中有效白点个数;在至少一个焦距对应的有效白点个数大于第二设定数量阈值的情况下,则判断对焦区域当前显示画面是点光源环境。Before obtaining the number of effective white points in the focus area corresponding to different focal lengths, it also includes: judging whether the current display screen in the focus area is a point light source environment; judging whether the current display screen in the focus area is a point light source environment includes: adjusting the focal length, and counting different focal lengths The number of effective white points in the corresponding focus area; if the number of effective white points corresponding to at least one focal length is greater than the second set number threshold, it is determined that the current display screen in the focus area is a point light source environment.
例如焦距分别为f1、f2、f3,焦距f1对应的有效白点个数为120,焦距f2对应的有效白点个数为118,焦距f3对应的有效白点个数为115;若第二设定数量阈值为116,由于焦距分别为f1、f2对应的有效白点个数均大于第二设定数量阈值116,则判断对焦区域当前显示画面是点光源环境;若第二设定数量阈值为125,由于焦距分别为f1、f2、f3对应的有效白点个数均小于第二设定数量阈值125,则判断对焦区域当前显示画面不是点光源环境。第二设定数量阈值可以根据大量暗光点光源场景测试后经过统计来确定。For example, the focal lengths are f1, f2, and f3 respectively, the effective number of white points corresponding to the focal length f1 is 120, the effective number of white points corresponding to the focal length f2 is 118, and the effective number of white points corresponding to the focal length f3 is 115; if the second setting The fixed quantity threshold is 116. Since the effective white points corresponding to the focal lengths f1 and f2 are greater than the second set quantity threshold of 116, it is judged that the current display screen in the focus area is a point light source environment; if the second set quantity threshold is 125. Since the number of effective white points corresponding to the focal lengths f1, f2, and f3 is less than the second set number threshold 125, it is determined that the currently displayed image in the focus area is not a point light source environment. The second set quantity threshold may be determined through statistics after testing a large number of dark point light source scenes.
点光源包括蜡烛、霓虹灯等,对焦区域当前显示画面中的点光源的个数可以是一个或多个。The point light sources include candles, neon lights, etc., and the number of point light sources in the current display screen of the focus area can be one or more.
其中,在判断对焦区域当前显示画面是否是点光源环境之前,还包括:判断对焦区域当前显示画面是否是暗光场景。具体的,可以根据亮度判断对焦区域当前显示画面是否是暗光场景。亮度可以用传感器感应,也可以用曝光算法中的曝光变量来表达,曝光时间越长,亮度越暗,只要亮度或者曝光变量超过一定的阈值,即可判断为暗光场景,该阈值可以根据大量暗光场景测试后经过统计来确定。Wherein, before judging whether the currently displayed image in the focus area is a point light source environment, it further includes: judging whether the currently displayed image in the focus area is a dark light scene. Specifically, it may be determined according to the brightness whether the image currently displayed in the focus area is a dark scene. The brightness can be sensed by the sensor or expressed by the exposure variable in the exposure algorithm. The longer the exposure time, the darker the brightness. As long as the brightness or exposure variable exceeds a certain threshold, it can be judged as a dark scene. The threshold can be determined according to a large number of It is determined statistically after the dark-light scene test.
其中,S101中获取不同焦距对应的对焦区域中有效白点个数可以为:在调节焦距,统计不同焦距对应的对焦区域中有效白点个数,判断出对焦区域当前显示画面是否是点光源环境之后,直接获取上述统计到的不同焦距对应的对焦区域中有效白点个数。S101中获取不同焦距对应的对焦区域中有效白点个数还可以为:在调节焦距,统计不同焦距对应的对焦区域中有效白点个数,判断出对焦区域当前显示画面是否是点光源环境之后,再次调节焦距,重新统计不同焦距对应的对焦区域中有效白点个数,然后获取重新统计到的不同焦距对应的对焦区域中有效白点个数。Wherein, in S101, obtaining the number of effective white points in the focus area corresponding to different focal lengths can be: after adjusting the focus distance, counting the number of effective white points in the focus area corresponding to different focal lengths, and judging whether the current display image in the focus area is a point light source environment Afterwards, the number of effective white points in the focus area corresponding to the different focal lengths counted above is directly obtained. Obtaining the number of effective white points in the focus area corresponding to different focal lengths in S101 can also be: after adjusting the focus distance, counting the number of effective white points in the focus area corresponding to different focal lengths, and judging whether the current display image in the focus area is a point light source environment , adjust the focal length again, re-count the number of effective white points in the focus area corresponding to different focal lengths, and then obtain the re-counted number of effective white points in the focus area corresponding to different focal lengths.
其中,调节焦距,统计不同焦距对应的对焦区域中有效白点个数包括:按照焦距从大到小、或从小到大的顺序依次调节焦距,依次统计每个焦距对应的对焦区域中有效白点个数。Among them, adjusting the focal length and counting the number of effective white points in the focus area corresponding to different focal lengths includes: sequentially adjusting the focal length according to the order of the focal length from large to small, or from small to large, and counting the effective white points in the focus area corresponding to each focal length in turn number.
S102:从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距。S102: Select the focal length corresponding to the focus area with the smallest number of effective white points from different focal lengths as the target focal length.
获取不同焦距对应的对焦区域中有效白点个数包括:获取统计到的每个焦距对应的对焦区域中有效白点个数,把焦距作为横坐标,有效白点个数作为纵坐标,按照统计的时间顺序将各焦距与对应的有效白点个数在坐标图上进行描点,将各点按照统计的时间顺序连接成曲线;从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距包括:从曲线中查询有效白点个数最少的点,将该点对应的焦距作为目标焦距。Obtaining the number of effective white points in the focus area corresponding to different focal lengths includes: obtaining the counted number of effective white points in the focus area corresponding to each focal length, taking the focal length as the abscissa, and the number of effective white points as the ordinate, according to the statistics The time sequence of each focal length and the corresponding number of effective white points is plotted on the coordinate map, and the points are connected into a curve according to the statistical time sequence; from different focal lengths, select the corresponding focus area with the least number of effective white points The focal length as the target focal length includes: querying the point with the least number of effective white points from the curve, and using the focal length corresponding to the point as the target focal length.
例如,参见图3,图3为焦距与有效白点个数的曲线关系图,焦距分别为f1、f2、f3、f4、f5、f6、f7、f8、f9,焦距f1对应的有效白点个数为120,焦距f2对应的有效白点个数为118,焦距f3对应的有效白点个数为115,焦距f4对应的有效白点个数为97,焦距f5对应的有效白点个数为86,焦距f6对应的有效白点个数为97,焦距f7对应的有效白点个数为115,焦距f8对应的有效白点个数为118,焦距f9对应的有效白点个数为120。从曲线中可以看出,焦距f5对应的有效白点个数最少,则将焦距f5作为目标焦距,焦距f5即为实际对焦最清晰的点。For example, see Figure 3. Figure 3 is a graph showing the relationship between the focal length and the number of effective white points. The focal lengths are f1, f2, f3, f4, f5, f6, f7, f8, and f9. The number is 120, the number of effective white points corresponding to focal length f2 is 118, the number of effective white points corresponding to focal length f3 is 115, the number of effective white points corresponding to focal length f4 is 97, and the number of effective white points corresponding to focal length f5 is 86, the number of effective white points corresponding to focal length f6 is 97, the number of effective white points corresponding to focal length f7 is 115, the number of effective white points corresponding to focal length f8 is 118, and the number of effective white points corresponding to focal length f9 is 120. It can be seen from the curve that the number of effective white points corresponding to the focal length f5 is the least, so the focal length f5 is taken as the target focal length, and the focal length f5 is the point with the clearest focus.
或者,获取不同焦距对应的对焦区域中有效白点个数包括:获取统计到的每个焦距对应的对焦区域中有效白点个数,按照统计的时间顺序将各焦距与对应的有效白点个数列成一个对应关系表;从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距包括:从对应关系表中查询有效白点个数最少的对焦区域所对应的焦距,将该焦距作为目标焦距。Alternatively, obtaining the number of effective white points in the focus area corresponding to different focal lengths includes: obtaining the counted number of effective white points in the focus area corresponding to each focal length, and comparing each focal length with the corresponding number of effective white points according to the statistical time sequence The number is arranged into a correspondence table; selecting the focal length corresponding to the focus area with the least number of effective white points from different focal lengths as the target focal length includes: querying the focal length corresponding to the focus area with the minimum number of effective white points from the correspondence table, Use this focal length as the target focal length.
例如,参见表2,表2为焦距与有效白点个数的对应关系表,焦距分别为f1、f2、f3、f4、f5、f6、f7、f8、f9,焦距f1对应的有效白点个数为120,焦距f2对应的有效白点个数为118,焦距f3对应的有效白点个数为115,焦距f4对应的有效白点个数为97,焦距f5对应的有效白点个数为86,焦距f6对应的有效白点个数为97,焦距f7对应的有效白点个数为115,焦距f8对应的有效白点个数为118,焦距f9对应的有效白点个数为120。从对应关系表中可以查询到,焦距f5对应的有效白点个数最少,则将焦距f5作为目标焦距,焦距f5即为实际对焦最清晰的点。For example, see Table 2. Table 2 is the correspondence table between the focal length and the number of effective white dots. The focal lengths are f1, f2, f3, f4, f5, f6, f7, f8, and f9. The number is 120, the number of effective white points corresponding to focal length f2 is 118, the number of effective white points corresponding to focal length f3 is 115, the number of effective white points corresponding to focal length f4 is 97, and the number of effective white points corresponding to focal length f5 is 86, the number of effective white points corresponding to focal length f6 is 97, the number of effective white points corresponding to focal length f7 is 115, the number of effective white points corresponding to focal length f8 is 118, and the number of effective white points corresponding to focal length f9 is 120. From the correspondence table, it can be found that the number of effective white points corresponding to the focal length f5 is the least, then the focal length f5 is taken as the target focal length, and the focal length f5 is the point with the clearest focus.
表2Table 2
根据本发明实施例提供的自动对焦方法,通过在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值;从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距;采用上述方案,在暗光环境下,在对点光源进行拍照时,从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距,有效白点个数最少的对焦区域所对应的焦距即为实际对焦最清晰的点,保证了对焦准确度,防止失焦现象发生,提升用户拍摄体验。According to the auto-focus method provided by the embodiment of the present invention, by obtaining the number of effective white points in the focus area corresponding to different focal lengths in the dark light and point light source environment, the pixel brightness value of the effective white point is greater than or equal to the preset brightness threshold; from Select the focal length corresponding to the focus area with the least number of effective white points among different focal lengths as the target focal length; using the above scheme, when taking pictures of point light sources in a dark light environment, select the minimum number of effective white points from different focal lengths The focal length corresponding to the focus area is taken as the target focal length, and the focal length corresponding to the focus area with the least number of effective white points is the point with the clearest actual focus, which ensures focus accuracy, prevents out-of-focus phenomena, and improves user shooting experience.
实施例二Embodiment two
在暗光环境下,在对点光源进行拍照时,为了保证对焦准确度,防止失焦现象发生,本实施例提供一种自动对焦装置,请参见图4,包括:In a dark environment, in order to ensure focus accuracy and prevent out-of-focus phenomena when taking pictures of point light sources, this embodiment provides an autofocus device, as shown in Figure 4, including:
获取模块201,用于在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值。The obtaining module 201 is used to obtain the number of effective white points in the focus area corresponding to different focal lengths in the dark light and point light source environment, and the pixel brightness value of the effective white point is greater than or equal to the preset brightness threshold.
选择模块202,用于从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距。The selection module 202 is configured to select, from different focal lengths, the focal length corresponding to the focal area with the smallest number of effective white points as the target focal length.
为了避免出现误判的情况,保证准确性,针对对焦区域中出现的散落白点则将其排除,散落的白点不是有效白点;有效白点的判断标准包括:每个白点在其m*n像素的邻域内的白点个数大于等于第一预设数量阈值。In order to avoid misjudgment and ensure accuracy, the scattered white points in the focus area are excluded, and the scattered white points are not effective white points; the criteria for judging effective white points include: each white point is within its m * The number of white dots in the neighborhood of n pixels is greater than or equal to a first preset number threshold.
其中,第一预设数量阈值可以是(m*n-1)/2或者(m*n)/2,表示在m*n像素区域内,有一半以上的白点的像素亮度值大于等于预设亮度阈值。Wherein, the first preset quantity threshold can be (m*n-1)/2 or (m*n)/2, which means that in the m*n pixel area, there are more than half of the pixel brightness values of the white points greater than or equal to the preset Set the brightness threshold.
其中,像素亮度值的取值范围为0到255。预设亮度阈值优选为230,m和n可以相等,也可以不等,m*n优选为5*5,第一预设数量阈值优选为12。Wherein, the value range of the pixel brightness value is 0 to 255. The preset brightness threshold is preferably 230, m and n may be equal or different, m*n is preferably 5*5, and the first preset number threshold is preferably 12.
例如,参见表1,表1为当前白点在其5*5像素邻域内各个白点的像素亮度值,当前白点的像素亮度值为255,当前白点为表1中位于中心位置的点,即第三行第三列的点。由于当前白点的像素亮度值255大于预设亮度阈值230,并且在其5*5像素邻域内,满足一半以上的白点的像素亮度值大于预设亮度阈值230,所以可以判断当前白点是有效白点。For example, see Table 1. Table 1 shows the pixel brightness value of each white point in the 5*5 pixel neighborhood of the current white point. The pixel brightness value of the current white point is 255. The current white point is the point in the center of Table 1. , that is, the point in the third row and third column. Since the pixel brightness value 255 of the current white point is greater than the preset brightness threshold 230, and within its 5*5 pixel neighborhood, the pixel brightness values of more than half of the white points are greater than the preset brightness threshold 230, so it can be judged that the current white point is Effective white point.
表1Table 1
还包括判断模块203,用于在获取模块201获取不同焦距对应的对焦区域中有效白点个数之前,判断对焦区域当前显示画面是否是点光源环境;It also includes a judging module 203, which is used to judge whether the current display image in the focused area is a point light source environment before the acquiring module 201 acquires the number of effective white points in the focused area corresponding to different focal lengths;
判断模块203包括处理子模块2031和判断子模块2032,处理子模块2031用于调节焦距,统计不同焦距对应的对焦区域中有效白点个数;判断子模块2032用于在至少一个焦距对应的有效白点个数大于第二设定数量阈值的情况下,则判断对焦区域当前显示画面是点光源环境。The judging module 203 includes a processing sub-module 2031 and a judging sub-module 2032. The processing sub-module 2031 is used to adjust the focal length and count the number of effective white points in the focus area corresponding to different focal lengths; If the number of white dots is greater than the second set number threshold, it is determined that the currently displayed image in the focus area is a point light source environment.
例如焦距分别为f1、f2、f3,处理子模块2031统计到的焦距f1对应的有效白点个数为120,焦距f2对应的有效白点个数为118,焦距f3对应的有效白点个数为115;若第二设定数量阈值为116,由于焦距分别为f1、f2对应的有效白点个数均大于第二设定数量阈值116,则判断子模块2032判断对焦区域当前显示画面是点光源环境;若第二设定数量阈值为125,由于焦距分别为f1、f2、f3对应的有效白点个数均小于第二设定数量阈值125,则判断子模块2032判断对焦区域当前显示画面不是点光源环境。第二设定数量阈值可以根据大量暗光点光源场景测试后经过统计来确定。For example, the focal lengths are f1, f2, and f3 respectively, the number of effective white points corresponding to the focal length f1 counted by the processing sub-module 2031 is 120, the effective number of white points corresponding to the focal length f2 is 118, and the effective number of white points corresponding to the focal length f3 is 115; if the second set number threshold is 116, since the effective white dot numbers corresponding to the focal lengths f1 and f2 are greater than the second set number threshold 116, then the judging submodule 2032 judges that the current display screen of the focus area is a dot Light source environment; if the second set number threshold is 125, since the effective white points corresponding to the focal lengths f1, f2, and f3 are all less than the second set number threshold 125, then the judging submodule 2032 judges the current display screen of the focus area Not a point light environment. The second set quantity threshold may be determined through statistics after testing a large number of dark point light source scenes.
点光源包括蜡烛、霓虹灯等,对焦区域当前显示画面中的点光源的个数可以是一个或多个。The point light sources include candles, neon lights, etc., and the number of point light sources in the current display screen of the focus area can be one or more.
其中,判断模块203还用于在判断对焦区域当前显示画面是否是点光源环境之前,判断对焦区域当前显示画面是否是暗光场景。具体的,可以根据亮度判断对焦区域当前显示画面是否是暗光场景。亮度可以用传感器感应,也可以用曝光算法中的曝光变量来表达,曝光时间越长,亮度越暗,只要亮度或者曝光变量超过一定的阈值,即可判断为暗光场景,该阈值可以根据大量暗光场景测试后经过统计来确定。Wherein, the determining module 203 is further configured to determine whether the currently displayed image in the focused area is a dark scene before determining whether the currently displayed image in the focused area is a point light source environment. Specifically, it may be determined according to the brightness whether the image currently displayed in the focus area is a dark scene. The brightness can be sensed by the sensor or expressed by the exposure variable in the exposure algorithm. The longer the exposure time, the darker the brightness. As long as the brightness or exposure variable exceeds a certain threshold, it can be judged as a dark scene. The threshold can be determined according to a large number of It is determined statistically after the low-light scene test.
其中,获取模块201获取不同焦距对应的对焦区域中有效白点个数可以为:在处理子模块2031调节焦距,统计不同焦距对应的对焦区域中有效白点个数,判断子模块2032判断出对焦区域当前显示画面是否是点光源环境之后,获取模块201直接获取上述统计到的不同焦距对应的对焦区域中有效白点个数。获取模块201获取不同焦距对应的对焦区域中有效白点个数还可以为:在处理子模块2031调节焦距,统计不同焦距对应的对焦区域中有效白点个数,判断子模块2032判断出对焦区域当前显示画面是否是点光源环境之后,处理子模块2031再次调节焦距,重新统计不同焦距对应的对焦区域中有效白点个数,然后获取模块201获取重新统计到的不同焦距对应的对焦区域中有效白点个数。Wherein, the obtaining module 201 obtains the number of effective white points in the focus area corresponding to different focal lengths may be: adjust the focal length in the processing sub-module 2031, count the number of effective white points in the focus area corresponding to different focal lengths, and judge the sub-module 2032 to determine the focus After whether the currently displayed image in the area is a point light source environment, the acquisition module 201 directly acquires the number of effective white points in the focus area corresponding to the different focal lengths counted above. The acquisition module 201 may acquire the number of effective white points in the focus area corresponding to different focal lengths: the processing sub-module 2031 adjusts the focus, counts the number of effective white points in the focus area corresponding to different focal lengths, and the determination sub-module 2032 determines the focus area After whether the current display screen is a point light source environment, the processing sub-module 2031 adjusts the focal length again, and re-counts the number of effective white points in the focus area corresponding to different focal lengths, and then the acquisition module 201 acquires the re-counted number of effective white points in the focus area corresponding to different focal lengths. Number of white points.
其中,处理子模块2031具体用于按照焦距从大到小、或从小到大的顺序依次调节焦距,依次统计每个焦距对应的对焦区域中有效白点个数。Wherein, the processing sub-module 2031 is specifically configured to sequentially adjust the focal length according to the order of the focal length from large to small, or from small to large, and sequentially count the number of effective white points in the focus area corresponding to each focal length.
其中,获取模块201具体用于:获取统计到的每个焦距对应的对焦区域中有效白点个数,把焦距作为横坐标,有效白点个数作为纵坐标,按照统计的时间顺序将各焦距与对应的有效白点个数在坐标图上进行描点,将各点按照统计的时间顺序连接成曲线;选择模块202具体用于:从曲线中查询有效白点个数最少的点,将该点对应的焦距作为目标焦距。Wherein, the obtaining module 201 is specifically used to: obtain the counted number of valid white spots in the focus area corresponding to each focal length, take the focal length as the abscissa, and the number of valid white spots as the vertical coordinate, and divide each focal length according to the statistical time sequence Draw points on the coordinate map with the corresponding number of effective white points, and connect each point into a curve according to the statistical time order; the selection module 202 is specifically used to: query the point with the least number of effective white points from the curve, and the point The corresponding focal length is taken as the target focal length.
例如,参见图3,图3为焦距与有效白点个数的曲线关系图,焦距分别为f1、f2、f3、f4、f5、f6、f7、f8、f9,获取模块201获取到的焦距f1对应的有效白点个数为120,焦距f2对应的有效白点个数为118,焦距f3对应的有效白点个数为115,焦距f4对应的有效白点个数为97,焦距f5对应的有效白点个数为86,焦距f6对应的有效白点个数为97,焦距f7对应的有效白点个数为115,焦距f8对应的有效白点个数为118,焦距f9对应的有效白点个数为120。选择模块202从曲线中可以查询到,焦距f5对应的有效白点个数最少,将焦距f5作为目标焦距,焦距f5即为实际对焦最清晰的点。For example, referring to FIG. 3, FIG. 3 is a graph showing the relationship between the focal length and the number of effective white points. The focal lengths are respectively f1, f2, f3, f4, f5, f6, f7, f8, and f9. The focal length f1 acquired by the acquisition module 201 The corresponding number of effective white points is 120, the number of effective white points corresponding to focal length f2 is 118, the number of effective white points corresponding to focal length f3 is 115, the number of effective white points corresponding to focal length f4 is 97, and the number of effective white points corresponding to focal length f5 is The number of effective white points is 86, the number of effective white points corresponding to focal length f6 is 97, the number of effective white points corresponding to focal length f7 is 115, the number of effective white points corresponding to focal length f8 is 118, and the effective number of white points corresponding to focal length f9 is The number of points is 120. The selection module 202 can inquire from the curve that the number of effective white points corresponding to the focal length f5 is the least, and taking the focal length f5 as the target focal length, the focal length f5 is the point with the clearest focus.
或者,获取模块201具体用于:获取统计到的每个焦距对应的对焦区域中有效白点个数,按照统计的时间顺序将各焦距与对应的有效白点个数列成一个对应关系表;选择模块202具体用于:从对应关系表中查询有效白点个数最少的对焦区域所对应的焦距,将该焦距作为目标焦距。Alternatively, the obtaining module 201 is specifically configured to: obtain the counted number of effective white points in the focus area corresponding to each focal length, and list each focal length and the corresponding number of effective white points into a correspondence table according to the statistical time order; select The module 202 is specifically configured to: query the focal length corresponding to the focus area with the least number of effective white points from the correspondence table, and use the focal length as the target focal length.
例如,参见表2,表2为焦距与有效白点个数的对应关系表,焦距分别为f1、f2、f3、f4、f5、f6、f7、f8、f9,获取模块201获取到的焦距f1对应的有效白点个数为120,焦距f2对应的有效白点个数为118,焦距f3对应的有效白点个数为115,焦距f4对应的有效白点个数为97,焦距f5对应的有效白点个数为86,焦距f6对应的有效白点个数为97,焦距f7对应的有效白点个数为115,焦距f8对应的有效白点个数为118,焦距f9对应的有效白点个数为120。选择模块202从对应关系表中可以查询到,焦距f5对应的有效白点个数最少,则将焦距f5作为目标焦距,焦距f5即为实际对焦最清晰的点。For example, refer to Table 2. Table 2 is a table of correspondence between focal lengths and the number of effective white points. The focal lengths are respectively f1, f2, f3, f4, f5, f6, f7, f8, and f9. The focal length f1 obtained by the acquisition module 201 The corresponding number of effective white points is 120, the number of effective white points corresponding to focal length f2 is 118, the number of effective white points corresponding to focal length f3 is 115, the number of effective white points corresponding to focal length f4 is 97, and the number of effective white points corresponding to focal length f5 is The number of effective white points is 86, the number of effective white points corresponding to focal length f6 is 97, the number of effective white points corresponding to focal length f7 is 115, the number of effective white points corresponding to focal length f8 is 118, and the effective number of white points corresponding to focal length f9 is The number of points is 120. The selection module 202 can find out from the correspondence table that the number of effective white points corresponding to the focal length f5 is the least, so the focal length f5 is taken as the target focal length, and the focal length f5 is the point with the clearest focus.
表2Table 2
根据本发明实施例提供的自动对焦装置,通过获取模块201在暗光和点光源环境下,获取不同焦距对应的对焦区域中有效白点个数,有效白点的像素亮度值大于等于预设亮度阈值;选择模块202从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距;采用上述方案,在暗光环境下,在对点光源进行拍照时,从不同焦距中选择有效白点个数最少的对焦区域所对应的焦距作为目标焦距,有效白点个数最少的对焦区域所对应的焦距即为实际对焦最清晰的点,保证了对焦准确度,防止失焦现象发生,提升用户拍摄体验。According to the autofocus device provided by the embodiment of the present invention, the number of effective white points in the focus area corresponding to different focal lengths is obtained through the acquisition module 201 in the environment of dark light and point light source, and the pixel brightness value of the effective white point is greater than or equal to the preset brightness Threshold; the selection module 202 selects the focal length corresponding to the focal area with the least number of effective white points from different focal lengths as the target focal length; using the above-mentioned scheme, in a dark light environment, when taking pictures of point light sources, select from different focal lengths The focal length corresponding to the focus area with the least number of effective white points is the target focal length, and the focal length corresponding to the focus area with the fewest number of effective white points is the point with the clearest actual focus, which ensures the accuracy of focus and prevents out-of-focus phenomena , to improve user shooting experience.
在另一实施例中还提供一种移动终端,包括实施例二中的自动对焦装置。Another embodiment also provides a mobile terminal, including the autofocus device in the second embodiment.
在另一实施例中还提供一种计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于执行实施例一中任一项的自动对焦方法。In another embodiment, a computer storage medium is also provided, and computer executable instructions are stored in the computer storage medium, and the computer executable instructions are used to execute the autofocus method in any one of the first embodiment.
显然,本领域的技术人员应该明白,上述本发明实施例的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储介质(ROM/RAM、磁碟、光盘)中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。所以,本发明不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that each module or each step of the above-mentioned embodiments of the present invention can be realized by a general-purpose computing device, and they can be concentrated on a single computing device, or distributed across multiple computing devices. On the network, optionally, they can be implemented with program codes executable by a computing device, thereby, they can be stored in a storage medium (ROM/RAM, magnetic disk, optical disk) to be executed by a computing device, and in some In some cases, the steps shown or described may be performed in a different order than here, or they may be implemented as individual integrated circuit modules, or multiple modules or steps thereof may be implemented as a single integrated circuit module. Therefore, the present invention is not limited to any specific combination of hardware and software.
以上内容是结合具体的实施方式对本发明实施例所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above content is a further detailed description of the embodiments of the present invention in conjunction with specific implementation modes, and it cannot be assumed that the specific implementation of the present invention is limited to these descriptions. For those of ordinary skill in the technical field of the present invention, without departing from the concept of the present invention, some simple deduction or replacement can be made, which should be regarded as belonging to the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610587668.XA CN107643578A (en) | 2016-07-21 | 2016-07-21 | A kind of Atomatic focusing method, device and mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610587668.XA CN107643578A (en) | 2016-07-21 | 2016-07-21 | A kind of Atomatic focusing method, device and mobile terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107643578A true CN107643578A (en) | 2018-01-30 |
Family
ID=61109750
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610587668.XA Withdrawn CN107643578A (en) | 2016-07-21 | 2016-07-21 | A kind of Atomatic focusing method, device and mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107643578A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106412437A (en) * | 2016-10-19 | 2017-02-15 | 广东欧珀移动通信有限公司 | Terminal focusing method, device and terminal |
CN111212238A (en) * | 2020-02-14 | 2020-05-29 | 展讯通信(上海)有限公司 | Contrast focusing method, system, equipment and storage medium under point light source scene |
CN112333903A (en) * | 2020-10-28 | 2021-02-05 | 浙江大华技术股份有限公司 | Focusing method and device under light scene |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04283713A (en) * | 1991-03-12 | 1992-10-08 | Kyocera Corp | Automatic focus detector |
JP2004309653A (en) * | 2003-04-03 | 2004-11-04 | Minolta Co Ltd | Imaging unit |
CN102141717A (en) * | 2009-09-22 | 2011-08-03 | 三星电子株式会社 | Auto-focusing method, recording medium, and auto-focusing apparatus for performing the method |
CN102169276A (en) * | 2010-02-25 | 2011-08-31 | 奥林巴斯映像株式会社 | Imaging device and automatic focus adjustment method |
JP5100484B2 (en) * | 2008-04-15 | 2012-12-19 | Juki株式会社 | Automatic focus adjustment method |
CN103095983A (en) * | 2011-10-31 | 2013-05-08 | 株式会社日立制作所 | Image signal processing device |
US20140300802A1 (en) * | 2013-04-05 | 2014-10-09 | Canon Kabushiki Kaisha | Imaging apparatus and imaging method |
JP2016126046A (en) * | 2014-12-26 | 2016-07-11 | オリンパス株式会社 | Focal point detecting device and focal point detecting method |
-
2016
- 2016-07-21 CN CN201610587668.XA patent/CN107643578A/en not_active Withdrawn
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04283713A (en) * | 1991-03-12 | 1992-10-08 | Kyocera Corp | Automatic focus detector |
JP2004309653A (en) * | 2003-04-03 | 2004-11-04 | Minolta Co Ltd | Imaging unit |
JP5100484B2 (en) * | 2008-04-15 | 2012-12-19 | Juki株式会社 | Automatic focus adjustment method |
CN102141717A (en) * | 2009-09-22 | 2011-08-03 | 三星电子株式会社 | Auto-focusing method, recording medium, and auto-focusing apparatus for performing the method |
CN102169276A (en) * | 2010-02-25 | 2011-08-31 | 奥林巴斯映像株式会社 | Imaging device and automatic focus adjustment method |
CN103095983A (en) * | 2011-10-31 | 2013-05-08 | 株式会社日立制作所 | Image signal processing device |
US20140300802A1 (en) * | 2013-04-05 | 2014-10-09 | Canon Kabushiki Kaisha | Imaging apparatus and imaging method |
JP2016126046A (en) * | 2014-12-26 | 2016-07-11 | オリンパス株式会社 | Focal point detecting device and focal point detecting method |
Non-Patent Citations (1)
Title |
---|
张小波 等: ""激光三角法改进的显微镜快速自动对焦方法"", 《激光与红外工程》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106412437A (en) * | 2016-10-19 | 2017-02-15 | 广东欧珀移动通信有限公司 | Terminal focusing method, device and terminal |
CN111212238A (en) * | 2020-02-14 | 2020-05-29 | 展讯通信(上海)有限公司 | Contrast focusing method, system, equipment and storage medium under point light source scene |
CN112333903A (en) * | 2020-10-28 | 2021-02-05 | 浙江大华技术股份有限公司 | Focusing method and device under light scene |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2016373981B2 (en) | Calibration of defective image sensor elements | |
US9401036B2 (en) | Photographing apparatus and method | |
CN106550184B (en) | Photo processing method and device | |
CN105007430B (en) | The method and apparatus set for determining exposure | |
CN106791737B (en) | Method and device for color correction of projection screen | |
CN107659770B (en) | Method and device for rapid focusing and mobile equipment | |
JP6946564B2 (en) | Image processing methods and image processing equipment, computer-readable storage media and computer equipment | |
CN104767938A (en) | Method and device for taking pictures | |
WO2021083173A1 (en) | Exposure control method and device, and storage medium | |
CN107643578A (en) | A kind of Atomatic focusing method, device and mobile terminal | |
JP5927363B1 (en) | Image processing apparatus, image processing method, and image processing program | |
JP7686411B2 (en) | Imaging device, control method thereof, and program | |
JP2019501567A (en) | Device and method for reducing exposure time set for high dynamic range video / imaging | |
CN111025522B (en) | Lens focusing method and device and terminal equipment | |
CN114387441A (en) | Image processing method and system | |
CN114125408A (en) | Image processing method and device, terminal and readable storage medium | |
US9319581B2 (en) | Image editing method and associated apparatus | |
TWI754334B (en) | Image correction method and device | |
CN104796677B (en) | Focal length adjusting method and focal length adjusting device | |
JP2015142281A (en) | Subject searching device, control method and control program of the same, and imaging device | |
JP2013042207A (en) | Imaging apparatus, control method therefor, and control program | |
CN115086566B (en) | Picture scene detection method and device | |
TWI471678B (en) | Projector and method for automatically adjusting projection images | |
TW201404138A (en) | Image processing method and image processing system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20180130 |