




本申请要求于2018年07月05日提交中国专利局、申请号为201810735397.7、申请名称为“一种拍摄控制方法、终端及计算机可读介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority from a Chinese patent application filed with the Chinese Patent Office on July 05, 2018, with application number 201810735397.7, and with the application name "A Method of Shooting Control, Terminal, and Computer-readable Media", the entire contents of which are hereby incorporated by reference Incorporated in this application.
本申请涉及计算机技术领域,尤其涉及一种拍摄控制方法、终端及计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to a shooting control method, a terminal, and a computer-readable storage medium.
目前移动终端、智能手表、平板电脑、机器人等智能终端的功能越来越多,其中,最基本的且用户使用较多的一项功能是智能终端的摄像装置的拍照功能。然而,在用户通过智能终端的摄像装置进行拍照的过程中,往往由于环境光照的变化,导致无法正常识别出拍摄对象。因此,如何更有效地提高各种环境下的拍摄效果成为研究的热点。At present, smart terminals such as mobile terminals, smart watches, tablet computers, and robots have more and more functions. Among them, one of the most basic and user-used functions is the camera function of the camera device of the smart terminal. However, in the process of taking a picture by the user through the camera device of the smart terminal, often due to changes in ambient light, the photographic subject cannot be recognized normally. Therefore, how to more effectively improve the shooting effect in various environments has become a research hotspot.
发明内容Summary of the invention
本申请实施例提供一种拍摄控制方法、终端及计算机可读存储介质,可实现动态调节图像曝光度,增强了图像对比度,提高了拍摄图像的清晰度。The embodiments of the present application provide a shooting control method, a terminal, and a computer-readable storage medium, which can dynamically adjust image exposure, enhance image contrast, and improve the sharpness of a captured image.
第一方面,本申请实施例提供了一种拍摄控制方法,该方法包括:In a first aspect, an embodiment of the present application provides a shooting control method. The method includes:
检测终端的摄像装置采集到的预览图像中是否存在拍摄对象;Detecting whether a shooting object exists in the preview image collected by the camera device of the terminal;
如果检测到所述终端的摄像装置采集到的预览图像中不存在拍摄对象,则将所述预览图像转化为灰度图像;If it is detected that there is no shooting object in the preview image collected by the camera device of the terminal, converting the preview image into a grayscale image;
根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间;Determining a distribution probability of a gray level of each pixel and each gray level interval of the gray image according to the gray level of each pixel in the gray image;
根据各灰度级区间的累计概率调整所述灰度图像的曝光度,并按照调整后的曝光度进行图像拍摄,其中,所述累计概率是灰度级区间内的灰度级的分布概率之和。The exposure of the grayscale image is adjusted according to the cumulative probability of each grayscale interval, and image shooting is performed according to the adjusted exposure degree, where the cumulative probability is one of the distribution probability of the grayscale within the grayscale interval. with.
第二方面,本申请实施例提供了一种终端,该终端包括用于执行上述第一方面的方法的单元。In a second aspect, an embodiment of the present application provides a terminal, and the terminal includes a unit for executing the method in the first aspect.
第三方面,本申请实施例提供了另一种终端,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储支持终端执行上述方法的计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行上述第一方面的方法。According to a third aspect, an embodiment of the present application provides another terminal, including a processor, an input device, an output device, and a memory. The processor, the input device, the output device, and the memory are connected to each other, where the memory is used for storing A computer program supporting a terminal to execute the above method, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method of the first aspect.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行上述第一方面的方法。According to a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer storage medium stores a computer program, where the computer program includes program instructions, and the program instructions cause the processing when executed by a processor. The processor performs the method of the first aspect.
本申请实施例,根据灰度图像中各像素点的灰度级的分布概率和各灰度级区间的累计概率调整图像曝光度,实现了对图像曝光度的动态调节,增强了图像对比度,提高了拍摄图像的清晰度。In the embodiment of the present application, the image exposure is adjusted according to the distribution probability of the gray levels of each pixel in the gray image and the cumulative probability of each gray level interval, thereby achieving dynamic adjustment of the image exposure, enhancing image contrast, and improving The sharpness of the captured image.
图1是本申请实施例提供的一种拍摄控制方法的示意流程图;FIG. 1 is a schematic flowchart of a shooting control method according to an embodiment of the present application; FIG.
图2是本申请实施例提供的另一种拍摄控制方法的示意流程图;2 is a schematic flowchart of another shooting control method according to an embodiment of the present application;
图3是本申请实施例提供的又一种拍摄控制方法的示意流程图;3 is a schematic flowchart of another shooting control method according to an embodiment of the present application;
图4是本申请实施例提供的一种终端的示意框图;4 is a schematic block diagram of a terminal according to an embodiment of the present application;
图5是本申请实施例提供的另一种终端示意框图。FIG. 5 is a schematic block diagram of another terminal according to an embodiment of the present application.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In the following, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should be understood that the terminology used in the description of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should be further understood that the term "and / or" used in the specification of the application and the appended claims refers to any combination of one or more of the listed items and all possible combinations, and includes these combinations .
本申请实施例提供的拍摄控制方法可以由终端执行,所述终端可以是手机、电脑、平板、智能手表等智能终端,该终端上设置有摄像装置。下面对应用于终端的拍摄控制方法进行说明。The shooting control method provided in the embodiment of the present application may be executed by a terminal, and the terminal may be a smart terminal such as a mobile phone, a computer, a tablet, or a smart watch, and the terminal is provided with a camera device. The following describes the shooting control method for the terminal.
本申请实施例中,终端在利用摄像装置进行拍照的过程中,首先可以利用该终端的摄像装置采集预览图像,在获取到该摄像装置采集到的预览图像之后,可以检测该预览图像中是否存在拍摄对象,如果检测到该预览图像中不存在拍摄对象,则可以通过图像处理将该预览图像转化为灰度图像。该终端可以根据转化得到的灰度图像获取到该灰度图像中各像素点的灰度级,并根据该灰度图像的各灰度级确定该灰度图像的各灰度级区间。在确定该灰度图像的各灰度级区间之后,该终端可以根据各灰度级区间内的 灰度级的分布概率之和确定累计概率,并根据各灰度级区间的累计概率调整该灰度图像的曝光度,并采用调整后的曝光度进行图像拍摄,从而实现动态调节图像曝光度,增强了图像对比度,提高了拍摄图像的清晰度。下面结合附图对本申请实施例提供的拍摄控制方法进行说明。In the embodiment of the present application, in the process of taking a picture by using the camera device, the terminal may first use the camera device of the terminal to collect a preview image, and after obtaining the preview image collected by the camera device, it may detect whether the preview image exists For the shooting object, if it is detected that there is no shooting object in the preview image, the preview image can be converted into a grayscale image through image processing. The terminal can obtain the gray level of each pixel point in the gray image according to the converted gray image, and determine each gray level interval of the gray image according to each gray level of the gray image. After determining each grayscale interval of the grayscale image, the terminal may determine a cumulative probability according to a sum of distribution probabilities of grayscales in each grayscale interval, and adjust the grayscale according to a cumulative probability of each grayscale interval. It can adjust the exposure of the image, and use the adjusted exposure to perform image shooting, so as to achieve dynamic adjustment of the image exposure, enhance the image contrast, and improve the clarity of the captured image. The shooting control method provided by the embodiment of the present application will be described below with reference to the drawings.
参见图1,图1是本申请实施例提供的一种拍摄控制方法的示意流程图,如图1所示,该方法可以由终端执行,所述终端的具体解释如前所述,此处不再赘述。具体地,本申请实施例的所述方法包括如下步骤。Referring to FIG. 1, FIG. 1 is a schematic flowchart of a shooting control method according to an embodiment of the present application. As shown in FIG. 1, the method may be executed by a terminal. The specific explanation of the terminal is as described above, and is not described here. More details. Specifically, the method in the embodiment of the present application includes the following steps.
S101:如果检测到终端的摄像装置采集到的预览图像中不存在拍摄对象,则将所述预览图像转化为灰度图像。S101: If it is detected that there is no shooting object in the preview image collected by the camera device of the terminal, convert the preview image into a grayscale image.
本申请实施例中,终端可以获取摄像装置采集到的预览图像,在获取到预览图像之后可以检测该终端的摄像装置采集到的该预览图像中是否存在拍摄对象,如果检测到该预览图像中不存在拍摄对象,则可以将该预览图像转化为灰度图像。其中,所述拍摄对象可以是由人体、人脸、物体等任意一种或多种事物组成的对象,本申请实施例对拍摄对象的组成不做具体限定。In the embodiment of the present application, the terminal may obtain a preview image collected by the camera device, and after acquiring the preview image, it may detect whether a photographic object exists in the preview image collected by the camera device of the terminal. If there is a subject, the preview image can be converted into a grayscale image. The photographic subject may be an object composed of any one or more things, such as a human body, a human face, an object, and the embodiment of the present application does not specifically limit the composition of the photographic subject.
在一个实施例中,该终端在检测该终端的摄像装置采集到的该预览图像中是否存在拍摄对象时,可以根据所述终端的摄像装置采集到的预览图像,对获取到的所述终端的摄像装置采集到的预览图像进行图像处理,得到所述预览图像的模糊度,如果检测到所述预览图像的模糊度大于预设的模糊度阈值,则确定所述终端的摄像装置采集到的该所述预览图像中不存在拍摄对象。其中,该终端获取预览图像的模糊度的方法可以采用现有的多种方法对该预览图像进行处理得到,本申请实施例不做具体限定。In one embodiment, when the terminal detects whether there is a photographic subject in the preview image collected by the camera device of the terminal, the terminal may perform an operation on the acquired terminal according to the preview image collected by the camera device of the terminal. The preview image collected by the camera device is subjected to image processing to obtain the blur degree of the preview image. If it is detected that the blur degree of the preview image is greater than a preset blur degree threshold value, it is determined that There is no subject in the preview image. The method for obtaining the blur degree of the preview image by the terminal may be obtained by processing the preview image by using various existing methods, which are not specifically limited in the embodiment of the present application.
例如,假设预设的模糊度阈值为k,如果终端在检测该终端的摄像装置采集到的该预览图像中是否存在拍摄对象时,根据所述终端的摄像装置采集到的预览图像,对获取到的所述终端的摄像装置采集到的预览图像进行图像处理得到的所述预览图像的模糊度为m,如果检测到所述预览图像的模糊度m大于预设的模糊度阈值k,则可以确定所述终端的摄像装置采集到的该所述预览图像中不存在拍摄对象。For example, assuming that the preset blurriness threshold is k, if the terminal detects whether there is a shooting object in the preview image collected by the camera device of the terminal, the terminal obtains the acquired image according to the preview image collected by the camera device of the terminal. The blur degree of the preview image obtained by performing image processing on the preview image collected by the camera device of the terminal is m, and if it is detected that the blur degree m of the preview image is greater than a preset blur threshold k, it may be determined There is no shooting subject in the preview image collected by the camera device of the terminal.
在一个实施例中,该终端在检测该终端的摄像装置采集到的该预览图像中是否存在拍摄对象时,还可以根据预设的图像识别算法检测该预览图像中是否存在拍摄对象。其中,该预设的图像识别算法包括人脸识别、人体识别、物体识别等任意一种或多种算法,本申请实施例对该预设的图像算法不做具体限定。In one embodiment, when the terminal detects whether a photographic subject exists in the preview image collected by the camera device of the terminal, it can also detect whether the photographic subject exists in the preview image according to a preset image recognition algorithm. The preset image recognition algorithm includes any one or more algorithms such as face recognition, human body recognition, and object recognition. The embodiments of the present application do not specifically limit the preset image algorithm.
具体可以举例说明,假设预设的图像识别算法包括人脸识别算法、人体识别算法和物体识别算法,则该终端可以通过该人脸识别算法检测终端摄像装置采集到的预览图像中是否存在人脸;以及通过该人体识别算法检测终端摄像装置采集到的预览图像中是否存在人体;以及通过预设的物体识别算法检测终端摄像装置采集到的预览图像中是否存在被拍摄物体;如果通过上述各识别算法均没有识别出该预览图 像中存在任何人脸、人体、物体等拍摄对象,则可以确定从该预览图像中检测不到拍摄对象。Specifically, it can be illustrated that if the preset image recognition algorithm includes a face recognition algorithm, a human recognition algorithm, and an object recognition algorithm, the terminal can use the face recognition algorithm to detect whether a face exists in the preview image collected by the camera device of the terminal. ; And detecting the presence of a human body in the preview image collected by the terminal camera device through the human body recognition algorithm; and detecting the presence of the photographed object in the preview image collected by the terminal camera device through a preset object recognition algorithm; The algorithm does not recognize any subjects such as faces, human bodies, and objects in the preview image, so it can be determined that no subjects can be detected from the preview image.
在一个实施例中,终端在将所述预览图像转化为灰度图像时,可以通过获取预览图像中各个像素点的GBR亮度值,根据以下公式计算该预览图像各个像素点的灰度值Gray,In one embodiment, when the terminal converts the preview image into a grayscale image, the terminal may obtain the GBR brightness value of each pixel point in the preview image and calculate the grayscale value Gray of each pixel point of the preview image according to the following formula,
Gray=(R*299+G*587+B*114+500)/1000Gray = (R * 299 + G * 587 + B * 114 + 500) / 1000
其中,R为红色亮度值、G为绿色亮度值、B为蓝色亮度值。Among them, R is a red brightness value, G is a green brightness value, and B is a blue brightness value.
终端可以根据上述公式计算得到的预览图像中各个像素点的灰度值,确定出该预览图像对应的灰度图像。具体实施过程中,终端可以将预览图像中获取到的RGB(R,G,B)中的R、G、B统一用对应的灰度值Gray替换,形成新的颜色RGB(Gray,Gray,Gray),用它替换原来的RGB(R,G,B)得到与该预览图像对应的灰度图。The terminal may determine the grayscale image corresponding to the preview image according to the grayscale value of each pixel in the preview image calculated by the foregoing formula. In the specific implementation process, the terminal may uniformly replace R, G, and B in the RGB (R, G, B) obtained in the preview image with the corresponding gray value Gray to form a new color RGB (Gray, Gray, Gray). ), Use it to replace the original RGB (R, G, B) to get the grayscale image corresponding to the preview image.
S102:根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间。S102: Determine the distribution probability of the gray level of each pixel and each gray level interval of the gray image according to the gray level of each pixel in the gray image.
本申请实施例中,终端可以根据所述灰度图像获取该灰度图像中各像素点的灰度级,并根据获取到的该灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间。In the embodiment of the present application, the terminal may obtain a gray level of each pixel in the gray image according to the gray image, and determine each pixel according to the gray level of each pixel in the gray image that is obtained. The distribution probability of the gray level and each gray level interval of the gray image.
在一个实施例中,终端在根据获取到的该灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率时,可以通过获取所述灰度图像中各像素点的灰度值,并根据获取到的各像素点的灰度值,确定各像素点的各灰度级,以及根据所述灰度图像中像素点的总数量和各灰度级对应的像素点数量,确定各灰度级的分布概率。其中,该分布概率可以利用如下公式计算得到:In one embodiment, when determining the distribution probability of the gray level of each pixel according to the gray level of each pixel in the gray image, the terminal may obtain each pixel in the gray image by And determine the gray levels of each pixel according to the obtained gray values of each pixel, and according to the total number of pixels in the gray image and the pixels corresponding to each gray level Number to determine the distribution probability of each gray level. The distribution probability can be calculated by the following formula:
P(rk)=nk/n k=0,1,......,L-1P (rk ) = nk / n k = 0,1, ..., L-1
其中,该P(rk)表示灰度级rk的分布概率,用灰度级为rk对应的像素点数量rk除以该灰度图像的像素点的总数量n,得到灰度级rk的分布概率为P(rk)。Wherein the P (rk) represents the probability distribution of the gray level rk, rk is the gray scales corresponding to the number of pixels rk n divided by the total number of pixels in the gray scale image to obtain a gray level rk is a probability distribution P (rk).
在一个实施例中,终端在计算得到该灰度图像中各灰度级对应的分布概率后,可以根据各个灰度级对应的分布概率,确定出归一化的灰度直方图,以便用户查看,通过该归一化的直方图可以更直接地查看各灰度级的分布概率。所述归一化的灰度直方图是指由各个灰度级对应的分布概率组成的灰度直方图,即该归一化的灰度直方图中的所有灰度级对应的分布概率之和为1,即p(r0)+p(r1)+p(r2)+p(r3)+…+p(rL-1)=1。其中,需要说明的是,归一化灰度直方图的横坐标为灰度级rk,纵坐标为P(rk)。In one embodiment, after calculating the distribution probability corresponding to each gray level in the gray image, the terminal may determine a normalized gray histogram according to the distribution probability corresponding to each gray level, for the user to view Through this normalized histogram, the distribution probability of each gray level can be viewed more directly. The normalized gray histogram refers to a gray histogram composed of distribution probabilities corresponding to respective gray levels, that is, a sum of distribution probabilities corresponding to all gray levels in the normalized gray histogram. Is 1, that is, p (r0 ) + p (r1 ) + p (r2 ) + p (r3 ) + ... + p (rL-1 ) = 1. It should be noted that the abscissa of the normalized gray histogram is the gray level rk , and the ordinate is P (rk).
具体可举例说明,假设终端获取到该灰度图像中像素点的总数量为N,根据确定的各像素点的各灰度级获取各灰度级对应的像素点数量为n,则终端可以利用获取到的各灰度级对应的像素点数量n以及获取到的该灰度图像中像素点的总数量N,计算各灰度级对应的像素点数量n与获取到的该灰度图像 中像素点的总数量N的比值n/N,将得到的该比值n/N确定为该灰度图像各灰度级的分布概率。Specifically, for example, if the total number of pixels in the grayscale image obtained by the terminal is N, and the number of pixels corresponding to each grayscale level is obtained according to the determined grayscale levels of each pixel point, the terminal can use The number of pixels n corresponding to each gray level obtained and the total number N of pixels in the gray image obtained, the number of pixels n corresponding to each gray level and the pixels in the gray image obtained are calculated The ratio n / N of the total number N of points is determined as the distribution probability of each gray level of the gray image.
在一个实施例中,终端在根据获取到的该灰度图像中各像素点的灰度级,确定所述灰度图像的各灰度级区间时,可以按照预设的划分规则对各灰度级进行区间划分,得到一个或多个灰度级区间。其中,灰度级表示灰度图像中不同灰度值的最大数量,灰度级越大,图像的亮度范围越大。一般灰度图像的灰度值范围为[0,255],因此灰度级总共有256级。灰度级的范围为[0,255],0代表黑色,255代表白色,随着灰度级的增加灰度图像越来越亮。需要说明的是,由于统计灰度图像的灰度级是为了从调整后的灰度图像中识别出拍摄对象,因此本方案不需要统计对比度很高的灰度级区间,因为对比度高的灰度级区间能够识别出拍摄对象。In one embodiment, when the terminal determines each gray level interval of the gray image according to the gray level of each pixel point in the gray image obtained, the terminal may Divide the interval to obtain one or more gray-level intervals. Among them, the gray level represents the maximum number of different gray values in a gray image. The larger the gray level, the larger the brightness range of the image. Generally, the gray value range of a gray image is [0,255], so there are 256 levels in total. The range of the gray level is [0,255], where 0 represents black and 255 represents white. As the gray level increases, the gray image becomes brighter and brighter. It should be noted that because the gray level of the statistical gray image is to identify the shooting object from the adjusted gray image, the solution does not need to count the gray level interval with high contrast because the gray level with high contrast is The step section can recognize the subject.
在一个实施例中,终端可以按照以下预设的规则对该灰度图像的灰度级划分为三个区间,假设灰度级i的范围为{0,1,2,、、、,L-1},则可以将灰度级i∈[0,0.4(L-1)]这个灰度级区间的灰度级划分为统计暗图部分的第一统计区间;将灰度级i∈[0.6(L-1),L-1]这个灰度级区间划分为统计亮图部分的第二统计区间;将灰度级i∈[0.35(L-1),0.65(L-1)]这个灰度级区间划分为统计对比度较低的第三统计区间。具体可举例说明,假设获取到的灰度图像的灰度级i的范围为{0,1,2,、、、,L-1},则终端可以按照预设的规则即第一统计区间为i∈[0,0.4(L-1)],第二统计区间为i∈[0.6(L-1),L-1],第三统计区间为i∈[0.6(L-1),L-1]的规则,将该灰度图像的灰度级划分为:第一统计区间[0,102]、第二统计区间[153,255]、第三统计区间[89,166]。当然,在其他实施例中,该灰度图像的灰度级区间的划分还可以采用其他划分规则,本申请实施例对灰度图像的灰度级区间的划分规则不做具体的限定。In one embodiment, the terminal may divide the gray level of the gray image into three sections according to the following preset rules, assuming that the range of gray level i is {0,1,2 ,,,,, L- 1}, the gray level of the gray level interval i ∈ [0,0.4 (L-1)] can be divided into the first statistical interval of the statistical dark image part; the gray level i ∈ [0.6 (L-1), L-1] This gray level interval is divided into the second statistical interval of the statistical bright part; the gray level i∈ [0.35 (L-1), 0.65 (L-1)] is gray The degree interval is divided into a third statistical interval with a lower statistical contrast. Specifically, it can be illustrated that if the range of the gray level i of the obtained gray image is {0,1,2 ,,,,, L-1}, the terminal may follow a preset rule, that is, the first statistical interval is i∈ [0,0.4 (L-1)], the second statistical interval is i∈ [0.6 (L-1), L-1], and the third statistical interval is i∈ [0.6 (L-1), L- 1] rule, the gray level of the gray image is divided into: a first statistical interval [0,102], a second statistical interval [153,255], and a third statistical interval [89,166]. Of course, in other embodiments, the division of the grayscale interval of the grayscale image may also adopt other division rules. The embodiment of the present application does not specifically limit the division rule of the grayscale interval of the grayscale image.
S103:根据各灰度级区间的累计概率调整所述灰度图像的曝光度,并按照调整后的曝光度进行图像拍摄。S103: Adjust the exposure of the gray image according to the cumulative probability of each gray level interval, and perform image shooting according to the adjusted exposure.
本申请实施例中,终端可以根据获取到的各灰度级区间的累计概率调整所述灰度图像的曝光度,并按照调整后的曝光度进行图像拍摄,其中,所述累计概率是灰度级区间内的灰度级的分布概率之和。In the embodiment of the present application, the terminal may adjust the exposure of the grayscale image according to the acquired cumulative probability of each grayscale interval, and perform image shooting according to the adjusted exposure degree, where the cumulative probability is grayscale The sum of the distribution probabilities of the gray levels in the interval.
在一个实施例中,终端可以根据得到的归一化灰度直方图,按照预设的规则对灰度图像的灰度级进行划分,得到的各统计区间内的累计概率。其中,统计累计概率的公式如下:In one embodiment, the terminal may divide the gray level of the gray image according to a preset rule according to the obtained normalized gray histogram, and obtain the cumulative probability in each statistical interval. Among them, the formula for statistical cumulative probability is as follows:
其中,i∈[a,b]为统计区间,Pr(ri)为归一化直方图中灰度级rk对应的分布概率。Among them, i ∈ [a, b] is the statistical interval, and Pr (ri ) is the distribution probability corresponding to the gray level rk in the normalized histogram.
具体可举例说明,假设灰度图的灰度级范围为[0,255],且按照预设的规则第一统计区间为i∈[0,0.4(L-1)],第二统计区间为i∈[0.6(L-1),L-1],第三统计区间为i∈[0.35(L-1),0.65(L-1)],将该灰度图像 的灰度级划分为:第一统计区间[0,102]、第二统计区间[153,255]、第三统计区间[89,166],则可以计算得到该灰度图像各灰度级统计区间的累计概率为:Specifically, it can be illustrated that the gray level range of the grayscale image is [0,255], and according to a preset rule, the first statistical interval is i∈ [0,0.4 (L-1)], and the second statistical interval is i∈ [0.6 (L-1), L-1], and the third statistical interval is i∈ [0.35 (L-1), 0.65 (L-1)]. The gray level of this gray image is divided into: The first statistical interval [0, 102], the second statistical interval [153, 255], and the third statistical interval [89, 166], then the cumulative probability of each gray level statistical interval of the gray image can be calculated as:
Sk=p(r0)+…+p(r102) k=0,1,…,102;Sk = p (r0 ) + ... + p (r102 ) k = 0,1, ..., 102;
Sk=p(r153)+…+p(r255) k=153,154,…,255;Sk = p (r153 ) + ... + p (r255 ) k = 153,154, ..., 255;
Sk=p(r89)+…+p(r166) k=89,90,…,166。Sk = p (r89 ) + ... + p (r166 ) k = 89,90, ..., 166.
在一个实施例中,终端可以在根据各灰度级区间的累计概率调整所述灰度图像的曝光度后,按照调整后的曝光度进行图像拍摄。In one embodiment, after adjusting the exposure of the grayscale image according to the cumulative probability of each grayscale interval, the terminal may perform image shooting according to the adjusted exposure.
本申请实施例,终端如果检测到终端的摄像装置采集到的预览图像中不存在拍摄对象,则可以将预览图像转化为灰度图像,根据灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间,根据各灰度级区间的累计概率调整所述灰度图像的曝光度,并采用调整后的曝光度和焦距进行图像拍摄。通过这种方式可以实现对图像曝光度的动态调节,增强了图像对比度,提高了拍摄图像的清晰度。In the embodiment of the present application, if the terminal detects that there is no shooting object in the preview image collected by the camera device of the terminal, the terminal may convert the preview image into a grayscale image, and determine each The distribution probability of the gray levels of the pixels and each gray level interval of the gray image, the exposure of the gray image is adjusted according to the cumulative probability of each gray level interval, and the adjusted exposure and focal length are used Take an image. In this way, dynamic adjustment of image exposure can be achieved, image contrast is enhanced, and sharpness of the captured image is improved.
参见图2,图2是本申请实施例提供的另一种拍摄控制方法的示意流程图,如图2所示,该方法可以由终端执行,该终端的具体解释如前所述,此处不再赘述。本申请实施例与上述图1所述实施例的区别在于,本申请实施例主要讲述是根据各灰度级区间的累计概率调整所述灰度图像的曝光度的详细过程。具体地,本申请实施例的所述方法包括如下步骤。Referring to FIG. 2, FIG. 2 is a schematic flowchart of another shooting control method according to an embodiment of the present application. As shown in FIG. 2, the method may be executed by a terminal. The specific explanation of the terminal is as described above, and is not described here. More details. The difference between the embodiment of the present application and the embodiment shown in FIG. 1 is that the embodiment of the present application mainly describes the detailed process of adjusting the exposure of the grayscale image according to the cumulative probability of each grayscale interval. Specifically, the method in the embodiment of the present application includes the following steps.
S201:如果检测到终端的摄像装置采集到的预览图像中不存在拍摄对象,则将所述预览图像转化为灰度图像。S201: If it is detected that there is no shooting object in the preview image collected by the camera device of the terminal, convert the preview image into a grayscale image.
本申请实施例中,终端可以检测该终端的摄像装置采集到的该预览图像中是否存在拍摄对象,如果检测到该预览图像中不存在拍摄对象,则可以将该预览图像转化为灰度图像。其中,所述拍摄对象的解释如前所述,此处不再赘述。In the embodiment of the present application, the terminal may detect whether a photographic subject exists in the preview image collected by the camera device of the terminal, and if it is detected that the photographic subject does not exist in the preview image, the preview image may be converted into a grayscale image. The explanation of the subject is as described above, and is not repeated here.
S202:根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间。S202: Determine the distribution probability of the gray level of each pixel and each gray level interval of the gray image according to the gray level of each pixel in the gray image.
本申请实施例中,终端可以根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间,所述确定各像素点的灰度级的分布概率以及确定所述灰度图像的各灰度级区间的具体实施过程和举例如前所述,此处不再赘述。In the embodiment of the present application, the terminal may determine the distribution probability of the gray level of each pixel and each gray level interval of the gray image according to the gray level of each pixel in the gray image, and the determining The specific implementation process and example of determining the gray level distribution probability of each pixel and determining each gray level interval of the gray image are as described above, and are not repeated here.
S203:检测各灰度级区间中是否存在累计概率大于预设阈值的灰度级区间,如果检测结果为是,则执行步骤S204,如果检测结果为否,则执行步骤S206。S203: Detect whether there is a grayscale interval with a cumulative probability greater than a preset threshold in each grayscale interval. If the detection result is yes, step S204 is performed, and if the detection result is no, step S206 is performed.
本申请实施例中,终端可以根据获取到的该灰度图像的各灰度级区间内灰度级的分布概率之和确定累计概率,并可以检测各灰度级区间中是否存在累计概率大于预设阈值的灰度级区间,如果检测到各 灰度级区间中存在所述累计概率大于预设阈值的灰度级区间,则执行步骤S204。例如,假设预设阈值为0.85,如果根据预设的规则划分得到的灰度级区间包括:第一统计区间的累计概率为0.88、第二统计区间的累计概率为0.9、第三统计区间的累计概率为0.82,则可以确定各灰度级区间中的第一统计区间和第二统计区间的累计概率大于预设阈值。In the embodiment of the present application, the terminal may determine the cumulative probability based on the sum of the distribution probabilities of the gray levels in each gray level interval of the obtained gray image, and may detect whether there is a cumulative probability greater than A threshold gray level interval is set. If it is detected that a gray level interval in which the cumulative probability is greater than a preset threshold exists in each gray level interval, step S204 is performed. For example, assuming the preset threshold is 0.85, if the gray level interval obtained according to the preset rule includes: the cumulative probability of the first statistical interval is 0.88, the cumulative probability of the second statistical interval is 0.9, and the cumulative of the third statistical interval If the probability is 0.82, it can be determined that the cumulative probability of the first statistical interval and the second statistical interval in each gray level interval is greater than a preset threshold.
S204:根据预设的累计概率与曝光度的对应关系,确定各灰度级区间中大于预设阈值的累计概率对应的曝光度的目标值。S204: Determine the target value of the exposure corresponding to the cumulative probability greater than the preset threshold in each gray level interval according to the corresponding relationship between the preset cumulative probability and the exposure.
本申请实施例中,终端在检测到各灰度级区间中存在所述累计概率大于预设阈值的灰度级区间后,可以根据预设的累计概率与曝光度的对应关系,确定各灰度级区间中大于预设阈值的累计概率对应的曝光度的目标值。具体可举例说明,假设获取到的累计概x的曝光度为n,则可以根据预设的累计概率与曝光度的对应关系,从该对应关系中确定出累计概率x对应的曝光度的目标值为m。In the embodiment of the present application, after detecting that a gray level interval in which the cumulative probability is greater than a preset threshold exists in each gray level interval, the terminal may determine each gray level according to a correspondence relationship between the preset cumulative probability and exposure. The target value of the exposure corresponding to the cumulative probability greater than the preset threshold in the step interval. Specifically, it can be illustrated that if the exposure of the cumulative probability x obtained is n, the target value of the exposure corresponding to the cumulative probability x can be determined from the corresponding relationship according to a preset correspondence between the cumulative probability and the exposure. Is m.
S205:将所述灰度图像中所述累计概率大于预设阈值的灰度级区间的曝光度调整至所述目标值。S205: Adjust the exposure of the gray level interval in which the cumulative probability is greater than a preset threshold in the gray image to the target value.
本申请实施例中,终端在根据预设的累计概率与曝光度的对应关系,确定各灰度级区间中大于预设阈值的累计概率对应的曝光度的目标值后,可以将所述灰度图像中所述累计概率大于预设阈值的灰度级区间的曝光度调整至所述目标值。具体可举例说明,假设从预设的累计概率与曝光度的对应关系中确定出累计概率x对应的曝光度的目标值为m,如果获取到的该灰度图像中的累计概率x对应的曝光度为n,且n大于m,则该终端可以将灰度图像中的累计概率x对应的曝光度从n调整至m。In the embodiment of the present application, after determining the target value of the exposure corresponding to the cumulative probability greater than a preset threshold in each gray level interval according to the corresponding relationship between the preset cumulative probability and the exposure, the terminal may change the gray level. The exposure degree of the gray level interval in which the cumulative probability is greater than a preset threshold in the image is adjusted to the target value. Specifically, for example, it is assumed that the target value of the exposure corresponding to the cumulative probability x is determined from the preset correspondence between the cumulative probability and the exposure. If the acquired exposure corresponding to the cumulative probability x in the grayscale image is obtained If the degree is n and n is greater than m, the terminal can adjust the exposure corresponding to the cumulative probability x in the grayscale image from n to m.
S206:按照调整后的曝光度进行图像拍摄。S206: Take an image according to the adjusted exposure.
本申请实施例中,终端在将所述灰度图像中所述累计概率大于预设阈值的灰度级区间的曝光度调整至所述目标值之后,可以按照调整后的曝光度进行图像拍摄。In the embodiment of the present application, after the terminal adjusts the exposure of the gray level interval in which the cumulative probability is greater than a preset threshold to the target value, the terminal may perform image shooting according to the adjusted exposure.
本申请实施例中,终端在检测到摄像装置采集到的预览图像中不存在拍摄对象时,通过将该预览图像转化为灰度图像,以及确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间,并根据获取到的该灰度图像的各灰度级区间内灰度级的分布概率之和确定累计概率,如果检测到各灰度级区间中存在所述累计概率大于预设阈值的灰度级区间,则将所述灰度图像中所述累计概率大于预设阈值的灰度级区间的曝光度调整至所述目标值,并按照调整后的曝光度进行图像拍摄。通过这种方式可以实现对图像曝光度的动态调节,增强了图像对比度,提高了拍摄图像的清晰度。In the embodiment of the present application, when the terminal detects that there is no shooting object in the preview image collected by the camera device, the terminal converts the preview image into a grayscale image, and determines the distribution probability of the grayscale level of each pixel and the Each gray level interval of the gray image, and the cumulative probability is determined according to the sum of the distribution probability of the gray levels in each gray level interval of the obtained gray image. If it is detected that the gray level interval exists, For a gray level interval whose cumulative probability is greater than a preset threshold, the exposure of the gray level interval whose cumulative probability is greater than the preset threshold is adjusted to the target value, and according to the adjusted exposure Take an image. In this way, dynamic adjustment of image exposure can be achieved, image contrast is enhanced, and sharpness of the captured image is improved.
参见图3,图3是本申请实施例提供的又一种拍摄控制方法的示意流程图,如图3所示,该方法可以由终端执行,该终端的具体解释如前所述,此处不再赘述。本申请实施例与上述图2所述实施例的区别在于,本申请实施例还可以对根据所述灰度图像中所述拍摄对象的位置信息调整所述摄像装置的焦距。具体地,本申请实施例的所述方法包括如下步骤。Referring to FIG. 3, FIG. 3 is a schematic flowchart of another shooting control method according to an embodiment of the present application. As shown in FIG. 3, the method may be executed by a terminal. The specific explanation of the terminal is as described above, and is not described here. More details. The difference between the embodiment of the present application and the embodiment shown in FIG. 2 is that the embodiment of the present application can also adjust the focal length of the imaging device according to the position information of the shooting object in the grayscale image. Specifically, the method in the embodiment of the present application includes the following steps.
S301:如果检测到终端的摄像装置采集到的预览图像中不存在拍摄对象,则将所述预览图像转化为灰度图像。S301: If it is detected that there is no shooting object in the preview image collected by the camera device of the terminal, convert the preview image into a grayscale image.
本申请实施例中,终端可以检测该终端的摄像装置采集到的该预览图像中是否存在拍摄对象,如果检测到该预览图像中不存在拍摄对象,则可以将该预览图像转化为灰度图像。其中,所述拍摄对象的解释如前所述,此处不再赘述。In the embodiment of the present application, the terminal may detect whether a photographic subject exists in the preview image collected by the camera device of the terminal, and if it is detected that the photographic subject does not exist in the preview image, the preview image may be converted into a grayscale image. The explanation of the subject is as described above, and is not repeated here.
S302:根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间。S302: Determine the distribution probability of the gray level of each pixel and each gray level interval of the gray image according to the gray level of each pixel in the gray image.
本申请实施例中,终端可以根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间,所述确定各像素点的灰度级的分布概率以及确定所述灰度图像的各灰度级区间的具体实施过程和举例如前所述,此处不再赘述。In the embodiment of the present application, the terminal may determine the distribution probability of the gray level of each pixel and each gray level interval of the gray image according to the gray level of each pixel in the gray image, and the determining The specific implementation process and example of determining the gray level distribution probability of each pixel and determining each gray level interval of the gray image are as described above, and are not repeated here.
S303:根据各灰度级区间的累计概率调整所述灰度图像的曝光度。S303: Adjust the exposure of the grayscale image according to the cumulative probability of each grayscale interval.
本申请实施例中,终端可以根据获取到的该灰度图像的各灰度级区间内灰度级的分布概率之和确定累计概率,其中,所述累计概率的解释如前所述,此处不再赘述。In the embodiment of the present application, the terminal may determine the cumulative probability according to the sum of the distribution probabilities of the gray levels in each gray level interval of the gray image obtained, where the interpretation of the cumulative probability is as described above, here No longer.
S304:根据各灰度级的分布概率,对所述灰度图像进行均衡化处理。S304: Perform equalization processing on the grayscale image according to a distribution probability of each grayscale level.
本申请实施例中,终端还可以根据获取到的所述灰度图像的分布概率,进一步对所述灰度图像进行均衡化处理。In the embodiment of the present application, the terminal may further perform equalization processing on the grayscale image according to the obtained distribution probability of the grayscale image.
其中,所述终端在对所述灰度图像进行均衡化处理时,可以根据各灰度级的分布概率,确定所述灰度图像的累计概率直方图,并根据所述累计概率直方图,采用直方图均衡化处理技术对所述灰度图像进行对比度增强处理。其中,该直方图均衡化处理是一种能仅靠输入图像直方图信息自动达到图像的像素占有很多的灰度级而且分布均匀这种效果的变换函数。在一个实施例中,终端在对获取到的灰度图像进行均衡化处理时,可以根据获取到的归一化灰度直方图确定出累计概率直方图。When the terminal performs equalization processing on the grayscale image, the terminal may determine a cumulative probability histogram of the grayscale image according to the distribution probability of each grayscale level, and use the cumulative probability histogram according to the A histogram equalization processing technique performs contrast enhancement processing on the grayscale image. Among them, the histogram equalization process is a transformation function that can automatically achieve the effect that the pixels of the image occupy a lot of gray levels and are evenly distributed by using only the histogram information of the input image. In one embodiment, when the terminal performs equalization processing on the acquired grayscale image, the terminal may determine the cumulative probability histogram according to the obtained normalized grayscale histogram.
具体可以举例说明,假设获取到的灰度图像有L个灰度级,利用获取到的归一化灰度直方图中各灰度级的累计概率,可以确定出累积概率直方图Ek(k)Specifically, it can be exemplified that, assuming that the obtained grayscale image has L grayscale levels, the cumulative probability histogram Ek (k )
其中,如前所述灰度值ri被归一化到区间[0,1]的分布概率为P(ri),且r0表示黑色,rL-1表示白色;则Ek(k)满足以下两个条件:Among them, as described above, the distribution probability of the gray value ri normalized to the interval [0,1] is P (ri ), and r0 represents black, and rL-1 represents white; then Ek (k ) Satisfy the following two conditions:
(a)Ek(k)在区间[0,1]中为单值且单调递增(a) Ek (k) is monotonic and monotonically increasing in the interval [0,1]
(b)当在区间[0,1]时,Ek(k)∈[0,1](b) When in the interval [0,1], Ek (k) ∈ [0,1]
该实施方式通过确定累计概率直方图的方式对灰度图像进行均衡化处理,其中,灰度值被归一化到区间[0,1]保证了输入与输出一一对应的关系,区间[0,1]单调递增保证了灰度图像从黑到白的对应顺序,不会出现反转灰度级,从而保证了输入输出在同一个范围。根据概率累计直方图这两个条件,可以通过(L-1)Ek(k)可以得到概率累积到灰度空间的映射,从而实现对灰度图像的均衡化处理。这样的均衡化处理可以使灰度值覆盖整个灰度级更大的范围,提高灰度图像的清晰度。This embodiment performs equalization processing on a grayscale image by determining a cumulative probability histogram. The grayscale value is normalized to an interval [0,1] to ensure a one-to-one correspondence between input and output. The interval [0 1] Monotonic increase ensures the corresponding order of grayscale images from black to white, and does not appear reverse grayscale, thereby ensuring that the input and output are in the same range. According to the two conditions of the probability cumulative histogram, the mapping of the probability cumulative to the gray space can be obtained through (L-1) Ek (k), thereby achieving the equalization processing of the gray image. Such equalization processing can make the gray value cover a larger range of the gray level and improve the sharpness of the gray image.
在一个实施例中,该终端在根据所述累计概率直方图,采用直方图均衡化处理技术对所述灰度图像进行对比度增强处理时,可以根据所述累计概率直方图,按照预设规则调整所述灰度图像中各灰度级区间的累计概率,按照调整后各灰度级区间的累计概率,对所述灰度图像中各灰度级区间对应各像素点的灰度值进行调整,以增强所述灰度图像的对比度。In one embodiment, when the terminal uses the histogram equalization processing technology to perform contrast enhancement processing on the grayscale image according to the cumulative probability histogram, the terminal may adjust according to the cumulative probability histogram according to a preset rule. The cumulative probability of each grayscale interval in the grayscale image is adjusted according to the cumulative probability of each grayscale interval after adjustment, the grayscale value of each grayscale interval corresponding to each pixel in the grayscale image, To enhance the contrast of the grayscale image.
S305:从均衡化处理后的灰度图像中确定出所述拍摄对象的位置信息。S305: Determine position information of the shooting object from the grayscale image after the equalization process.
本申请实施例中,终端可以从均衡化处理后的灰度图像中确定出所述拍摄对象的位置信息。具体实施过程中,该终端可以根据预设的检测算法如人脸识别算法、人体检测算法、物体检测算法等,对均衡化处理后的灰度图像进行检测,得到拍摄对象在灰度图像中的坐标位置信息如P(x,y)。In the embodiment of the present application, the terminal may determine position information of the shooting object from the grayscale image after the equalization process. In the specific implementation process, the terminal can detect the grayscale image after the equalization processing according to a preset detection algorithm such as a face recognition algorithm, a human detection algorithm, an object detection algorithm, and the like, and obtain the shooting object in the grayscale image. Coordinate position information such as P (x, y).
S306:根据所述拍摄对象在均衡化处理后的灰度图像中的位置信息,调整所述摄像装置的焦距,并采用调整后的曝光度和焦距进行图像拍摄。S306: Adjust the focal length of the imaging device according to the position information of the photographic subject in the grayscale image after the equalization process, and use the adjusted exposure and focal length to perform image shooting.
本申请实施例中,终端在根据所述灰度图像中所述拍摄对象的位置信息调整所述摄像装置的焦距时,可以根据所述拍摄对象在均衡化处理后的灰度图像中的位置信息,调整所述摄像装置的焦距,并采用调整后的曝光度和焦距进行图像拍摄。In the embodiment of the present application, when the terminal adjusts the focal length of the imaging device according to the position information of the photographic object in the grayscale image, the terminal may use the position information of the photographic object in the grayscale image after the equalization process. , Adjusting the focal length of the imaging device, and using the adjusted exposure and focal length for image capture.
在一个实施例中,终端在根据所述拍摄对象在均衡化处理后的灰度图像中的位置信息,调整所述摄像装置的焦距时,可以根据获取到的拍摄对象在灰度图像中的坐标位置信息如P(x,y),调节摄像装置的焦距。其中,对摄像装置的调焦过程是将获取到的拍摄对象在灰度图像中的坐标位置信息发送给摄像装置,以使摄像装置根据预设的调焦算法,对摄像装置的焦距进行调整。其中,本申请实施例对该预设的调焦算法不做具体的限定。通过这种方式可以使该灰度图像更加清晰,使得摄像装置对焦更加准确,从而获取到更加清晰的拍摄对象。In an embodiment, when the terminal adjusts the focal length of the imaging device according to the position information of the photographic object in the grayscale image after the equalization process, the terminal may use the acquired coordinates of the photographic object in the grayscale image. Position information, such as P (x, y), adjusts the focal length of the camera. The focusing process of the imaging device is to send the acquired coordinate position information of the photographic object in the grayscale image to the imaging device, so that the imaging device adjusts the focal length of the imaging device according to a preset focusing algorithm. The embodiment of the present application does not specifically limit the preset focusing algorithm. In this way, the grayscale image can be made clearer, the focus of the camera device can be more accurate, and a sharper subject can be obtained.
本申请实施例中,终端在检测到摄像装置采集到的预览图像中不存在拍摄对象时,通过将该预览图像转化为灰度图像,以及确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间,并根据各灰度级区间的累计概率调整所述灰度图像的曝光度,以及对所述灰度图像进行均衡化处理,从均衡化处理后的灰度图像中确定出所述拍摄对象的位置信息,根据所述拍摄对象在均衡化处理后的灰度图像中 的位置信息,调整所述摄像装置的焦距,并采用调整后的曝光度和焦距进行图像拍摄。通过这种方式可以实现对摄像装置的焦距的动态调节,进一步地提高了拍摄图像的清晰度。In the embodiment of the present application, when the terminal detects that there is no shooting object in the preview image collected by the camera device, the terminal converts the preview image into a grayscale image, and determines the distribution probability of the grayscale level of each pixel and the Each grayscale interval of the grayscale image, and adjusting the exposure of the grayscale image according to the cumulative probability of each grayscale interval, and performing equalization processing on the grayscale image, The position information of the photographic subject is determined in the image, the focal length of the imaging device is adjusted according to the position information of the photographic subject in the grayscale image after the equalization process, and the adjusted exposure and focal length are used for the image Shoot. In this way, dynamic adjustment of the focal length of the imaging device can be achieved, and the sharpness of the captured image is further improved.
本申请实施例还提供了一种终端,该终端用于执行前述任一项所述的方法的单元。具体地,参见图4,图4是本申请实施例提供的一种终端的示意框图。本实施例的终端包括:第一检测单元401、转化单元402、确定单元403、第一调整单元404。An embodiment of the present application further provides a terminal, where the terminal is configured to execute a unit of the foregoing method. Specifically, referring to FIG. 4, FIG. 4 is a schematic block diagram of a terminal provided by an embodiment of the present application. The terminal in this embodiment includes a
第一检测单元401,用于检测终端的摄像装置采集到的预览图像中是否存在拍摄对象。The
进一步地,第一检测单元401,具体用于对获取到的所述终端的摄像装置采集到的预览图像进行图像处理,得到所述预览图像的模糊度;如果检测到所述预览图像的模糊度大于预设的模糊度阈值,则确定所述终端的摄像装置采集到的该所述预览图像中不存在拍摄对象。Further, the
转化单元402,用于如果检测到所述终端的摄像装置采集到的预览图像中不存在拍摄对象,则将所述预览图像转化为灰度图像。The
确定单元403,用于根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间。A determining
进一步地,确定单元403,用于获取所述灰度图像中各像素点的灰度值;根据各像素点的灰度值,确定各像素点的各灰度级;根据所述灰度图像中像素点的总数量和各灰度级对应的像素点数量,确定各灰度级的分布概率;按照预设的划分规则对各灰度级进行区间划分,得到一个或多个灰度级区间。Further, a determining
进一步地,本申请实施例的终端还包括:第二检测单元406,Further, the terminal in the embodiment of the present application further includes: a
第二检测单元406,用于在所述根据各灰度级区间的累计概率调整所述灰度图像的曝光度之前,检测各灰度级区间中是否存在累计概率大于预设阈值的灰度级区间;如果检测到各灰度级区间中存在所述累计概率大于预设阈值的灰度级区间,则执行根据所述各灰度级区间的累计概率调整各灰度区间的灰度图像的曝光度。A
第一调整单元404,用于根据预设的累计概率与曝光度的对应关系,确定各灰度级区间中大于预设阈值的累计概率对应的曝光度的目标值;将所述灰度图像中所述累计概率大于预设阈值的灰度级区间的曝光度调整至所述目标值。The
进一步地,本申请实施例的终端中还包括:第二调整单元405,Further, the terminal in the embodiment of the present application further includes: a second adjustment unit 405,
第二调整单元405,用于对所述灰度图像进行均衡化处理;从均衡化处理后的灰度图像中确定出所述拍摄对象的位置信息;根据所述拍摄对象在均衡化处理后的灰度图像中的位置信息,调整所述终端中摄像装置的焦距,并采用调整后的曝光度和焦距进行图像拍摄。A second adjustment unit 405, configured to perform equalization processing on the grayscale image; determine position information of the photographic object from the grayscale image after the equalization processing; and according to the photographic object after the equalization processing, Position information in the grayscale image, adjusting the focal length of the camera device in the terminal, and using the adjusted exposure and focal length for image capture.
进一步地,第二调整单元405,用于根据各灰度级的分布概率,确定所述灰度图像的累计概率直方 图;根据所述累计概率直方图,按照预设规则调整所述灰度图像中各灰度级区间的累计概率;按照调整后各灰度级区间的累计概率,对所述灰度图像中各灰度级区间对应各像素点的灰度值进行调整,以增强所述灰度图像的对比度。Further, a second adjusting unit 405 is configured to determine a cumulative probability histogram of the grayscale image according to the distribution probability of each grayscale level; and adjust the grayscale image according to a preset rule according to the cumulative probability histogram. The cumulative probability of each gray level interval in the medium; according to the cumulative probability of each gray level interval after adjustment, adjusting the gray value of each gray level interval corresponding to each pixel in the gray image to enhance the gray level Degree image contrast.
本申请实施例,终端的第一检测单元401如果检测到终端的摄像装置采集到的预览图像中不存在拍摄对象,则可以通过转化单元402将预览图像转化为灰度图像,确定单元403根据灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间,第一调整单元404根据各灰度级区间的累计概率调整所述灰度图像的曝光度,第二调整单元405根据所述灰度图像中拍摄对象的位置信息调整所述摄像装置的焦距,并采用调整后的曝光度和焦距进行图像拍摄。通过这种方式可以实现对图像曝光度和摄像装置的焦距的动态调节,提高了拍摄图像的清晰度。In the embodiment of the present application, if the
参见图5,图5是本申请实施例提供的另一种终端示意框图。如图所示的本实施例中的终端可以包括:一个或多个处理器501;一个或多个输入设备502,一个或多个输出设备503和存储器504。上述处理器501、输入设备402、输出设备503和存储器504通过总线505连接。存储器504用于存储计算机程序,所述计算机程序包括程序指令,处理器501用于执行存储器504存储的程序指令。其中,处理器501被配置用于调用所述程序指令执行:Referring to FIG. 5, FIG. 5 is a schematic block diagram of another terminal provided by an embodiment of the present application. The terminal in this embodiment as shown in the figure may include: one or
检测终端的摄像装置采集到的预览图像中是否存在拍摄对象;Detecting whether a shooting object exists in the preview image collected by the camera device of the terminal;
如果检测到所述终端的摄像装置采集到的预览图像中不存在拍摄对象,则将所述预览图像转化为灰度图像;If it is detected that there is no shooting object in the preview image collected by the camera device of the terminal, converting the preview image into a grayscale image;
根据所述灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间;Determining a distribution probability of a gray level of each pixel and each gray level interval of the gray image according to the gray level of each pixel in the gray image;
根据各灰度级区间的累计概率调整所述灰度图像的曝光度,并按照调整后的曝光度进行图像拍摄,其中,所述累计概率是灰度级区间内的灰度级的分布概率之和。The exposure of the grayscale image is adjusted according to the cumulative probability of each grayscale interval, and image shooting is performed according to the adjusted exposure degree, where the cumulative probability is one of the distribution probability of the grayscale within the grayscale interval. with.
进一步地,所述处理器501用于执行如下步骤:Further, the
对获取到的所述终端的摄像装置采集到的预览图像进行图像处理,得到所述预览图像的模糊度;Performing image processing on the acquired preview image collected by the camera device of the terminal to obtain the blur degree of the preview image;
如果检测到所述预览图像的模糊度大于预设的模糊度阈值,则确定所述终端的摄像装置采集到的该所述预览图像中不存在拍摄对象。If it is detected that the blur degree of the preview image is greater than a preset blur degree threshold, it is determined that there is no photographic subject in the preview image collected by the camera device of the terminal.
进一步地,所述处理器501用于执行如下步骤:Further, the
获取所述灰度图像中各像素点的灰度值;Obtaining the gray value of each pixel in the gray image;
根据各像素点的灰度值,确定各像素点的各灰度级;Determining each gray level of each pixel according to the gray value of each pixel;
根据所述灰度图像中像素点的总数量和各灰度级对应的像素点数量,确定各灰度级的分布概率;Determine the distribution probability of each gray level according to the total number of pixels in the gray image and the number of pixels corresponding to each gray level;
按照预设的划分规则对各灰度级进行区间划分,得到一个或多个灰度级区间。Interval division of each gray level is performed according to a preset division rule to obtain one or more gray level intervals.
进一步地,所述处理器501用于执行如下步骤:Further, the
检测各灰度级区间中是否存在累计概率大于预设阈值的灰度级区间;Detecting whether there is a gray level interval whose cumulative probability is greater than a preset threshold in each gray level interval;
如果检测到各灰度级区间中存在所述累计概率大于预设阈值的灰度级区间,则执行根据所述各灰度级区间的累计概率调整各灰度区间的灰度图像的曝光度。If it is detected that a gray level interval in which the cumulative probability is greater than a preset threshold exists in each gray level interval, adjusting the exposure of the gray image in each gray level interval according to the cumulative probability of each gray level interval.
进一步地,所述处理器501用于执行如下步骤:Further, the
根据预设的累计概率与曝光度的对应关系,确定各灰度级区间中大于预设阈值的累计概率对应的曝光度的目标值;Determine the target value of the exposure corresponding to the cumulative probability greater than the preset threshold in each gray level interval according to the corresponding relationship between the preset cumulative probability and the exposure;
将所述灰度图像中所述累计概率大于预设阈值的灰度级区间的曝光度调整至所述目标值。And adjusting the exposure degree of the grayscale interval in the grayscale image that is greater than a preset threshold to the target value.
进一步地,所述处理器501用于执行如下步骤:Further, the
对所述灰度图像进行均衡化处理;Performing equalization processing on the grayscale image;
从均衡化处理后的灰度图像中确定出所述拍摄对象的位置信息;Determining position information of the shooting object from the grayscale image after the equalization process;
根据所述拍摄对象在均衡化处理后的灰度图像中的位置信息,调整所述终端中摄像装置的焦距,并采用调整后的曝光度和焦距进行图像拍摄。Adjusting the focal length of the camera device in the terminal according to the position information of the photographic subject in the grayscale image after the equalization process, and using the adjusted exposure and focal length to perform image shooting.
进一步地,所述处理器501用于执行如下步骤:Further, the
根据各灰度级的分布概率,确定所述灰度图像的累计概率直方图;Determining a cumulative probability histogram of the grayscale image according to the distribution probability of each grayscale level;
根据所述累计概率直方图,按照预设规则调整所述灰度图像中各灰度级区间的累计概率;Adjusting the cumulative probability of each gray level interval in the gray image according to the cumulative probability histogram according to a preset rule;
按照调整后各灰度级区间的累计概率,对所述灰度图像中各灰度级区间对应各像素点的灰度值进行调整,以增强所述灰度图像的对比度。According to the cumulative probability of each gray level interval after adjustment, the gray value of each pixel point corresponding to each gray level interval in the gray image is adjusted to enhance the contrast of the gray image.
本申请实施例,终端如果检测到终端的摄像装置采集到的预览图像中不存在拍摄对象,则可以将预览图像转化为灰度图像,根据灰度图像中各像素点的灰度级,确定各像素点的灰度级的分布概率和所述灰度图像的各灰度级区间,根据各灰度级区间的累计概率调整所述灰度图像的曝光度,并采用调整后的曝光度进行图像拍摄。通过这种方式可以实现对图像曝光度的动态调节,增强了图像对比度,提高了拍摄图像的清晰度。In the embodiment of the present application, if the terminal detects that there is no shooting object in the preview image collected by the camera device of the terminal, the terminal may convert the preview image into a grayscale image, and determine each of the grayscale levels according to the grayscale level of each pixel in the grayscale image. The distribution probability of the gray levels of the pixels and each gray level interval of the gray image, adjusting the exposure of the gray image according to the cumulative probability of each gray level interval, and using the adjusted exposure to perform the image Shoot. In this way, dynamic adjustment of image exposure can be achieved, image contrast is enhanced, and sharpness of the captured image is improved.
应当理解,在本申请实施例中,所称处理器501可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the
输入设备502可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出设备503可以包括显示器(LCD等)、扬声器等。The
该存储器504可以包括只读存储器和随机存取存储器,并向处理器501提供指令和数据。存储器504的一部分还可以包括非易失性随机存取存储器。例如,存储器504还可以存储设备类型的信息。The
具体实现中,本申请实施例中所描述的处理器501、输入设备502、输出设备503可执行本申请实施例提供的拍摄控制方法的图1、图2或图3所述的方法实施例中所描述的实现方式,也可执行本申请实施例图4所描述的终端的实现方式,在此不再赘述。In specific implementation, the
本申请实施例中还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现图1、图2或图3所对应实施例中描述的拍摄控制方法,也可实现本申请图4或图5所对应实施例的终端,在此不再赘述。A computer-readable storage medium is also provided in the embodiments of the present application. The computer-readable storage medium stores a computer program, and the computer program implements the embodiments corresponding to FIG. The shooting control method described in the above can also implement the terminal of the embodiment corresponding to FIG. 4 or FIG. 5 of the present application, and details are not described herein again.
所述计算机可读存储介质可以是前述任一实施例所述的终端的内部存储单元,例如终端的硬盘或内存。所述计算机可读存储介质也可以是所述终端的外部存储设备,例如所述终端上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述计算机可读存储介质还可以既包括所述终端的内部存储单元也包括外部存储设备。所述计算机可读存储介质用于存储所述计算机程序以及所述终端所需的其他程序和数据。所述计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。The computer-readable storage medium may be an internal storage unit of the terminal according to any of the foregoing embodiments, such as a hard disk or a memory of the terminal. The computer-readable storage medium may also be an external storage device of the terminal, such as a plug-in hard disk, a Smart Media Card (SMC), and a Secure Digital (SD) card provided on the terminal. , Flash card (Flash card) and so on. Further, the computer-readable storage medium may further include both an internal storage unit of the terminal and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the terminal. The computer-readable storage medium may also be used to temporarily store data that has been or will be output.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art may realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the hardware and software, Interchangeability. In the above description, the composition and steps of each example have been described generally in terms of functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
以上所述,仅为本申请的部分实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。The above description is only part of the implementation of this application, but the scope of protection of this application is not limited to this. Any person skilled in the art can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements should be covered by the protection scope of this application.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810735397.7ACN109040579B (en) | 2018-07-05 | 2018-07-05 | Shooting control method, terminal and computer readable medium |
| CN201810735397.7 | 2018-07-05 |
| Publication Number | Publication Date |
|---|---|
| WO2020006907A1true WO2020006907A1 (en) | 2020-01-09 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2018/108677CeasedWO2020006907A1 (en) | 2018-07-05 | 2018-09-29 | Photographing control method, terminal, and computer readable storage medium |
| Country | Link |
|---|---|
| CN (1) | CN109040579B (en) |
| WO (1) | WO2020006907A1 (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111382726A (en)* | 2020-04-01 | 2020-07-07 | 浙江大华技术股份有限公司 | Engineering work detection method and related device |
| CN111563517A (en)* | 2020-04-20 | 2020-08-21 | 腾讯科技(深圳)有限公司 | Image processing method, image processing device, electronic equipment and storage medium |
| CN112165616A (en)* | 2020-11-13 | 2021-01-01 | 歌尔光学科技有限公司 | Test method, device, electronic device and storage medium for camera module |
| CN113674196A (en)* | 2020-05-15 | 2021-11-19 | 河南紫联物联网技术有限公司 | Filter cleanliness detection method, device and system, electronic equipment |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2002229092A (en)* | 2001-01-31 | 2002-08-14 | Canon Inc | Exposure control device, exposure control method, and storage medium |
| CN101304489A (en)* | 2008-06-20 | 2008-11-12 | 北京中星微电子有限公司 | Automatic exposure method and apparatus |
| CN103218621A (en)* | 2013-04-21 | 2013-07-24 | 北京航空航天大学 | Identification method of multi-scale vehicles in outdoor video surveillance |
| CN103327259A (en)* | 2013-07-19 | 2013-09-25 | 西安诺瓦电子科技有限公司 | Parameter adjusting method and device of camera for correcting LED (Light Emitting Diode) display screen |
| CN106713778A (en)* | 2016-12-28 | 2017-05-24 | 上海兴芯微电子科技有限公司 | Exposure control method and device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2002229092A (en)* | 2001-01-31 | 2002-08-14 | Canon Inc | Exposure control device, exposure control method, and storage medium |
| CN101304489A (en)* | 2008-06-20 | 2008-11-12 | 北京中星微电子有限公司 | Automatic exposure method and apparatus |
| CN103218621A (en)* | 2013-04-21 | 2013-07-24 | 北京航空航天大学 | Identification method of multi-scale vehicles in outdoor video surveillance |
| CN103327259A (en)* | 2013-07-19 | 2013-09-25 | 西安诺瓦电子科技有限公司 | Parameter adjusting method and device of camera for correcting LED (Light Emitting Diode) display screen |
| CN106713778A (en)* | 2016-12-28 | 2017-05-24 | 上海兴芯微电子科技有限公司 | Exposure control method and device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111382726A (en)* | 2020-04-01 | 2020-07-07 | 浙江大华技术股份有限公司 | Engineering work detection method and related device |
| CN111382726B (en)* | 2020-04-01 | 2023-09-01 | 浙江大华技术股份有限公司 | Engineering operation detection method and related device |
| CN111563517A (en)* | 2020-04-20 | 2020-08-21 | 腾讯科技(深圳)有限公司 | Image processing method, image processing device, electronic equipment and storage medium |
| CN111563517B (en)* | 2020-04-20 | 2023-07-04 | 腾讯科技(深圳)有限公司 | Image processing method, device, electronic equipment and storage medium |
| CN113674196A (en)* | 2020-05-15 | 2021-11-19 | 河南紫联物联网技术有限公司 | Filter cleanliness detection method, device and system, electronic equipment |
| CN112165616A (en)* | 2020-11-13 | 2021-01-01 | 歌尔光学科技有限公司 | Test method, device, electronic device and storage medium for camera module |
| CN112165616B (en)* | 2020-11-13 | 2023-05-02 | 歌尔光学科技有限公司 | Camera module testing method and device, electronic equipment and storage medium |
| Publication number | Publication date |
|---|---|
| CN109040579B (en) | 2021-08-20 |
| CN109040579A (en) | 2018-12-18 |
| Publication | Publication Date | Title |
|---|---|---|
| CN111028189B (en) | Image processing method, device, storage medium and electronic equipment | |
| CN108668093B (en) | HDR image generation method and device | |
| WO2019183813A1 (en) | Image capture method and device | |
| CN102300049B (en) | Image signal processing apparatus | |
| WO2020006907A1 (en) | Photographing control method, terminal, and computer readable storage medium | |
| WO2019137038A1 (en) | Method for determining point of gaze, contrast adjustment method and device, virtual reality apparatus, and storage medium | |
| CN107704798B (en) | Image blurring method, apparatus, computer-readable storage medium, and computer device | |
| JP5753393B2 (en) | Image processing apparatus and method | |
| CN112565636A (en) | Image processing method, device, equipment and storage medium | |
| CN110445986B (en) | Image processing method, image processing device, storage medium and electronic equipment | |
| JP5152405B2 (en) | Image processing apparatus, image processing method, and image processing program | |
| CN107465903A (en) | Image white balance method, device and computer-readable storage medium | |
| CN110213462A (en) | Image processing method, image processing device, electronic equipment and image processing circuit | |
| CN111080571B (en) | Camera shielding state detection method, device, terminal and storage medium | |
| CN110688926B (en) | Subject detection method and device, electronic device, computer-readable storage medium | |
| US10972676B2 (en) | Image processing method and electronic device capable of optimizing hdr image by using depth information | |
| CN107464225A (en) | Image processing method, device, computer readable storage medium and mobile terminal | |
| CN108282616B (en) | Image processing method and device, storage medium and electronic equipment | |
| WO2020006906A1 (en) | Photograph capturing control method, terminal, and computer-readable storage medium | |
| TWI768282B (en) | Method and system for establishing light source information prediction model | |
| CN112243118B (en) | White balance correction method, apparatus, device and storage medium | |
| CN108520036B (en) | Image selection method and device, storage medium and electronic equipment | |
| CN110276730A (en) | Image processing method, device, and electronic device | |
| CN113422893B (en) | Image acquisition method and device, storage medium and mobile terminal | |
| WO2022252007A1 (en) | Distance measurement method, distance measurement apparatus, and computer-program product |
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application | Ref document number:18925062 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 15.04.2021) | |
| 122 | Ep: pct application non-entry in european phase | Ref document number:18925062 Country of ref document:EP Kind code of ref document:A1 |