[go: up one dir, main page]

CN111372007A - Ambient illumination detection method, device and electronic device - Google Patents

Ambient illumination detection method, device and electronic device Download PDF

Info

Publication number
CN111372007A
CN111372007A CN202010140912.4A CN202010140912A CN111372007A CN 111372007 A CN111372007 A CN 111372007A CN 202010140912 A CN202010140912 A CN 202010140912A CN 111372007 A CN111372007 A CN 111372007A
Authority
CN
China
Prior art keywords
target
pixel
color
threshold
calculation formula
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.)
Granted
Application number
CN202010140912.4A
Other languages
Chinese (zh)
Other versions
CN111372007B (en
Inventor
马骋宇
张伟
王朝
罗伟
武渊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010140912.4A priority Critical patent/CN111372007B/en
Publication of CN111372007A publication Critical patent/CN111372007A/en
Application granted granted Critical
Publication of CN111372007B publication Critical patent/CN111372007B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/71Circuitry for evaluating the brightness variation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/88Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

本申请实施例提供一种环境光照度的检测方法、装置和电子设备,上述环境光照度的检测方法中,获取当前待摄影像、目标曝光时间及目标感光度;根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,从而提供了一种更方便的环境光照度的检测方式,可以通过摄像头检测环境光照度,节省了企业的生产成本,并可避免由实体环境光传感器在环境光检测时带来的一致性差异。

Figure 202010140912

Embodiments of the present application provide a method, device, and electronic device for detecting ambient illuminance. In the above-mentioned method for detecting ambient illuminance, a current image to be photographed, target exposure time, and target sensitivity are obtained; Detect the image and obtain the pixel statistical value corresponding to each target color, wherein the target color set includes multiple target colors; obtain each target color according to the pixel statistical value, target exposure time and target sensitivity of each target color. The pixel uniform value of the color; the corresponding target calculation formula is obtained according to the ratio of the pixel uniform value of any two target colors, and the current ambient illuminance is detected according to the target calculation formula, thereby providing a more convenient detection of ambient illuminance In this way, the ambient illuminance can be detected by the camera, which saves the production cost of the enterprise, and can avoid the consistency difference caused by the physical ambient light sensor in the ambient light detection.

Figure 202010140912

Description

环境光照度的检测方法、装置和电子设备Ambient illumination detection method, device and electronic device

技术领域technical field

本申请涉及智能终端技术领域,特别涉及一种环境光照度的检测方法、装置和电子设备。The present application relates to the technical field of intelligent terminals, and in particular, to a method, device and electronic device for detecting ambient illuminance.

背景技术Background technique

随着智能终端技术的不断发展,智能终端上的摄像头功能也越来越强大。当前,基本上所有智能终端的摄像头在进行环境光照度的检测时通常通过平局亮度、环境亮度、距离检测、人脸识别、瞳孔识别等方法进行,上述方法通常都是利用环境光传感器等实体器件完成环境光照度检测。With the continuous development of smart terminal technology, the functions of cameras on smart terminals are becoming more and more powerful. At present, the cameras of basically all smart terminals usually use methods such as flat brightness, ambient brightness, distance detection, face recognition, pupil recognition, etc. to detect ambient illuminance. The above methods are usually completed by using physical devices such as ambient light sensors. Ambient light detection.

而智能终端中的硬件架构比较紧凑,由于环境光传感器等实体器件的引入,从而导致智能终端的架构空间会被占用,并提升了企业的生产成本;此外,在通过环境光传感器等实体器件对当前环境的光照度进行检测时,环境光传感器的光路上存在均光油墨,该均光油墨的可见光/红外透过率差异会给同款智能终端的环境光检测带来一致性差异。综上所述,上述问题在智能终端的生产过程中都是亟需解决的问题。The hardware architecture of smart terminals is relatively compact. Due to the introduction of physical devices such as ambient light sensors, the architectural space of smart terminals will be occupied, and the production cost of enterprises will be increased; When detecting the illuminance of the current environment, there is a uniform light ink on the optical path of the ambient light sensor. The difference in visible light/infrared transmittance of the uniform light ink will bring consistency differences in the ambient light detection of the same smart terminal. To sum up, the above problems are all problems that need to be solved urgently in the production process of the intelligent terminal.

发明内容SUMMARY OF THE INVENTION

本申请提供了一种环境光照度的检测方法、装置和电子设备,本申请还提供一种计算机可读存储介质,以提供一种环境光照度的检测方式,通过软件方式替代环境光传感器等实体器件,可以节省终端的架构空间,简化终端的架构设计,节省企业的生产成本,并避免环境光检测的一致性差异。The present application provides a method, device and electronic device for detecting ambient illuminance, and the present application also provides a computer-readable storage medium to provide a method for detecting ambient illuminance, replacing physical devices such as ambient light sensors by software, It can save the architecture space of the terminal, simplify the architecture design of the terminal, save the production cost of the enterprise, and avoid the consistency difference of ambient light detection.

第一方面,本申请提供了一种环境光照度的检测方法,包括:In a first aspect, the present application provides a method for detecting ambient illuminance, including:

获取当前待摄影像、目标曝光时间及目标感光度;其中,所述目标色彩集合包含多种目标色彩;具体地,上述目标色彩集合通常包含RGB三种目标色彩,即红(R,Red)、绿(G,Green)即蓝(B,Blue);也可以是RYB三种目标色彩,即红(R,Red)、黄(Y,Yellow)即蓝(B,Blue);Obtain the current image to be photographed, the target exposure time, and the target sensitivity; wherein, the target color set includes a variety of target colors; Green (G, Green) is blue (B, Blue); it can also be three target colors of RYB, namely red (R, Red), yellow (Y, Yellow) or blue (B, Blue);

根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值;具体地,当前待摄影像中所有像素点的像素值及对应的目标色彩可由互补金属氧化物半导体(CMOS,Complementary Metal Oxide Semiconductor)图像传感器检测获得。The current image to be photographed is detected according to the target color set, and the pixel statistics value corresponding to each target color is obtained; Semiconductor (CMOS, Complementary Metal Oxide Semiconductor) image sensor detection and acquisition.

根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;具体地,依次根据每种目标色彩的像素统计值及当前的目标曝光时间及目标感光度进行计算,获得每种目标色彩的像素均一值;其中,目标曝光时间和目标感光度在针对当前任一目标色彩的计算时保持不变;The pixel uniform value of each target color is obtained according to the pixel statistical value, target exposure time and target sensitivity of each target color; specifically, according to the pixel statistical value of each target color and the current target exposure time and target sensitivity in turn Calculation is performed to obtain the pixel uniform value of each target color; wherein, the target exposure time and the target sensitivity remain unchanged when calculating for any current target color;

根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The corresponding target calculation formula is obtained according to the ratio of the pixel uniformity values of any two target colors, and the current ambient illuminance is detected according to the target calculation formula, wherein the target calculation formula is used according to the current pixel uniformity of the two target colors. The value calculates the ambient lighting.

当获取到目标色彩集合中所有目标色彩的像素均一值后,可任意选取其中两种目标色彩的像素均一值,然后计算两种目标色彩的像素均一值的比值,并根据比值查询到对应的目标计算公式,通过目标计算公式可以计算出当前的环境光照度;以RGB三种目标色彩举例,当获取到RGB的像素均一值后,可选择RG两种色彩的像素均一值,然后计算R和G之间的像素均一值的比值,由此获得对应的目标计算公式,并根据目标计算公式获得当前的环境光照度。After obtaining the uniform pixel values of all target colors in the target color set, you can arbitrarily select the uniform pixel values of two target colors, then calculate the ratio of the uniform pixel values of the two target colors, and query the corresponding target according to the ratio. Calculation formula, the current ambient illuminance can be calculated through the target calculation formula; taking the three target colors of RGB as an example, when the uniform pixel value of RGB is obtained, the uniform pixel value of the two colors of RG can be selected, and then the ratio of R and G can be calculated. The ratio of the pixel uniform value between the two, thereby obtaining the corresponding target calculation formula, and obtains the current ambient illuminance according to the target calculation formula.

上述环境光照度的检测方法中,通过对当前待摄影像根据目标色彩集合进行检测,获得每种目标色彩对应的像素统计值,并对每种目标色彩的像素统计值根据目标曝光时间和目光感光度进行进一步计算,获得每种目标色彩的像素均一值,最后选取任意两种目标色彩的像素均一值,并计算两种目标色彩的像素均一值的比值,根据比值获得对应的目标计算公式,并根据目标计算公式获得当前的环境光照度,从而提供了一种环境光照度的检测方式,可以节省终端的架构空间,简化终端的架构设计,节省企业的生产成本,并避免环境光检测的一致性差异。In the above-mentioned detection method of ambient illuminance, the current image to be photographed is detected according to the target color set to obtain the pixel statistical value corresponding to each target color, and the pixel statistical value of each target color is determined according to the target exposure time and eye sensitivity. Carry out further calculation to obtain the pixel uniform value of each target color, and finally select the pixel uniform value of any two target colors, and calculate the ratio of the pixel uniform value of the two target colors, and obtain the corresponding target calculation formula according to the ratio. The target calculation formula obtains the current ambient illuminance, thereby providing a detection method of ambient illuminance, which can save the architectural space of the terminal, simplify the architectural design of the terminal, save the production cost of the enterprise, and avoid the consistency difference of ambient light detection.

其中一种可能的实现方式中,所述根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值包括:In one possible implementation manner, the detection of the currently-to-be-photographed image according to the target color set, and obtaining the pixel statistical value corresponding to each target color includes:

根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;Detect the current image to be photographed according to the target color set, and obtain the original pixel values of all pixels corresponding to each target color respectively;

将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;dividing the current image to be photographed into a plurality of target areas, wherein each target area contains a corresponding target weight;

在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;In each target area, the original pixel values of all pixel points of each target color are counted, and the pixel cumulative value of each target color in the target area to which it belongs is obtained;

分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The cumulative value of pixels of each target color in all target areas is weighted and counted according to the target weight of each target area, and the pixel statistics value of each target color is obtained.

首先对当前待摄影像中的每个像素点进行检测,获得每个像素点对应的目标色彩及原始像素值,然后将当前待摄影像划分为多个目标区域,并给每个目标区域分配一个目标权重,接着将每个目标区域内的像素点根据目标色彩进行归类,并将属于同一种目标色彩的像素点的原始像素值进行累计,由此获得每种目标色彩的像素累计值,最后,分别将每种目标色彩的所有累计值进行加权统计,获得每种目标色彩的像素统计值。First, detect each pixel in the current image to be photographed, obtain the target color and original pixel value corresponding to each pixel, then divide the current image to be photographed into multiple target areas, and assign each target area a The target weight, then classify the pixels in each target area according to the target color, and accumulate the original pixel values of the pixels belonging to the same target color, thereby obtaining the pixel cumulative value of each target color, and finally , perform weighted statistics on all accumulated values of each target color to obtain the pixel statistics of each target color.

其中一种可能的实现方式中,所述根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值包括:In one possible implementation manner, the detection of the currently-to-be-photographed image according to the target color set, and obtaining the pixel statistical value corresponding to each target color includes:

根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。Perform white balance on the current image to be photographed according to the target color set, obtain a gain value corresponding to each target color, and obtain a pixel statistical value corresponding to each target color according to the gain value.

对当前待摄影像进行白平衡,获得每种目标色彩的增益值,可将每种目标色彩的增益值设为每种目标色彩当前的像素统计值。Perform white balance on the current image to be photographed to obtain the gain value of each target color. The gain value of each target color can be set as the current pixel statistical value of each target color.

其中一种可能的实现方式中,所述根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值包括:In one possible implementation manner, the detection of the current image to be photographed according to the target color set, and obtaining the original pixel values of all pixels corresponding to each target color respectively includes:

将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;Matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel;

检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The electrical analog signals of all pixels are detected, and the electrical analog signals of all pixels are analog-digital converted to obtain the original pixel values of all pixels.

首先将待摄影像中的每个像素点与目标色彩集合中的每种目标色彩进行匹配,由此获得每个像素点对应的目标色彩,然后将当前获取的每个像素点的电模拟信号进行模数转换,获得每个像素点对应的原始像素值。First, match each pixel in the to-be-photographed image with each target color in the target color set, thereby obtaining the target color corresponding to each pixel, and then perform the current acquisition of the electrical analog signal of each pixel to Analog-to-digital conversion to obtain the original pixel value corresponding to each pixel point.

其中一种可能的实现方式中,所述根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式包括:In one of the possible implementations, obtaining the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors includes:

将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。Compare the ratio of the pixel uniform values of any two target colors with the target threshold to obtain the comparison result, and obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to characterize the comparison result and the target color. The mapping relationship between the combination of and the target calculation formula.

在当前所有目标色彩的像素均一值中任意选取两种目标色彩的像素均一值,并计算两种目标色彩像素均一值的比值,将比值与目标阈值进行比较,获得比较的结果,根据比较结果及当前两种目标色彩在数据库中进行查询,获得对应的目标计算公式,其中,数据库中可存储比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。The pixel uniform value of two target colors is arbitrarily selected from the pixel uniform values of all the current target colors, and the ratio of the pixel uniform values of the two target colors is calculated, and the ratio is compared with the target threshold value to obtain the comparison result. The current two target colors are queried in the database to obtain the corresponding target calculation formula, wherein the database can store the comparison result and the mapping relationship between the combination of the target color and the target calculation formula.

其中一种可能的实现方式中,所述将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式包括:In one of the possible implementations, the ratio of the pixel uniform value of any two target colors is compared with the target threshold to obtain the comparison result, and the corresponding target calculation formula obtained according to the target mapping relationship includes:

将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;The ratio of the pixel uniform values of any two target colors is compared with the first target threshold, the second target threshold and the third target threshold, wherein the first target threshold, the second target threshold and the third target threshold are compared. The three-target threshold corresponds to the combination of the current two target colors;

若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;If the ratio is less than the first target threshold, obtain a corresponding first target calculation formula according to the target mapping relationship;

若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;If the ratio is not less than the first target threshold and not greater than the second target threshold, obtain a corresponding second target calculation formula according to the target mapping relationship;

若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;If the ratio is greater than the second target threshold and not greater than the third target threshold, obtain a corresponding third target calculation formula according to the target mapping relationship;

若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。If the ratio is greater than the third target threshold, a corresponding fourth target calculation formula is obtained according to the target mapping relationship.

可先设置多个目标阈值,并将两种目标色彩的像素均一值的比值分别与每个目标阈值进行比较,获得比较结果,根据不同的比较结果获得对应的目标计算公式。Multiple target thresholds can be set first, and the ratio of the pixel uniform value of the two target colors is compared with each target threshold to obtain the comparison result, and the corresponding target calculation formula is obtained according to the different comparison results.

第二方面,本申请提供一种环境光照度的检测装置,包括:In a second aspect, the present application provides a device for detecting ambient illuminance, including:

获取模块:用于获取当前待摄影像、目标曝光时间及目标感光度;Acquisition module: used to acquire the current image to be photographed, target exposure time and target sensitivity;

第一计算模块,用于根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;a first calculation module, configured to detect the current image to be photographed according to a target color set, and obtain a pixel statistical value corresponding to each target color, wherein the target color set includes multiple target colors;

第二计算模块,用于根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;The second calculation module is used to obtain the pixel uniform value of each target color according to the pixel statistical value, target exposure time and target sensitivity of each target color;

检测模块,用于根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The detection module is used to obtain the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors, and detect the current ambient illuminance according to the target calculation formula, wherein the target calculation formula is used according to the current two Ambient illumination is calculated from the pixel-average value of the target color.

其中一种可能的实现方式中,所述第一计算模块还包括:In one possible implementation manner, the first computing module further includes:

计算子模块,用于根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;a calculation submodule for detecting the current image to be photographed according to the target color set, and obtaining the original pixel values of all pixels corresponding to each target color;

区域划分子模块,用于将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;an area division sub-module, configured to divide the current image to be photographed into a plurality of target areas, wherein each target area contains a corresponding target weight;

第一统计子模块,用于在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;The first statistical submodule is used to perform statistics on the original pixel values of all pixel points of each target color in each target area, and obtain the pixel cumulative value of each target color in the target area to which it belongs;

第二统计子模块,用于分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The second statistical sub-module is used to perform weighted statistics on the accumulated pixel values of each target color in all target areas according to the target weight of each target area, and obtain the pixel statistical value of each target color.

其中一种可能的实现方式中,所述第一计算模块还用于根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。In one possible implementation manner, the first calculation module is further configured to perform white balance on the current image to be photographed according to the target color set, obtain a gain value corresponding to each target color, and obtain a gain value according to the gain value. Pixel statistics corresponding to each target color.

其中一种可能的实现方式中,所述计算子模块包括:In one possible implementation manner, the computing submodule includes:

匹配单元,用于将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;a matching unit for matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel;

计算单元,用于检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The calculation unit is used for detecting the electrical analog signals of all the pixels, and performing analog-to-digital conversion on the electrical analog signals of all the pixels to obtain the original pixel values of all the pixels.

其中一种可能的实现方式中,所述检测模块还包括:In one possible implementation manner, the detection module further includes:

比较子模块,用于将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果;The comparison sub-module is used to compare the ratio of the pixel uniform value of any two target colors with the target threshold to obtain the comparison result;

获取子模块,用于根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。The obtaining sub-module is configured to obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to represent the mapping relationship between the combination of the comparison result and the target color and the target calculation formula.

其中一种可能的实现方式中,所述比较子模块还用于将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;In one possible implementation manner, the comparison sub-module is further configured to compare the ratio of the pixel uniform values of any two target colors with the first target threshold, the second target threshold and the third target threshold, respectively, wherein, The first target threshold, the second target threshold and the third target threshold correspond to the current combination of the two target colors;

则所述获取子模块包括:Then the acquisition sub-module includes:

第一获取单元,用于若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;a first obtaining unit, configured to obtain a corresponding first target calculation formula according to a target mapping relationship if the ratio is less than the first target threshold;

第二获取单元,用于若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;a second obtaining unit, configured to obtain a corresponding second target calculation formula according to the target mapping relationship if the ratio is not less than the first target threshold and not greater than the second target threshold;

第三获取单元,用于若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;a third obtaining unit, configured to obtain a corresponding third target calculation formula according to the target mapping relationship if the ratio is greater than the second target threshold and not greater than the third target threshold;

第四获取单元,用于若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。A fourth obtaining unit, configured to obtain a corresponding fourth target calculation formula according to the target mapping relationship if the ratio is greater than the third target threshold.

第三方面,本申请提供一种电子设备,包括:In a third aspect, the application provides an electronic device, comprising:

一个或多个处理器;存储器;多个应用程序;以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述设备执行时,使得所述设备执行以下步骤:one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions, When the instructions are executed by the device, the device is caused to perform the following steps:

获取当前待摄影像、目标曝光时间及目标感光度;Obtain the current image to be photographed, target exposure time and target sensitivity;

根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;Detecting the currently-to-be-photographed image according to a target color set, to obtain a pixel statistic value corresponding to each target color, wherein the target color set includes multiple target colors;

根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;Obtain the pixel uniform value of each target color according to the pixel statistics value, target exposure time and target sensitivity of each target color;

根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The corresponding target calculation formula is obtained according to the ratio of the pixel uniformity values of any two target colors, and the current ambient illuminance is detected according to the target calculation formula, wherein the target calculation formula is used according to the current pixel uniformity of the two target colors. The value calculates the ambient lighting.

其中一种可能的实现方式中,所述指令被所述设备执行时,使得所述设备执行根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值的步骤包括:In one possible implementation manner, when the instruction is executed by the device, the device executes the detection of the current image to be photographed according to the target color set, and obtains the statistical value of the pixel corresponding to each target color. Steps include:

根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;Detect the current image to be photographed according to the target color set, and obtain the original pixel values of all pixels corresponding to each target color respectively;

将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;dividing the current image to be photographed into a plurality of target areas, wherein each target area contains a corresponding target weight;

在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;In each target area, the original pixel values of all pixel points of each target color are counted, and the pixel cumulative value of each target color in the target area to which it belongs is obtained;

分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The cumulative value of pixels of each target color in all target areas is weighted and counted according to the target weight of each target area, and the pixel statistics value of each target color is obtained.

其中一种可能的实现方式中,所述指令被所述设备执行时,使得所述设备执行根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值的步骤包括:In one possible implementation manner, when the instruction is executed by the device, the device executes the detection of the current image to be photographed according to the target color set, and obtains the statistical value of the pixel corresponding to each target color. Steps include:

根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。Perform white balance on the current image to be photographed according to the target color set, obtain a gain value corresponding to each target color, and obtain a pixel statistical value corresponding to each target color according to the gain value.

其中一种可能的实现方式中,所述指令被所述设备执行时,使得所述设备执行根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值的步骤包括:In one possible implementation manner, when the instruction is executed by the device, the device executes the detection of the current image to be photographed according to the target color set, and obtains all pixels corresponding to each target color respectively. The steps of raw pixel values include:

将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;Matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel;

检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The electrical analog signals of all pixels are detected, and the electrical analog signals of all pixels are analog-digital converted to obtain the original pixel values of all pixels.

其中一种可能的实现方式中,所述指令被所述设备执行时,使得所述设备执行根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式的步骤包括:In one of the possible implementations, when the instruction is executed by the device, causing the device to perform the step of obtaining the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors includes:

将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。Compare the ratio of the pixel uniform values of any two target colors with the target threshold to obtain the comparison result, and obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to characterize the comparison result and the target color. The mapping relationship between the combination of and the target calculation formula.

其中一种可能的实现方式中,所述指令被所述设备执行时,使得所述设备执行将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式的步骤包括:In one possible implementation manner, when the instruction is executed by the device, the device is made to compare the ratio of the pixel uniform value of any two target colors with the target threshold to obtain the comparison result, according to the target mapping relationship The steps of obtaining the corresponding target calculation formula include:

将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;The ratio of the pixel uniform values of any two target colors is compared with the first target threshold, the second target threshold and the third target threshold, wherein the first target threshold, the second target threshold and the third target threshold are compared. The three-target threshold corresponds to the combination of the current two target colors;

若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;If the ratio is less than the first target threshold, obtain a corresponding first target calculation formula according to the target mapping relationship;

若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;If the ratio is not less than the first target threshold and not greater than the second target threshold, obtain a corresponding second target calculation formula according to the target mapping relationship;

若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;If the ratio is greater than the second target threshold and not greater than the third target threshold, obtain a corresponding third target calculation formula according to the target mapping relationship;

若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。If the ratio is greater than the third target threshold, a corresponding fourth target calculation formula is obtained according to the target mapping relationship.

应当理解的是,本申请的第二至三方面与本申请的第一方面的技术方案一致,各方面及对应的可行实施方式所取得的有益效果相似,不再赘述。It should be understood that the second to third aspects of the present application are consistent with the technical solutions of the first aspect of the present application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manner are similar, and will not be repeated.

第四方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行如第一方面所述的方法。In a fourth aspect, the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, which, when executed on a computer, causes the computer to execute the method according to the first aspect.

第五方面,本申请提供一种计算机程序,当所述计算机程序被计算机执行时,用于执行第一方面所述的方法。In a fifth aspect, the present application provides a computer program for executing the method of the first aspect when the computer program is executed by a computer.

在一种可能的设计中,第五方面中的程序可以全部或者部分存储在与处理器封装在一起的存储介质上,也可以部分或者全部存储在不与处理器封装在一起的存储器上。In a possible design, the program in the fifth aspect may be stored in whole or in part on a storage medium packaged with the processor, and may also be stored in part or in part in a memory not packaged with the processor.

附图说明Description of drawings

图1为本申请环境光照度的检测方法一个实施例的流程图;1 is a flowchart of an embodiment of a method for detecting ambient illuminance of the present application;

图2为本申请环境光照度的检测方法另一个实施例的流程图;2 is a flowchart of another embodiment of a method for detecting ambient illuminance of the present application;

图3为本申请环境光照度的检测装置一个实施例的结构示意图;3 is a schematic structural diagram of an embodiment of an apparatus for detecting ambient illuminance of the present application;

图4为本申请环境光照度的检测装置另一个实施例的结构示意图;4 is a schematic structural diagram of another embodiment of an apparatus for detecting ambient illuminance of the present application;

图5为本申请环境光照度的检测装置再一个实施例的结构示意图;5 is a schematic structural diagram of yet another embodiment of an apparatus for detecting ambient illuminance of the present application;

图6为本申请环境光照度的检测装置再一个实施例的结构示意图;6 is a schematic structural diagram of yet another embodiment of an apparatus for detecting ambient illuminance of the present application;

图7为本申请环境光照度的检测装置再一个实施例的结构示意图;FIG. 7 is a schematic structural diagram of still another embodiment of an apparatus for detecting ambient illuminance of the present application;

图8为本申请电子设备一个实施例的结构示意图。FIG. 8 is a schematic structural diagram of an embodiment of an electronic device of the present application.

具体实施方式Detailed ways

本申请的实施方式部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。The terms used in the embodiments of the present application are only used to explain specific embodiments of the present application, and are not intended to limit the present application.

现有的实现方案中,都是通过环境光传感器等实体器件完成当前的环境光照度检测。In the existing implementation solutions, the current ambient light intensity detection is completed through physical devices such as ambient light sensors.

在这种实现方案中,移动终端的架构空间被占用,提升了企业的生产成本,且通过环境光传感器对环境光照度进行检测会带来一致性差异。In this implementation solution, the architectural space of the mobile terminal is occupied, which increases the production cost of the enterprise, and the detection of the ambient illuminance through the ambient light sensor will bring about consistency differences.

为此,本申请提出一种环境光照度的检测方法,可以可以节省终端的架构空间,简化终端的架构设计,节省企业的生产成本,并避免环境光检测的一致性差异。To this end, the present application proposes an ambient light detection method, which can save the architectural space of the terminal, simplify the architectural design of the terminal, save the production cost of the enterprise, and avoid the consistency difference of ambient light detection.

图1为本申请环境光照度的检测方法一个实施例的流程图,如图1所示,上述环境光照度的检测方法可以包括:FIG. 1 is a flowchart of an embodiment of a method for detecting ambient illuminance of the present application. As shown in FIG. 1 , the above-mentioned method for detecting ambient illuminance may include:

步骤101,获取当前待摄影像、目标曝光时间及目标感光度。Step 101: Obtain the current image to be photographed, the target exposure time and the target sensitivity.

具体地,上述当前待摄影像可以是CMOS图像传感器捕获到的当前原始图像。Specifically, the above-mentioned current image to be photographed may be a current original image captured by a CMOS image sensor.

上述目标曝光时间及目标感光度可以通过当前的镜头参数计算获得,在具体实现中,可以首先获得当前的光圈值,光圈值和当前终端使用的镜头对应,用户可以通过调整当前的镜头来对应的调整光圈值,当确定光圈值之后,可以根据计算公式A+B=C+D进行计算,获得当前的亮度值;其中,A表征当前光圈值,B表征曝光时间值,C表征感光度值,D表征亮度值,曝光时间和感光度为一对相关数值,即以组合形式出现,并预先以表格形式存储在目标数据库中,如表1所示,将表1中的每一对数值代入上述计算公式,计算获得当前的亮度值,并将当前的亮度值与目标亮度值进行比较,如果当前的亮度值与目标亮度值匹配,则当前的曝光时间和感光度组合即为目标曝光时间和目标感光度,并进行缓存,以便后续进行计算。The above target exposure time and target sensitivity can be obtained by calculating the current lens parameters. In the specific implementation, the current aperture value can be obtained first. The aperture value corresponds to the lens currently used by the terminal, and the user can adjust the current lens to correspond. Adjust the aperture value. After the aperture value is determined, it can be calculated according to the calculation formula A+B=C+D to obtain the current brightness value; where A represents the current aperture value, B represents the exposure time value, C represents the sensitivity value, D represents the brightness value, exposure time and sensitivity are a pair of related values, that is, they appear in combination, and are stored in the target database in table form in advance, as shown in Table 1, and each pair of values in Table 1 is substituted into the above Calculate the formula to obtain the current brightness value, and compare the current brightness value with the target brightness value. If the current brightness value matches the target brightness value, the current exposure time and sensitivity combination is the target exposure time and target. Sensitivity, and cached for subsequent calculations.

表1Table 1

序号serial number 曝光时间和感光度组合Exposure Time and Sensitivity Combinations 数值Numerical value 11 曝光时间+感光度ISO值Exposure time + ISO value 100ms+ISO1.0100ms+ISO1.0 22 曝光时间+感光度ISO值Exposure time + ISO value 100ms+ISO1.1100ms+ISO1.1 33 曝光时间+感光度ISO值Exposure time + ISO value 100ms+ISO1.2100ms+ISO1.2 44 曝光时间+感光度ISO值Exposure time + ISO value 100ms+ISO1.3100ms+ISO1.3 55 曝光时间+感光度ISO值Exposure time + ISO value 100ms+ISO1.4100ms+ISO1.4 66 曝光时间+感光度ISO值Exposure time + ISO value 200ms+ISO1.5200ms+ISO1.5

进一步地,为了运算方便,还可以对感光度值进行单位换算,在具体实现中,可将感光度值除以一个通用值,例如,假设共采集到三组感光度数据,分别为ISO_1、ISO_2及ISO_3,如果当前的ISO最小单位为100,则可将ISO_1、ISO_2及ISO_3分别除以100,获得ISO_1/100、ISO_2/100及ISO_3/100。Further, in order to facilitate the operation, the unit conversion of the sensitivity value can also be performed. In the specific implementation, the sensitivity value can be divided by a general value. For example, it is assumed that three sets of sensitivity data are collected, which are ISO_1 and ISO_2 respectively. and ISO_3, if the current ISO minimum unit is 100, you can divide ISO_1, ISO_2 and ISO_3 by 100 to obtain ISO_1/100, ISO_2/100 and ISO_3/100.

步骤102,根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩。Step 102: Detect the current image to be photographed according to a target color set, and obtain a pixel statistical value corresponding to each target color, wherein the target color set includes multiple target colors.

具体地,目标色彩集合和步骤101中CMOS图像传感器当前应用的滤光片相关,例如,如果当前应用的是RGB红绿蓝三色滤光片,则目标色彩集合为R、G及B。Specifically, the target color set is related to the filters currently applied by the CMOS image sensor in step 101. For example, if the currently applied RGB red, green, and blue filters are used, the target color set is R, G, and B.

当确定目标色彩集合后,可根据目标色彩集合对当前待摄影像进行检测,其中,检测过程包括分别对目标色彩集合中每种目标色彩进行检测,由此获得每种目标色彩对应的像素值的总和。After the target color set is determined, the current image to be photographed can be detected according to the target color set, wherein the detection process includes detecting each target color in the target color set respectively, thereby obtaining the pixel value corresponding to each target color. sum.

在具体实现时,可分别对每种目标色彩进行检测,例如,先对红色进行检测,由此统计出待摄影像中所有红色像素点的像素值的总和,然后对绿色进行检测,同样可统计出待摄影像中所有绿色像素点的像素值的总和,最后对蓝色进行检测,同样可统计出待摄影像中所有蓝色像素点的像素值的总和。In specific implementation, each target color can be detected separately. For example, red is detected first, and the sum of the pixel values of all red pixels in the to-be-photographed image is counted, and then green is detected. The sum of the pixel values of all green pixels in the to-be-photographed image is obtained, and finally the blue is detected, and the sum of the pixel values of all the blue pixels in the to-be-photographed image can also be counted.

应理解的是,对目标色彩集合中的每种目标色彩进行检测时,不分顺序,即可以按照任意顺序对当前目标色彩集合中的每种目标色彩进行检测,本实施例对此不作限定。It should be understood that, when detecting each target color in the target color set, there is no order, that is, each target color in the current target color set can be detected in any order, which is not limited in this embodiment.

步骤103,根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值。Step 103: Obtain a pixel uniform value of each target color according to the pixel statistics value, target exposure time and target sensitivity of each target color.

具体地,在获取到每种目标色彩的像素统计值后,可将像素统计值和步骤101获得的目标曝光时间及目标感光度根据公式S=X/(Y×Z)进行计算,由此获得像素均一值,其中,S表征像素均一值,X表征像素统计值,Y表征目标曝光时间值,Z表征目标感光度值;计算过程按照每种目标色彩分别进行,在具体实现中,由于目标曝光时间和目标感光度在进行计算时对当前的任意一种目标色彩是不变的,因此可依次将每种目标色彩的像素统计值代入上述公式,获得每种目标色彩的像素均一值。以RGB红绿蓝三色为例,可先将红色像素统计值代入上述公式,获得红色像素均一值,然后将绿色像素统计值代入上述公式,获得绿色像素均一值,最后将蓝色像素统计值代入上述公式,获得蓝色像素均一值。Specifically, after obtaining the pixel statistical value of each target color, the pixel statistical value and the target exposure time and target sensitivity obtained in step 101 can be calculated according to the formula S=X/(Y×Z), thereby obtaining The pixel uniform value, where S represents the pixel uniform value, X represents the pixel statistical value, Y represents the target exposure time value, and Z represents the target sensitivity value; the calculation process is carried out according to each target color. Time and target sensitivity are invariable to any current target color during calculation, so the pixel statistics value of each target color can be substituted into the above formula in turn to obtain the pixel uniform value of each target color. Taking RGB red, green and blue as an example, you can first substitute the statistical value of red pixels into the above formula to obtain the uniform value of red pixels, then substitute the statistical value of green pixels into the above formula to obtain the uniform value of green pixels, and finally add the statistical value of blue pixels. Substitute into the above formula to obtain the uniform value of blue pixels.

应理解的是,在对每种目标色彩的像素均一值进行计算时,不分顺序,即可以按照任意顺序将当前目标色彩集合中的每种目标色彩代入上述公式进行计算,本实施例对此不作限定。It should be understood that when calculating the pixel uniform value of each target color, the order is not determined, that is, each target color in the current target color set can be substituted into the above formula for calculation in any order. Not limited.

步骤104,根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。Step 104: Obtain a corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors, and detect the current ambient illuminance according to the target calculation formula, wherein the target calculation formula is used according to the current two target colors. The pixel-averaged value of the ambient light is calculated.

具体地,在当前的所有目标色彩的像素均一值中可任意选取两种目标色彩,然后计算当前两种目标色彩像素均一值的比值,在具体实现时,以RGB红绿蓝三色为例,可选择红色和绿色的像素均一值,并计算两者的比值,也可以选择红色和蓝色的像素均一值,并计算两者的比值,也可以选择蓝色和绿色的像素均一值,并计算两者的比值;当获取到两种目标色彩的像素均一值的比值后,可根据比值获得对应的目标计算公式,然后根据目标计算公式对当前的环境光照度进行检测;在具体实现时,可先预设比值与目标计算公式之间的映射关系,当获取到具体比值后,可通过查询获得对应的目标计算公式,然后根据目标计算公式计算获得对应的环境光照度。Specifically, two target colors can be arbitrarily selected from the pixel uniform values of all the current target colors, and then the ratio of the current pixel uniform values of the two target colors is calculated. You can select the pixel uniform value of red and green, and calculate the ratio of the two, or you can select the pixel uniform value of red and blue, and calculate the ratio of the two, or you can select the pixel uniform value of blue and green, and calculate The ratio of the two; when the ratio of the pixel uniform value of the two target colors is obtained, the corresponding target calculation formula can be obtained according to the ratio, and then the current ambient illuminance can be detected according to the target calculation formula; The mapping relationship between the preset ratio and the target calculation formula, when the specific ratio is obtained, the corresponding target calculation formula can be obtained by query, and then the corresponding ambient illuminance can be calculated according to the target calculation formula.

其中,目标计算公式包含两种目标色彩的像素均一值。目标计算公式可以预先存储在数据库中,目标计算公式可预先由模拟光进行模拟计算后获得,在具体实现时,可在相同或相近照度条件下,以不同光源类型所对应的单位照度时的目标色彩的像素均一值绘制散点图,其中,光源类型可包括模拟H光、模拟A光、模拟C光和模拟D,模拟A光可以是模拟太阳光,模拟C光可以是模拟灯光,模拟A光可以是模拟热光源发的光,模拟H光可以是模拟其它光源发出的光,光源的生成可通过AEBOX、积分球系统、灯箱等标准光源设备生成,并由此求出模拟H光、模拟A光、模拟C光和模拟D光所对应的散点之间连线的表达式。该连线的表达式的物理意义为混合光源所对应的单位照度时的目标色彩的像素均一值,以RGB红绿蓝三色为例,当以红色和绿色的像素均一值绘制散点图时,红色和绿色的像素均一值分别为Rave和Gave,则单位照度的红色和绿色像素均一值即为Rave/Lux和Gave/Lux,其中,Lux为环境光照度,则某两种标准光源之间连线的表达式可用Gave/Lux=j×Rave/Lux-k表示,其中,j和k为常数系数,假设有一种未知光源是由上述两种标准光源混合而成,则该未知光源条件下CMOS图像传感器捕获的原始图像的红色和蓝色的像素均一值也同样满足表达式Gave/Lux=j×Rave/Lux-k;当获得多种标准光源之间的连线表达式后,分别做单位换算即可得到不同光源类型的环境光照度换算公式,例如:当以红色和绿色的像素均一值绘制散点图时,照度换算公式为Lux=m×Gave-n×Rave,其中,m和n为常数系数;当以红色和蓝色的像素均一值绘制散点图时,照度换算公式为Lux=m×Bave-n×Rave。Among them, the target calculation formula includes the pixel uniform value of the two target colors. The target calculation formula can be stored in the database in advance, and the target calculation formula can be obtained by simulating the calculation of the simulated light in advance. In the specific implementation, the target can be obtained under the same or similar illuminance conditions and with the unit illuminance corresponding to different light source types. The pixel uniform value of the color is used to draw a scatter diagram. The light source types can include analog H light, analog A light, analog C light, and analog D. The simulated A light can be simulated sunlight, the simulated C light can be simulated light, and the simulated A light can be simulated light. The light can be the light emitted by the simulated thermal light source, and the simulated H light can be the light emitted by the simulated other light sources. The generation of the light source can be generated by standard light source equipment such as AEBOX, integrating sphere system, light box, etc. The expression of the connection between the scatter points corresponding to the A light, the simulated C light and the simulated D light. The physical meaning of the expression of the connection line is the pixel uniform value of the target color when the unit illuminance corresponding to the mixed light source is used. Taking RGB, red, green and blue as an example, when the scatter diagram is drawn with the uniform pixel value of red and green , the uniform values of red and green pixels are Rave and Gave, respectively, then the uniform values of red and green pixels per unit illuminance are Rave/Lux and Gave/Lux, where Lux is the ambient illuminance, then the connection between the two standard light sources The expression of the line can be expressed by Gave/Lux=j×Rave/Lux-k, where j and k are constant coefficients. Assuming that there is an unknown light source that is formed by mixing the above two standard light sources, then under the condition of the unknown light source, the CMOS The uniform value of the red and blue pixels of the original image captured by the image sensor also satisfies the expression Gave/Lux=j×Rave/Lux-k; when the connection expression between multiple standard light sources is obtained, the unit is respectively The conversion formula of ambient illuminance for different light source types can be obtained by conversion. For example, when the scatter diagram is drawn with the uniform value of red and green pixels, the illuminance conversion formula is Lux=m×Gave-n×Rave, where m and n are Constant coefficient; when the scatter diagram is drawn with the uniform value of red and blue pixels, the illuminance conversion formula is Lux=m×Bave-n×Rave.

本实施例中,通过对当前待摄影像根据目标色彩集合进行检测,获得每种目标色彩对应的像素统计值,并对每种目标色彩的像素统计值根据目标曝光时间和目光感光度进行进一步计算,获得每种目标色彩的像素均一值,最后选取任意两种目标色彩的像素均一值,并计算两种目标色彩的像素均一值的比值,根据比值获得对应的目标计算公式,并根据目标计算公式获得当前的环境光照度,从而提供了一种环境光照度的检测方式,可以节省终端的架构空间,简化终端的架构设计,节省企业的生产成本,并避免环境光检测的一致性差异。In this embodiment, the current image to be photographed is detected according to the target color set to obtain the pixel statistic value corresponding to each target color, and the pixel statistic value of each target color is further calculated according to the target exposure time and eye sensitivity , obtain the pixel uniform value of each target color, and finally select the pixel uniform value of any two target colors, and calculate the ratio of the pixel uniform value of the two target colors, obtain the corresponding target calculation formula according to the ratio, and according to the target calculation formula The current ambient illuminance is obtained, thereby providing a detection method of ambient illuminance, which can save the architectural space of the terminal, simplify the architectural design of the terminal, save the production cost of the enterprise, and avoid the consistency difference of ambient light detection.

图2为本申请环境光照度的检测方法另一个实施例的流程图,如图2所示,本申请图1所示实施例中,步骤102可以包括:FIG. 2 is a flowchart of another embodiment of the method for detecting ambient illuminance of the present application. As shown in FIG. 2 , in the embodiment shown in FIG. 1 of the present application, step 102 may include:

步骤201,根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值。Step 201: Detect the current image to be photographed according to the target color set, and obtain the original pixel values of all pixels corresponding to each target color.

具体地,首先可根据CMOS图像传感器计算获得当前待摄影像中所有像素点的原始像素值,然后继续根据CMOS图像传感器中的滤光片获得每个像素点的目标色彩,其中,每个像素点的目标色彩与目标色彩集合中的任意一种目标色彩对应。Specifically, firstly, the original pixel values of all pixels in the current image to be photographed can be obtained by calculating according to the CMOS image sensor, and then the target color of each pixel can be obtained according to the filter in the CMOS image sensor. The target color corresponds to any target color in the target color set.

步骤202,将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重。Step 202: Divide the current image to be photographed into a plurality of target areas, wherein each target area includes a corresponding target weight.

在具体实现时,可将当前待摄影像划分成多个等大小的区域,例如,将当前待摄影像分割成120×90个区域,即横向每排120个区域,纵向每列90个区域,合计总共10800个区域,然后给这10800个区域分配权重,该权重是预设的常数系数,每个区域之间可以相同,也可以不同。In specific implementation, the current image to be photographed can be divided into multiple areas of equal size. For example, the current image to be photographed can be divided into 120×90 areas, that is, 120 areas in each horizontal row and 90 areas in each vertical column. A total of 10,800 areas are totaled, and then weights are assigned to these 10,800 areas. The weight is a preset constant coefficient, and each area can be the same or different.

步骤203,在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值。Step 203: Count the original pixel values of all the pixel points of each target color in each target area, and obtain the pixel cumulative value of each target color in the target area to which it belongs.

具体地,在区域划分之后,可对每个区域内的每种目标色彩的所有像素点的原始像素值进行统计,分别获得每种目标色彩的像素累计值;在具体实现中,以RGB红绿蓝三色为例,首先可在一个区域内对红色的所有像素点的原始像素值进行累计,获得当前区域内红色像素点的像素累计值,同样地,然后对绿色进行统计,获得当前区域内绿色像素点的像素累计值,最后对蓝色进行统计,获得当前区域内蓝色像素点的像素累计值;当对当前区域内的所有目标色彩统计完之后,进行下一个区域的统计,直到所有区域统计完毕。Specifically, after the area is divided, the original pixel values of all the pixel points of each target color in each area can be counted, and the pixel cumulative value of each target color can be obtained respectively; Taking the blue three colors as an example, firstly, the original pixel values of all red pixels can be accumulated in an area to obtain the pixel accumulated value of the red pixels in the current area. Similarly, the green color can be counted to obtain the current area. The pixel cumulative value of the green pixel point, and finally the blue is counted to obtain the pixel cumulative value of the blue pixel point in the current area; when all the target colors in the current area are counted, the next area is counted, until all Regional statistics completed.

应理解的是,在对某一个区域内进行目标色彩的原始像素值的统计时,目标色彩的顺序可以是任意的,本实施例对比不作限定。It should be understood that, when performing statistics on the original pixel values of the target colors in a certain area, the order of the target colors may be arbitrary, and the comparison in this embodiment is not limited.

步骤204,分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。Step 204: Perform weighted statistics on the cumulative pixel values of each target color in all target regions according to the target weight of each target region, and obtain the pixel statistics value of each target color.

具体地,在获取到每个目标区域的每种目标色彩的像素累计值后,可分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,由此获得每种目标色彩的像素统计值。在具体实现时,以RGB红绿蓝三色为例,假设n个区域的R(红色)像素累计值分别为R1、R2...Rn,与每个区域对应的权重分别为P1、P2...Pn,则红色的像素统计值R=R1×P1+R2×P2+...+Rn×Pn,同样地,如果n个区域的G(绿色)像素累计值分别为G1、G2...Gn,则绿色的像素统计值G=G1×P1+G2×P2+...+Gn×Pn,如果n个区域的B(蓝色)像素累计值分别为B1、B2...Bn,则绿色的像素统计值B=B1×P1+B2×P2+...+Bn×Pn。Specifically, after obtaining the pixel cumulative value of each target color in each target area, the pixel cumulative value of each target color in all target areas can be weighted and counted according to the target weight of each target area. This gets pixel statistics for each target color. In the specific implementation, taking RGB, red, green and blue as an example, it is assumed that the cumulative values of R (red) pixels in n regions are R1, R2...Rn, respectively, and the weights corresponding to each region are P1, P2. ...... Gn, then the green pixel statistic value G=G1×P1+G2×P2+...+Gn×Pn, if the B (blue) pixel accumulated values of n areas are B1, B2...Bn, then the green The pixel statistics of B=B1×P1+B2×P2+...+Bn×Pn.

本实施例中,对待摄影像进行区域划分,并分配权重,通过加权统计获得待摄影像中的每种目标色彩的原始像素统计值,可以提高对待摄影像的像素值的提取,有利于后续对环境光照度的计算,提高环境光照度计算的准确度。In this embodiment, the image to be photographed is divided into regions, and weights are assigned, and the statistical value of the original pixels of each target color in the image to be photographed is obtained through weighted statistics, which can improve the extraction of pixel values of the image to be photographed, which is beneficial to the subsequent analysis. Calculation of ambient illuminance to improve the accuracy of ambient illuminance calculation.

可选的,在本申请的一些实施例中,步骤102可以包括:Optionally, in some embodiments of the present application, step 102 may include:

根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。Perform white balance on the current image to be photographed according to the target color set, obtain a gain value corresponding to each target color, and obtain a pixel statistical value corresponding to each target color according to the gain value.

具体地,还可以通过计算当前待摄影像的增益值替代像素统计值,在增益值的计算过程中,也是分别计算获得每种目标色彩的增益值,该增益值的获得是通过白平衡后获得,由于白平衡时目标色彩的增益值是一种能表征原始图像中目标色彩的像素统计值的值,故可以将该增益值替代为像素统计值。Specifically, it is also possible to replace the pixel statistics value by calculating the gain value of the current image to be shot. During the calculation process of the gain value, the gain value of each target color is also obtained by calculating separately, and the gain value is obtained after the white balance. , since the gain value of the target color during white balance is a value that can represent the pixel statistical value of the target color in the original image, the gain value can be replaced by the pixel statistical value.

可选的,在本申请的一些实施例中,步骤201可以包括:Optionally, in some embodiments of the present application, step 201 may include:

将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;Matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel;

检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The electrical analog signals of all pixels are detected, and the electrical analog signals of all pixels are analog-digital converted to obtain the original pixel values of all pixels.

具体地,CMOS图像传感器采用感光元件作为影像捕获的基本手段,其核心是一个感光二极管(Photodiode),该感光二极管在接受光线照射之后能够产生输出电流,而电流的大小则与感受到的光强度对应。上述的感光二极管即为一个感光元件,每个感光元件对应图像传感器中的一个像素点;在具体实现中,由于感光元件只能感应光的强度,无法捕获色彩信息,因此必须在感光元件上方覆盖彩色滤光片;由于人眼对绿色较为敏感,因此通常覆盖RGB红绿蓝三色滤光片,其中,彩色像素点可以以1:2:1的比例构成,例如,红蓝滤光片分别覆盖一个像素点,剩下的两个像素点都覆盖绿色滤光片。通过滤光片可以获得当前待摄影像中每个像素点的目标色彩,即经过RGB滤光片覆盖后,每个像素点获得的是对应R(红)、G(绿)或B(蓝)的目标色彩。Specifically, a CMOS image sensor uses a photosensitive element as the basic means of image capture. Its core is a photodiode, which can generate an output current after receiving light, and the magnitude of the current is related to the intensity of the light. correspond. The above-mentioned photosensitive diode is a photosensitive element, and each photosensitive element corresponds to a pixel in the image sensor; in the specific implementation, since the photosensitive element can only sense the intensity of light and cannot capture color information, it must be covered above the photosensitive element. Color filter; because the human eye is more sensitive to green, it usually covers RGB red, green and blue three-color filters, in which the color pixels can be formed in a ratio of 1:2:1, for example, the red and blue filters are respectively One pixel is covered, and the remaining two pixels are covered by the green filter. The target color of each pixel in the current image to be photographed can be obtained through the filter, that is, after being covered by the RGB filter, each pixel obtains the corresponding R (red), G (green) or B (blue) target color.

应理解的是,本实施例也适用于其他像素点排列形式的CMOS图像传感器,例如,以红黄蓝1:2:1比例构成的CMOS图像传感器,本实施例对此不作限定;其中,每个像素点的目标色彩与当前的滤光片对应,例如,若使用红黄蓝滤光片,则每个像素点获得的是对应R(红)、Y(黄)或B(蓝)的目标色彩,。It should be understood that this embodiment is also applicable to CMOS image sensors with other pixel arrangement forms, for example, a CMOS image sensor composed of a ratio of red, yellow and blue at 1:2:1, which is not limited in this embodiment; The target color of each pixel corresponds to the current filter. For example, if a red, yellow and blue filter is used, each pixel obtains a target corresponding to R (red), Y (yellow) or B (blue). color,.

其中,当像素点接受光照之后,感光元件产生对应的电流,电流大小与光强对应,因此感光元件直接输出的电信号是模拟量,该模拟量经过模数(AD,Analogue-to-Digital)转换后以原始数字量送给图像信号处理器(ISP,Image Signal Processor)进行处理;在具体实现中,不同厂商的各型号传感器采集的原始数字量位数可能存在差异,举例RAW10表示该传感器上某个像素点的原始数字量最大为1024,RAW8表示该传感器上某个像素点的原始数字量最大为256,任何一个彩色像素点的原始数字量都可以用来表征该颜色的明暗程度,灰度值越高则该颜色越明亮。Among them, when the pixel receives light, the photosensitive element generates a corresponding current, and the magnitude of the current corresponds to the light intensity, so the electrical signal directly output by the photosensitive element is an analog quantity, which is analog-to-digital (AD, Analogue-to-Digital) After conversion, the original digital quantity is sent to the Image Signal Processor (ISP, Image Signal Processor) for processing; in the specific implementation, there may be differences in the number of original digital quantities collected by sensors of different manufacturers. For example, RAW10 indicates that the sensor has The maximum raw digital quantity of a pixel is 1024, and RAW8 means that the raw digital quantity of a pixel on the sensor is at most 256. The raw digital quantity of any color pixel can be used to represent the lightness and darkness of the color. Gray The higher the degree value, the brighter the color.

应理解的是,色彩匹配的步骤可以在电模拟信号进行模数转换之前进行,色彩匹配的步骤也可以在电模拟信号进行模数转换之后进行,色彩匹配的步骤也可以和电模拟信号的模数转换同时进行,也就是说,色彩匹配的步骤与原始像素值的获得并不冲突,因此可以按照任意的顺序进行,本实施例对此不作限定。It should be understood that the step of color matching can be performed before the analog-to-digital conversion of the electrical analog signal, the step of color matching can also be performed after the analog-to-digital conversion of the electrical analog signal, and the step of color matching can also be performed with the analog-to-digital conversion of the electrical analog signal. The digital conversion is performed at the same time, that is to say, the step of color matching does not conflict with the acquisition of the original pixel value, so it can be performed in any order, which is not limited in this embodiment.

本实施例中,通过CMOS图像传感器对待摄影像中电模拟信号进行检测,以及模数转换,由此获得对应的原始像素值,可以提高像素值的检测效率。In this embodiment, the CMOS image sensor detects the electrical analog signal in the to-be-photographed image, and performs analog-to-digital conversion to obtain the corresponding original pixel value, which can improve the detection efficiency of the pixel value.

可选的,在本申请的一些实施例中,步骤104中,所述根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式可以包括:Optionally, in some embodiments of the present application, in step 104, the obtaining the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors may include:

将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。Compare the ratio of the pixel uniform values of any two target colors with the target threshold to obtain the comparison result, and obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to characterize the comparison result and the target color. The mapping relationship between the combination of and the target calculation formula.

具体地,当获取到任意两种目标色彩的像素均一值的比值后,可将比值与预设的阈值进行比较,获得比较结果,比较结果包含大于、小于及等于等情况,且不同的比较结果和两种目标色彩的组合也有多种目标计算公式的组合,例如,以RGB红绿蓝三色为例,R(红)色和G(绿)色的组合与比较结果对应一个目标计算公式的组合,R(红)色和B(蓝)色的组合与比较结果对应另一个目标计算公式的组合,而G(绿)和和B(蓝)色的组合与比较结果对应又一个目标计算公式的组合;因此可先预存比较结果及目标色彩的组合与所述目标计算公式之间的映射关系,当获取到当前的比较结果之后,可通过当前的比较结果及当前的目标色彩组合查询获得对应的目标计算公式。Specifically, after obtaining the ratio of the pixel uniform values of any two target colors, the ratio can be compared with a preset threshold to obtain a comparison result. The comparison result includes conditions such as greater than, less than, and equal to, and different comparison results There are also various combinations of target calculation formulas for the combination of two target colors. For example, taking RGB, red, green and blue as an example, the combination and comparison result of R (red) color and G (green) color corresponds to a target calculation formula. Combination, the combination of R (red) and B (blue) colors and the comparison result corresponds to the combination of another target calculation formula, and the combination of G (green) and B (blue) colors and the comparison result corresponds to another target calculation formula Therefore, the mapping relationship between the combination of the comparison result and the target color and the target calculation formula can be pre-stored. When the current comparison result is obtained, the corresponding query can be obtained through the current comparison result and the current target color combination. target calculation formula.

可选的,在本申请的一些实施例中,所述将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式可以包括:Optionally, in some embodiments of the present application, the ratio of the pixel uniform value of any two target colors is compared with the target threshold to obtain the comparison result, and obtaining the corresponding target calculation formula according to the target mapping relationship may include:

将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;The ratio of the pixel uniform values of any two target colors is compared with the first target threshold, the second target threshold and the third target threshold, wherein the first target threshold, the second target threshold and the third target threshold are compared. The three-target threshold corresponds to the combination of the current two target colors;

若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;If the ratio is less than the first target threshold, obtain a corresponding first target calculation formula according to the target mapping relationship;

若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;If the ratio is not less than the first target threshold and not greater than the second target threshold, obtain a corresponding second target calculation formula according to the target mapping relationship;

若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;If the ratio is greater than the second target threshold and not greater than the third target threshold, obtain a corresponding third target calculation formula according to the target mapping relationship;

若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。If the ratio is greater than the third target threshold, a corresponding fourth target calculation formula is obtained according to the target mapping relationship.

具体地,当获取到当前两种目标色彩的像素均一值的比值后,可将该比值与分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中目标阈值与目标计算公式中的系数相关,现结合表2进行进一步说明,如表2所示为RGB红绿蓝三色的目标计算公式映射表,其中,比值Q为任意两种目标色彩像素均一值的比值,Ma、Mc、Md、Mh、Na、Nc、Nd及Nh为常数系数,(Mc-Md)/(Nc-Nd)为第一目标阈值,(Ma-Mc)/(Na-Nc)为第二目标阈值,(Mh-Ma)/(Nh-Na)为第三目标阈值;在RG色彩组合中,若Q<(Mc-Md)/(Nc-Nd),则对应的第一目标计算公式为Lux=Md×Gave-Nd×Rave,若(Mc-Md)/(Nc-Nd)=<Q<=(Ma-Mc)/(Na-Nc),则对应的第二目标计算公式为Lux=Mc×Gave-Nc×Rave,若(Ma-Mc)/(Na-Nc)<Q<=(Mh-Ma)/(Nh-Na),则对应的第三目标计算公式为Lux=Ma×Gave-Na×Rave,若Q>(Mh-Ma)/(Nh-Na),则对应的第四目标计算公式为Lux=Mh×Gave-Nh×Rave;同样地,在GB色彩组合和RB色彩组合中,根据Q在目标阈值内的区间,可以确定对应的目标计算公式;由于在RG色彩组合中,根据RG色彩组合获得的目标计算公式计算获得的环境光照度准确度最高,因此建议使用RG色彩组合,本实施例对此不作限定。Specifically, after obtaining the ratio of the pixel uniform values of the current two target colors, the ratio can be compared with the first target threshold, the second target threshold and the third target threshold respectively, wherein the target threshold and the target calculation formula The coefficients in the correlation are further explained in conjunction with Table 2. As shown in Table 2, it is the target calculation formula mapping table of RGB red, green and blue, wherein, the ratio Q is the ratio of the uniform value of any two target color pixels, and Ma, Mc, Md, Mh, Na, Nc, Nd and Nh are constant coefficients, (Mc-Md)/(Nc-Nd) is the first target threshold, (Ma-Mc)/(Na-Nc) is the second target threshold , (Mh-Ma)/(Nh-Na) is the third target threshold; in the RG color combination, if Q<(Mc-Md)/(Nc-Nd), the corresponding first target calculation formula is Lux= Md×Gave-Nd×Rave, if (Mc-Md)/(Nc-Nd)=<Q<=(Ma-Mc)/(Na-Nc), then the corresponding second target calculation formula is Lux=Mc× Gave-Nc×Rave, if (Ma-Mc)/(Na-Nc)<Q<=(Mh-Ma)/(Nh-Na), then the corresponding third target calculation formula is Lux=Ma×Gave-Na ×Rave, if Q>(Mh-Ma)/(Nh-Na), the corresponding fourth target calculation formula is Lux=Mh×Gave-Nh×Rave; Similarly, in GB color combination and RB color combination, According to the interval of Q within the target threshold, the corresponding target calculation formula can be determined; since in the RG color combination, the target calculation formula obtained according to the RG color combination has the highest accuracy of the ambient illuminance, so it is recommended to use the RG color combination. The embodiment does not limit this.

表2Table 2

Figure BDA0002399053230000121
Figure BDA0002399053230000121

本实施例中通过将两种目标色彩像素均一值的比值、当前目标色彩的组合与目标计算公式进行关联,然后根据当前比对结果进行查询获得对应的目标计算公式,可以有效提高目标计算公式的查询效率,同时也提高了环境光照度的计算效率。In this embodiment, by associating the ratio of the uniform pixel values of the two target colors and the combination of the current target color with the target calculation formula, and then querying according to the current comparison result to obtain the corresponding target calculation formula, the efficiency of the target calculation formula can be effectively improved. The query efficiency also improves the calculation efficiency of ambient illumination.

可以理解的是,上述实施例中的部分或全部步骤骤或操作仅是示例,本申请实施例还可以执行其它操作或者各种操作的变形。此外,各个步骤可以按照上述实施例呈现的不同的顺序来执行,并且有可能并非要执行上述实施例中的全部操作。It can be understood that, some or all of the steps or operations in the foregoing embodiments are merely examples, and other operations or variations of various operations may also be performed in the embodiments of the present application. Furthermore, the various steps may be performed in a different order presented in the above-described embodiments, and may not perform all operations in the above-described embodiments.

图3为本申请环境光照度的检测装置一个实施例的结构示意图,如图3所示,上述环境光照度的检测装置30可以包括:获取模块31、第一计算模块32、第二计算模块33和检测模块34。FIG. 3 is a schematic structural diagram of an embodiment of an apparatus for detecting ambient illuminance of the present application. As shown in FIG. 3 , the apparatus 30 for detecting ambient illuminance may include: an acquisition module 31 , a first calculation module 32 , a second calculation module 33 and a detection module 30 . module 34.

其中,获取模块31,用于获取当前待摄影像、目标曝光时间及目标感光度;Wherein, the acquisition module 31 is used to acquire the current image to be photographed, the target exposure time and the target sensitivity;

第一计算模块32,用于根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;The first calculation module 32 is configured to detect the current image to be photographed according to a target color set, and obtain a pixel statistical value corresponding to each target color, wherein the target color set includes multiple target colors;

第二计算模块33,用于根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;The second calculation module 33 is used to obtain the pixel uniform value of each target color according to the pixel statistical value, target exposure time and target sensitivity of each target color;

检测模块34,用于根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The detection module 34 is used to obtain the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors, and detect the current ambient illuminance according to the target calculation formula, wherein the target calculation formula is used according to the current two. Ambient illumination is calculated based on the pixel uniform value of each target color.

图3所示实施例提供的环境光照度的检测装置可用于执行本申请图1所示方法实施例的技术方案,其实现原理和技术效果可以进一步参考方法实施例中的相关描述。The apparatus for detecting ambient illuminance provided by the embodiment shown in FIG. 3 can be used to implement the technical solution of the method embodiment shown in FIG. 1 of the present application, and the implementation principle and technical effect may further refer to the relevant description in the method embodiment.

图4为本申请环境光照度的检测装置另一个实施例的结构示意图,与图3所示的环境光照度的检测装置30相比,不同之处在于,图4所示的环境光照度的检测装置40中,第一计算模块32可以包括:计算子模块321、区域划分子模块322、第一统计子模块323和第二统计子模块324;FIG. 4 is a schematic structural diagram of another embodiment of the apparatus for detecting ambient illuminance of the present application. Compared with the apparatus for detecting ambient illuminance 30 shown in FIG. 3 , the difference is that in the apparatus 40 for detecting ambient illuminance shown in FIG. 4 , the first calculation module 32 may include: a calculation sub-module 321, an area division sub-module 322, a first statistics sub-module 323 and a second statistics sub-module 324;

其中,计算子模块321,用于根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;Wherein, the calculation sub-module 321 is used to detect the current image to be photographed according to the target color set, and obtain the original pixel values of all pixels corresponding to each target color respectively;

区域划分子模块322,用于将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;an area division sub-module 322, configured to divide the current to-be-photographed image into multiple target areas, wherein each target area contains a corresponding target weight;

第一统计子模块323,用于在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;The first statistical sub-module 323 is used to perform statistics on the original pixel values of all pixel points of each target color in each target area, and obtain the pixel cumulative value of each target color in the target area to which it belongs;

第二统计子模块324,用于分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The second statistics sub-module 324 is configured to perform weighted statistics on the cumulative pixel values of each target color in all target regions according to the target weight of each target region, and obtain the pixel statistics value of each target color.

图4所示实施例提供的环境光照度的检测装置40可用于执行本申请图2所示方法实施例的技术方案,其实现原理和技术效果可以进一步参考方法实施例中的相关描述。The apparatus 40 for detecting ambient illuminance provided by the embodiment shown in FIG. 4 can be used to implement the technical solution of the method embodiment shown in FIG. 2 of the present application, and the implementation principle and technical effect may further refer to the relevant description in the method embodiment.

其中一种可能的实现方式中,上述第一计算模块32还可以用于根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。In one possible implementation manner, the above-mentioned first calculation module 32 may also be configured to perform white balance on the current image to be photographed according to the target color set, and obtain a gain value corresponding to each target color, according to the gain value Obtain pixel statistics corresponding to each target color.

图5为本申请环境光照度的检测装置再一个实施例的结构示意图,与图4所示的环境光照度的检测装置40相比,不同之处在于,图5所示的环境光照度的检测装置50中,计算子模块321可以包括:匹配单元3211和计算单元3212;FIG. 5 is a schematic structural diagram of another embodiment of the apparatus for detecting ambient illuminance of the present application. Compared with the apparatus for detecting ambient illuminance 40 shown in FIG. 4 , the difference is that in the apparatus 50 for detecting ambient illuminance shown in FIG. 5 , the calculation sub-module 321 may include: a matching unit 3211 and a calculation unit 3212;

其中,匹配单元3211,用于将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;Wherein, the matching unit 3211 is used to match each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel;

计算单元3212,用于检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The calculation unit 3212 is configured to detect the electrical analog signals of all the pixels, perform analog-to-digital conversion on the electrical analog signals of all the pixels, and obtain the original pixel values of all the pixels.

图6为本申请环境光照度的检测装置再一个实施例的结构示意图,与图3所示的环境光照度的检测装置30相比,不同之处在于,图6所示的环境光照度的检测装置60中,检测模块34可以包括:比较子模块341和获取子模块342;FIG. 6 is a schematic structural diagram of another embodiment of the apparatus for detecting ambient illuminance of the present application. Compared with the apparatus for detecting ambient illuminance 30 shown in FIG. 3 , the difference is that in the apparatus 60 for detecting ambient illuminance shown in FIG. 6 , the detection module 34 may include: a comparison sub-module 341 and an acquisition sub-module 342;

其中,比较子模块341,用于将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果;Wherein, the comparison sub-module 341 is used to compare the ratio of the pixel uniform value of any two target colors with the target threshold to obtain the comparison result;

获取子模块342,用于根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。The obtaining sub-module 342 is configured to obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to represent the mapping relationship between the combination of the comparison result and the target color and the target calculation formula.

图7为本申请环境光照度的检测装置再一个实施例的结构示意图,与图6所示的环境光照度的检测装置60相比,不同之处在于,图7所示的环境光照度的检测装置70中,比较子模块341还用于将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;FIG. 7 is a schematic structural diagram of still another embodiment of the apparatus for detecting ambient illuminance of the present application. Compared with the apparatus for detecting ambient illuminance 60 shown in FIG. 6 , the difference is that in the apparatus 70 for detecting ambient illuminance shown in FIG. 7 , the comparison sub-module 341 is further configured to compare the ratio of the pixel uniform values of any two target colors with the first target threshold, the second target threshold and the third target threshold, wherein the first target threshold, the The second target threshold and the third target threshold correspond to the current combination of the two target colors;

则获取子模块342可以包括:第一获取单元3421、第二获取单元3422、第三获取单元3423和第四获取单元3424;Then the obtaining sub-module 342 may include: a first obtaining unit 3421, a second obtaining unit 3422, a third obtaining unit 3423 and a fourth obtaining unit 3424;

其中,第一获取单元3421,用于若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;Wherein, the first obtaining unit 3421 is configured to obtain the corresponding first target calculation formula according to the target mapping relationship if the ratio is less than the first target threshold;

第二获取单元3422,用于若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;A second obtaining unit 3422, configured to obtain a corresponding second target calculation formula according to the target mapping relationship if the ratio is not less than the first target threshold and not greater than the second target threshold;

第三获取单元3423,用于若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;A third obtaining unit 3423, configured to obtain a corresponding third target calculation formula according to the target mapping relationship if the ratio is greater than the second target threshold and not greater than the third target threshold;

第四获取单元3424,用于若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。The fourth obtaining unit 3424 is configured to obtain a corresponding fourth target calculation formula according to the target mapping relationship if the ratio is greater than the third target threshold.

应理解以上图3~图7所示的环境光照度的检测装置的各个模块的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。且这些模块可以全部以软件通过处理元件调用的形式实现;也可以全部以硬件的形式实现;还可以部分模块以软件通过处理元件调用的形式实现,部分模块通过硬件的形式实现。例如,检测模块可以为单独设立的处理元件,也可以集成在电子设备的某一个芯片中实现。其它模块的实现与之类似。此外这些模块全部或部分可以集成在一起,也可以独立实现。在实现过程中,上述方法的各步骤或以上各个模块可以通过处理器元件中的硬件的集成逻辑电路或者软件形式的指令完成。It should be understood that the division of each module of the apparatus for detecting ambient illuminance shown in Figures 3 to 7 is only a division of logical functions, and can be fully or partially integrated into one physical entity or physically separated in actual implementation. And these modules can all be implemented in the form of software calling through processing elements; they can also all be implemented in hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in hardware. For example, the detection module may be a separately established processing element, or may be integrated in a certain chip of the electronic device. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, and can also be implemented independently. In the implementation process, each step of the above-mentioned method or each of the above-mentioned modules can be completed by an integrated logic circuit of hardware in the processor element or an instruction in the form of software.

例如,以上这些模块可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(Application Specific Integrated Circuit;以下简称:ASIC),或,一个或多个微处理器(Digital Singnal Processor;以下简称:DSP),或,一个或者多个现场可编程门阵列(Field Programmable Gate Array;以下简称:FPGA)等。再如,这些模块可以集成在一起,以片上系统(System-On-a-Chip;以下简称:SOC)的形式实现。For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more specific integrated circuits (Application Specific Integrated Circuit; hereinafter referred to as: ASIC), or, one or more microprocessors A digital processor (Digital Singnal Processor; hereinafter referred to as: DSP), or, one or more Field Programmable Gate Arrays (Field Programmable Gate Array; hereinafter referred to as: FPGA), etc. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (System-On-a-Chip; hereinafter referred to as: SOC).

图8为本申请电子设备一个实施例的结构示意图,如图8所示,上述电子设备可以包括:一个或多个处理器;存储器;多个应用程序;以及一个或多个计算机程序。FIG. 8 is a schematic structural diagram of an embodiment of an electronic device of the present application. As shown in FIG. 8 , the electronic device may include: one or more processors; a memory; multiple application programs; and one or more computer programs.

其中,上述电子设备可以为移动终端(手机),智慧屏,无人机,智能网联车(Intelligent Connected Vehicle;以下简称:ICV),智能(汽)车(smart/intelligentcar)或车载设备等设备。Wherein, the above-mentioned electronic devices may be mobile terminals (mobile phones), smart screens, drones, intelligent connected vehicles (Intelligent Connected Vehicles; hereinafter referred to as: ICVs), smart (car) vehicles (smart/intelligentcar) or in-vehicle equipment and other equipment .

其中上述一个或多个计算机程序被存储在上述存储器中,上述一个或多个计算机程序包括指令,当上述指令被上述设备执行时,使得上述设备执行以下步骤:Wherein the above-mentioned one or more computer programs are stored in the above-mentioned memory, and the above-mentioned one or more computer programs include instructions that, when the above-mentioned instructions are executed by the above-mentioned equipment, cause the above-mentioned equipment to perform the following steps:

获取当前待摄影像、目标曝光时间及目标感光度;Obtain the current image to be photographed, target exposure time and target sensitivity;

根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;Detecting the currently-to-be-photographed image according to a target color set, to obtain a pixel statistic value corresponding to each target color, wherein the target color set includes multiple target colors;

根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;Obtain the pixel uniform value of each target color according to the pixel statistics value, target exposure time and target sensitivity of each target color;

根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The corresponding target calculation formula is obtained according to the ratio of the pixel uniformity values of any two target colors, and the current ambient illuminance is detected according to the target calculation formula, wherein the target calculation formula is used according to the current pixel uniformity of the two target colors. The value calculates the ambient lighting.

其中一种可能的实现方式中,上述指令被上述设备执行时,使得上述设备执行根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值的步骤包括:In one of the possible implementation manners, when the above-mentioned instruction is executed by the above-mentioned device, the above-mentioned device executes the detection of the current image to be photographed according to the target color set, and the steps of obtaining the pixel statistical value corresponding to each target color include:

根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;Detect the current image to be photographed according to the target color set, and obtain the original pixel values of all pixels corresponding to each target color respectively;

将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;dividing the current image to be photographed into a plurality of target areas, wherein each target area contains a corresponding target weight;

在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;In each target area, the original pixel values of all pixel points of each target color are counted, and the pixel cumulative value of each target color in the target area to which it belongs is obtained;

分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The cumulative value of pixels of each target color in all target areas is weighted and counted according to the target weight of each target area, and the pixel statistics value of each target color is obtained.

其中一种可能的实现方式中,上述指令被上述设备执行时,使得上述设备执行根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值的步骤包括:In one of the possible implementation manners, when the above-mentioned instruction is executed by the above-mentioned device, the above-mentioned device executes the detection of the current image to be photographed according to the target color set, and the steps of obtaining the pixel statistical value corresponding to each target color include:

根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。Perform white balance on the current image to be photographed according to the target color set, obtain a gain value corresponding to each target color, and obtain a pixel statistical value corresponding to each target color according to the gain value.

其中一种可能的实现方式中,上述指令被上述设备执行时,使得上述设备执行根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值的步骤包括:In one possible implementation manner, when the above-mentioned instruction is executed by the above-mentioned device, the above-mentioned device executes the detection of the current image to be photographed according to the target color set, and obtains the original pixels of all the pixels corresponding to each target color respectively. Value steps include:

将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;Matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel;

检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The electrical analog signals of all pixels are detected, and the electrical analog signals of all pixels are analog-digital converted to obtain the original pixel values of all pixels.

其中一种可能的实现方式中,上述指令被上述设备执行时,使得上述设备执行根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式的步骤包括:In one of the possible implementations, when the above-mentioned instruction is executed by the above-mentioned device, the above-mentioned device performs the step of obtaining the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors:

将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。Compare the ratio of the pixel uniform values of any two target colors with the target threshold to obtain the comparison result, and obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to characterize the comparison result and the target color. The mapping relationship between the combination of and the target calculation formula.

其中一种可能的实现方式中,上述指令被上述设备执行时,使得上述设备执行将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式的步骤包括:In one possible implementation manner, when the above-mentioned instruction is executed by the above-mentioned device, the above-mentioned device is made to compare the ratio of the pixel uniform value of any two target colors with the target threshold value, obtain the comparison result, and obtain the corresponding The steps in the target calculation formula include:

将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;The ratio of the pixel uniform values of any two target colors is compared with the first target threshold, the second target threshold and the third target threshold, wherein the first target threshold, the second target threshold and the third target threshold are compared. The three-target threshold corresponds to the combination of the current two target colors;

若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;If the ratio is less than the first target threshold, obtain a corresponding first target calculation formula according to the target mapping relationship;

若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;If the ratio is not less than the first target threshold and not greater than the second target threshold, obtain a corresponding second target calculation formula according to the target mapping relationship;

若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;If the ratio is greater than the second target threshold and not greater than the third target threshold, obtain a corresponding third target calculation formula according to the target mapping relationship;

若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。If the ratio is greater than the third target threshold, a corresponding fourth target calculation formula is obtained according to the target mapping relationship.

图8所示的电子设备可以是终端设备也可以是内置于上述终端设备的电路设备。该设备可以用于执行本申请图1~图2所示实施例提供的方法中的功能/步骤。The electronic device shown in FIG. 8 may be a terminal device or a circuit device built in the above-mentioned terminal device. The device may be used to execute the functions/steps in the methods provided by the embodiments shown in FIG. 1 to FIG. 2 of the present application.

如图8所示,电子设备800包括处理器810、存储器820、CMOS图像传感器830及ISP图像信号处理器840。其中,处理器810、存储器820、CMOS图像传感器830及ISP图像信号处理器840之间可以通过内部连接通路互相通信,传递控制和/或数据信号,该存储器820用于存储计算机程序,该处理器810用于从该存储器820中调用并运行该计算机程序。As shown in FIG. 8 , the electronic device 800 includes a processor 810 , a memory 820 , a CMOS image sensor 830 and an ISP image signal processor 840 . The processor 810, the memory 820, the CMOS image sensor 830 and the ISP image signal processor 840 can communicate with each other through an internal connection path to transmit control and/or data signals. The memory 820 is used to store computer programs, and the processor 810 is used to call and run the computer program from the memory 820 .

上述存储器820可以是只读存储器(ROM,read-only memory)、可存储静态信息和指令的其它类型的静态存储设备、随机存取存储器(RAM,random access memory)或可存储信息和指令的其它类型的动态存储设备,也可以是电可擦可编程只读存储器(EEPROM,electrically erasable programmable read-only memory)、只读光盘(CD-ROM,compactdisc read-only memory)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备,或者还可以是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质等。The above-mentioned memory 820 may be a read-only memory (ROM, read-only memory), other types of static storage devices that can store static information and instructions, random access memory (RAM, random access memory), or other types of information and instructions. It can also be an electrically erasable programmable read-only memory (EEPROM, electrically erasable programmable read-only memory), a CD-ROM (compactdisc read-only memory), or other CD-ROM storage, CD-ROM storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and Any other medium that can be accessed by a computer, etc.

上述处理器810可以和存储器820可以合成一个处理装置,更常见的是彼此独立的部件,处理器810用于执行存储器820中存储的程序代码来实现上述功能。具体实现时,该存储器820也可以集成在处理器810中,或者,独立于处理器810。The above-mentioned processor 810 and the memory 820 can be combined into a processing device, and more commonly, they are independent components, and the processor 810 is used to execute the program codes stored in the memory 820 to realize the above-mentioned functions. During specific implementation, the memory 820 may also be integrated in the processor 810 , or be independent of the processor 810 .

应理解,图8所示的电子设备800能够实现本申请图1~图2所示实施例提供的方法的各个过程。电子设备800中的各个模块的操作和/或功能,分别为了实现上述方法实施例中的相应流程。具体可参见本申请图1~图2所示方法实施例中的描述,为避免重复,此处适当省略详细描述。It should be understood that the electronic device 800 shown in FIG. 8 can implement each process of the method provided by the embodiments shown in FIG. 1 to FIG. 2 of the present application. The operations and/or functions of each module in the electronic device 800 are respectively to implement the corresponding processes in the foregoing method embodiments. For details, reference may be made to the descriptions in the method embodiments shown in FIG. 1 to FIG. 2 of the present application. To avoid repetition, detailed descriptions are appropriately omitted here.

应理解,图8所示的电子设备800中的处理器810可以是片上系统SOC,该处理器810中可以包括中央处理器(Central Processing Unit;以下简称:CPU),还可以进一步包括其他类型的处理器,例如:图像处理器(Graphics Processing Unit;以下简称:GPU)等。It should be understood that the processor 810 in the electronic device 800 shown in FIG. 8 may be a system-on-chip SOC, and the processor 810 may include a central processing unit (Central Processing Unit; hereinafter referred to as: CPU), and may further include other types of A processor, for example, a Graphics Processing Unit (Graphics Processing Unit; hereinafter referred to as: GPU) and the like.

总之,处理器810内部的各部分处理器或处理单元可以共同配合实现之前的方法流程,且各部分处理器或处理单元相应的软件程序可存储在存储器820中。In a word, each part of the processors or processing units inside the processor 810 can cooperate to implement the previous method process, and the corresponding software programs of each part of the processors or processing units can be stored in the memory 820 .

本申请还提供一种电子设备,所述设备包括存储介质和中央处理器,所述存储介质可以是非易失性存储介质,所述存储介质中存储有计算机可执行程序,所述中央处理器与所述非易失性存储介质连接,并执行所述计算机可执行程序以实现本申请图1~图2所示实施例提供的方法。The present application also provides an electronic device, the device includes a storage medium and a central processing unit, the storage medium may be a non-volatile storage medium, and a computer-executable program is stored in the storage medium, and the central processing unit is connected to the central processing unit. The non-volatile storage medium is connected, and the computer-executable program is executed to implement the method provided by the embodiments shown in FIG. 1 to FIG. 2 of the present application.

以上各实施例中,涉及的处理器可以例如包括CPU、DSP、微控制器或数字信号处理器,还可包括GPU、嵌入式神经网络处理器(Neural-network Process Units;以下简称:NPU)和图像信号处理器(Image Signal Processing;以下简称:ISP),该处理器还可包括必要的硬件加速器或逻辑处理硬件电路,如ASIC,或一个或多个用于控制本申请技术方案程序执行的集成电路等。此外,处理器可以具有操作一个或多个软件程序的功能,软件程序可以存储在存储介质中。In the above embodiments, the involved processors may include, for example, a CPU, a DSP, a microcontroller or a digital signal processor, and may also include a GPU, an embedded neural-network process unit (Neural-network Process Units; hereinafter referred to as: NPU) and Image Signal Processing (hereinafter referred to as: ISP), the processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASIC, or one or more integrated circuits for controlling the execution of the programs of the technical solution of the present application circuit, etc. Furthermore, the processor may have the function of operating one or more software programs, which may be stored in a storage medium.

本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行本申请图1~图2所示实施例提供的方法。Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when it runs on a computer, enables the computer to execute the program provided by the embodiments shown in FIG. 1 to FIG. 2 of the present application. method.

本申请实施例还提供一种计算机程序产品,该计算机程序产品包括计算机程序,当其在计算机上运行时,使得计算机执行本申请图1~图2所示实施例提供的方法。An embodiment of the present application further provides a computer program product, the computer program product includes a computer program, which, when running on a computer, enables the computer to execute the method provided by the embodiments shown in FIG. 1 to FIG. 2 of the present application.

本申请实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示单独存在A、同时存在A和B、单独存在B的情况。其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项”及其类似表达,是指的这些项中的任意组合,包括单项或复数项的任意组合。例如,a,b和c中的至少一项可以表示:a,b,c,a和b,a和c,b和c或a和b和c,其中a,b,c可以是单个,也可以是多个。In the embodiments of the present application, "at least one" refers to one or more, and "multiple" refers to two or more. "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can indicate the existence of A alone, the existence of A and B at the same time, and the existence of B alone. where A and B can be singular or plural. The character "/" generally indicates that the associated objects are an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, and c may represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c may be single, or Can be multiple.

本领域普通技术人员可以意识到,本文中公开的实施例中描述的各单元及算法步骤,能够以电子硬件、计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps described in the embodiments disclosed herein can be implemented by a combination of electronic hardware, computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

在本申请所提供的几个实施例中,任一功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory;以下简称:ROM)、随机存取存储器(RandomAccess Memory;以下简称:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (Read-Only Memory; hereinafter referred to as: ROM), Random Access Memory (Random Access Memory; hereinafter referred to as: RAM), magnetic disk or optical disk, etc. A medium on which program code is stored.

以上所述,仅为本申请的具体实施方式,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application. The protection scope of the present application shall be subject to the protection scope of the claims.

Claims (19)

1.一种环境光照度的检测方法,其特征在于,包括:1. a detection method of ambient illuminance, is characterized in that, comprises: 获取当前待摄影像、目标曝光时间及目标感光度;Obtain the current image to be photographed, target exposure time and target sensitivity; 根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;Detecting the currently-to-be-photographed image according to a target color set, to obtain a pixel statistic value corresponding to each target color, wherein the target color set includes multiple target colors; 根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;Obtain the pixel uniform value of each target color according to the pixel statistics value, target exposure time and target sensitivity of each target color; 根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The corresponding target calculation formula is obtained according to the ratio of the pixel uniformity values of any two target colors, and the current ambient illuminance is detected according to the target calculation formula, wherein the target calculation formula is used according to the current pixel uniformity of the two target colors. The value calculates the ambient lighting. 2.根据权利要求1所述的环境光照度的检测方法,其特征在于,所述根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值包括:2. The method for detecting ambient illuminance according to claim 1, wherein the current image to be photographed is detected according to a target color set, and obtaining a pixel statistical value corresponding to each target color comprises: 根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;Detect the current image to be photographed according to the target color set, and obtain the original pixel values of all pixels corresponding to each target color respectively; 将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;dividing the current image to be photographed into a plurality of target areas, wherein each target area contains a corresponding target weight; 在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;In each target area, the original pixel values of all pixel points of each target color are counted, and the pixel cumulative value of each target color in the target area to which it belongs is obtained; 分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The cumulative value of pixels of each target color in all target areas is weighted and counted according to the target weight of each target area, and the pixel statistics value of each target color is obtained. 3.根据权利要求1所述的环境光照度的检测方法,其特征在于,所述根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值包括:3. The detection method of ambient illuminance according to claim 1, wherein the detection of the current image to be photographed according to a target color set, and obtaining the pixel statistical value corresponding to each target color comprises: 根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。Perform white balance on the current image to be photographed according to the target color set, obtain a gain value corresponding to each target color, and obtain a pixel statistical value corresponding to each target color according to the gain value. 4.根据权利要求2所述的环境光照度的检测方法,其特征在于,所述根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值包括:4. The method for detecting ambient illuminance according to claim 2, wherein the current image to be photographed is detected according to a target color set, and the original pixels of all pixels corresponding to each target color are obtained respectively Values include: 将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;Matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel; 检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The electrical analog signals of all pixels are detected, and the electrical analog signals of all pixels are analog-digital converted to obtain the original pixel values of all pixels. 5.根据权利要求1所述的环境光照度的检测方法,其特征在于,所述根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式包括:5. The detection method of ambient illuminance according to claim 1, wherein the obtaining the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors comprises: 将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。Compare the ratio of the pixel uniform values of any two target colors with the target threshold to obtain the comparison result, and obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to characterize the comparison result and the target color. The mapping relationship between the combination of and the target calculation formula. 6.根据权利要求5所述的环境光照度的检测方法,其特征在于,所述将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式包括:6. The detection method of ambient illuminance according to claim 5, wherein the ratio of the pixel uniform value of any two target colors is compared with the target threshold, and the comparison result is obtained, and the corresponding target is obtained according to the target mapping relationship. The target calculation formula includes: 将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;The ratio of the pixel uniform values of any two target colors is compared with the first target threshold, the second target threshold and the third target threshold, wherein the first target threshold, the second target threshold and the third target threshold are compared. The three-target threshold corresponds to the combination of the current two target colors; 若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;If the ratio is less than the first target threshold, obtain a corresponding first target calculation formula according to the target mapping relationship; 若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;If the ratio is not less than the first target threshold and not greater than the second target threshold, obtain a corresponding second target calculation formula according to the target mapping relationship; 若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;If the ratio is greater than the second target threshold and not greater than the third target threshold, obtain a corresponding third target calculation formula according to the target mapping relationship; 若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。If the ratio is greater than the third target threshold, a corresponding fourth target calculation formula is obtained according to the target mapping relationship. 7.一种环境光照度的检测装置,其特征在于,包括:7. A detection device for ambient illuminance, comprising: 获取模块:用于获取当前待摄影像、目标曝光时间及目标感光度;Acquisition module: used to acquire the current image to be photographed, target exposure time and target sensitivity; 第一计算模块,用于根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;a first calculation module, configured to detect the current image to be photographed according to a target color set, and obtain a pixel statistical value corresponding to each target color, wherein the target color set includes multiple target colors; 第二计算模块,用于根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;The second calculation module is used to obtain the pixel uniform value of each target color according to the pixel statistical value, target exposure time and target sensitivity of each target color; 检测模块,用于根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The detection module is used to obtain the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors, and detect the current ambient illuminance according to the target calculation formula, wherein the target calculation formula is used according to the current two Ambient illumination is calculated from the pixel-average value of the target color. 8.根据权利要求7所述的装置,其特征在于,所述第一计算模块还包括:8. The apparatus according to claim 7, wherein the first computing module further comprises: 计算子模块,用于根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;a calculation submodule for detecting the current image to be photographed according to the target color set, and obtaining the original pixel values of all pixels corresponding to each target color; 区域划分子模块,用于将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;an area division sub-module, configured to divide the current image to be photographed into a plurality of target areas, wherein each target area contains a corresponding target weight; 第一统计子模块,用于在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;The first statistical submodule is used to perform statistics on the original pixel values of all pixel points of each target color in each target area, and obtain the pixel cumulative value of each target color in the target area to which it belongs; 第二统计子模块,用于分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The second statistical sub-module is used to perform weighted statistics on the accumulated pixel values of each target color in all target areas according to the target weight of each target area, and obtain the pixel statistical value of each target color. 9.根据权利要求7所述的装置,其特征在于,所述第一计算模块还用于根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。9. The device according to claim 7, wherein the first calculation module is further configured to perform white balance on the current image to be photographed according to a target color set to obtain a gain value corresponding to each target color, Pixel statistics corresponding to each target color are obtained according to the gain value. 10.根据权利要求8所述的装置,其特征在于,所述计算子模块包括:10. The apparatus according to claim 8, wherein the calculation submodule comprises: 匹配单元,用于将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;a matching unit for matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel; 计算单元,用于检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The calculation unit is used for detecting the electrical analog signals of all the pixels, and performing analog-to-digital conversion on the electrical analog signals of all the pixels to obtain the original pixel values of all the pixels. 11.根据权利要求7所述的装置,其特征在于,所述检测模块还包括:11. The device according to claim 7, wherein the detection module further comprises: 比较子模块,用于将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果;The comparison sub-module is used to compare the ratio of the pixel uniform value of any two target colors with the target threshold to obtain the comparison result; 获取子模块,用于根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。The obtaining sub-module is configured to obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to represent the mapping relationship between the combination of the comparison result and the target color and the target calculation formula. 12.根据权利要求11所述的装置,其特征在于,所述比较子模块还用于将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;12 . The device according to claim 11 , wherein the comparison sub-module is further configured to compare the ratio of the pixel uniform values of any two target colors with the first target threshold, the second target threshold and the third target respectively. 13 . thresholds are compared, wherein the first target threshold, the second target threshold and the third target threshold correspond to the current combination of the two target colors; 则所述获取子模块包括:Then the acquisition sub-module includes: 第一获取单元,用于若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;a first obtaining unit, configured to obtain a corresponding first target calculation formula according to a target mapping relationship if the ratio is less than the first target threshold; 第二获取单元,用于若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;a second obtaining unit, configured to obtain a corresponding second target calculation formula according to the target mapping relationship if the ratio is not less than the first target threshold and not greater than the second target threshold; 第三获取单元,用于若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;a third obtaining unit, configured to obtain a corresponding third target calculation formula according to the target mapping relationship if the ratio is greater than the second target threshold and not greater than the third target threshold; 第四获取单元,用于若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。A fourth obtaining unit, configured to obtain a corresponding fourth target calculation formula according to the target mapping relationship if the ratio is greater than the third target threshold. 13.一种电子设备,其特征在于,包括:13. An electronic device, characterized in that, comprising: 一个或多个处理器;存储器;多个应用程序;以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述设备执行时,使得所述设备执行以下步骤:one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions, When the instructions are executed by the device, the device is caused to perform the following steps: 获取当前待摄影像、目标曝光时间及目标感光度;Obtain the current image to be photographed, target exposure time and target sensitivity; 根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值,其中,所述目标色彩集合包含多种目标色彩;Detecting the currently-to-be-photographed image according to a target color set, to obtain a pixel statistic value corresponding to each target color, wherein the target color set includes multiple target colors; 根据每种目标色彩的像素统计值、目标曝光时间及目标感光度获得每种目标色彩的像素均一值;Obtain the pixel uniform value of each target color according to the pixel statistics value, target exposure time and target sensitivity of each target color; 根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式,并根据所述目标计算公式检测当前的环境光照度,其中,所述目标计算公式用于根据当前两种目标色彩的像素均一值计算环境光照度。The corresponding target calculation formula is obtained according to the ratio of the pixel uniformity values of any two target colors, and the current ambient illuminance is detected according to the target calculation formula, wherein the target calculation formula is used according to the current pixel uniformity of the two target colors. The value calculates the ambient lighting. 14.根据权利要求13所述的电子设备,其特征在于,所述指令被所述设备执行时,使得所述设备执行根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值的步骤包括:14 . The electronic device according to claim 13 , wherein when the instruction is executed by the device, the device executes the detection of the currently-to-be-photographed image according to the target color set, and obtains the image corresponding to each target color. 15 . The steps of pixel statistics corresponding to colors include: 根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值;Detect the current image to be photographed according to the target color set, and obtain the original pixel values of all pixels corresponding to each target color respectively; 将所述当前待摄影像划分成多个目标区域,其中,每个目标区域包含对应的目标权重;dividing the current image to be photographed into a plurality of target areas, wherein each target area contains a corresponding target weight; 在每个目标区域中分别对每种目标色彩的所有像素点的原始像素值进行统计,获得所属目标区域内每种目标色彩的像素累计值;In each target area, the original pixel values of all pixel points of each target color are counted, and the pixel cumulative value of each target color in the target area to which it belongs is obtained; 分别将每种目标色彩在所有目标区域内的像素累计值根据每个目标区域的目标权重进行加权统计,获得每种目标色彩的像素统计值。The cumulative value of pixels of each target color in all target areas is weighted and counted according to the target weight of each target area, and the pixel statistics value of each target color is obtained. 15.根据权利要求13所述的电子设备,其特征在于,所述指令被所述设备执行时,使得所述设备执行根据目标色彩集合对所述当前待摄影像进行检测,获得与每种目标色彩对应的像素统计值的步骤包括:15 . The electronic device according to claim 13 , wherein when the instruction is executed by the device, the device executes the detection of the currently-to-be-photographed image according to the target color set, and obtains the image corresponding to each target color. 16 . The steps of pixel statistics corresponding to colors include: 根据目标色彩集合对所述当前待摄影像进行白平衡,获得与每种目标色彩对应的增益值,根据所述增益值获得与每种目标色彩对应的像素统计值。Perform white balance on the current image to be photographed according to the target color set, obtain a gain value corresponding to each target color, and obtain a pixel statistical value corresponding to each target color according to the gain value. 16.根据权利要求14所述的电子设备,其特征在于,所述指令被所述设备执行时,使得所述设备执行根据目标色彩集合对所述当前待摄影像进行检测,分别获得与每种目标色彩对应的所有像素点的原始像素值的步骤包括:16 . The electronic device according to claim 14 , wherein when the instruction is executed by the device, the device executes the detection of the currently-to-be-photographed image according to the target color set, and obtains and obtains the corresponding image with each color respectively. 17 . The steps of obtaining the original pixel values of all pixels corresponding to the target color include: 将所述当前待摄影像中的每个像素点与目标色彩集合中的目标色彩进行匹配,获得每个像素点的目标色彩;Matching each pixel in the current image to be photographed with the target color in the target color set to obtain the target color of each pixel; 检测所有像素点的电模拟信号,将所有像素点的电模拟信号进行模数转换,获得所有像素点的原始像素值。The electrical analog signals of all pixels are detected, and the electrical analog signals of all pixels are analog-digital converted to obtain the original pixel values of all pixels. 17.根据权利要求13所述的电子设备,其特征在于,所述指令被所述设备执行时,使得所述设备执行根据任意两种目标色彩的像素均一值的比值获得对应的目标计算公式的步骤包括:17. The electronic device according to claim 13, characterized in that, when the instruction is executed by the device, the device is made to perform the calculation of obtaining the corresponding target calculation formula according to the ratio of the pixel uniform values of any two target colors. Steps include: 将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式,其中,所述目标映射关系用于表征所述比较结果及目标色彩的组合与所述目标计算公式之间的映射关系。Compare the ratio of the pixel uniform values of any two target colors with the target threshold to obtain the comparison result, and obtain the corresponding target calculation formula according to the target mapping relationship, wherein the target mapping relationship is used to characterize the comparison result and the target color. The mapping relationship between the combination of and the target calculation formula. 18.根据权利要求17所述的电子设备,其特征在于,所述指令被所述设备执行时,使得所述设备执行将任意两种目标色彩的像素均一值的比值与目标阈值进行比较,获得比较结果,根据目标映射关系获得对应的目标计算公式的步骤包括:18. The electronic device according to claim 17, wherein when the instruction is executed by the device, the device is made to compare the ratio of the pixel uniform values of any two target colors with the target threshold to obtain Comparing the results, the steps of obtaining the corresponding target calculation formula according to the target mapping relationship include: 将任意两种目标色彩的像素均一值的比值分别与第一目标阈值、第二目标阈值及第三目标阈值进行比较,其中,所述第一目标阈值、所述第二目标阈值及所述第三目标阈值与当前两种目标色彩的组合对应;The ratio of the pixel uniform values of any two target colors is compared with the first target threshold, the second target threshold and the third target threshold, wherein the first target threshold, the second target threshold and the third target threshold are compared. The three-target threshold corresponds to the combination of the current two target colors; 若所述比值小于所述第一目标阈值,则根据目标映射关系获得对应的第一目标计算公式;If the ratio is less than the first target threshold, obtain a corresponding first target calculation formula according to the target mapping relationship; 若所述比值不小于所述第一目标阈值且不大于所述第二目标阈值,则根据目标映射关系获得对应的第二目标计算公式;If the ratio is not less than the first target threshold and not greater than the second target threshold, obtain a corresponding second target calculation formula according to the target mapping relationship; 若所述比值大于所述第二目标阈值且不大于所述第三目标阈值,则根据目标映射关系获得对应的第三目标计算公式;If the ratio is greater than the second target threshold and not greater than the third target threshold, obtain a corresponding third target calculation formula according to the target mapping relationship; 若所述比值大于所述第三目标阈值,则根据目标映射关系获得对应的第四目标计算公式。If the ratio is greater than the third target threshold, a corresponding fourth target calculation formula is obtained according to the target mapping relationship. 19.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行如权利要求1-6任一项所述的方法。19. A computer-readable storage medium, characterized in that, a computer program is stored in the computer-readable storage medium, and when it is run on a computer, the computer is made to execute the method according to any one of claims 1-6. method.
CN202010140912.4A 2020-03-03 2020-03-03 Ambient light illumination detection method and device and electronic equipment Active CN111372007B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010140912.4A CN111372007B (en) 2020-03-03 2020-03-03 Ambient light illumination detection method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010140912.4A CN111372007B (en) 2020-03-03 2020-03-03 Ambient light illumination detection method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111372007A true CN111372007A (en) 2020-07-03
CN111372007B CN111372007B (en) 2021-11-12

Family

ID=71211673

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010140912.4A Active CN111372007B (en) 2020-03-03 2020-03-03 Ambient light illumination detection method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111372007B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112218065A (en) * 2020-09-14 2021-01-12 深圳英飞拓科技股份有限公司 Image white balance method, system, terminal device and storage medium
CN112995635A (en) * 2021-04-21 2021-06-18 贝壳找房(北京)科技有限公司 Image white balance processing method and device, electronic equipment and storage medium
CN113596343A (en) * 2021-07-23 2021-11-02 北京字节跳动网络技术有限公司 Lamplight brightness adjusting method and device and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130016249A1 (en) * 2011-07-14 2013-01-17 Canon Kabushiki Kaisha Imaging apparatus capable of controlling exposure including flash amount control of flash apparatus, and control method thereof
CN104601787A (en) * 2013-10-30 2015-05-06 联想(北京)有限公司 Information processing method and apparatus
US20160014316A1 (en) * 2014-07-10 2016-01-14 Lotes Co., Ltd Photography method using projecting light source and a photography element thereof
CN105376394A (en) * 2014-08-29 2016-03-02 中兴通讯股份有限公司 Terminal business processing method and apparatus
WO2016042734A1 (en) * 2014-09-19 2016-03-24 パナソニックIpマネジメント株式会社 Solid-state imaging device
CN106296658A (en) * 2016-07-28 2017-01-04 电子科技大学 A method for improving the accuracy of scene light source estimation based on camera response function
CN108184076A (en) * 2018-02-01 2018-06-19 天津天地伟业信息系统集成有限公司 A kind of brightness calculation algorithm based on Color Statistical
CN108337496A (en) * 2018-04-25 2018-07-27 普联技术有限公司 White balancing treatment method, processing unit, processing equipment and storage medium
CN109842728A (en) * 2019-03-04 2019-06-04 出门问问信息科技有限公司 Auxiliary answers method, apparatus, intelligent terminal and the storage medium of voice communication
US20190174043A1 (en) * 2016-07-29 2019-06-06 Zhejiang Dahua Technology Co., Ltd. Systems and methods for changing operation modes of the optical filter of an imaging device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130016249A1 (en) * 2011-07-14 2013-01-17 Canon Kabushiki Kaisha Imaging apparatus capable of controlling exposure including flash amount control of flash apparatus, and control method thereof
CN104601787A (en) * 2013-10-30 2015-05-06 联想(北京)有限公司 Information processing method and apparatus
US20160014316A1 (en) * 2014-07-10 2016-01-14 Lotes Co., Ltd Photography method using projecting light source and a photography element thereof
CN105376394A (en) * 2014-08-29 2016-03-02 中兴通讯股份有限公司 Terminal business processing method and apparatus
WO2016042734A1 (en) * 2014-09-19 2016-03-24 パナソニックIpマネジメント株式会社 Solid-state imaging device
CN106296658A (en) * 2016-07-28 2017-01-04 电子科技大学 A method for improving the accuracy of scene light source estimation based on camera response function
US20190174043A1 (en) * 2016-07-29 2019-06-06 Zhejiang Dahua Technology Co., Ltd. Systems and methods for changing operation modes of the optical filter of an imaging device
CN108184076A (en) * 2018-02-01 2018-06-19 天津天地伟业信息系统集成有限公司 A kind of brightness calculation algorithm based on Color Statistical
CN108337496A (en) * 2018-04-25 2018-07-27 普联技术有限公司 White balancing treatment method, processing unit, processing equipment and storage medium
CN109842728A (en) * 2019-03-04 2019-06-04 出门问问信息科技有限公司 Auxiliary answers method, apparatus, intelligent terminal and the storage medium of voice communication

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112218065A (en) * 2020-09-14 2021-01-12 深圳英飞拓科技股份有限公司 Image white balance method, system, terminal device and storage medium
CN112995635A (en) * 2021-04-21 2021-06-18 贝壳找房(北京)科技有限公司 Image white balance processing method and device, electronic equipment and storage medium
CN112995635B (en) * 2021-04-21 2021-07-20 贝壳找房(北京)科技有限公司 Image white balance processing method and device, electronic equipment and storage medium
CN113596343A (en) * 2021-07-23 2021-11-02 北京字节跳动网络技术有限公司 Lamplight brightness adjusting method and device and electronic equipment

Also Published As

Publication number Publication date
CN111372007B (en) 2021-11-12

Similar Documents

Publication Publication Date Title
CN110233971B (en) A shooting method and terminal, and a computer-readable storage medium
US20210192698A1 (en) Image Processing Method, Electronic Device, and Non-Transitory Computer-Readable Storage Medium
US11457189B2 (en) Device for and method of correcting white balance of image
US20130271631A1 (en) Light receiver, light reception method and transmission system
CN107407600B (en) Sensing images and light sources
CN111372007A (en) Ambient illumination detection method, device and electronic device
CN113301318B (en) Image white balance processing method and device, storage medium and terminal
TW201419853A (en) Image processor and image dead pixel detection method thereof
US12058450B2 (en) Electronic device which adjusts white balance of image according to attributes of object in image and method for processing image by electronic device
CN109274948A (en) Image color correction method, device, storage medium and computer device
CN113538223B (en) Noise image generation method, device, electronic device and storage medium
WO2021115419A1 (en) Image processing method, terminal, and storage medium
CN114037606B (en) Image processing methods, processors, processing devices, software products, and storage media
CN111311500A (en) Method and device for carrying out color restoration on image
US12167145B2 (en) Processing circuit analyzing image data and generating final image data
WO2019201065A1 (en) Geographic iconography-based high-pedestrian volume area determination method and apparatus
CN113793291A (en) An image fusion method, device, electronic device and storage medium
US11869224B2 (en) Method and system for establishing light source information prediction model
CN112584057B (en) Illumination detection method and device
CN108184076B (en) Brightness calculation method based on color statistics
US9131200B2 (en) White balance adjusting method with scene detection and device thereof
CN104780322B (en) Image pickup device, image pickup method, and image processing device
TWI723729B (en) White balance adjustment method, image processing device and image processing system
CN105282401B (en) Image acquisition device and vignetting compensation method thereof
CN113271450A (en) White balance adjusting method, image processing device 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
TA01 Transfer of patent application right

Effective date of registration: 20210426

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Applicant after: Honor Device Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant before: HUAWEI TECHNOLOGIES Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address