CN115426458A - Light source detection method and related equipment thereof - Google Patents
Light source detection method and related equipment thereof Download PDFInfo
- Publication number
- CN115426458A CN115426458A CN202211354642.2A CN202211354642A CN115426458A CN 115426458 A CN115426458 A CN 115426458A CN 202211354642 A CN202211354642 A CN 202211354642A CN 115426458 A CN115426458 A CN 115426458A
- Authority
- CN
- China
- Prior art keywords
- camera
- image
- light source
- electronic device
- detection method
- 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
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 110
- 238000012545 processing Methods 0.000 claims abstract description 77
- 238000000034 method Methods 0.000 claims description 49
- 230000015654 memory Effects 0.000 claims description 43
- 238000004590 computer program Methods 0.000 claims description 19
- 230000035945 sensitivity Effects 0.000 claims description 18
- 230000009467 reduction Effects 0.000 claims description 6
- 230000006870 function Effects 0.000 description 26
- 239000002184 metal Substances 0.000 description 21
- 229910052751 metal Inorganic materials 0.000 description 21
- 230000008569 process Effects 0.000 description 17
- 238000004422 calculation algorithm Methods 0.000 description 16
- 238000010586 diagram Methods 0.000 description 15
- 238000004891 communication Methods 0.000 description 13
- 230000007423 decrease Effects 0.000 description 6
- 238000003384 imaging method Methods 0.000 description 6
- 230000004048 modification Effects 0.000 description 6
- 238000012986 modification Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 6
- 239000011521 glass Substances 0.000 description 5
- 230000001360 synchronised effect Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 229920001621 AMOLED Polymers 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000005034 decoration Methods 0.000 description 3
- 150000002739 metals Chemical class 0.000 description 3
- 241000191291 Abies alba Species 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000003190 augmentative effect Effects 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 230000000295 complement effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 241000282326 Felis catus Species 0.000 description 1
- 241000023320 Luma <angiosperm> Species 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 238000009825 accumulation Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 210000000988 bone and bone Anatomy 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000004020 conductor Substances 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000003760 hair shine Effects 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 230000001976 improved effect Effects 0.000 description 1
- 238000010348 incorporation Methods 0.000 description 1
- 230000001939 inductive effect Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- OSWPMRLSEDHDFF-UHFFFAOYSA-N methyl salicylate Chemical compound COC(=O)C1=CC=CC=C1O OSWPMRLSEDHDFF-UHFFFAOYSA-N 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 239000002096 quantum dot Substances 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000003595 spectral effect Effects 0.000 description 1
- 230000006641 stabilisation Effects 0.000 description 1
- 238000011105 stabilization Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02B—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
- Y02B20/00—Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
- Y02B20/40—Control techniques providing energy savings, e.g. smart controller or presence detection
Landscapes
- Studio Devices (AREA)
Abstract
Description
技术领域technical field
本申请涉及图像处理领域,具体涉及一种光源检测方法及其相关设备。The present application relates to the field of image processing, in particular to a light source detection method and related equipment.
背景技术Background technique
随着具有拍摄功能的电子设备在生活中的普及,人们使用电子设备进行拍摄已经成为了生活中的一种日常行为方式。With the popularization of electronic devices with a shooting function in daily life, it has become a daily behavior of people to use electronic devices to take pictures.
当拍摄的场景中包括光源时,由于光源产生的亮度比较高,影响周围环境的光影效果,因此,相关技术通常会先根据亮度阈值识别的方法来检测出光源,例如将大于预设亮度阈值的局部区域确定为光源,然后再进行后续处理。When the scene to be photographed includes a light source, because the brightness generated by the light source is relatively high, which affects the light and shadow effect of the surrounding environment, the related technology usually first detects the light source according to the brightness threshold recognition method, for example, the brightness greater than the preset brightness threshold The local area is determined as the light source, and then the subsequent processing is performed.
然而,这种检测方法鲁棒性不高,会错误的将一些高反光物体、高亮金属等识别为光源,针对这一问题,亟需一种新的检测方法进行解决。However, the robustness of this detection method is not high, and some highly reflective objects and bright metals may be mistakenly identified as light sources. To solve this problem, a new detection method is urgently needed.
发明内容Contents of the invention
本申请提供了一种光源检测方法及其相关设备,通过对第二摄像头来进行虚焦和/或降低曝光值处理,可以以简单快捷的方式,辅助第一摄像头准确的检测出光源。The present application provides a light source detection method and related equipment, which can assist the first camera to accurately detect the light source in a simple and quick manner by performing defocusing and/or reducing exposure value processing on the second camera.
第一方面,提供了一种光源检测方法,应用于包括第一摄像头和第二摄像头的电子设备,所述第一摄像头和所述第二摄像头用于拍摄同一场景;该方法包括:In a first aspect, a light source detection method is provided, which is applied to an electronic device including a first camera and a second camera, and the first camera and the second camera are used to shoot the same scene; the method includes:
启动所述电子设备的相机应用程序;launch the camera application of the electronic device;
利用所述第一摄像头采集第一图像;using the first camera to capture a first image;
对所述第二摄像头进行虚焦处理,和/或,降低曝光值处理;Perform virtual focus processing on the second camera, and/or reduce exposure value processing;
利用处理后的所述第二摄像头采集参考图像;Using the processed second camera to capture a reference image;
基于所述参考图像,确定所述第一图像中包括的目标光源。Target light sources included in the first image are determined based on the reference image.
本申请实施例提供的光源检测方法,在启用第一摄像头和第二摄像头进行拍摄的情况下,通过对第二摄像头进行虚焦和/或降低曝光值处理,使得处理后的第二摄像头采集到的参考图像中的非真实光源的区域变模糊、变黑;然后,结合该参考图像辅助第一图像筛除掉高反光物体、高亮金属、噪声等产生的高亮区域,从中识别出真正的光源,由此可以达到提高光源检测的准确度。In the light source detection method provided by the embodiment of the present application, when the first camera and the second camera are enabled to take pictures, the processed second camera captures the The area of the non-real light source in the reference image becomes blurred and black; then, combined with the reference image to assist the first image to filter out the highlighted areas produced by highly reflective objects, bright metal, noise, etc., and identify the real light source, thereby improving the accuracy of light source detection.
结合第一方面,在第一方面的一种实现方式中,对所述第二摄像头进行虚焦处理,包括:With reference to the first aspect, in an implementation manner of the first aspect, performing virtual focus processing on the second camera includes:
将所述第二摄像头中镜头与图像传感器之间的距离减小到小于采集所述第一图像时,所述第一摄像头中镜头与图像传感器之间的距离。reducing the distance between the lens in the second camera and the image sensor to be smaller than the distance between the lens in the first camera and the image sensor when capturing the first image.
在该实现方式中,由于对第二摄像头进行了虚焦处理,可以使得第二摄像头采集的第一参考图像中的大部分物体变得虚化。例如,可以使得距离第二摄像头较远的背景中的物体变得模糊。高亮金属、高反光的物体由于自身是反射高亮的光线成像的,反射光的能量相对发光光源的能量非常低,所以,这些高亮金属、高反光的物体在第一参考图像中对应的成像,在虚焦处理后也变得模糊不清,与背景混合成一团。此时,只有真正的发光光源由于能量较高,在虚焦处理后也不会模糊,从而可以在模糊的背景中凸显出来,相对于周围变得较亮。In this implementation manner, since virtual focus processing is performed on the second camera, most objects in the first reference image captured by the second camera may become blurred. For example, objects in the background that are far away from the second camera can be blurred. Since the bright metal and highly reflective objects are imaged by reflecting bright light, the energy of the reflected light is very low compared to the energy of the luminous light source. Therefore, these bright metal and highly reflective objects in the first reference image correspond to Imaging, after defocus processing, also becomes blurred and blends with the background. At this time, only the real luminous light source will not be blurred after the virtual focus processing due to its high energy, so it can stand out in the blurred background and become brighter relative to the surroundings.
结合第一方面,在第一方面的一种实现方式中,对所述第二摄像头进行降低曝光值处理,包括:With reference to the first aspect, in an implementation manner of the first aspect, the processing of reducing the exposure value of the second camera includes:
将所述第二摄像头对应的曝光值降低为采集所述第一图像时,所述第一摄像头对应的曝光值的一半。reducing the exposure value corresponding to the second camera to half of the exposure value corresponding to the first camera when capturing the first image.
在该实现方式中,降低曝光值会使得第二摄像头采集到的第二参考图像变成比较黑的图像。此时,高亮金属、高反光物体由于自身是反射高亮的光线成像的,反射光的能量相对发光光源的能力非常低,所以,这些高亮金属、高反光的物体在第二参考图像中对应的成像,随着曝光值的降低,也变成了灰色或者黑色区域;噪声生成的亮区同样也会随着曝光值的降低而变灰、变黑;此时,只有真正的发光光源由于能量较高,在第二摄像头降低曝光值之后还是会相对比较亮,接近白色。In this implementation manner, reducing the exposure value will cause the second reference image captured by the second camera to become a relatively dark image. At this time, since the bright metal and highly reflective objects themselves are imaged by reflecting bright light, the energy of the reflected light is very low compared to the ability of the light source. Therefore, these bright metal and highly reflective objects are displayed in the second reference image The corresponding imaging, as the exposure value decreases, also becomes a gray or black area; the bright area generated by the noise will also become gray or black as the exposure value decreases; at this time, only the real light source due to The energy is high, and after the second camera reduces the exposure value, it will still be relatively bright, close to white.
结合第一方面,在第一方面的一种实现方式中,对所述第二摄像头进行降低曝光值处理,包括:With reference to the first aspect, in an implementation manner of the first aspect, the processing of reducing the exposure value of the second camera includes:
保持感光度不变,降低所述第二摄像头对应的曝光时间;或者,Keeping the sensitivity constant, reducing the exposure time corresponding to the second camera; or,
保持曝光时间不变,降低所述第二摄像头对应的感光度。The exposure time is kept constant, and the sensitivity corresponding to the second camera is reduced.
在该实现方式中,通过降低曝光时间或感光度可以降低第二摄像头的曝光值。此外,还可以同时降低曝光时间和感光度。In this implementation manner, the exposure value of the second camera can be reduced by reducing the exposure time or sensitivity. In addition, exposure time and sensitivity can be reduced at the same time.
结合第一方面,在第一方面的一种实现方式中,在对所述第二摄像头进行虚焦处理,和/或,降低曝光值处理之前,所述方法还包括:With reference to the first aspect, in an implementation manner of the first aspect, before performing virtual focus processing on the second camera, and/or before reducing the exposure value, the method further includes:
利用所述第二摄像头采集第二图像;using the second camera to capture a second image;
对所述第一图像和所述第二图像进行亮度阈值识别和形状检测,确定所述第一图像中的待测区域和所述第二图像中的待测区域并进行匹配;performing brightness threshold recognition and shape detection on the first image and the second image, determining and matching the area to be tested in the first image and the area to be tested in the second image;
基于所述参考图像,确定所述第一图像中包括的目标光源,包括:Based on the reference image, determining a target light source included in the first image includes:
对所述参考图像进行所述亮度阈值识别和所述形状检测,确定所述参考图像中的目标区域,所述目标区域与所述第二图像中的待测区域具有对应关系;performing the brightness threshold identification and the shape detection on the reference image, and determining a target area in the reference image, where the target area has a corresponding relationship with an area to be tested in the second image;
确定具有对应的目标区域的所述第一图像中的待测区域为目标光源。Determining the area to be measured in the first image with the corresponding target area as the target light source.
在该实现方式中,将第一图像中的待测区域和第二图像中的待测区域进行匹配,又因为第二参考图像中的目标区域与第二图像中的待测区域具有对应关系,从而可以将第一图像中的待测区域与第二参考图像中的目标区域关联起来。当第二参考图像中具有与第一图像中的待测区域具有关联的目标区域时,说明该待测区域指示真实的光源位置;当第二参考图像中没有与第一图像中的待测区域具有关联的目标区域时,说明该待测区域指示的是假的光源位置,例如为高反光物体、高亮金属或噪声形成的亮区。由此,以第二参考图像为参考,通过简单对比即可确定出第一图像中真实和虚假的光源。In this implementation, the area to be tested in the first image is matched with the area to be tested in the second image, and because the target area in the second reference image has a corresponding relationship with the area to be tested in the second image, Therefore, the area to be tested in the first image can be associated with the target area in the second reference image. When there is a target area associated with the area to be tested in the first image in the second reference image, it means that the area to be tested indicates the real position of the light source; If there is an associated target area, it means that the area to be detected indicates a false light source position, such as a bright area formed by a highly reflective object, a bright metal, or noise. Thus, with the second reference image as a reference, the real and false light sources in the first image can be determined through simple comparison.
结合第一方面,在第一方面的一种实现方式中,所述第二摄像头包括至少一个第二摄像头。With reference to the first aspect, in an implementation manner of the first aspect, the second camera includes at least one second camera.
当具有多个第二摄像头时,可以对多个第二摄像头分别进行虚焦和/或降低曝光值处理,结合多个第二摄像头拍摄的参考图像中的目标区域,来确定出第一图像中的目标光源。辅助的摄像头越多,检测的越准确。When there are multiple second cameras, virtual focus and/or exposure value reduction processing can be performed on the multiple second cameras, and combined with the target areas in the reference images captured by the multiple second cameras, the first image can be determined target light source. The more auxiliary cameras, the more accurate the detection.
第二方面,提供了一种电子设备,所述电子设备包括:一个或多个处理器、存储器和显示屏;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:In a second aspect, an electronic device is provided, and the electronic device includes: one or more processors, a memory, and a display screen; the memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code comprising computer instructions that are invoked by the one or more processors to cause the electronic device to perform:
启动所述电子设备的相机应用程序;launch the camera application of the electronic device;
利用所述第一摄像头采集第一图像;using the first camera to capture a first image;
对所述第二摄像头进行虚焦处理,和/或,降低曝光值处理;Perform virtual focus processing on the second camera, and/or reduce exposure value processing;
利用处理后的所述第二摄像头采集参考图像;Using the processed second camera to capture a reference image;
基于所述参考图像,确定所述第一图像中包括的目标光源。Target light sources included in the first image are determined based on the reference image.
结合第二方面,在第二方面的一种实现方式中,对所述第二摄像头进行虚焦处理,包括:With reference to the second aspect, in an implementation manner of the second aspect, performing virtual focus processing on the second camera includes:
将所述第二摄像头中镜头与图像传感器之间的距离减小到小于采集所述第一图像时,所述第一摄像头中镜头与图像传感器之间的距离。reducing the distance between the lens in the second camera and the image sensor to be smaller than the distance between the lens in the first camera and the image sensor when capturing the first image.
结合第二方面,在第二方面的一种实现方式中,对所述第二摄像头进行降低曝光值处理,包括:With reference to the second aspect, in an implementation manner of the second aspect, the processing of reducing the exposure value of the second camera includes:
将所述第二摄像头对应的曝光值降低为采集所述第一图像时,所述第一摄像头对应的曝光值的一半。reducing the exposure value corresponding to the second camera to half of the exposure value corresponding to the first camera when capturing the first image.
结合第二方面,在第二方面的一种实现方式中,对所述第二摄像头进行降低曝光值处理,包括:With reference to the second aspect, in an implementation manner of the second aspect, the processing of reducing the exposure value of the second camera includes:
保持感光度不变,降低所述第二摄像头对应的曝光时间;或者,Keeping the sensitivity constant, reducing the exposure time corresponding to the second camera; or,
保持曝光时间不变,降低所述第二摄像头对应的感光度。The exposure time is kept constant, and the sensitivity corresponding to the second camera is reduced.
结合第二方面,在第二方面的一种实现方式中,在对所述第二摄像头进行虚焦处理,和/或,降低曝光值处理之前,所述方法还包括:With reference to the second aspect, in an implementation manner of the second aspect, before performing virtual focus processing on the second camera, and/or before reducing the exposure value, the method further includes:
利用所述第二摄像头采集第二图像;using the second camera to capture a second image;
对所述第一图像和所述第二图像进行亮度阈值识别和形状检测,确定所述第一图像中的待测区域和所述第二图像中的待测区域并进行匹配;performing brightness threshold recognition and shape detection on the first image and the second image, determining and matching the area to be tested in the first image and the area to be tested in the second image;
基于所述参考图像,确定所述第一图像中包括的目标光源,包括:Based on the reference image, determining a target light source included in the first image includes:
对所述参考图像进行所述亮度阈值识别和所述形状检测,确定所述参考图像中的目标区域,所述目标区域与所述第二图像中的待测区域具有对应关系;performing the brightness threshold identification and the shape detection on the reference image, and determining a target area in the reference image, where the target area has a corresponding relationship with an area to be tested in the second image;
确定具有对应的目标区域的所述第一图像中的待测区域为目标光源。Determining the area to be measured in the first image with the corresponding target area as the target light source.
结合第二方面,在第二方面的一种实现方式中,所述第二摄像头包括至少一个第二摄像头。With reference to the second aspect, in an implementation manner of the second aspect, the second camera includes at least one second camera.
第三方面,提供了一种光源检测装置,包括用于执行第一方面中任一种光源检测方法的单元。In a third aspect, a light source detection device is provided, including a unit for performing any light source detection method in the first aspect.
在一种可能的实现方式中,当该光源检测装置是电子设备时,该处理单元可以是处理器,该输入单元可以是通信接口;该电子设备还可以包括存储器,该存储器用于存储计算机程序代码,当该处理器执行该存储器所存储的计算机程序代码时,使得该电子设备执行第一方面中的任一种方法。In a possible implementation, when the light source detection device is an electronic device, the processing unit may be a processor, and the input unit may be a communication interface; the electronic device may also include a memory, and the memory is used to store computer programs A code for causing the electronic device to execute any method in the first aspect when the processor executes the computer program code stored in the memory.
第四方面,提供了一种芯片,所述芯片应用于电子设备,所述芯片包括一个或多个处理器,所述处理器用于调用计算机指令以使得所述电子设备执行第一方面中的任一种光源检测方法。In a fourth aspect, a chip is provided, the chip is applied to an electronic device, and the chip includes one or more processors, and the processor is used to invoke computer instructions so that the electronic device performs any of the tasks in the first aspect. A light source detection method.
第五方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序代码,当所述计算机程序代码被电子设备运行时,使得该电子设备执行第一方面中的任一种光源检测方法。In a fifth aspect, a computer-readable storage medium is provided, the computer-readable storage medium stores computer program codes, and when the computer program codes are executed by an electronic device, the electronic device executes any of the items in the first aspect. A light source detection method.
第六方面,提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码被电子设备运行时,使得该电子设备执行第一方面中的任一种光源检测方法。In a sixth aspect, a computer program product is provided, the computer program product comprising: computer program code, when the computer program code is run by an electronic device, the electronic device is made to perform any light source detection in the first aspect method.
本申请实施例提供的光源检测方法,通过启用一个第一摄像头和至少一个第二摄像头,在拍摄时,利用第一摄像头采集第一图像,而对第二摄像头进行虚焦、降低曝光值处理,再利用处理后的第二摄像头采集第二参考图像;对第二摄像头采集的第二参考图像进行亮度阈值识别以及形状检测;然后,再利用该检测结果辅助第一图像筛除掉高反光物体、高亮金属、噪声等产生的高亮区域,从中识别出真正的光源作为目标光源。In the light source detection method provided in the embodiment of the present application, by enabling one first camera and at least one second camera, when shooting, the first camera is used to capture the first image, and the second camera is defocused and the exposure value is reduced. Then use the processed second camera to capture a second reference image; perform brightness threshold recognition and shape detection on the second reference image captured by the second camera; then, use the detection result to assist the first image to screen out highly reflective objects, The highlight area generated by highlighting metal, noise, etc., from which the real light source is identified as the target light source.
由于相关电子设备普遍都包括多个摄像头,因此,本申请无需做结构上的修改,仅需要调用多个摄像头,经过简单的虚焦和/或降低曝光值处理即可进行检测,方法简单,检测效率较高,检测准确度也非常高。Since related electronic equipment generally includes multiple cameras, this application does not need to make structural modifications, and only needs to call multiple cameras, and the detection can be performed after simple virtual focus and/or exposure value reduction processing. The method is simple and the detection The efficiency is high, and the detection accuracy is also very high.
附图说明Description of drawings
图1是一种适用于本申请的应用场景的示意图;Figure 1 is a schematic diagram of an application scenario applicable to this application;
图2是本申请实施例提供的一种光源检测方法的流程示意图;Fig. 2 is a schematic flow chart of a light source detection method provided by an embodiment of the present application;
图3是本申请实施例提供的一种摄像头的布局示意图;FIG. 3 is a schematic layout diagram of a camera provided in an embodiment of the present application;
图4是本申请实施例提供的一种光源检测过程中的图像示意图;FIG. 4 is a schematic diagram of an image during a light source detection process provided by an embodiment of the present application;
图5是本申请实施例提供的另一种光源检测过程中的图像示意图;FIG. 5 is a schematic diagram of another light source detection process provided by the embodiment of the present application;
图6是本申请实施例提供的一种显示界面示意图;Fig. 6 is a schematic diagram of a display interface provided by an embodiment of the present application;
图7是一种适用于本申请的电子设备的硬件系统的示意图;FIG. 7 is a schematic diagram of a hardware system applicable to the electronic device of the present application;
图8是一种适用于本申请的电子设备的软件系统的示意图;Fig. 8 is a schematic diagram of a software system applicable to the electronic device of the present application;
图9是本申请提供的一种光源检测装置的结构示意图;Fig. 9 is a schematic structural diagram of a light source detection device provided by the present application;
图10是本申请提供的一种芯片的结构示意图。FIG. 10 is a schematic structural diagram of a chip provided by the present application.
具体实施方式detailed description
下面将结合附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
首先,对本申请实施例中的部分用语进行解释说明,以便于本领域技术人员理解。First of all, some terms used in the embodiments of the present application are explained to facilitate the understanding of those skilled in the art.
1、RGB(red,green,blue)颜色空间,或者称为RGB域,指的是一种与人的视觉系统结构相关的颜色模型。根据人眼睛的结构,将所有颜色都当作是红色、绿色和蓝色的不同组合。1. The RGB (red, green, blue) color space, or RGB domain, refers to a color model related to the structure of the human visual system. According to the structure of the human eye, all colors are seen as different combinations of red, green and blue.
2、YUV颜色空间,或者称为YUV域,指的是一种颜色编码方法,Y表示亮度,U和V表示的则是色度。上述RGB颜色空间着重于人眼对色彩的感应,YUV颜色空间则着重于视觉对亮度的敏感程度,RGB颜色空间和YUV颜色空间可以互相转换。2. The YUV color space, or YUV domain, refers to a color coding method, Y represents brightness, and U and V represent chroma. The above-mentioned RGB color space focuses on the human eye's perception of color, while the YUV color space focuses on the sensitivity of vision to brightness. RGB color space and YUV color space can be converted to each other.
3、亮度(lighting value,LV)值,用于估计环境亮度,其具体计算公式如下:3. The brightness (lighting value, LV) value is used to estimate the ambient brightness. The specific calculation formula is as follows:
其中,Exposure为曝光时间,Aperture为光圈大小,ISO为感光度,Luma为XYZ颜色空间中,Y的平均值。Among them, Exposure is the exposure time, Aperture is the aperture size, ISO is the sensitivity, and Luma is the average value of Y in the XYZ color space.
4、自动对焦(automatic focus,AF),是指电子设备通过调整聚焦镜头的位置,获得最高的图像频率成分,以得到更高的图像对比度。其中,自动对焦是一个不断积累的过程,电子设备比较镜头在不同位置下拍摄的图像的对比度,从而获得图像的对比度最大时镜头的位置,进而确定对焦的焦距。4. Autofocus (automatic focus, AF) means that the electronic device obtains the highest image frequency component by adjusting the position of the focusing lens to obtain a higher image contrast. Among them, automatic focusing is a process of continuous accumulation. The electronic device compares the contrast of images captured by the lens at different positions, so as to obtain the position of the lens when the contrast of the image is maximum, and then determine the focal length of the focus.
5、焦距,焦距的大小标志着折光能力的大小,焦距越短,其折光能力就越大。5. Focal length, the size of the focal length marks the size of the refractive power, the shorter the focal length, the greater the refractive power.
光学镜头组件的焦距决定了该光学镜头组件拍摄的被摄物体在成像平面上所生成图像的大小。假设以相同的距离面对同一被摄物体进行拍摄,那么光学镜头组件的焦距越长,则被摄体在感光元件(charge-coupled device,CCD)上所生成的图像的放大倍数就越大。The focal length of the optical lens assembly determines the size of the image generated on the imaging plane of the object captured by the optical lens assembly. Assuming that the same subject is photographed at the same distance, the longer the focal length of the optical lens assembly, the greater the magnification of the image generated by the subject on the charge-coupled device (CCD).
6、对焦距离,是指物体和成像之间的距离,是镜头到物体的距离与镜头到感光元件的距离之和。6. The focus distance refers to the distance between the object and the imaging, which is the sum of the distance from the lens to the object and the distance from the lens to the photosensitive element.
7、拍摄参数,可包括快门、曝光时间、光圈值(aperture value,AV)、曝光值(exposure value,EV)和感光度ISO。以下分别进行介绍。7. Shooting parameters, including shutter speed, exposure time, aperture value (AV), exposure value (exposure value, EV) and sensitivity ISO. The following are introduced respectively.
快门是控制光线进入摄像头时间长短,以决定图像曝光时间的装置。快门保持在开启状态的时间越长,进入摄像头的光线越多,图像对应的曝光时间越长。相反,快门保持在开启状态的时间越短,进入摄像头的光线越少,图像对应的曝光时间越短。The shutter is a device that controls the length of time that light enters the camera to determine the exposure time of the image. The longer the shutter is left open, the more light enters the camera and the longer the corresponding exposure time for the image. Conversely, the shorter the shutter remains open, the less light enters the camera and the shorter the exposure time for the image.
曝光时间是指为了将光投射到摄像头的感光材料的感光面上,快门所要打开的时间。曝光时间由感光材料的感光度和感光面上的照度确定。曝光时间越长,进入摄像头的光越多,曝光时间越短,进入摄像头的光越少。因此,暗光场景下需要长的曝光时间,逆光场景下需要短的曝光时间。Exposure time refers to the time for the shutter to be open in order to project light onto the photosensitive surface of the photosensitive material of the camera. The exposure time is determined by the sensitivity of the photosensitive material and the illuminance on the photosensitive surface. The longer the exposure time, the more light enters the camera, and the shorter the exposure time, the less light enters the camera. Therefore, a long exposure time is required in a dark scene, and a short exposure time is required in a backlit scene.
光圈值(f值),是摄像头中的镜头(lens)的焦距与镜头通光直径的比值。光圈值越大,进入摄像头的光线越多。光圈值越小,进入摄像头的光线越少。The aperture value (f value) is the ratio of the focal length of the lens (lens) in the camera to the diameter of the lens. The larger the aperture value, the more light enters the camera. The smaller the aperture value, the less light enters the camera.
曝光值,是曝光时间和光圈值组合起来表示摄像头的镜头通光能力的一个数值。曝光值可以定义为:Exposure value is a value that combines the exposure time and aperture value to represent the light-transmitting ability of the camera lens. The exposure value can be defined as:
其中,N为光圈值;t为曝光时间,单位为秒。Among them, N is the aperture value; t is the exposure time in seconds.
ISO,用于衡量底片对于光的灵敏程度,即感光度或增益。对于不敏感的底片,需要更长的曝光时间以达到跟敏感底片亮度相同的成像。对于敏感的底片,需要较短的曝光时间以达到与不敏感的底片亮度相同的成像。ISO, a measure of how sensitive a film is to light, known as sensitivity or gain. For insensitive negatives, longer exposure times are required to achieve the same brightness as sensitive negatives. For sensitive negatives, shorter exposure times are required to achieve the same brightness as for insensitive negatives.
拍摄参数中,快门、曝光时间、光圈值、曝光值和ISO,电子设备可通过算法实现自动对焦(auto focus,AF)、自动曝光(automatic exposure,AE)、自动白平衡(auto whitebalance,AWB)中的至少一项,以实现这些拍摄参数的自动调节。Among the shooting parameters, shutter, exposure time, aperture value, exposure value and ISO, electronic equipment can realize auto focus (auto focus, AF), auto exposure (automatic exposure, AE), auto white balance (auto white balance, AWB) through algorithms At least one of them to realize the automatic adjustment of these shooting parameters.
示例性地,上述曝光值的取值可以为-24、-4、-3、-2、-1、0、1、2、3、4、24中的任一项。Exemplarily, the above exposure value may be any one of -24, -4, -3, -2, -1, 0, 1, 2, 3, 4, 24.
EV0对应的曝光图像,用于指示电子设备通过算法实现曝光时,通过确定的曝光值0来捕获的曝光图像。EV-2对应的曝光图像,用于指示电子设备通过算法实现曝光时,通过确定的曝光值-2来捕获的曝光图像。EV1对应的曝光图像,用于指示电子设备通过算法实现曝光时,通过确定的曝光值1来捕获的曝光图像。其他依次类推,在此不再赘述。The exposure image corresponding to EV0 is used to indicate the exposure image captured by the determined exposure value 0 when the electronic device achieves exposure through an algorithm. The exposure image corresponding to EV-2 is used to indicate the exposure image captured by the determined exposure value -2 when the electronic device achieves exposure through an algorithm. The exposure image corresponding to EV1 is used to indicate the exposure image captured by the determined exposure value 1 when the electronic device achieves exposure through an algorithm. Others are analogized in turn, and will not be repeated here.
其中,曝光值每增加1将改变一挡曝光,也就是将曝光量(指物体表面某一面元接收的光照度在时间t内的积分)增加一倍,比如将曝光时间或光圈面积增加一倍。那么,曝光值的增加将对应于更慢的快门速度和更小的f值。由此可知,EV0相对于EV-2,曝光值增加了2,改变了两挡曝光;同理,EV1相对于EV0,曝光值增加了1,改变了一挡曝光。Among them, every increase of 1 in the exposure value will change the exposure by one stop, that is, doubling the exposure (referring to the integral of the illuminance received by a surface element on the surface of the object within time t), such as doubling the exposure time or aperture area. An increase in exposure value would then correspond to a slower shutter speed and smaller f-number. It can be seen from this that the exposure value of EV0 is increased by 2 relative to EV-2, which changes the exposure by two stops; similarly, the exposure value of EV1 is increased by 1 relative to EV0, which changes the exposure by one stop.
此处,当曝光值EV等于0时,该曝光值通常为当前照明条件下的最佳曝光值。相应的,在EV0的条件下电子设备对应获取的曝光图像,为当前照明条件下的最佳曝光图像,该最佳曝光图像也可以称为参考曝光图像。Here, when the exposure value EV is equal to 0, the exposure value is usually the best exposure value under the current lighting conditions. Correspondingly, the exposure image correspondingly acquired by the electronic device under the condition of EV0 is an optimal exposure image under the current lighting condition, and the optimal exposure image may also be referred to as a reference exposure image.
应理解,该“最佳”曝光图像指的是给定的电子设备通过算法确定的曝光图像,当电子设备不同、算法不同或当前照明条件不同时,确定的最佳曝光图像不同。It should be understood that the "best" exposure image refers to an exposure image determined by a given electronic device through an algorithm. When the electronic device is different, the algorithm is different, or the current lighting conditions are different, the determined optimal exposure image is different.
以上是对本申请实施例所涉及的名词的简单介绍,以下不再赘述。The above is a brief introduction to the nouns involved in the embodiments of the present application, and details will not be repeated below.
本申请实施例提供的光源检测方法可以适用于各种电子设备。The light source detection method provided in the embodiment of the present application may be applicable to various electronic devices.
在本申请的一些实施例中,该电子设备可以是运动相机、数码相机等各种摄像装置、手机、智慧屏、平板电脑、可穿戴电子设备、车载电子设备、增强现实(augmentedreality,AR)设备、虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digitalassistant,PDA)、投影仪等等,本申请实施例对电子设备的具体类型不作任何限制。In some embodiments of the present application, the electronic device may be various camera devices such as sports cameras, digital cameras, mobile phones, smart screens, tablet computers, wearable electronic devices, vehicle-mounted electronic devices, and augmented reality (augmented reality, AR) devices , virtual reality (virtual reality, VR) equipment, notebook computer, ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook, personal digital assistant (personal digital assistant, PDA), projector, etc. The specific type of electronic device is not limited in any way.
结合电子设备,图1是本申请实施例提供的光源检测方法的应用场景的示意图。In combination with electronic devices, FIG. 1 is a schematic diagram of an application scenario of a light source detection method provided in an embodiment of the present application.
示例性地,本申请实施例中的光源检测方法可以应用于拍照领域;例如,本申请的光源检测方法可以应用于在具有光源的拍摄环境中拍摄包括光源在内的拍摄对象。拍摄环境可以为自然外景、实景外景、实景内景、摄影棚内景等拍摄环境。光源可以包括自然光源和人造光源,例如,太阳、打开的电灯、燃烧着的蜡烛等都是光源。其中,光源可以包括一个光源,也可以包括多个光源。Exemplarily, the light source detection method in the embodiment of the present application can be applied to the photographing field; for example, the light source detection method of the present application can be applied to photographing objects including the light source in a shooting environment with light sources. The shooting environment may be a shooting environment such as a natural exterior scene, a real scene exterior scene, a real scene interior scene, or a studio interior scene. Light sources may include natural light sources and artificial light sources, for example, the sun, a turned on electric light, a burning candle, etc. are all light sources. Wherein, the light source may include one light source, or may include multiple light sources.
例如,如图1所示,以电子设备100是手机为例,拍摄对象包括便利店的玻璃门、门前的圣诞树、以及旁边提供照明的光源101(例如,路灯)。电子设备100运行相机应用程序,电子设备100采集包括拍摄对象的图像的过程中,显示屏上可以实时显示包括光源101在内的拍摄对象的预览图像;当用户在查看电子设备100的显示屏上的预览图像时,若想要以图1所示的视角拍摄时,则可以点击显示屏上显示的拍摄控件。当电子设备100的拍摄控件被触发,电子设备100可以拍摄到如图1中所示的包括光源101在内的拍摄对象的图像。For example, as shown in FIG. 1 , taking the
结合图1所示,当电子设备拍摄包括光源101在内的拍摄对象时,由于光源产生的亮度比较高,影响周围环境的光影效果,进而影响图像传感器采集的图像,可能会使得电子设备采集的图像出现模糊、局部过曝等问题。因此,相关技术通常会先根据亮度阈值识别的方法来检测出图像中的光源位置,例如将大于预设亮度阈值的局部区域确定为光源所在区域,然后再进行校正或其他一系列处理。As shown in FIG. 1 , when an electronic device photographs an object including the
然而,相关技术提供的检测方法鲁棒性不高,光源检测结果不准确。针对真实的发光光源和高反光形成的亮区,以及噪声形成的亮区等,相关方法无法正确分辨,会错误的将一些高反光物体、高亮金属形成的亮区等检测为光源,进而造成后续处理的困扰。针对这一问题,亟需一种新的检测方法进行解决。However, the detection method provided by the related technology is not robust, and the light source detection result is inaccurate. For the real luminous light source, the bright area formed by high reflection, and the bright area formed by noise, the relevant methods cannot correctly distinguish, and some highly reflective objects and bright areas formed by high-brightness metals will be mistakenly detected as light sources, which will cause Follow-up problems. To solve this problem, a new detection method is urgently needed.
有鉴于此,本申请实施例提供一种光源检测方法,在启用第一摄像头和第二摄像头进行拍摄的情况下,通过对第二摄像头进行虚焦和/或降低曝光值处理,使得处理后的第二摄像头采集到的参考图像中的非真实光源的区域变模糊、变黑;然后,结合该参考图像辅助第一图像筛除掉高反光物体、高亮金属、噪声等产生的高亮区域,从中识别出真正的光源,由此可以达到提高光源检测的准确度。In view of this, an embodiment of the present application provides a light source detection method. When the first camera and the second camera are enabled to take pictures, the second camera is processed by defocusing and/or reducing the exposure value, so that the processed The area of the non-real light source in the reference image collected by the second camera becomes blurred and blackened; then, combined with the reference image, the first image is assisted to filter out the highlighted areas generated by highly reflective objects, bright metal, noise, etc., The real light source is identified therefrom, thereby improving the accuracy of light source detection.
示例性地,在相机应用程序处于预览状态(例如,拍照预览)时,电子设备显示的预览图像中包括局部模糊、过曝等情况,在电子设备的拍摄控件被触发后,可以执行本申请实施例提供的光源检测方法;或者,在电子设备检测到用户点击某一拍照模式(例如,大光圈模式、夜景模式)时,根据该检测结果结合相关图像处理方法,可以得到更清晰、对比度更好、光影效果更自然的图像。Exemplarily, when the camera application is in the preview state (for example, photo preview), the preview image displayed by the electronic device includes local blurring, overexposure, etc., and after the shooting control of the electronic device is triggered, the implementation of the present application can be executed. The light source detection method provided in the example; or, when the electronic device detects that the user clicks on a certain camera mode (for example, large aperture mode, night scene mode), according to the detection result combined with related image processing methods, a clearer and better contrast can be obtained , Light and shadow effects more natural images.
可选地,在电子设备具有足够的运算能力的情况下,本申请实施例中的光源检测方法还可以应用于录制视频领域、视频通话领域或者其他图像处理领域。Optionally, if the electronic device has sufficient computing power, the light source detection method in the embodiment of the present application may also be applied to the field of video recording, video calling, or other image processing fields.
示例性地,视频通话场景可以包括但不限于以下场景中:Exemplarily, video call scenarios may include but not limited to the following scenarios:
视频通话、视频会议应用、长短视频应用、视频直播类应用、视频网课应用、人像智能运镜应用场景、系统相机录像功能录制视频、视频监控,或者智能猫眼等人像拍摄类场景等。Video calls, video conferencing applications, long-term and short-term video applications, video live broadcast applications, video online course applications, application scenarios of smart portrait mirroring, system camera recording function recording video, video surveillance, or portrait shooting scenarios such as smart cat eyes, etc.
应理解,上述为对应用场景的举例说明,并不对本申请的应用场景作任何限定。It should be understood that the foregoing is an illustration of an application scenario, and does not limit the application scenario of the present application in any way.
下面结合图2至图6对本申请实施例提供的光源检测方法进行详细地描述。The light source detection method provided by the embodiment of the present application will be described in detail below with reference to FIG. 2 to FIG. 6 .
图2是本申请实施例提供的一种光源检测方法的示意性流程图。该方法200可以由至少包括两个摄像头的电子设备执行。Fig. 2 is a schematic flowchart of a light source detection method provided by an embodiment of the present application. The
示例性地,图3为本申请实施例提供的一种电子设备上的摄像头的布局图。Exemplarily, FIG. 3 is a layout diagram of a camera on an electronic device according to an embodiment of the present application.
以电子设备100是手机为例,如图3中的(a)所示,在手机的后盖上可以排布两个摄像头,分别位于手机后盖左上角位置处的两个圆形区域中。该两个摄像头可以分别为广角摄像头1931和长焦摄像头1932。或者,如图3中的(b)所示,在手机的后盖上可以排布四个摄像头,该四个摄像头位于手机后盖上方中央的圆形区域中。该四个摄像头例如可以分别为超广角摄像头1933、广角摄像头1931、长焦摄像头1932和多光谱摄像头1934。Taking the
应理解,广角摄像头1931,由于对焦距离较小,所以适合拍摄近景,并且,顾名思义,广角摄像头适合拍摄视场角相对较大的场景。超广角摄像头1933对应的视场角范围相对大于广角摄像头1931对应的视场角范围,对焦距离更小,适合拍摄视场角更大的场景。长焦摄像头1932对应的视场角范围相对小于广角摄像头1931对应的视场角范围,对焦距离较大,所以适合拍摄远景。It should be understood that the wide-
多光谱摄像头1934,包含多光谱传感器的摄像头,其中,多光谱传感器为比三基色(RGB)传感器的光谱响应范围宽的其他多光谱传感器。例如,多光谱摄像头可以为红绿蓝青品黄(RGBCMY)传感器,该多光谱传感器的颜色还原能力以及信噪比表现相对于RGB传感器都有所提高。多光谱摄像头1934对应的视场角范围可以与主摄摄像头对应的视场角范围一致。
相对来说,超广角摄像头1933获取的图像细节更丰富,清晰度更高,长焦摄像头1932获取的图像细节较少,清晰度相对较低一些。Relatively speaking, the image obtained by the super wide-
当然,上述仅为两种示例,手机的后盖上还可以排布三个或者四个以上的摄像头,摄像头的具体数量和排布位置、以及每个摄像头的种类、功能可以根据需要进行设置和修改,本申请实施例对此不进行任何限制。Of course, the above are only two examples. Three or more cameras can also be arranged on the back cover of the mobile phone. Modification, the embodiment of this application does not impose any limitation on this.
在本申请实施例中,可以启用两个或两个以上摄像头,其中,一个可以称为第一摄像头,其他摄像头称为第二摄像头;第一摄像头用于正常采集图像,第二摄像头用于进行处理后辅助识别第一摄像头采集的图像中的光源。可以理解的是,第一摄像头和第二摄像头仅为一种指示,指示的具体摄像头可以根据需要进行更换。In this embodiment of the application, two or more cameras can be enabled, one of which can be called the first camera, and the other cameras can be called the second camera; the first camera is used for normal image collection, and the second camera is used for After processing, assist in identifying the light source in the image captured by the first camera. It can be understood that the first camera and the second camera are only an indication, and the indicated specific cameras can be replaced as required.
例如,当电子设备包括两个摄像头时,一个摄像头为广角摄像头,另一个摄像头为超广角摄像头,可以称广角摄像头为第一摄像头,超广角摄像头为第二摄像头。超广角摄像头用于辅助识别广角摄像头采集的图像中的光源。For example, when an electronic device includes two cameras, one of which is a wide-angle camera and the other is a super-wide-angle camera, the wide-angle camera can be called a first camera, and the super-wide-angle camera can be called a second camera. The ultra-wide-angle camera is used to assist in identifying light sources in images captured by the wide-angle camera.
结合上述示例,本申请实施例提供的光源检测方法200可以包括以下S201至S206,下面分别对S201至S206进行详细地描述。With reference to the above examples, the light
S201、启动电子设备中的相机应用程序。S201. Start a camera application in the electronic device.
示例性地,用户可以通过单击“相机”应用程序的图标,指示电子设备启动相机应用;或者,电子设备处于锁屏状态时,用户可以通过在电子设备的显示屏上向右滑动的手势,指示电子设备启动相机应用。又或者,电子设备处于锁屏状态,锁屏界面上包括相机应用程序的图标,用户通过点击相机应用程序的图标,指示电子设备启动相机应用程序。又或者,电子设备在运行其他应用时,该应用具有调用相机应用程序的权限;用户通过点击相应的控件可以指示电子设备启动相机应用程序。例如,电子设备正在运行即时通信类应用程序时,用户可以通过选择相机功能的控件,指示电子设备启动相机应用程序等。Exemplarily, the user can instruct the electronic device to start the camera application by clicking the icon of the "camera" application; or, when the electronic device is in a locked screen state, the user can slide right on the display screen of the electronic device The electronic device is instructed to launch a camera application. Alternatively, the electronic device is in a locked screen state, and the lock screen interface includes an icon of the camera application program, and the user instructs the electronic device to start the camera application program by clicking the icon of the camera application program. Alternatively, when the electronic device is running other applications, the application has the permission to call the camera application program; the user can instruct the electronic device to start the camera application program by clicking a corresponding control. For example, when the electronic device is running an instant messaging application, the user may instruct the electronic device to start the camera application by selecting the control of the camera function.
应理解,上述为对启动相机应用程序的操作的举例说明;还可以通过语音指示操作,或者其它操作的指示电子设备启动相机应用程序;本申请对此不作任何限定。It should be understood that the above is an example of the operation of starting the camera application program; the camera application program can also be started by voice instruction operation, or other operation instruction electronic devices; this application does not make any limitation on this.
还应理解,启动相机应用程序可以是指运行相机应用程序。It should also be understood that launching the camera application may refer to running the camera application.
S202、利用第一摄像头采集第一图像。S202. Collect a first image by using the first camera.
其中,第一图像为第一摄像头对拍摄对象采集的图像,第一摄像头可以为超广角摄像头、广角摄像头、长焦摄像头和多光谱摄像头中的任意一种类型的摄像头;拍摄对象可以包括光源,第一图像包括一个或多个待测区域,待测区域可以通过亮度阈值识别和形状检测确定出。Wherein, the first image is an image collected by the first camera for the subject, and the first camera may be any type of camera in an ultra-wide-angle camera, a wide-angle camera, a telephoto camera and a multispectral camera; the subject may include a light source, The first image includes one or more regions to be detected, and the regions to be detected can be determined through brightness threshold recognition and shape detection.
应理解,第一图像可以为电子设备执行第一摄像头相关的算法,根据算法确定出镜头与图像传感器之间的目标距离、曝光值并进行调节后,利用第一摄像头所采集的图像。第一图像为一帧清晰的图像。此处,第一摄像头对应的镜头与图像传感器之间的目标距离指的是拍摄清晰的图像时,第一摄像头中的镜头与图像传感器之间的距离。It should be understood that the first image may be an image captured by the first camera after the electronic device executes an algorithm related to the first camera, determines and adjusts the target distance and exposure value between the lens and the image sensor according to the algorithm. The first image is a clear image. Here, the target distance between the lens corresponding to the first camera and the image sensor refers to the distance between the lens of the first camera and the image sensor when capturing a clear image.
应理解,第一图像包括的一个或多个待测区域为待检测的光源位置,其中有可能是真实的光源所对应的亮区,也有可能是高反光物体、高亮金属形成的亮区。It should be understood that the one or more areas to be detected included in the first image are the positions of the light sources to be detected, which may be bright areas corresponding to real light sources, or bright areas formed by highly reflective objects or bright metals.
还应理解,待测区域可以基于图像中每个像素对应的RGB像素值进行阈值识别后确定;或者,可以基于亮度值进行阈值识别后确定。待测区域的形状可以根据需要进行划分,本申请实施例对此不进行限制。It should also be understood that the area to be detected may be determined after threshold recognition based on RGB pixel values corresponding to each pixel in the image; or, may be determined after threshold recognition based on brightness values. The shape of the area to be measured can be divided according to needs, which is not limited in this embodiment of the present application.
示例性地,第一图像可以如图4中的(a)所示的图像,图像中包括四个待测区域,分别为a1、a2、a3和a4,该四个待测区域即为待检测的光源位置。Exemplarily, the first image may be an image as shown in (a) in FIG. position of the light source.
可选地,第一图像可以为位于RAW域的图像、位于RGB域的图像,或者,还可以为位于YUV域的图像。Optionally, the first image may be an image located in the RAW domain, an image located in the RGB domain, or may also be an image located in the YUV domain.
S203、对第二摄像头进行虚焦处理,并利用虚焦处理后的第二摄像头采集第一参考图像。S203. Perform virtual focus processing on the second camera, and use the virtual focus processed second camera to capture a first reference image.
其中,第一参考图像为第二摄像头基于第一曝光值,进行虚焦处理后对拍摄对象采集的图像,第二摄像头也可以为超广角摄像头、长焦摄像头和多光谱摄像头中的任意一种类型的摄像头;第二摄像头的类型可以与第一摄像头不同,或者,也可以相同。第二摄像头所拍摄的拍摄对象与第一摄像头所拍摄的拍摄对象相同。Wherein, the first reference image is an image collected by the second camera based on the first exposure value, after performing virtual focus processing on the subject, and the second camera can also be any one of a super wide-angle camera, a telephoto camera and a multi-spectral camera type of camera; the type of the second camera may be different from that of the first camera, or may also be the same. The subject captured by the second camera is the same as the subject captured by the first camera.
可选地,作为一种实现方式,在对第二摄像头进行虚焦处理之前,电子设备利用第二摄像头还可以采集第二图像。第二图像为电子设备执行第二摄像头相关的算法,根据算法确定出镜头与图像传感器之间的目标距离、曝光值并进行调节后,利用第二摄像头采集的图像。第二图像为一帧清晰的图像。此处,第二摄像头对应的镜头与图像传感器之间的目标距离指的是拍摄清晰的图像时,第二摄像头中镜头与图像传感器之间的距离。第二图像可以包括多个待测区域,待测区域可以通过亮度阈值识别和形状检测确定出;第二图像中的待测区域和第一图像中的待测区域的位置具有匹配关系。Optionally, as an implementation manner, before performing virtual focus processing on the second camera, the electronic device may further capture a second image by using the second camera. The second image is an image collected by the second camera after the electronic device executes an algorithm related to the second camera, determines and adjusts the target distance and exposure value between the lens and the image sensor according to the algorithm. The second image is a clear image. Here, the target distance between the lens of the second camera and the image sensor refers to the distance between the lens of the second camera and the image sensor when capturing a clear image. The second image may include a plurality of regions to be detected, and the regions to be detected can be determined through brightness threshold recognition and shape detection; the positions of the regions to be detected in the second image and the regions to be detected in the first image have a matching relationship.
例如,第一图像中的中心坐标为(i1,j1)的待测区域与第二图像中的中心坐标为(p2,q2)的待测区域指示的是拍摄对象中的同一光源,比如同一个路灯。For example, the region to be measured with the center coordinates of (i1, j1) in the first image and the region to be measured with the center coordinates of (p2, q2) in the second image indicate the same light source in the subject, such as the same street light.
在此基础上,对第二摄像头进行虚焦处理指的是调整确定出的目标距离,使得第二摄像头中镜头与图像传感器之间的距离减小,从而使得虚焦处理后的第二摄像头采集的第一参考图像是模糊的,相对第二图像清晰度降低。第一参考图像相对于第一图像也是模糊的,清晰度降低。On this basis, performing virtual focus processing on the second camera refers to adjusting the determined target distance, so that the distance between the lens and the image sensor in the second camera is reduced, so that the second camera after the virtual focus processing The first reference image is blurred, with reduced sharpness relative to the second image. The first reference image is also blurred with reduced clarity relative to the first image.
应理解,电子设备中除了包括第二摄像头之外,还可以包括对焦处理部件和对焦马达。对焦处理部件用于采集第二摄像头中的图像传感器上所成的图像,并根据所采集的图像的清晰程度,控制对焦马达转动。对焦马达转动带动第二摄像头中的镜头移动,从而实现对焦功能。例如,对焦马达可以指示光学图像防抖(optical image stabilization,OIS)马达。It should be understood that, in addition to the second camera, the electronic device may also include a focus processing component and a focus motor. The focus processing component is used to collect the image formed on the image sensor in the second camera, and control the rotation of the focus motor according to the clarity of the collected image. The rotation of the focusing motor drives the lens in the second camera to move, thereby realizing the focusing function. For example, the focus motor may indicate an optical image stabilization (OIS) motor.
此处,在进行虚焦处理时,对焦处理部件可以控制对焦马达转动,对焦马达转动带动第二摄像头中的镜头向靠近图像传感器的方向移动,从而使得第二摄像头中的镜头与图像传感器的距离减小,第二摄像头逐渐虚焦,采集到模糊的第一参考图像。Here, when performing virtual focus processing, the focus processing component can control the rotation of the focus motor, and the rotation of the focus motor drives the lens in the second camera to move in a direction close to the image sensor, so that the distance between the lens in the second camera and the image sensor Decreases, the second camera gradually goes out of focus, and a blurred first reference image is collected.
可选地,作为另一种实现方式,在对第二摄像头进行虚焦处理时,可以先获取第一摄像头中的镜头与图像传感器之间的目标距离,再设定第二摄像头中镜头与图像传感器之间的目标距离为小于第一摄像头中的镜头与图像传感器之间的目标距离的数值。然后,依据该设定的数值,对第二摄像头中的镜头进行调整,再利用调整后的第二摄像头进行采集,从而可以得到模糊的第一参考图像。Optionally, as another implementation, when performing virtual focus processing on the second camera, the target distance between the lens in the first camera and the image sensor can be obtained first, and then the distance between the lens and the image in the second camera can be set. The target distance between the sensors is a value smaller than the target distance between the lens in the first camera and the image sensor. Then, according to the set value, the lens in the second camera is adjusted, and then the adjusted second camera is used for acquisition, so that a blurred first reference image can be obtained.
示例性地,若第一摄像头为广角摄像头,第二摄像头为超广角摄像头,通过计算确定出第一摄像头采集第一图像时所对应的镜头与图像传感器之间的目标距离为V1,第二摄像头中镜头离图像传感器之间的距离应小于第一摄像头的目标距离V1,于是,可以设定第二摄像头中镜头离图像传感器之间的距离为V2,V2小于V1。Exemplarily, if the first camera is a wide-angle camera and the second camera is an ultra-wide-angle camera, it is determined through calculation that the target distance between the corresponding lens and the image sensor when the first camera captures the first image is V1, and the second camera The distance between the middle lens and the image sensor should be smaller than the target distance V1 of the first camera, so the distance between the middle lens and the image sensor of the second camera can be set as V2, and V2 is smaller than V1.
进一步地,若第二摄像头中镜头离图像传感器之间的最小距离为V3,还可以直接设定第二摄像头中的镜头与图像传感器之间的距离为V3,此时,相当于对焦马达无需转动带动第二摄像头中的镜头移动,V3小于V1,V3小于或等于V2。Further, if the minimum distance between the lens and the image sensor in the second camera is V3, the distance between the lens and the image sensor in the second camera can also be directly set to be V3. At this time, it is equivalent to that the focus motor does not need to rotate Driving the lens in the second camera to move, V3 is smaller than V1, and V3 is smaller than or equal to V2.
可选地,第一摄像头对应的视场角范围小于或等于第二摄像头对应的视场角范围。Optionally, the field angle range corresponding to the first camera is smaller than or equal to the field angle range corresponding to the second camera.
应理解,当第一摄像头对应的视场角范围小于或等于第二摄像头对应的视场角范围时,在后续利用第二摄像头采集的图像辅助第一摄像头识别出真实的光源位置时,可以对第一摄像头所采集的图像中的所有待测区域均进行识别。It should be understood that when the field angle range corresponding to the first camera is smaller than or equal to the field angle range corresponding to the second camera, when the image captured by the second camera is used to assist the first camera in identifying the real light source position, the All regions to be tested in the images collected by the first camera are identified.
例如,第一摄像头对应的视场角范围等于第二摄像头对应的视场角范围,第一摄像头采集的第一图像可以如图4中的(a)所示的图像;第二摄像头进行虚焦处理后,所采集的第一参考图像可以如图4中的(b)所示的图像。For example, the field of view range corresponding to the first camera is equal to the field of view range corresponding to the second camera, the first image collected by the first camera may be as shown in (a) in Figure 4; the second camera performs virtual focus After processing, the collected first reference image may be the image shown in (b) of FIG. 4 .
如果第一摄像头对应的视场角范围大于第二摄像头对应的视场角范围时,第二摄像头采集的图像内容相当于是第一摄像头采集的图像内容的一部分,在后续利用第二摄像头采集的图像辅助第一摄像头识别出真实的光源位置时,只能对第一摄像头所采集的图像中的部分待测区域进行识别。若想要对第一摄像头的全部内容进行检测,则需要利用第二摄像头采集多个第一参考图像,且每个第一参考图像对应的内容不同,多个第一参考图像去重后能覆盖到第一摄像头的视场角范围。If the field of view range corresponding to the first camera is larger than the field of view range corresponding to the second camera, the content of the image captured by the second camera is equivalent to a part of the content of the image captured by the first camera. When assisting the first camera to identify the real light source position, only part of the region to be tested in the image captured by the first camera can be identified. If you want to detect all the content of the first camera, you need to use the second camera to capture multiple first reference images, and the corresponding content of each first reference image is different, and multiple first reference images can be overwritten after deduplication to the field of view range of the first camera.
在本申请实施例中,由于对第二摄像头进行了虚焦处理,可以使得第二摄像头采集的第一参考图像中的大部分物体变得虚化,例如,可以使得距离第二摄像头较远的背景中的物体变得模糊;高亮金属、高反光的物体由于自身是反射高亮的光线成像的,反射光的能量相对发光光源的能量非常低,所以,这些高亮金属、高反光的物体在第一参考图像中对应的成像,在虚焦处理后也变得模糊不清,与背景混合成一团。此时,只有真正的发光光源由于能量较高,在虚焦处理后也不会模糊,从而可以在模糊的背景中凸显出来,相对于周围变得较亮。In the embodiment of the present application, since the virtual focus processing is performed on the second camera, most of the objects in the first reference image captured by the second camera can become blurred, for example, objects farther away from the second camera can be made The objects in the background become blurred; the bright metal and highly reflective objects are imaged by reflecting bright light, and the energy of the reflected light is very low compared to the energy of the light source. Therefore, these bright metal and highly reflective objects The corresponding imaging in the first reference image also becomes blurred after defocus processing, and is mixed with the background. At this time, only the real luminous light source will not be blurred after the virtual focus processing due to its high energy, so it can stand out in the blurred background and become brighter relative to the surroundings.
需要说明的是,由于后续还需要对第二摄像头进行处理,此处在仅对第二摄像头进行虚焦处理后,也可以不采集第一参考图像。It should be noted that, since the second camera needs to be processed later, the first reference image may not be collected after only the virtual focus processing is performed on the second camera.
S204、降低第二摄像头对应的曝光值,并利用降低曝光值后的第二摄像头采集第二参考图像。S204. Reduce the exposure value corresponding to the second camera, and use the second camera with the reduced exposure value to capture a second reference image.
其中,第二参考图像为第二摄像头基于第二曝光值对拍摄对象采集的图像;或者,第二参考图像为第二摄像头虚焦处理后,基于第二曝光值对拍摄对象采集的图像。第二曝光值小于第一曝光值,同时,第二曝光值也小于第一摄像头采集第一图像时对应的曝光值。Wherein, the second reference image is an image captured by the second camera based on the second exposure value of the subject; or, the second reference image is an image acquired by the second camera based on the second exposure value of the subject after virtual focus processing. The second exposure value is smaller than the first exposure value, and at the same time, the second exposure value is also smaller than the corresponding exposure value when the first camera captures the first image.
此处,第一曝光值可以与第一摄像头采集第一图像时对应的曝光值相同,或者,第一曝光值可以小于第一摄像头采集第一图像时对应的曝光值。Here, the first exposure value may be the same as the corresponding exposure value when the first camera captures the first image, or the first exposure value may be smaller than the corresponding exposure value when the first camera captures the first image.
可选地,为了增强明暗对比效果,可以使得降低后的第二曝光值可以为第一摄像头对应的曝光值的一半。Optionally, in order to enhance the light-dark contrast effect, the reduced second exposure value may be half of the corresponding exposure value of the first camera.
例如,第二摄像头对应的曝光值为第一摄像头对应的曝光值的一半。第一摄像头采集的第一图像可以如图4中的(a)所示的图像;第二摄像头进行虚焦处理后,所采集的第一参考图像可以如图4中的(b)所示的图像;第二摄像头对应的曝光值降低后,继续采集的第二参考图像可以如图4中的(c)所示的图像。For example, the exposure value corresponding to the second camera is half of the exposure value corresponding to the first camera. The first image captured by the first camera can be as shown in (a) in Figure 4; after the second camera performs virtual focus processing, the first reference image collected can be as shown in (b) in Figure 4 Image; after the exposure value corresponding to the second camera decreases, the second reference image that continues to be collected may be the image shown in (c) in FIG. 4 .
可选地,由于曝光值与曝光时间和感光度ISO相关,由此,在降低第二摄像头对应的曝光值时,可以保持感光度ISO不变,而降低曝光时间;或者,也可以保持曝光时间不变,而降低感光度ISO的大小。Optionally, since the exposure value is related to the exposure time and the sensitivity ISO, when reducing the exposure value corresponding to the second camera, the sensitivity ISO can be kept unchanged, and the exposure time can be reduced; or, the exposure time can also be maintained The same, but reduce the size of the ISO sensitivity.
在本申请实施例中,降低曝光值会使得第二摄像头采集到的第二参考图像变成比较黑的图像;此时,高亮金属、高反光物体由于自身是反射高亮的光线成像的,反射光的能量相对发光光源的能力非常低,所以,这些高亮金属、高反光的物体在第二参考图像中对应的成像,随着曝光值的降低,也变成了灰色或者黑色区域;噪声生成的亮区同样也会随着曝光值的降低而变灰、变黑;此时,只有真正的发光光源由于能量较高,在第二摄像头降低曝光值之后还是会相对比较亮,接近白色。In the embodiment of the present application, reducing the exposure value will make the second reference image captured by the second camera become a relatively dark image; at this time, since the bright metal and highly reflective objects themselves are imaged by reflecting the bright light, The energy of the reflected light is very low compared to the ability of the luminous light source. Therefore, the corresponding imaging of these bright metal and highly reflective objects in the second reference image also becomes a gray or black area as the exposure value decreases; noise The generated bright areas will also turn gray and black as the exposure value decreases; at this time, only the real light source will still be relatively bright and close to white due to its high energy after the second camera reduces the exposure value.
应理解,由于发光光源的能量可能会各不相同,所以在降低曝光值后,能量相对较低一点的发光光源在第二参考图像中的成像也会变灰一些。It should be understood that since the energies of the luminescent light sources may vary, after the exposure value is reduced, the image of the luminous light source with a relatively lower energy in the second reference image will also become grayer.
S205、对第二参考图像进行亮度阈值识别和形状检测,确定目标区域。S205. Perform brightness threshold recognition and shape detection on the second reference image to determine a target area.
示例性地,若第二参考图像为YUV域的图像,则可以针对第二参考图像中的像素对应的Y值进行判断,确定大于预设Y阈值的像素所连通的像素区域为预选区域;然后针对预选区域进行形状检测,确定预选区域对应的形状,例如为圆形、长方形、正方形等。Y值表示亮度大小。Exemplarily, if the second reference image is an image in the YUV domain, it can be judged for the Y value corresponding to the pixel in the second reference image, and it is determined that the pixel area connected by the pixel greater than the preset Y threshold is the preselected area; then Perform shape detection for the preselected area, and determine the shape corresponding to the preselected area, such as circle, rectangle, square, etc. The Y value represents the brightness level.
若第二参考图像不是YUV域的图像,还可以利用颜色空间转换方法,将第二参考图像转成位于YUV域的图像,然后,再结合预设Y阈值进行判断;预设Y阈值的大小可以根据需要进行设置和修改,本申请实施例对此不进行任何限制。If the second reference image is not an image in the YUV domain, you can also use the color space conversion method to convert the second reference image into an image in the YUV domain, and then judge in conjunction with the preset Y threshold; the size of the preset Y threshold can be It can be set and modified as needed, and this embodiment of the present application does not impose any limitation on this.
应理解,针对第二参考图像确定出的检测结果可以为某一形状的目标区域,该目标区域中的像素的Y值大于预设Y阈值。若从第二参考图像中确定出一个或多个目标区域,该多个目标区域分别对应的形状可以相同,也可以不同。It should be understood that the detection result determined for the second reference image may be a target area of a certain shape, and the Y value of the pixels in the target area is greater than a preset Y threshold. If one or more target areas are determined from the second reference image, the shapes corresponding to the multiple target areas may be the same or different.
可选地,可以利用多个降低曝光值后的第二摄像头采集多帧第二参考图像,或者,还可以利用降低曝光值后的第二摄像头采集多帧第二参考图像,再分别对多帧第二参考图像进行亮度阈值识别和形状检测,确定出各自对应的目标区域;然后,再将多帧第二参考图像中相近位置处的目标区域进行合并,确定出对应的交集为最终的目标区域。Optionally, multiple second cameras with reduced exposure values can be used to capture multiple frames of second reference images, or second cameras with reduced exposure values can also be used to capture multiple frames of second reference images, and then the multi-frames Perform brightness threshold recognition and shape detection on the second reference image to determine the corresponding target areas; then, merge the target areas at similar positions in multiple frames of the second reference image to determine the corresponding intersection as the final target area .
应理解,第二参考图像中确定出的目标区域与第二图像中确定出的待测区域具有对应关系。例如,第二参考图像中确定出的目标区域和第二图像中确定出的待测区域交叠时,用于指示同一个位置处的光源。It should be understood that the target area determined in the second reference image has a corresponding relationship with the area to be tested determined in the second image. For example, when the target area determined in the second reference image overlaps with the area to be measured determined in the second image, it is used to indicate the light source at the same position.
S206、结合该检测结果,识别出第一图像中的目标光源。S206. Based on the detection result, identify the target light source in the first image.
可选地,结合第二参考图像中的目标区域,可以确定第一图像中待测区域和第二参考图像中对应的目标区域的交集区域来作为第一图像中的目标光源所在区域。若第一图像中的待测区域在第二参考图像中找不到对应的目标区域,无法结合,则说明该待测区域为非真实的光源形成的亮区,不能作为目标光源所在的区域。Optionally, in combination with the target area in the second reference image, the intersection area of the area to be tested in the first image and the corresponding target area in the second reference image may be determined as the area where the target light source is located in the first image. If the area to be tested in the first image cannot find the corresponding target area in the second reference image and cannot be combined, it means that the area to be tested is a bright area formed by a non-real light source and cannot be used as the area where the target light source is located.
此处,需要说明的是,在进行S203之前,还可以将第二摄像头采集的第二图像的内容与第一摄像头采集的第一图像进行匹配,生成一一对应的关系;由此,对第二摄像头进行处理后,后续可以借助该对应关系,从采集的第二参考图像中查找第一图像中的某一个待测区域对应的目标区域。Here, it should be noted that, before performing S203, the content of the second image captured by the second camera may also be matched with the content of the first image captured by the first camera to generate a one-to-one correspondence; After the processing by the second camera, the corresponding target area corresponding to a certain area to be measured in the first image can be found from the collected second reference image by means of the corresponding relationship.
例如,第一摄像头采集的第一图像可以如图5中的(a)所示,第一图像中包括四个待测区域,分别为a1、a2、a3和a4,该四个待测区域即为待检测的光源位置。For example, the first image captured by the first camera may be shown in (a) in FIG. is the position of the light source to be detected.
第二摄像头进行虚焦、降低曝光值处理后采集的第二参考图像可以如图4中的(c)所示。将第二参考图像进行亮度阈值识别和形状检测后,所得到的图像可以如图5中的(b)所示,在该图像中可以包括三个目标区域,分别为b1、b2和b3,目标区域的形状为圆形。该三个目标区域即为第二摄像头辅助确定出的真实的光源。The second reference image collected by the second camera after performing defocusing and reducing exposure value processing may be as shown in (c) in FIG. 4 . After performing brightness threshold recognition and shape detection on the second reference image, the resulting image can be shown as (b) in Figure 5, which can include three target areas, namely b1, b2 and b3, the target The shape of the area is circular. The three target areas are the real light sources assisted by the second camera.
结合图5中的(a)和图5中的(b)所示的检测结果,可以确定出第一图像中的三个待测区域均为真实的光源位置,此处可以将第一图像中的a1和第二参考图像中的b1指示的区域进行合并,求得交集区域a11作为第一个目标光源所在区域;可以将第一图像中的a2和第二参考图像中的b2指示的区域进行合并,求得交集区域a12作为第二个目标光源所在区域;同理,将第一图像中的a3和第二参考图像中的b3指示的区域进行合并,求得交集区域a13作为第三个目标光源所在区域。Combining the detection results shown in (a) and (b) in Figure 5, it can be determined that the three regions to be tested in the first image are all real light source positions, and here the a1 in the second reference image and the area indicated by b1 in the second reference image are merged to obtain the intersection area a11 as the area where the first target light source is located; the area indicated by a2 in the first image and b2 in the second reference image can be obtained Merge to obtain the intersection area a12 as the area where the second target light source is located; similarly, merge the area indicated by a3 in the first image and b3 in the second reference image to obtain the intersection area a13 as the third target The area where the light source is located.
此处,还可以确定出第一图像中的一个待测区域a4在第二参考图像中没有匹配的目标区域,因此,可以确定待测区域a4是非真实的光源位置。Here, it can also be determined that a region to be measured a4 in the first image has no matching target region in the second reference image, therefore, it can be determined that the region to be measured a4 is a non-real light source position.
本申请实施例提供的光源检测方法,通过启用一个第一摄像头和至少一个第二摄像头,在拍摄时,利用第一摄像头采集第一图像,而对第二摄像头进行虚焦、降低曝光值处理,再利用处理后的第二摄像头采集第二参考图像;对第二摄像头采集的第二参考图像进行亮度阈值识别以及形状检测;然后,再利用该检测结果辅助第一图像筛除掉高反光物体、高亮金属、噪声等产生的高亮区域,从中识别出真正的光源作为目标光源。In the light source detection method provided in the embodiment of the present application, by enabling one first camera and at least one second camera, when shooting, the first camera is used to capture the first image, and the second camera is defocused and the exposure value is reduced. Then use the processed second camera to capture a second reference image; perform brightness threshold recognition and shape detection on the second reference image captured by the second camera; then, use the detection result to assist the first image to screen out highly reflective objects, The highlight area generated by highlighting metal, noise, etc., from which the real light source is identified as the target light source.
由于相关电子设备普遍都包括多个摄像头,因此,本申请无需做结构上的修改,仅需要调用多个摄像头,经过简单的虚焦、降低曝光值处理即可进行检测,方法简单,检测效率较高,检测准确度也非常高。Since related electronic devices generally include multiple cameras, this application does not need to make structural modifications, and only needs to call multiple cameras, and the detection can be carried out after simple virtual focus and exposure reduction processing. The method is simple and the detection efficiency is relatively high. High, the detection accuracy is also very high.
可选地,还可以启用一个第一摄像头和至少一个第二摄像头,在拍摄时,利用第一摄像头采集第一图像,而对第二摄像头进行虚焦处理,再利用处理后的第二摄像头采集第一参考图像;对第二摄像头采集的第一参考图像进行亮度阈值识别以及形状检测;然后,再利用该检测结果辅助第一图像筛除掉高反光物体、高亮金属、噪声等产生的高亮区域,从中识别出真正的光源作为目标光源。Optionally, one first camera and at least one second camera can also be enabled. When shooting, the first camera is used to capture the first image, and the second camera is subjected to virtual focus processing, and then the processed second camera is used to capture the image. The first reference image; perform brightness threshold recognition and shape detection on the first reference image collected by the second camera; then, use the detection result to assist the first image to filter out high-reflective objects, bright metal, noise, etc. Bright areas, from which the true light source is identified as the target light source.
可选地,还可以启用一个第一摄像头和至少一个第二摄像头,在拍摄时,利用第一摄像头采集第一图像,而对第二摄像头进行降低曝光值处理,再利用处理后的第二摄像头采集第二参考图像;对第二摄像头采集的第二参考图像进行亮度阈值识别以及形状检测;然后,再利用该检测结果辅助第一图像筛除掉高反光物体、高亮金属、噪声等产生的高亮区域,从中识别出真正的光源作为目标光源。Optionally, one first camera and at least one second camera can also be enabled. When shooting, the first camera is used to collect the first image, and the second camera is processed to reduce the exposure value, and then the processed second camera is used to Collect the second reference image; perform brightness threshold recognition and shape detection on the second reference image collected by the second camera; then, use the detection result to assist the first image to filter out highly reflective objects, bright metal, noise, etc. The highlighted area from which the real light source is identified as the target light source.
此外,第一图像可以是指电子设备中预览界面中的预览图像;其中,预览界面可以是指拍照预览界面,或者,录像预览界面。第一图像还可以是电子设备相册中的拍摄图像,或者,是视频中的一帧视频帧。In addition, the first image may refer to a preview image in a preview interface of the electronic device; wherein, the preview interface may refer to a photo preview interface, or a video preview interface. The first image may also be a captured image in an album of the electronic device, or a video frame in a video.
第一图像进行显示时,可以显示检测出的目标光源的位置;当然,也可以不显示,本申请对此不进行任何限制。When the first image is displayed, the detected position of the target light source may be displayed; of course, it may not be displayed, and this application does not impose any limitation on this.
下面结合图6对电子设备中的界面示意图进行举例描述。The following describes a schematic diagram of an interface in an electronic device with reference to FIG. 6 .
在一种可能的实现方式中,可以在电子设备的设置界面中设置开启“光源检测”的功能,在电子设备中用于拍照的应用程序运行后,可以自动开启“光源检测”的功能执行本申请实施例的光源检测方法。In a possible implementation, the function of "light source detection" can be set to be enabled in the setting interface of the electronic device, and the function of "light source detection" can be automatically enabled after the application program for taking pictures in the electronic device is run. The light source detection method of the embodiment of the application.
在另一种可能的实现方式中,可以在电子设备的相机中设置开启“光源检测”功能,根据设置可以在拍摄照片时可以开启“光源检测”的功能,执行本申请实施例的光源检测方法。In another possible implementation, the "light source detection" function can be enabled in the camera of the electronic device, and according to the setting, the "light source detection" function can be enabled when taking pictures, and the light source detection method of the embodiment of the present application can be executed .
在又一种可能的实现方式中,可以仅在电子设备的相机中的“大光圈”模式下,增加“光源检测”功能,根据增加可以在选择“大光圈”模式时,自动开启“光源检测”的功能执行本申请实施例的光源检测方法。In yet another possible implementation, the "light source detection" function can be added only in the "large aperture" mode of the camera of the electronic device. According to the addition, the "light source detection" function can be automatically turned on when the "large aperture" mode is selected. " function to execute the light source detection method of the embodiment of the present application.
结合第三种实现方式,以电子设备在“大光圈”模式下自动开启“光源检测”功能为例,图6是本申请实施例提供的一种电子设备的界面示意图。Combining with the third implementation mode, taking the electronic device automatically enabling the "light source detection" function in the "large aperture" mode as an example, FIG. 6 is a schematic diagram of an interface of an electronic device provided by an embodiment of the present application.
如图6中的(a)所示,为电子设备的桌面601,该桌面601上包括有相机应用程序对应的图标602。电子设备检测用户点击桌面601上的相机应用程序对应的图标602,如图6中的(b)所示。在电子设备检测到用户点击桌面601上的相机应用程序的图标602的操作后,响应于用户的操作,电子设备运行相机应用程序,显示如图6中的(c)所示的显示界面603,在该显示界面603中包括预览窗口,预览窗口可以显示默认拍照模式下,第一摄像头采集的预览图像;该显示界面603还包括其他模式,例如大光圈模式604等。As shown in (a) of FIG. 6 , it is a
电子设备检测到用户从拍照模式切换到大光圈模式604后,可以执行本申请提供的光源检测方法。例如,利用第一摄像头采集第一图像,再启用一个第二摄像头,并对第二摄像头进行虚焦、降低曝光值处理,利用处理后的第二摄像头采集第二参考图像;针对第二参考图像进行亮度阈值识别和形状检测,确定出目标区域;再结合该目标区域,辅助确定出第一图像中真实的光源为目标光源。然后,如图6中的(d)所示,在预览窗口中显示第一图像并可以提示第一图像中的光源位置。After the electronic device detects that the user has switched from the camera mode to the
在该示例中,由于路灯光线较强,照射到玻璃门上、以及圣诞树上时,玻璃和金属装饰物对路灯投射的光线进行了强烈地反射,如果利用相关技术进行检测时,可能会错误的将玻璃上反射的假的路灯,以及金属装饰物反射的光线当作光源;而利用本申请实施例提供的光源检测方法在检测时,则会在第二摄像头进行虚焦、降低曝光值的处理过程中,将玻璃上反射的假的路灯、以及金属装饰物的反射的光线所对应的亮区变模糊、变暗然后筛除掉,识别出留下的亮区为真正的光源为路灯。In this example, due to the strong light from the street light, when it shines on the glass door and the Christmas tree, the glass and metal decorations strongly reflect the light projected by the street light. If the relevant technology is used for detection, it may be wrong The fake street lamp reflected on the glass and the light reflected by the metal decoration are used as the light source; while using the light source detection method provided by the embodiment of the present application to detect, the second camera will perform defocusing and reduce the exposure value. During the process, the bright areas corresponding to the fake street lamps reflected on the glass and the light reflected by the metal decorations are blurred, darkened and then screened out, and the remaining bright areas are identified as the real light sources as street lamps.
需要说明的是,上述为对电子设备中的显示界面的举例说明,本申请对此不作任何限定。It should be noted that the above description is an example of a display interface in an electronic device, and this application does not make any limitation thereto.
应理解,上述举例说明是为了帮助本领域技术人员理解本申请实施例,而非要将本申请实施例限于所例示的具体数值或具体场景。本领域技术人员根据所给出的上述举例说明,显然可以进行各种等价的修改或变化,这样的修改或变化也落入本申请实施例的范围内。It should be understood that the above illustrations are intended to help those skilled in the art understand the embodiments of the present application, rather than to limit the embodiments of the present application to the illustrated specific values or specific scenarios. Those skilled in the art can obviously make various equivalent modifications or changes based on the above illustrations given, and such modifications or changes also fall within the scope of the embodiments of the present application.
上文结合图1至图6,描述了本申请实施例的光源检测方法、适用场景和相关显示界面。下面将结合图7至图10,详细描述本申请适用的电子设备的软件系统、硬件系统、装置以及芯片。应理解,本申请实施例中的软件系统、硬件系统、装置以及芯片可以执行前述本申请实施例的各种方法,即以下各种产品的具体工作过程,可以参考前述方法实施例中的对应过程。The light source detection method, applicable scenarios and related display interfaces of the embodiments of the present application are described above with reference to FIG. 1 to FIG. 6 . The software system, hardware system, device and chip of the electronic equipment applicable to the present application will be described in detail below with reference to FIG. 7 to FIG. 10 . It should be understood that the software system, hardware system, device, and chip in the embodiments of the present application can execute the various methods in the foregoing embodiments of the present application, that is, the specific working processes of the following various products can refer to the corresponding processes in the foregoing method embodiments .
图7示出了一种适用于本申请的电子设备的硬件系统。电子设备100可用于实现上述方法实施例中描述的光源检测方法。Fig. 7 shows a hardware system applicable to the electronic device of this application. The
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The
需要说明的是,图7所示的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图7所示的部件更多或更少的部件,或者,电子设备100可以包括图7所示的部件中某些部件的组合,或者,电子设备100可以包括图7所示的部件中某些部件的子部件。图7示的部件可以以硬件、软件、或软件和硬件的组合实现。It should be noted that the structure shown in FIG. 7 does not constitute a specific limitation on the
处理器110可以包括一个或多个处理单元。例如,处理器110可以包括以下处理单元中的至少一个:应用处理器(application processor,AP)、调制解调处理器、图形处理器(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、控制器、视频编解码器、数字信号处理器(digital signal processor,DSP)、基带处理器、神经网络处理器(neural-network processing unit,NPU)。其中,不同的处理单元可以是独立的器件,也可以是集成的器件。
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the
在一些实施例中,处理器110可以包括一个或多个接口。例如,处理器110可以包括以下接口中的至少一个:内部集成电路(inter-integrated circuit,I2C)接口、内部集成电路音频(inter-integrated circuit sound,I2S)接口、脉冲编码调制(pulse codemodulation,PCM)接口、通用异步接收传输器(universal asynchronous receiver/transmitter,UART)接口、移动产业处理器接口(mobile industry processor interface,MIPI)、通用输入输出(general-purpose input/output,GPIO)接口、SIM接口、USB接口。In some embodiments,
示例性地,在本申请的实施例中,可以在处理器110中执行本申请提供的光源检测方法。Exemplarily, in the embodiment of the present application, the light source detection method provided in the present application may be executed in the
图7所示的各模块间的连接关系只是示意性说明,并不构成对电子设备100的各模块间的连接关系的限定。可选地,电子设备100的各模块也可以采用上述实施例中多种连接方式的组合。The connection relationship between the modules shown in FIG. 7 is only a schematic illustration, and does not constitute a limitation on the connection relationship between the modules of the
电子设备100的无线通信功能可以通过天线1、天线2、移动通信模块150、无线通信模块160、调制解调处理器以及基带处理器等器件实现。天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。The wireless communication function of the
电子设备100可以通过GPU、显示屏194以及应用处理器实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The
显示屏194可以用于显示图像或视频。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)、有源矩阵有机发光二极体(active-matrix organic light-emitting diode,AMOLED)、柔性发光二极管(flex light-emitting diode,FLED)、迷你发光二极管(mini light-emitting diode,Mini LED)、微型发光二极管(micro light-emitting diode,Micro LED)、微型OLED (Micro OLED)或量子点发光二极管(quantum dotlight emitting diodes,QLED)。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。Display 194 may be used to display images or video. The display screen 194 includes a display panel. The display panel can adopt liquid crystal display (liquid crystal display, LCD), organic light-emitting diode (organic light-emitting diode, OLED), active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), flexible Light-emitting diode (flex light-emitting diode, FLED), mini light-emitting diode (mini light-emitting diode, Mini LED), micro light-emitting diode (micro light-emitting diode, Micro LED), micro OLED (Micro OLED) or quantum dots Diodes (quantum dotlight emitting diodes, QLEDs). In some embodiments, the
电子设备100可以通过ISP、摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。The
示例性地,ISP 用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP可以对图像的噪点、亮度和色彩进行算法优化,ISP还可以优化拍摄场景的曝光和色温等参数。在一些实施例中,ISP可以设置在摄像头193中。Exemplarily, the ISP is used to process the data fed back by the camera 193 . For example, when taking a picture, open the shutter, the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can optimize the algorithm of image noise, brightness and color, and ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP may be located in the camera 193 .
示例性地,摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的红绿蓝(red green blue,RGB),YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。Exemplarily, the camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects it to the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a complementary metal-oxide-semiconductor (complementary metal-oxide-semiconductor, CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard red green blue (red green blue, RGB), YUV and other image signals. In some embodiments, the
示例性地,数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Exemplarily, the digital signal processor is used to process digital signals, and can process other digital signals in addition to digital image signals. For example, when the
示例性地,视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1、MPEG2、MPEG3和MPEG4。Exemplarily, a video codec is used to compress or decompress digital video. The
示例性地,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,例如可以是电阻式压力传感器、电感式压力传感器或电容式压力传感器。电容式压力传感器可以是包括至少两个具有导电材料的平行板,当力作用于压力传感器180A,电极之间的电容改变,电子设备100根据电容的变化确定压力的强度。当触摸操作作用于显示屏194时,电子设备100根据压力传感器180A检测所述触摸操作。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令;当触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。Exemplarily, the pressure sensor 180A may be disposed on the display screen 194 . There are many types of pressure sensor 180A, for example, it may be a resistive pressure sensor, an inductive pressure sensor or a capacitive pressure sensor. The capacitive pressure sensor may include at least two parallel plates with conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes, and the
示例性地,环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。Exemplarily, the ambient light sensor 180L is used to sense ambient light brightness. The
示例性地,指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现解锁、访问应用锁、拍照和接听来电等功能。Exemplarily, the fingerprint sensor 180H is used to collect fingerprints. The
示例性地,触摸传感器180K,也称为触控器件。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,触摸屏也称为触控屏。触摸传感器180K用于检测作用于其上或其附近的触摸操作。触摸传感器180K可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,并且与显示屏194设置于不同的位置。Exemplarily, the touch sensor 180K is also called a touch device. The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a touch screen. The touch sensor 180K is used to detect a touch operation on or near it. The touch sensor 180K may transmit the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation can be provided through the display screen 194 . In some other embodiments, the touch sensor 180K may also be disposed on the surface of the
上文详细描述了电子设备100的硬件系统,下面介绍电子设备100的软件系统。软件系统可以采用分层架构、事件驱动架构、微核架构、微服务架构或云架构,本申请实施例以分层架构为例,示例性地描述电子设备100的软件系统。The hardware system of the
如图8所示,系统架构中可以包括应用层210、应用框架层220、硬件抽象层230、驱动层240以及硬件层250。As shown in FIG. 8 , the system architecture may include an application layer 210 , an application framework layer 220 , a hardware abstraction layer 230 , a driver layer 240 and a hardware layer 250 .
应用层210可以包括相机应用程序。The application layer 210 may include a camera application.
可选地,应用层210还可以包括图库、日历、通话、地图、导航、WLAN、蓝牙、音乐、视频、短信息等应用程序。Optionally, the application layer 210 may also include application programs such as gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
应用框架层220为应用程序层的应用程序提供应用程序编程接口(applicationprogramming interface,API)和编程框架;应用程序框架层可以包括一些预定义的函数。The application framework layer 220 provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer; the application framework layer may include some predefined functions.
例如,应用框架层220可以包括相机访问接口;相机访问接口中可以包括相机管理与相机设备。其中,相机管理可以用于提供管理相机的访问接口;相机设备可以用于提供访问相机的接口。For example, the application framework layer 220 may include a camera access interface; the camera access interface may include camera management and camera equipment. Wherein, the camera management can be used to provide an access interface for managing the camera; the camera device can be used to provide an interface for accessing the camera.
硬件抽象层230用于将硬件抽象化。比如,硬件抽象层可以包相机抽象层以及其他硬件设备抽象层;相机抽象层中可以包括相机设备1、相机设备2等;相机硬件抽象层可以与相机算法库相连接,相机硬件抽象层可以调用相机算法库中的算法。The hardware abstraction layer 230 is used to abstract hardware. For example, the hardware abstraction layer can include the camera abstraction layer and other hardware device abstraction layers; the camera abstraction layer can include camera device 1, camera device 2, etc.; the camera hardware abstraction layer can be connected with the camera algorithm library, and the camera hardware abstraction layer can call Algorithms in the camera algorithm library.
示例性地,相机算法库中可以包括光源检测方法,运行光源检测方法时用于执行本申请实施例提供的光源检测方法。Exemplarily, the camera algorithm library may include a light source detection method, which is used to execute the light source detection method provided in the embodiment of the present application when running the light source detection method.
驱动层240用于为不同硬件设备提供驱动。比如,驱动层可以包括相机设备驱动。The driver layer 240 is used to provide drivers for different hardware devices. For example, the driver layer may include camera device drivers.
硬件层250可以包括图像传感器、多光谱传感器、图像信号处理器以及其他硬件设备。The hardware layer 250 may include image sensors, multispectral sensors, image signal processors, and other hardware devices.
图9是本申请实施例提供的光源检测装置的结构示意图。该光源检测装置300包括采集单元310和处理单元320。FIG. 9 is a schematic structural diagram of a light source detection device provided by an embodiment of the present application. The light source detection device 300 includes an acquisition unit 310 and a processing unit 320 .
处理单元320用于启动所述电子设备的相机应用程序;The processing unit 320 is configured to start a camera application program of the electronic device;
采集单元310用于利用所述第一摄像头采集第一图像;The collection unit 310 is configured to use the first camera to collect a first image;
处理单元320用于对所述第二摄像头进行虚焦处理,和/或,降低曝光值处理;The processing unit 320 is configured to perform virtual focus processing on the second camera, and/or, reduce exposure value processing;
采集单元310用于利用处理后的所述第二摄像头采集参考图像;The collection unit 310 is configured to use the processed second camera to collect a reference image;
处理单元320还用于基于所述参考图像,确定所述第一图像中包括的目标光源。The processing unit 320 is further configured to determine the target light source included in the first image based on the reference image.
可选地,作为一个实施例,处理单元320还用于:Optionally, as an embodiment, the processing unit 320 is further configured to:
将所述第二摄像头中镜头与图像传感器之间的距离减小到小于采集所述第一图像时,所述第一摄像头中镜头与图像传感器之间的距离。reducing the distance between the lens in the second camera and the image sensor to be smaller than the distance between the lens in the first camera and the image sensor when capturing the first image.
可选地,作为一个实施例,处理单元320还用于:Optionally, as an embodiment, the processing unit 320 is further configured to:
将所述第二摄像头对应的曝光值降低为采集所述第一图像时,所述第一摄像头对应的曝光值的一半。reducing the exposure value corresponding to the second camera to half of the exposure value corresponding to the first camera when capturing the first image.
可选地,作为一个实施例,处理单元320还用于:Optionally, as an embodiment, the processing unit 320 is further configured to:
保持感光度不变,降低所述第二摄像头对应的曝光时间;或者,Keeping the sensitivity constant, reducing the exposure time corresponding to the second camera; or,
保持曝光时间不变,降低所述第二摄像头对应的感光度。The exposure time is kept constant, and the sensitivity corresponding to the second camera is reduced.
可选地,作为一个实施例,处理单元320还用于:Optionally, as an embodiment, the processing unit 320 is further configured to:
利用所述第二摄像头采集第二图像;using the second camera to capture a second image;
对所述第一图像和所述第二图像进行亮度阈值识别和形状检测,确定所述第一图像中的待测区域和所述第二图像中的待测区域并进行匹配;performing brightness threshold recognition and shape detection on the first image and the second image, determining and matching the area to be tested in the first image and the area to be tested in the second image;
对所述参考图像进行所述亮度阈值识别和所述形状检测,确定所述参考图像中的目标区域,所述目标区域与所述第二图像中的待测区域具有对应关系;performing the brightness threshold identification and the shape detection on the reference image, and determining a target area in the reference image, where the target area has a corresponding relationship with an area to be tested in the second image;
确定具有对应的目标区域的所述第一图像中的待测区域为目标光源。Determining the area to be measured in the first image with the corresponding target area as the target light source.
可选地,作为一个实施例,所述第二摄像头包括至少一个第二摄像头。Optionally, as an embodiment, the second camera includes at least one second camera.
需要说明的是,上述光源检测装置300以功能单元的形式体现。这里的术语“单元”可以通过软件和/或硬件形式实现,对此不作具体限定。It should be noted that the above-mentioned light source detection device 300 is embodied in the form of a functional unit. The term "unit" here may be implemented in the form of software and/or hardware, which is not specifically limited.
例如,“单元”可以是实现上述功能的软件程序、硬件电路或二者结合。所述硬件电路可能包括应用特有集成电路(application specific integrated circuit,ASIC)、电子电路、用于执行一个或多个软件或固件程序的处理器(例如共享处理器、专有处理器或组处理器等)和存储器、合并逻辑电路和/或其它支持所描述的功能的合适组件。For example, a "unit" may be a software program, a hardware circuit or a combination of both to realize the above functions. The hardware circuitry may include application specific integrated circuits (ASICs), electronic circuits, processors (such as shared processors, dedicated processors, or group processors) for executing one or more software or firmware programs. etc.) and memory, incorporated logic, and/or other suitable components to support the described functionality.
因此,在本申请的实施例中描述的各示例的单元,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Therefore, the units of each example described in the embodiments of the present application can be realized by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
图10示出了本申请提供的一种电子设备的结构示意图。图10中的虚线表示该单元或该模块为可选的,电子设备400可用于实现上述方法实施例中描述的光源检测方法。FIG. 10 shows a schematic structural diagram of an electronic device provided by the present application. The dotted line in FIG. 10 indicates that this unit or this module is optional, and the
电子设备400包括一个或多个处理器401,该一个或多个处理器402可支持电子设备400实现方法实施例中的方法。处理器401可以是通用处理器或者专用处理器。例如,处理器401可以是中央处理器(central processing unit,CPU)、数字信号处理器(digitalsignal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其它可编程逻辑器件,如分立门、晶体管逻辑器件或分立硬件组件。The
可选地,处理器401可以用于对电子设备400进行控制,执行软件程序,处理软件程序的数据。电子设备400还可以包括通信单元405,用以实现信号的输入(接收)和输出(发送)。Optionally, the
例如,电子设备400可以是芯片,通信单元405可以是该芯片的输入和/或输出电路,或者,通信单元405可以是该芯片的通信接口,该芯片可以作为终端设备或其它电子设备的组成部分。For example, the
又例如,电子设备400可以是终端设备,通信单元405可以是该终端设备的收发器,或者,通信单元405可以是该终端设备的收发电路。For another example, the
电子设备400中可以包括一个或多个存储器402,其上存有程序404,程序404可被处理器401运行,生成指令403,使得处理器401根据指令403执行上述方法实施例中描述的光源检测方法。The
可选地,存储器402中还可以存储有数据。Optionally, data may also be stored in the
可选地,处理器401还可以读取存储器402中存储的数据,该数据可以与程序404存储在相同的存储地址,该数据也可以与程序404存储在不同的存储地址。Optionally, the
可选地,处理器401和存储器402可以单独设置,也可以集成在一起;例如,集成在终端设备的系统级芯片(system on chip,SOC)上。Optionally, the
示例性地,存储器402可以用于存储本申请实施例中提供的光源检测方法的相关程序404,处理器301可以用于在视频处理时调用存储器402中存储的光源检测方法的相关程序404,执行本申请实施例的光源检测方法。Exemplarily, the
本申请还提供了一种计算机程序产品,该计算机程序产品被处理器401执行时实现本申请中任一方法实施例所述的光源检测方法。The present application also provides a computer program product. When the computer program product is executed by the
该计算机程序产品可以存储在存储器402中,例如是程序404,程序404经过预处理、编译、汇编和链接等处理过程最终被转换为能够被处理器401执行的可执行目标文件。The computer program product can be stored in the
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时实现本申请中任一方法实施例所述的光源检测方法。该计算机程序可以是高级语言程序,也可以是可执行目标程序。The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computer, the light source detection method described in any method embodiment in the present application is implemented. The computer program may be a high-level language program or an executable object program.
可选地,该计算机可读存储介质例如是存储器402。存储器402可以是易失性存储器或非易失性存储器,或者,存储器402可以同时包括易失性存储器和非易失性存储器。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlinkDRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。Optionally, the computer-readable storage medium is, for example, the
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的电子设备的实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the embodiments of the electronic equipment described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
应理解,在本申请的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施例的实施过程构成任何限定。It should be understood that in various embodiments of the present application, the sequence numbers of the processes do not mean the order of execution, and the execution order of the processes should be determined by their functions and internal logic, rather than by the embodiments of the present application. The implementation process constitutes any limitation.
另外,本文中的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。In addition, the term "and/or" in this article is only an association relationship describing associated objects, indicating that there may be three relationships, for example, A and/or B, which may mean: A exists alone, and A and B exist at the same time , there are three cases of B alone. In addition, the character "/" in this article generally indicates that the contextual objects are an "or" relationship.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) 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, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk, and various media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准总之,以上所述仅为本申请技术方案的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims. In a word, the above description is only a preferred embodiment of the technical solution of the application, and is not intended to limit the protection scope of the application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this application shall be included within the protection scope of this application.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211354642.2A CN115426458B (en) | 2022-11-01 | 2022-11-01 | Light source detection method and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211354642.2A CN115426458B (en) | 2022-11-01 | 2022-11-01 | Light source detection method and related equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115426458A true CN115426458A (en) | 2022-12-02 |
CN115426458B CN115426458B (en) | 2023-04-07 |
Family
ID=84207878
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211354642.2A Active CN115426458B (en) | 2022-11-01 | 2022-11-01 | Light source detection method and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115426458B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006018056A1 (en) * | 2004-08-16 | 2006-02-23 | Fotonation Vision Limited | Method and apparatus for detecting and correcting red-eye effect |
JP2015090562A (en) * | 2013-11-05 | 2015-05-11 | カシオ計算機株式会社 | Image processing device, method, and program |
US20170163862A1 (en) * | 2013-03-14 | 2017-06-08 | Fotonation Cayman Limited | Systems and Methods for Reducing Motion Blur in Images or Video in Ultra Low Light with Array Cameras |
CN109816734A (en) * | 2019-01-23 | 2019-05-28 | 武汉精立电子技术有限公司 | Camera calibration method based on target optical spectrum |
CN110198417A (en) * | 2019-06-28 | 2019-09-03 | Oppo广东移动通信有限公司 | Image processing method, image processing device, storage medium and electronic equipment |
-
2022
- 2022-11-01 CN CN202211354642.2A patent/CN115426458B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006018056A1 (en) * | 2004-08-16 | 2006-02-23 | Fotonation Vision Limited | Method and apparatus for detecting and correcting red-eye effect |
US20170163862A1 (en) * | 2013-03-14 | 2017-06-08 | Fotonation Cayman Limited | Systems and Methods for Reducing Motion Blur in Images or Video in Ultra Low Light with Array Cameras |
JP2015090562A (en) * | 2013-11-05 | 2015-05-11 | カシオ計算機株式会社 | Image processing device, method, and program |
CN109816734A (en) * | 2019-01-23 | 2019-05-28 | 武汉精立电子技术有限公司 | Camera calibration method based on target optical spectrum |
CN110198417A (en) * | 2019-06-28 | 2019-09-03 | Oppo广东移动通信有限公司 | Image processing method, image processing device, storage medium and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN115426458B (en) | 2023-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113452898B (en) | Method and device for taking pictures | |
CN107734225A (en) | A kind of image pickup method and device | |
CN118175436B (en) | Image processing method and related device | |
CN113630558B (en) | Camera exposure method and electronic equipment | |
WO2023124201A1 (en) | Image processing method and electronic device | |
CN116744120B (en) | Image processing method and electronic device | |
WO2024045670A1 (en) | Method for generating high-dynamic-range video, and electronic device | |
CN115272138B (en) | Image processing method and related device | |
CN115604572B (en) | Image acquisition method, electronic device and computer-readable storage medium | |
CN117177062B (en) | Camera switching method and electronic device | |
CN113905182A (en) | A shooting method and equipment | |
WO2022083325A1 (en) | Photographic preview method, electronic device, and storage medium | |
CN116668838B (en) | Image processing methods and electronic equipment | |
WO2023160221A1 (en) | Image processing method and electronic device | |
US20240397015A1 (en) | Image Processing Method and Electronic Device | |
CN117499779B (en) | Image preview method, device and storage medium | |
WO2024239779A1 (en) | Video shooting method and electronic device | |
CN115426458B (en) | Light source detection method and related equipment | |
CN116055895B (en) | Image processing method and its device, chip system and storage medium | |
CN115767290B (en) | Image processing method and electronic device | |
CN116437198B (en) | Image processing method and electronic equipment | |
WO2023160190A1 (en) | Automatic exposure method and electronic device | |
CN113891008A (en) | Exposure intensity adjusting method and related equipment | |
CN117132511B (en) | Image processing method and electronic equipment | |
CN115526786B (en) | Image processing method and related device |
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 | ||
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 |