CN109040729A - Image white balance correcting, device, storage medium and terminal - Google Patents
Image white balance correcting, device, storage medium and terminal Download PDFInfo
- Publication number
- CN109040729A CN109040729A CN201810934706.3A CN201810934706A CN109040729A CN 109040729 A CN109040729 A CN 109040729A CN 201810934706 A CN201810934706 A CN 201810934706A CN 109040729 A CN109040729 A CN 109040729A
- Authority
- CN
- China
- Prior art keywords
- light source
- image
- target sub
- white balance
- images
- 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
- 238000012937 correction Methods 0.000 claims abstract description 79
- 238000000034 method Methods 0.000 claims abstract description 54
- 238000010801 machine learning Methods 0.000 claims description 32
- 230000011218 segmentation Effects 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 238000013527 convolutional neural network Methods 0.000 claims description 8
- 230000000694 effects Effects 0.000 abstract description 9
- 238000012545 processing Methods 0.000 description 24
- 230000002093 peripheral effect Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000001514 detection method Methods 0.000 description 3
- 230000000007 visual effect Effects 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 238000010897 surface acoustic wave method Methods 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 230000002087 whitening effect Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/73—Colour balance circuits, e.g. white balance circuits or colour temperature control
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/646—Circuits for processing colour signals for image enhancement, e.g. vertical detail restoration, cross-colour elimination, contour correction, chrominance trapping filters
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Color Television Image Signal Generators (AREA)
- Processing Of Color Television Signals (AREA)
Abstract
Description
技术领域technical field
本申请实施例涉及图像处理技术领域,尤其涉及图像白平衡校正方法、装置、存储介质及终端。The embodiments of the present application relate to the technical field of image processing, and in particular, to an image white balance correction method, device, storage medium, and terminal.
背景技术Background technique
随着移动终端的不断发展,几乎每台移动终端均配置了相机功能,基于相机功能可以进行拍照。移动终端趋向于自动化的拍照过程,能够根据拍照环境自动进行曝光及白平衡校正。With the continuous development of mobile terminals, almost every mobile terminal is equipped with a camera function, and can take pictures based on the camera function. The mobile terminal tends to automate the photo-taking process, and can automatically perform exposure and white balance correction according to the photo-taking environment.
但是在使用中发现,如果拍摄画面中存在多个不同方向光源时,即存在混光场景时,则拍摄得到的照片白平衡效果较差。However, in use, it is found that if there are multiple light sources from different directions in the shooting screen, that is, when there is a scene with mixed light, the white balance effect of the captured photo will be poor.
发明内容Contents of the invention
本申请实施例的目的是提供一种图像白平衡校正方法、装置、存储介质及终端,可以混光场景下的白平衡校正效果。The purpose of the embodiments of the present application is to provide an image white balance correction method, device, storage medium, and terminal, which can achieve white balance correction effects in mixed light scenes.
第一方面,本申请实施例提供了一种图像白平衡校正方法,包括:In the first aspect, the embodiment of the present application provides an image white balance correction method, including:
对目标图像进行分割,得到多个目标子图像;Segmenting the target image to obtain multiple target sub-images;
获取每个目标子图像内容对应的光源方向;Obtain the light source direction corresponding to the content of each target sub-image;
根据所述多个目标子图像对应光源方向判断是否存在混光场景;judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images;
当存在混光场景时,根据所述混光场景对应的光源进行白平衡校正。When there is a mixed light scene, the white balance correction is performed according to the light source corresponding to the mixed light scene.
第二方面,本申请实施例提供了一种图像白平衡校正装置,包括:In the second aspect, the embodiment of the present application provides an image white balance correction device, including:
分割模块,用于对目标图像进行分割,得到多个目标子图像;A segmentation module is used to segment the target image to obtain multiple target sub-images;
获取模块,用于获取所述分割模块得到的每个目标子图像内容对应的光源方向;An acquisition module, configured to acquire the light source direction corresponding to the content of each target sub-image obtained by the segmentation module;
判断模块,用于根据所述获取模块获取的所述多个目标子图像对应光源方向判断是否存在混光场景;A judging module, configured to judge whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images acquired by the acquiring module;
白平衡模块,用于当所述判断模块判定存在混光场景时,根据所述混光场景对应的光源进行白平衡校正。The white balance module is configured to perform white balance correction according to the light source corresponding to the mixed light scene when the judging module determines that there is a mixed light scene.
第三方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方面所示的图像白平衡校正方法。In a third aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image white balance correction method as shown in the first aspect is implemented.
第四方面,本申请实施例提供了一种终端,包括存储器,处理器及存储在存储器上并可在处理器运行的计算机程序,所述处理器执行所述计算机程序时实现如第一方面所示的图像白平衡校正方法。In a fourth aspect, an embodiment of the present application provides a terminal, including a memory, a processor, and a computer program stored in the memory and operable on the processor. When the processor executes the computer program, the computer program described in the first aspect is implemented. The image white balance correction method shown.
本申请实施例中提供的图像白平衡校正方案,首先对目标图像进行分割,得到多个目标子图像;其次,获取每个目标子图像内容对应的光源方向;再次,根据所述多个目标子图像对应光源方向判断是否存在混光场景;最后,当存在混光场景时,根据所述混光场景对应的光源进行白平衡校正,能够提高混光场景下图像白平衡校正效果。In the image white balance correction scheme provided in the embodiment of the present application, firstly, the target image is segmented to obtain multiple target sub-images; secondly, the direction of the light source corresponding to the content of each target sub-image is obtained; The image corresponds to the direction of the light source to determine whether there is a mixed light scene; finally, when there is a mixed light scene, the white balance correction is performed according to the light source corresponding to the mixed light scene, which can improve the image white balance correction effect in the mixed light scene.
附图说明Description of drawings
图1为本申请实施例提供的一种图像白平衡校正方法的流程示意图;FIG. 1 is a schematic flow chart of an image white balance correction method provided in an embodiment of the present application;
图2为本申请实施例提供的另一种图像白平衡校正方法的流程示意图;FIG. 2 is a schematic flowchart of another image white balance correction method provided by the embodiment of the present application;
图3为本申请实施例提供的另一种图像白平衡校正方法的流程示意图;FIG. 3 is a schematic flowchart of another image white balance correction method provided by the embodiment of the present application;
图4为本申请实施例提供的另一种图像白平衡校正方法的流程示意图;FIG. 4 is a schematic flowchart of another image white balance correction method provided by the embodiment of the present application;
图5为本申请实施例提供的另一种图像白平衡校正方法的流程示意图;FIG. 5 is a schematic flowchart of another image white balance correction method provided by the embodiment of the present application;
图6为本申请实施例提供的另一种图像白平衡校正方法的流程示意图;FIG. 6 is a schematic flowchart of another image white balance correction method provided by the embodiment of the present application;
图7为本申请实施例提供的一种图像白平衡校正装置的结构示意图;FIG. 7 is a schematic structural diagram of an image white balance correction device provided in an embodiment of the present application;
图8为本申请实施例提供的一种移动终端的结构示意图。FIG. 8 is a schematic structural diagram of a mobile terminal provided by an embodiment of the present application.
具体实施方式Detailed ways
下面结合附图并通过具体实施方式来进一步说明本申请的技术方案。可以理解的是,此处所描述的具体实施例仅仅用于解释本申请,而非对本申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本申请相关的部分而非全部结构。The technical solution of the present application will be further described below in conjunction with the accompanying drawings and through specific implementation methods. It should be understood that the specific embodiments described here are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only some structures related to the present application are shown in the drawings but not all structures.
在更加详细地讨论示例性实施例之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各步骤描述成顺序的处理,但是其中的许多步骤可以被并行地、并发地或者同时实施。此外,各步骤的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processing, many of the steps may be performed in parallel, concurrently, or simultaneously. Additionally, the order of steps may be rearranged. The process may be terminated when its operations are complete, but may also have additional steps not included in the figure. The processing may correspond to a method, function, procedure, subroutine, subroutine, or the like.
随着移动终端的不断发展,几乎每台移动终端均配置了相机功能,基于相机功能可以进行拍照。移动终端趋向于自动化的拍照过程,能够根据拍照环境自动进行曝光及白平衡校正。但是在使用中发现,如果拍摄画面中存在多个不同方向光源时,即存在混光场景时,则拍摄得到的照片白平衡效果较差,无法准确的反映被拍摄主体色温。本申请实施例中的混光场景包括存在多个不同方向的光源的拍摄场景。多个光源从不同角度发出的光,通过被拍摄物体的反射进入模组时,会导致采集到的光线色温失常。目前移动终端的自动白平衡程序中,缺少对不同光源方向进行识别的机制,导致无法识别不同方向的光源,进而无法对混光场景进行有效的白平衡处理。With the continuous development of mobile terminals, almost every mobile terminal is equipped with a camera function, and can take pictures based on the camera function. The mobile terminal tends to automate the photo-taking process, and can automatically perform exposure and white balance correction according to the photo-taking environment. However, in use, it is found that if there are multiple light sources from different directions in the shooting screen, that is, when there is a scene with mixed light, the white balance effect of the captured photo will be poor, and it will not be able to accurately reflect the color temperature of the subject being photographed. The mixed light scene in the embodiment of the present application includes a shooting scene in which there are multiple light sources in different directions. When the light emitted by multiple light sources from different angles enters the module through the reflection of the object to be photographed, the color temperature of the collected light will be abnormal. At present, in the automatic white balance program of the mobile terminal, there is a lack of a mechanism for identifying the directions of different light sources, resulting in the inability to identify light sources in different directions, and thus unable to perform effective white balance processing on mixed light scenes.
本申请实施例提供了一种图像白平衡校正方法,能够识别拍摄场景是否为混光场景,当拍摄场景为混光场景时,能够基于多个光源方向的光源进行白平衡处理,提高混光场景的白平衡处理效率,使白平衡处理后的图像具有更加准确的色温,提高资源利用率。具体方案如下所示:The embodiment of the present application provides an image white balance correction method, which can identify whether the shooting scene is a mixed light scene. When the shooting scene is a mixed light scene, it can perform white balance processing based on light sources in multiple light source directions to improve the mixed light scene. Excellent white balance processing efficiency, so that the white balance processed image has a more accurate color temperature and improves resource utilization. The specific plan is as follows:
图1为本申请实施例提供的图像白平衡校正方法的流程示意图,该方法用于使用移动终端进行拍照的情况,尤其是混光场景拍照的情况,该方法可以由移动终端来执行,该移动终端可以为智能手机、平板电脑、可穿戴设备、笔记本电脑等,该方法具体包括如下步骤:Figure 1 is a schematic flow chart of an image white balance correction method provided by an embodiment of the present application. This method is used in the case of using a mobile terminal to take pictures, especially in the case of taking pictures in mixed light scenes. The method can be executed by the mobile terminal. The mobile The terminal can be a smart phone, a tablet computer, a wearable device, a notebook computer, etc., and the method specifically includes the following steps:
步骤110、对目标图像进行分割,得到多个目标子图像。Step 110: Segment the target image to obtain multiple target sub-images.
目标图像可以为用户拍照得到的照片,也可以为预览阶段的预览图像。当用户拍照得到一张照片后,移动终端自动对照片进行白平衡处理,或者用户进行后期制作时以拍照得到的照片为基础修改。用户启动相机应用时,相机应用在预览界面中实时显示摄像头获取到的预览帧图像。当预览界面中预览帧图像符合用户需求时,用户点击拍照按钮进行拍照,得到照片。移动终端在显示预览画面前,对预览画面进行白平衡处理,使得用户在预览阶段即可获取到准确色温的图像。考虑到白平衡处理会产生计算时间,可相应降低预览画面的帧率。The target image may be a photo taken by the user, or may be a preview image in a preview stage. After the user takes a photo and obtains a photo, the mobile terminal automatically performs white balance processing on the photo, or the user performs post-production based on the photo obtained by taking the photo for modification. When the user starts the camera application, the camera application displays the preview frame image acquired by the camera in real time on the preview interface. When the preview frame image in the preview interface meets the user's needs, the user clicks the camera button to take a photo and obtain the photo. Before displaying the preview image, the mobile terminal performs white balance processing on the preview image, so that the user can obtain an image with accurate color temperature during the preview stage. Considering that white balance processing will generate calculation time, the frame rate of the preview image can be reduced accordingly.
可以根据固定的预设分割面积,如以50像素*50像素的固定大小分割目标图像。进一步的,如果固定大小的分割方式无法与目标图像匹配,如果目标图像侧边存在一条不足预设分割面积的子图像,则可以忽略该子图像。也可以,根据固定分割数量对目标图像记性分割,例如,将目标图像分割为10*10,共100个目标子图像。The area can be divided according to a fixed preset, for example, the target image can be divided with a fixed size of 50 pixels*50 pixels. Further, if the fixed-size segmentation method cannot match the target image, and if there is a sub-image on the side of the target image that is less than the preset segmentation area, the sub-image can be ignored. Alternatively, the target image can be memorized divided according to a fixed number of divisions, for example, the target image can be divided into 10*10, 100 target sub-images in total.
步骤120、获取每个目标子图像内容对应的光源方向。Step 120, acquire the light source direction corresponding to the content of each target sub-image.
在一种实现方式中,光源的照射具有方向性,通过对光源以及反射光的检测,可通过检测目标子图像中的光反射情况确定光源方向。示例性的,如果至少两个目标子图像中的光源方向满足反射定律,则可根据目标子图像确定反射信息。反射信息可以包括存在反射关系的至少两个检测区域的对应关系。In an implementation manner, the illumination of the light source has directionality, and by detecting the light source and reflected light, the direction of the light source can be determined by detecting the light reflection in the target sub-image. Exemplarily, if the light source directions in at least two target sub-images satisfy a reflection law, the reflection information may be determined according to the target sub-images. The reflection information may include a corresponding relationship of at least two detection areas that have a reflection relationship.
例如,对于白炽灯等闪烁光源,当白炽灯点亮时桌面等物体会发出反光。当白炽灯熄灭时,桌面等物体不发光。因此可以根据像素变化值确定成对出现像素或亮度变化的检测区域。基于亮度同步变化的检测区域可以确定光源及其照射区域。For example, for flickering light sources such as incandescent lamps, objects such as tabletops will reflect light when the incandescent lamp is lit. When the incandescent lamp is extinguished, objects such as the table top do not emit light. Therefore, detection areas where pixel or brightness changes occur in pairs can be determined according to the pixel change values. The light source and its irradiation area can be determined based on the detection area of synchronously changing brightness.
在另一种实现方式中,可以通过建立预设机器学习模型实现识别任意一个目标子图像中的光源方向,如果目标子图像中存在光源,则输出为表示光源方向的方向矢量。如果目标子图像中不存在光源,则输出结果可以为0或缺省项等。In another implementation, the direction of the light source in any target sub-image can be identified by establishing a preset machine learning model. If there is a light source in the target sub-image, the output is a direction vector representing the direction of the light source. If there is no light source in the target sub-image, the output result can be 0 or a default item, etc.
步骤130、根据多个目标子图像对应光源方向判断是否存在混光场景。Step 130 , judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images.
如果存在多个光源方向,则可确定存在混光场景,执行步骤140。如果只存在一个光源方向,则确定不存在混光场景,执行步骤150。If there are multiple light source directions, it may be determined that there is a mixed light scene, and step 140 is performed. If there is only one light source direction, it is determined that there is no mixed light scene, and step 150 is performed.
步骤140、当存在混光场景时,根据混光场景对应的光源进行白平衡校正。Step 140, when there is a mixed light scene, perform white balance correction according to the light source corresponding to the mixed light scene.
混光场景对应的光源可以为目标子图像对应的全部光源。在获取混光场景的多个光源后,根据多个光源的光强确定白平衡校正的参考颜色。The light sources corresponding to the mixed light scene may be all light sources corresponding to the target sub-image. After obtaining the multiple light sources of the mixed light scene, the reference color for white balance correction is determined according to the light intensities of the multiple light sources.
步骤150、当不存在混光场景时,根据调白板进行白平衡处理。Step 150, when there is no mixed light scene, perform white balance processing according to the whiteboard.
调白板可以获取到环境色温,根据环境色温进行白平衡处理。可选的,以3200K色温条件下设置的蓝、绿、红感光平衡。当环境色温为3200K时,摄像机色温滤光片放置在3200K,景物可以得到正确的色彩还原;当环境色温为5600K时,摄像机色温滤光片放置在5600K,景物可以得到正确的色彩还原。当环境色温在3200K上下1000K和5600K上下1000K范围内,利用白平衡预置功能可以得到人眼可以接受的色彩还原。The whiteboard can obtain the ambient color temperature, and perform white balance processing according to the ambient color temperature. Optionally, set the blue, green, and red photosensitive balance under the condition of 3200K color temperature. When the ambient color temperature is 3200K, the camera color temperature filter is placed at 3200K, and the scene can get correct color reproduction; when the ambient color temperature is 5600K, the camera color temperature filter is placed at 5600K, and the scene can get correct color reproduction. When the ambient color temperature is within the range of 1000K around 3200K and 1000K around 5600K, the color reproduction acceptable to human eyes can be obtained by using the white balance preset function.
本申请实施例提供的图像白平衡校正方法,首先对目标图像进行分割,得到多个目标子图像。其次,获取每个目标子图像内容对应的光源方向。再次,根据多个目标子图像对应光源方向判断是否存在混光场景。最后,当存在混光场景时,根据混光场景对应的光源进行白平衡校正,能够提高混光场景下图像白平衡校正效果。目前无法识别目标图像中不同光源方向的光源,导致目标图像整体色温判断不准确等问题,白平衡效果差。本申请实施例能够基于分割得到的目标子图像确定不同光源方向的光源,然后根据不同方向的光源进行白平衡矫正,进而能够更加高质的还原被拍摄场景色温。In the image white balance correction method provided in the embodiment of the present application, first, the target image is segmented to obtain multiple target sub-images. Secondly, the direction of the light source corresponding to the content of each target sub-image is acquired. Again, it is judged whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images. Finally, when there is a mixed light scene, the white balance correction is performed according to the light source corresponding to the mixed light scene, which can improve the image white balance correction effect in the mixed light scene. At present, it is impossible to identify light sources from different light source directions in the target image, resulting in inaccurate judgment of the overall color temperature of the target image and poor white balance effect. The embodiments of the present application can determine light sources in different light source directions based on the segmented target sub-images, and then perform white balance correction according to the light sources in different directions, thereby restoring the color temperature of the scene to be photographed with higher quality.
图2为本申请实施例提供的一种图像白平衡校正方法的流程示意图,作为对上述实施例的进一步说明,包括:Fig. 2 is a schematic flowchart of an image white balance correction method provided by the embodiment of the present application, as a further description of the above embodiment, including:
步骤210、对目标图像进行分割,得到多个目标子图像。Step 210, segment the target image to obtain multiple target sub-images.
步骤220、获取每个目标子图像内容对应的光源方向。Step 220, acquiring the light source direction corresponding to the content of each target sub-image.
步骤230、判断多个相邻的目标子图像对应的光源方向是否相同。Step 230, judging whether the light source directions corresponding to the multiple adjacent target sub-images are the same.
判断是否存在混光场景的一个重要因素为是否存在多个光源,而多个光源的一种表现形式为,多个相邻的目标子图像对应的光源方向不同相同。通过预设机器学习模型等算法可以获取每个目标子图像的光源方向。通过比较相邻的目标子图像之间的光源方向是否相同,可确定是否存在不同光源。进一步的,当相邻的目标子图像之间的光源方向的角度差值小于预设角度时,可以判定相邻的目标子图像之间的光源方向相同。预设角度为5度10度。An important factor for judging whether there is a mixed light scene is whether there are multiple light sources, and one form of multiple light sources is that multiple adjacent target sub-images correspond to different light source directions. The light source direction of each target sub-image can be obtained by preset algorithms such as machine learning models. Whether there are different light sources can be determined by comparing whether the light source directions between adjacent target sub-images are the same. Further, when the angular difference of the light source directions between adjacent target sub-images is smaller than a preset angle, it may be determined that the light source directions between adjacent target sub-images are the same. The preset angle is 5 degrees and 10 degrees.
如果多个相邻的目标子图像对应的光源方向相同,则执行步骤240。如果多个相邻的目标子图像对应的光源方向不相同,则执行步骤260。If the light source directions corresponding to multiple adjacent target sub-images are the same, step 240 is performed. If the light source directions corresponding to multiple adjacent target sub-images are not the same, step 260 is performed.
步骤240、如果多个相邻的目标子图像对应的光源方向不相同,则存在混光场景。Step 240, if the directions of the light sources corresponding to the multiple adjacent target sub-images are not the same, then there is a mixed light scene.
步骤250、当存在混光场景时,根据混光场景对应的光源进行白平衡校正。Step 250, when there is a mixed light scene, perform white balance correction according to the light source corresponding to the mixed light scene.
步骤260、如果多个相邻的目标子图像对应的光源方向相同,则不存在混光场景,根据调白板进行白平衡处理。Step 260, if the direction of the light source corresponding to the multiple adjacent target sub-images is the same, then there is no mixed light scene, and white balance processing is performed according to the whiteboard.
本申请实施例提供的图像白平衡校正方法,能够基于相邻目标子图像的光源方向是否相同,换言之,相邻目标子图像的光源方向是否明显不同,来确定是否存在多个光源,进而更加准确的判定混光场景,提高资源利用率。The image white balance correction method provided by the embodiment of the present application can determine whether there are multiple light sources based on whether the light source directions of adjacent target sub-images are the same, in other words, whether the light source directions of adjacent target sub-images are significantly different, and thus more accurate It can accurately determine mixed light scenes and improve resource utilization.
图3为本申请实施例提供的一种图像白平衡校正方法的流程示意图,作为对上述实施例的进一步说明,包括:Fig. 3 is a schematic flowchart of an image white balance correction method provided by the embodiment of the present application, as a further description of the above embodiment, including:
步骤310、对目标图像进行分割,得到多个目标子图像。Step 310: Segment the target image to obtain multiple target sub-images.
步骤320、获取每个目标子图像内容对应的光源方向。Step 320, acquiring the light source direction corresponding to the content of each target sub-image.
步骤330、根据多个目标子图像对应光源方向判断是否存在混光场景。Step 330 , judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images.
步骤340、当存在混光场景时,根据多个目标子图像对应的多个光源确定主光源。Step 340: When there is a mixed light scene, determine the main light source according to the multiple light sources corresponding to the multiple target sub-images.
可选的,可以根据目标子图像的亮度,确定光源光强,将光强最高的光源确定为主光源。根据主光源的光源颜色进行白平衡矫正。Optionally, the light intensity of the light source may be determined according to the brightness of the target sub-image, and the light source with the highest light intensity is determined as the main light source. Perform white balance correction according to the color of the light source of the main light source.
进一步的,还可以根据光源光强确定各光源的权重,光源强度越高权重越高,根据各光源权重以及各光源颜色,得到主光源颜色。根据主光源的光源颜色进行白平衡矫正。Further, the weight of each light source may also be determined according to the light intensity of the light source. The higher the light source intensity is, the higher the weight is. Based on the weight of each light source and the color of each light source, the color of the main light source is obtained. Perform white balance correction according to the color of the light source of the main light source.
步骤350、根据主光源对目标图像进行白平衡校正。Step 350, performing white balance correction on the target image according to the main light source.
步骤360、当不存在混光场景时,根据调白板进行白平衡处理。Step 360, when there is no mixed light scene, perform white balance processing according to the whitening board.
本申请实施例提供的图像白平衡校正方法,能够从多个光源中确定主光源,并根据主光源进行白平衡处理,进而更加准确的确定主光源颜色,提高白平衡处理效率。The image white balance correction method provided by the embodiment of the present application can determine the main light source from multiple light sources, and perform white balance processing according to the main light source, thereby more accurately determining the color of the main light source, and improving the white balance processing efficiency.
图4为本申请实施例提供的一种图像白平衡校正方法的流程示意图,作为对上述实施例的进一步说明,包括:Fig. 4 is a schematic flowchart of an image white balance correction method provided by the embodiment of the present application, as a further description of the above embodiment, including:
步骤410、对目标图像进行分割,得到多个目标子图像。Step 410: Segment the target image to obtain multiple target sub-images.
步骤420、获取每个目标子图像内容对应的光源方向。Step 420, acquiring the light source direction corresponding to the content of each target sub-image.
步骤430、根据多个目标子图像对应光源方向判断是否存在混光场景。Step 430, judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images.
步骤440、当存在混光场景时,获取多个目标子图像对应的多个光源方向。Step 440, when there is a mixed light scene, acquire multiple light source directions corresponding to multiple target sub-images.
在确定混光场景后,可以根据光照强度筛选出光照较强的多个光源方向。可选的,获取各光源颜色,从同类光源颜色中选取一个光强加高的光源。还可以,读取步骤420中确定的全部光源方向。After the mixed light scene is determined, multiple light source directions with strong light can be filtered out according to the light intensity. Optionally, the colors of each light source are obtained, and a light source with increased light intensity is selected from the same light source colors. Alternatively, all light source directions determined in step 420 can be read.
步骤450、统计每个光源方向对应的目标子图像数量。Step 450, count the number of target sub-images corresponding to each light source direction.
统计具有相同光源方向的目标子图像的数量,得到每个光源方向对应的目标子图像数量。The number of target sub-images with the same light source direction is counted to obtain the number of target sub-images corresponding to each light source direction.
步骤460、根据统计的目标子图像数量确定主光源。Step 460: Determine the main light source according to the counted number of target sub-images.
将数值最高的目标子图像数量对应的光源方向确定为主光源。Determine the direction of the light source corresponding to the number of target sub-images with the highest value as the main light source.
步骤470、根据主光源对目标图像进行白平衡校正。Step 470, perform white balance correction on the target image according to the main light source.
步骤480、当不存在混光场景时,根据调白板进行白平衡处理。Step 480, when there is no mixed light scene, perform white balance processing according to the whitening board.
本申请实施例提供的图像白平衡校正方法,能够从多个光源中将光源占比最高的光源确定为主光源,进而更加准确的确定主光源颜色,提高白平衡处理效率。The image white balance correction method provided in the embodiment of the present application can determine the light source with the highest light source ratio as the main light source from among multiple light sources, and then determine the color of the main light source more accurately, and improve the white balance processing efficiency.
图5为本申请实施例提供的一种图像白平衡校正方法的流程示意图,作为对上述实施例的进一步说明,包括:Fig. 5 is a schematic flowchart of an image white balance correction method provided by the embodiment of the present application, as a further description of the above embodiment, including:
步骤510、获取多张具有单一光源的学习图像,将学习图像输入至卷积神经网络模型中,得到预设机器学习模型。Step 510, acquiring multiple learning images with a single light source, and inputting the learning images into the convolutional neural network model to obtain a preset machine learning model.
在获取每个目标子图像的光源方向时,可借助预设机器学习模型进行识别。该预设机器学习模型可以是一个卷积神经网络模型。在本申请实施例执行之前,通过机器学习的方式,对卷积神经网络模型进行训练,训练样本可以为具有单一光源的学习图像。经过训练的卷积神经网络模型,即预设机器学习模型能够识别任意一张目标子图像对应的光源方向。When obtaining the light source direction of each target sub-image, it can be identified with the help of a preset machine learning model. The preset machine learning model may be a convolutional neural network model. Before the implementation of the embodiment of the present application, the convolutional neural network model is trained by means of machine learning, and the training sample may be a learning image with a single light source. The trained convolutional neural network model, that is, the preset machine learning model can identify the direction of the light source corresponding to any target sub-image.
步骤520、对目标图像进行分割,得到多个目标子图像。Step 520: Segment the target image to obtain multiple target sub-images.
步骤530、分别将每个目标子图像输入值预设机器学习模型,得到每个目标子图像对应的光源方向。Step 530 : Preset the machine learning model with the input value of each target sub-image to obtain the light source direction corresponding to each target sub-image.
步骤540、根据多个目标子图像对应光源方向判断是否存在混光场景。Step 540: Determine whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images.
步骤550、当存在混光场景时,根据混光场景对应的光源进行白平衡校正。Step 550, when there is a mixed light scene, perform white balance correction according to the light source corresponding to the mixed light scene.
步骤560、当不存在混光场景时,根据调白板进行白平衡处理。Step 560, when there is no mixed light scene, perform white balance processing according to the whiteboard.
本申请实施例提供的图像白平衡校正方法,能够通过输入具有单一光源的学习图像训练得到预设机器学习模型,进而避免通过固定算法识别不准确的问题,提高光源方向识别的易用性。The image white balance correction method provided by the embodiment of the present application can obtain a preset machine learning model by inputting a learning image with a single light source for training, thereby avoiding the problem of inaccurate identification by a fixed algorithm and improving the usability of light source direction identification.
图6为本申请实施例提供的一种图像白平衡校正方法的流程示意图,作为对上述实施例的进一步说明,包括:FIG. 6 is a schematic flowchart of an image white balance correction method provided by the embodiment of the present application, as a further description of the above embodiment, including:
步骤610、获取预设机器学习模型的输入规格。Step 610, acquiring input specifications of a preset machine learning model.
如果预设机器学习模型的输入规格是固定大小的图像,则在对目标图像进行分割之前,获取预设机器学习模型的输入规格,以便根据输入规格对目标图像进行分割。If the input specification of the preset machine learning model is an image of a fixed size, before segmenting the target image, the input specification of the preset machine learning model is obtained, so as to segment the target image according to the input specification.
步骤620、根据输入规格对目标图像进行分割,得到多个目标子图像。Step 620: Segment the target image according to the input specification to obtain multiple target sub-images.
步骤630、分别将每个目标子图像输入值预设机器学习模型,得到每个目标子图像对应的光源方向。Step 630: Preset the machine learning model with the input value of each target sub-image to obtain the light source direction corresponding to each target sub-image.
步骤640、根据多个目标子图像对应光源方向判断是否存在混光场景。Step 640: Determine whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images.
步骤650、当存在混光场景时,根据混光场景对应的光源进行白平衡校正。Step 650: When there is a mixed light scene, perform white balance correction according to the light source corresponding to the mixed light scene.
步骤660、当不存在混光场景时,根据调白板进行白平衡处理。Step 660, when there is no mixed light scene, perform white balance processing according to the whiteboard.
本申请实施例提供的图像白平衡校正方法,能够根据预设机器学习模型的输入规格对目标图像进行划分,进而使预设机器学习模型能够更快的识别出目标子图像的光源方向,提高处理效率。The image white balance correction method provided in the embodiment of the present application can divide the target image according to the input specifications of the preset machine learning model, so that the preset machine learning model can identify the light source direction of the target sub-image faster, and improve the processing efficiency. efficiency.
图7为本申请实施例提供的一种图像白平衡校正装置的结构示意图。如图7所示,该装置包括:分割模块710、获取模块720、判断模块730、白平衡模块740和学习模块750。FIG. 7 is a schematic structural diagram of an image white balance correction device provided by an embodiment of the present application. As shown in FIG. 7 , the device includes: a segmentation module 710 , an acquisition module 720 , a judgment module 730 , a white balance module 740 and a learning module 750 .
分割模块710,用于对目标图像进行分割,得到多个目标子图像;A segmentation module 710, configured to segment the target image to obtain multiple target sub-images;
获取模块720,用于获取所述分割模块710得到的每个目标子图像内容对应的光源方向;An acquisition module 720, configured to acquire the light source direction corresponding to each target sub-image content obtained by the segmentation module 710;
判断模块730,用于根据所述获取模块720获取的所述多个目标子图像对应光源方向判断是否存在混光场景;A judging module 730, configured to judge whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images acquired by the acquiring module 720;
白平衡模块740,用于当所述判断模块730判定存在混光场景时,根据所述混光场景对应的光源进行白平衡校正。The white balance module 740 is configured to perform white balance correction according to the light source corresponding to the mixed light scene when the judging module 730 determines that there is a mixed light scene.
进一步的,判断模块730用于:Further, the judging module 730 is used for:
判断多个相邻的目标子图像对应的光源方向是否相同;Judging whether the light source directions corresponding to multiple adjacent target sub-images are the same;
如果多个相邻的目标子图像对应的光源方向不相同,则存在混光场景。If the light source directions corresponding to multiple adjacent target sub-images are not the same, there is a mixed light scene.
进一步的,白平衡模块740用于:Further, the white balance module 740 is used for:
根据所述多个目标子图像对应的多个光源确定主光源;determining a main light source according to multiple light sources corresponding to the multiple target sub-images;
根据所述主光源对所述目标图像进行白平衡校正。Perform white balance correction on the target image according to the main light source.
进一步的,白平衡模块740根据所述多个目标子图像对应的多个光源确定主光源,包括:Further, the white balance module 740 determines the main light source according to the multiple light sources corresponding to the multiple target sub-images, including:
获取所述多个目标子图像对应的多个光源方向;Acquiring multiple light source directions corresponding to the multiple target sub-images;
统计每个光源方向对应的目标子图像数量;Count the number of target sub-images corresponding to each light source direction;
根据统计的目标子图像数量确定主光源。The main light source is determined according to the counted number of target sub-images.
进一步的,获取模块720用于:Further, the acquiring module 720 is used for:
分别将每个目标子图像输入值预设机器学习模型,得到所述每个目标子图像对应的光源方向。Each target sub-image input value is preset to a machine learning model to obtain the light source direction corresponding to each target sub-image.
进一步的,还包括学习模块750,学习模块750用于:在分别将每个目标子图像输入值预设机器学习模型之前,获取多张具有单一光源的学习图像;Further, a learning module 750 is also included, and the learning module 750 is used to: acquire multiple learning images with a single light source before each target sub-image input value is preset to the machine learning model;
将所述学习图像输入至卷积神经网络模型中,得到预设机器学习模型,以便判断模块730根据学习模块750得到的预设机器学习模型判断多个目标子图像对应光源方向判断是否存在混光场景。Input the learning image into the convolutional neural network model to obtain a preset machine learning model, so that the judging module 730 judges the direction of the light source corresponding to the multiple target sub-images according to the preset machine learning model obtained by the learning module 750 and judges whether there is mixed light Scenes.
进一步的,获取模块720用于:Further, the acquiring module 720 is used for:
获取所述预设机器学习模型的输入规格;Obtaining input specifications of the preset machine learning model;
根据所述输入规格对所述目标图像进行分割,得到多个目标子图像。Segmenting the target image according to the input specification to obtain multiple target sub-images.
本申请实施例提供的图像白平衡校正装置,首先分割模块710对目标图像进行分割,得到多个目标子图像;其次,获取模块720获取每个目标子图像内容对应的光源方向;再次,判断模块730根据所述多个目标子图像对应光源方向判断是否存在混光场景;最后,当存在混光场景时,白平衡模块740根据所述混光场景对应的光源进行白平衡校正,能够提高混光场景下图像白平衡校正效果。目前无法识别目标图像中不同光源方向的光源,导致目标图像整体色温判断不准确等问题,白平衡效果差。本申请实施例能够基于分割得到的目标子图像确定不同光源方向的光源,然后根据不同方向的光源进行白平衡矫正,进而能够更加高质的还原被拍摄场景色温。In the image white balance correction device provided in the embodiment of the present application, the segmentation module 710 firstly segments the target image to obtain multiple target sub-images; secondly, the acquisition module 720 acquires the light source direction corresponding to the content of each target sub-image; thirdly, the judgment module 730 judges whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images; finally, when there is a mixed light scene, the white balance module 740 performs white balance correction according to the light source corresponding to the mixed light scene, which can improve the mixed light scene. Image white balance correction effect in the scene. At present, it is impossible to identify light sources from different light source directions in the target image, resulting in inaccurate judgment of the overall color temperature of the target image and poor white balance effect. The embodiments of the present application can determine light sources in different light source directions based on the segmented target sub-images, and then perform white balance correction according to the light sources in different directions, thereby restoring the color temperature of the scene to be photographed with higher quality.
上述装置可执行本申请前述所有实施例所提供的方法,具备执行上述方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本申请前述所有实施例所提供的方法。The above-mentioned device can execute the methods provided by all the foregoing embodiments of the present application, and has corresponding functional modules and beneficial effects for executing the above-mentioned methods. For technical details not exhaustively described in this embodiment, reference may be made to the methods provided in all the foregoing embodiments of the present application.
图8是本申请实施例提供的一种终端设备的结构示意图。如图8所示,该终端可以包括:壳体(图中未示出)、存储器801、中央处理器(Central Processing Unit,CPU)802(又称处理器,以下简称CPU)、存储在存储器801上并可在处理器802上运行的计算机程序、电路板(图中未示出)和电源电路(图中未示出)。所述电路板安置在所述壳体围成的空间内部;所述CPU802和所述存储器801设置在所述电路板上;所述电源电路,用于为所述终端的各个电路或器件供电;所述存储器801,用于存储可执行程序代码;所述CPU802通过读取所述存储器801中存储的可执行程序代码来运行与所述可执行程序代码对应的程序。FIG. 8 is a schematic structural diagram of a terminal device provided by an embodiment of the present application. As shown in FIG. 8 , the terminal may include: a housing (not shown in the figure), a memory 801, a central processing unit (Central Processing Unit, CPU) 802 (also known as a processor, hereinafter referred to as CPU), and stored in the memory 801. Computer programs running on the processor 802, a circuit board (not shown in the figure) and a power supply circuit (not shown in the figure). The circuit board is placed inside the space surrounded by the housing; the CPU 802 and the memory 801 are arranged on the circuit board; the power supply circuit is used to supply power to each circuit or device of the terminal; The memory 801 is used to store executable program codes; the CPU 802 runs programs corresponding to the executable program codes by reading the executable program codes stored in the memory 801 .
所述终端还包括:外设接口803、RF(Radio Frequency,射频)电路805、音频电路806、扬声器811、电源管理芯片808、输入/输出(I/O)子系统809、触摸屏812、其他输入/控制设备810以及外部端口804,这些部件通过一个或多个通信总线或信号线807来通信。The terminal also includes: peripheral interface 803, RF (Radio Frequency, radio frequency) circuit 805, audio circuit 806, speaker 811, power management chip 808, input/output (I/O) subsystem 809, touch screen 812, other input /control device 810 and external port 804 , these components communicate via one or more communication buses or signal lines 807 .
应该理解的是,图示终端设备800仅仅是终端的一个范例,并且终端设备800可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。It should be understood that the illustrated terminal device 800 is only an example of a terminal, and that the terminal device 800 may have more or fewer components than shown in the figure, two or more components may be combined, or Different component configurations are possible. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
下面就本实施例提供的用于一种终端设备进行详细的描述,该终端设备以智能手机为例。The following describes a terminal device provided in this embodiment in detail, and the terminal device takes a smart phone as an example.
存储器801,所述存储器801可以被CPU802、外设接口803等访问,所述存储器801可以包括高速随机存取存储器,还可以包括非易失性存储器,例如一个或多个磁盘存储器件、闪存器件、或其他易失性固态存储器件。Memory 801, the memory 801 can be accessed by the CPU 802, the peripheral interface 803, etc., the memory 801 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more disk storage devices, flash memory devices , or other volatile solid-state storage devices.
外设接口803,所述外设接口803可以将设备的输入和输出外设连接到CPU802和存储器801。Peripheral interface 803 , which can connect the input and output peripherals of the device to CPU 802 and memory 801 .
I/O子系统809,所述I/O子系统809可以将设备上的输入输出外设,例如触摸屏812和其他输入/控制设备810,连接到外设接口803。I/O子系统809可以包括显示控制器8091和用于控制其他输入/控制设备810的一个或多个输入控制器8092。其中,一个或多个输入控制器8092从其他输入/控制设备810接收电信号或者向其他输入/控制设备810发送电信号,其他输入/控制设备810可以包括物理按钮(按压按钮、摇臂按钮等)、拨号盘、滑动开关、操纵杆、点击滚轮。值得说明的是,输入控制器8092可以与以下任一个连接:键盘、红外端口、USB接口以及诸如鼠标的指示设备。The I/O subsystem 809 , the I/O subsystem 809 can connect input and output peripherals on the device, such as a touch screen 812 and other input/control devices 810 , to the peripheral interface 803 . I/O subsystem 809 may include a display controller 8091 and one or more input controllers 8092 for controlling other input/control devices 810 . Among them, one or more input controllers 8092 receive electrical signals from or send electrical signals to other input/control devices 810, which may include physical buttons (push buttons, rocker buttons, etc.) ), dials, slide switches, joysticks, click wheels. It is worth noting that the input controller 8092 can be connected to any of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
其中,按照触摸屏的工作原理和传输信息的介质分类,触摸屏812可以为电阻式、电容感应式、红外线式或表面声波式。按照安装方式分类,触摸屏812可以为:外挂式、内置式或整体式。按照技术原理分类,触摸屏812可以为:矢量压力传感技术触摸屏、电阻技术触摸屏、电容技术触摸屏、红外线技术触摸屏或表面声波技术触摸屏。Wherein, according to the working principle of the touch screen and the classification of the medium for transmitting information, the touch screen 812 can be a resistive type, a capacitive sensing type, an infrared type or a surface acoustic wave type. Classified according to the installation method, the touch screen 812 can be: plug-in type, built-in type or integral type. Classified according to technical principles, the touch screen 812 can be: a touch screen with vector pressure sensing technology, a touch screen with resistive technology, a touch screen with capacitive technology, a touch screen with infrared technology or a touch screen with surface acoustic wave technology.
触摸屏812,所述触摸屏812是用户终端与用户之间的输入接口和输出接口,将可视输出显示给用户,可视输出可以包括图形、文本、图标、视频等。可选的,触摸屏812将用户在触屏幕上触发的电信号(如接触面的电信号),发送给处理器802。A touch screen 812. The touch screen 812 is an input interface and an output interface between the user terminal and the user, and displays visual output to the user. The visual output may include graphics, text, icons, videos, and the like. Optionally, the touch screen 812 sends an electrical signal triggered by the user on the touch screen (such as an electrical signal on the contact surface) to the processor 802 .
I/O子系统809中的显示控制器8091从触摸屏812接收电信号或者向触摸屏812发送电信号。触摸屏812检测触摸屏上的接触,显示控制器8091将检测到的接触转换为与显示在触摸屏812上的用户界面对象的交互,即实现人机交互,显示在触摸屏812上的用户界面对象可以是运行游戏的图标、联网到相应网络的图标等。值得说明的是,设备还可以包括光鼠,光鼠是不显示可视输出的触摸敏感表面,或者是由触摸屏形成的触摸敏感表面的延伸。The display controller 8091 in the I/O subsystem 809 receives electrical signals from the touch screen 812 or sends electrical signals to the touch screen 812 . The touch screen 812 detects the contact on the touch screen, and the display controller 8091 converts the detected contact into an interaction with the user interface object displayed on the touch screen 812, that is, realizes human-computer interaction, and the user interface object displayed on the touch screen 812 can be a running Icons for games, icons for networking to appropriate networks, etc. It is worth noting that the device may also include an optical mouse, which is a touch-sensitive surface that does not display visual output, or that is an extension of a touch-sensitive surface formed by a touch screen.
RF电路805,主要用于建立智能音箱与无线网络(即网络侧)的通信,实现智能音箱与无线网络的数据接收和发送。例如收发短信息、电子邮件等。The RF circuit 805 is mainly used to establish communication between the smart speaker and the wireless network (that is, the network side), and realize data reception and transmission between the smart speaker and the wireless network. Such as sending and receiving short messages, e-mails, etc.
音频电路806,主要用于从外设接口803接收音频数据,将该音频数据转换为电信号,并且将该电信号发送给扬声器811。The audio circuit 806 is mainly used to receive audio data from the peripheral interface 803 , convert the audio data into electrical signals, and send the electrical signals to the speaker 811 .
扬声器811,用于将智能音箱通过RF电路805从无线网络接收的语音信号,还原为声音并向用户播放该声音。The speaker 811 is used to restore the voice signal received by the smart speaker from the wireless network through the RF circuit 805 into sound and play the sound to the user.
电源管理芯片808,用于为CPU802、I/O子系统及外设接口所连接的硬件进行供电及电源管理。The power management chip 808 is used for power supply and power management for the hardware connected to the CPU 802 , the I/O subsystem and the peripheral interface.
在本实施例中,中央处理器802用于:In this embodiment, the central processing unit 802 is used for:
对目标图像进行分割,得到多个目标子图像;Segmenting the target image to obtain multiple target sub-images;
获取每个目标子图像内容对应的光源方向;Obtain the light source direction corresponding to the content of each target sub-image;
根据所述多个目标子图像对应光源方向判断是否存在混光场景;judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images;
当存在混光场景时,根据所述混光场景对应的光源进行白平衡校正。When there is a mixed light scene, the white balance correction is performed according to the light source corresponding to the mixed light scene.
进一步的,所述根据所述多个目标子图像对应光源方向判断是否存在混光场景,包括:Further, the judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images includes:
判断多个相邻的目标子图像对应的光源方向是否相同;Judging whether the light source directions corresponding to multiple adjacent target sub-images are the same;
如果多个相邻的目标子图像对应的光源方向不相同,则存在混光场景。If the light source directions corresponding to multiple adjacent target sub-images are not the same, there is a mixed light scene.
进一步的,所述根据所述混光场景对应的光源进行白平衡校正,包括:Further, the performing white balance correction according to the light source corresponding to the mixed light scene includes:
根据所述多个目标子图像对应的多个光源确定主光源;determining a main light source according to multiple light sources corresponding to the multiple target sub-images;
根据所述主光源对所述目标图像进行白平衡校正。Perform white balance correction on the target image according to the main light source.
进一步的,所述根据所述多个目标子图像对应的多个光源确定主光源,包括:Further, the determining the main light source according to the multiple light sources corresponding to the multiple target sub-images includes:
获取所述多个目标子图像对应的多个光源方向;Acquiring multiple light source directions corresponding to the multiple target sub-images;
统计每个光源方向对应的目标子图像数量;Count the number of target sub-images corresponding to each light source direction;
根据统计的目标子图像数量确定主光源。The main light source is determined according to the counted number of target sub-images.
进一步的,所述获取每个目标子图像内容对应的光源方向,包括:Further, the acquisition of the light source direction corresponding to the content of each target sub-image includes:
分别将每个目标子图像输入值预设机器学习模型,得到所述每个目标子图像对应的光源方向。Each target sub-image input value is preset to a machine learning model to obtain the light source direction corresponding to each target sub-image.
进一步的,在分别将每个目标子图像输入值预设机器学习模型之前,还包括:Further, before each target sub-image is input into a value preset machine learning model, it also includes:
获取多张具有单一光源的学习图像;Acquire multiple learning images with a single light source;
将所述学习图像输入至卷积神经网络模型中,得到预设机器学习模型。The learning image is input into the convolutional neural network model to obtain a preset machine learning model.
进一步的,所述对目标图像进行分割,得到多个目标子图像,包括:Further, the target image is segmented to obtain multiple target sub-images, including:
获取所述预设机器学习模型的输入规格;Obtaining input specifications of the preset machine learning model;
根据所述输入规格对所述目标图像进行分割,得到多个目标子图像。Segmenting the target image according to the input specification to obtain multiple target sub-images.
本申请实施例还提供一种包含终端设备可执行指令的存储介质,所述终端设备可执行指令在由终端设备处理器执行时用于执行一种图像白平衡校正方法,该方法包括:The embodiment of the present application also provides a storage medium containing executable instructions of a terminal device. The executable instructions of the terminal device are used to execute an image white balance correction method when executed by a processor of the terminal device. The method includes:
对目标图像进行分割,得到多个目标子图像;Segmenting the target image to obtain multiple target sub-images;
获取每个目标子图像内容对应的光源方向;Obtain the light source direction corresponding to the content of each target sub-image;
根据所述多个目标子图像对应光源方向判断是否存在混光场景;judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images;
当存在混光场景时,根据所述混光场景对应的光源进行白平衡校正。When there is a mixed light scene, the white balance correction is performed according to the light source corresponding to the mixed light scene.
进一步的,所述根据所述多个目标子图像对应光源方向判断是否存在混光场景,包括:Further, the judging whether there is a mixed light scene according to the direction of the light source corresponding to the plurality of target sub-images includes:
判断多个相邻的目标子图像对应的光源方向是否相同;Judging whether the light source directions corresponding to multiple adjacent target sub-images are the same;
如果多个相邻的目标子图像对应的光源方向不相同,则存在混光场景。If the light source directions corresponding to multiple adjacent target sub-images are not the same, there is a mixed light scene.
进一步的,所述根据所述混光场景对应的光源进行白平衡校正,包括:Further, the performing white balance correction according to the light source corresponding to the mixed light scene includes:
根据所述多个目标子图像对应的多个光源确定主光源;determining a main light source according to multiple light sources corresponding to the multiple target sub-images;
根据所述主光源对所述目标图像进行白平衡校正。Perform white balance correction on the target image according to the main light source.
进一步的,所述根据所述多个目标子图像对应的多个光源确定主光源,包括:Further, the determining the main light source according to the multiple light sources corresponding to the multiple target sub-images includes:
获取所述多个目标子图像对应的多个光源方向;Acquiring multiple light source directions corresponding to the multiple target sub-images;
统计每个光源方向对应的目标子图像数量;Count the number of target sub-images corresponding to each light source direction;
根据统计的目标子图像数量确定主光源。The main light source is determined according to the counted number of target sub-images.
进一步的,所述获取每个目标子图像内容对应的光源方向,包括:Further, the acquisition of the light source direction corresponding to the content of each target sub-image includes:
分别将每个目标子图像输入值预设机器学习模型,得到所述每个目标子图像对应的光源方向。Each target sub-image input value is preset to a machine learning model to obtain the light source direction corresponding to each target sub-image.
进一步的,在分别将每个目标子图像输入值预设机器学习模型之前,还包括:Further, before each target sub-image is input into a value preset machine learning model, it also includes:
获取多张具有单一光源的学习图像;Acquire multiple learning images with a single light source;
将所述学习图像输入至卷积神经网络模型中,得到预设机器学习模型。The learning image is input into the convolutional neural network model to obtain a preset machine learning model.
进一步的,所述对目标图像进行分割,得到多个目标子图像,包括:Further, the target image is segmented to obtain multiple target sub-images, including:
获取所述预设机器学习模型的输入规格;Obtaining input specifications of the preset machine learning model;
根据所述输入规格对所述目标图像进行分割,得到多个目标子图像。Segmenting the target image according to the input specification to obtain multiple target sub-images.
本申请实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。The computer storage medium in the embodiments of the present application may use any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (non-exhaustive list) of computer readable storage media include: electrical connections with one or more leads, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), Erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer readable signal medium may include a data signal carrying computer readable program code in baseband or as part of a carrier wave. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. .
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于无线、电线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including - but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言或其组合来编写用于执行本申请操作的计算机程序代码,程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如”C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present application may be written in one or more programming languages or combinations thereof, including object-oriented programming languages—such as Java, Smalltalk, C++, and conventional procedural Programming language - such as "C" or a similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
当然,本申请实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的图像白平衡校正操作,还可以执行本申请任意实施例所提供的图像白平衡校正方法中的相关操作。Certainly, a storage medium containing computer-executable instructions provided in the embodiments of the present application, the computer-executable instructions are not limited to the above-mentioned image white balance correction operation, and may also execute the image white balance correction operation provided in any embodiment of the present application. Related operations in the balance correction method.
注意,上述仅为本申请的较佳实施例及所运用技术原理。本领域技术人员会理解,本申请不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本申请的保护范围。因此,虽然通过以上实施例对本申请进行了较为详细的说明,但是本申请不仅仅限于以上实施例,在不脱离本申请构思的情况下,还可以包括更多其他等效实施例,而本申请的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments and technical principles used in this application. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present application. Therefore, although the present application has been described in detail through the above embodiments, the present application is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present application, and the present application The scope is determined by the scope of the appended claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810934706.3A CN109040729B (en) | 2018-08-16 | 2018-08-16 | Image white balance correction method and device, storage medium and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810934706.3A CN109040729B (en) | 2018-08-16 | 2018-08-16 | Image white balance correction method and device, storage medium and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109040729A true CN109040729A (en) | 2018-12-18 |
CN109040729B CN109040729B (en) | 2020-04-07 |
Family
ID=64631682
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810934706.3A Expired - Fee Related CN109040729B (en) | 2018-08-16 | 2018-08-16 | Image white balance correction method and device, storage medium and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109040729B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110647930A (en) * | 2019-09-20 | 2020-01-03 | 北京达佳互联信息技术有限公司 | Image processing method and device and electronic equipment |
CN112561810A (en) * | 2020-12-07 | 2021-03-26 | 西安诺瓦星云科技股份有限公司 | Display screen light-mixing removing method and device, storage medium and processor |
CN112634182A (en) * | 2020-12-18 | 2021-04-09 | 平安普惠企业管理有限公司 | Image correction method, device and equipment based on light field and storage medium |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US12219113B2 (en) | 2021-03-11 | 2025-02-04 | Samsung Electronics Co., Ltd. | Method and apparatus with image correction |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101046847A (en) * | 2007-04-29 | 2007-10-03 | 中山大学 | Human face light alignment method based on secondary multiple light mould |
US20110007181A1 (en) * | 2005-05-16 | 2011-01-13 | Sony Corporation | Image processing apparatus, method, program and image pickup apparatus |
CN106651795A (en) * | 2016-12-03 | 2017-05-10 | 北京联合大学 | Method of using illumination estimation to correct image color |
CN107464244A (en) * | 2017-03-09 | 2017-12-12 | 广东顺德中山大学卡内基梅隆大学国际联合研究院 | A kind of image irradiation method of estimation based on neutral net |
CN107682685A (en) * | 2017-10-30 | 2018-02-09 | 广东欧珀移动通信有限公司 | White balance processing method and device, electronic device, and computer-readable storage medium |
CN108401148A (en) * | 2017-02-06 | 2018-08-14 | 联发科技股份有限公司 | Method for performing automatic white balance on image |
-
2018
- 2018-08-16 CN CN201810934706.3A patent/CN109040729B/en not_active Expired - Fee Related
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110007181A1 (en) * | 2005-05-16 | 2011-01-13 | Sony Corporation | Image processing apparatus, method, program and image pickup apparatus |
CN101046847A (en) * | 2007-04-29 | 2007-10-03 | 中山大学 | Human face light alignment method based on secondary multiple light mould |
CN106651795A (en) * | 2016-12-03 | 2017-05-10 | 北京联合大学 | Method of using illumination estimation to correct image color |
CN108401148A (en) * | 2017-02-06 | 2018-08-14 | 联发科技股份有限公司 | Method for performing automatic white balance on image |
CN107464244A (en) * | 2017-03-09 | 2017-12-12 | 广东顺德中山大学卡内基梅隆大学国际联合研究院 | A kind of image irradiation method of estimation based on neutral net |
CN107682685A (en) * | 2017-10-30 | 2018-02-09 | 广东欧珀移动通信有限公司 | White balance processing method and device, electronic device, and computer-readable storage medium |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110647930A (en) * | 2019-09-20 | 2020-01-03 | 北京达佳互联信息技术有限公司 | Image processing method and device and electronic equipment |
CN112561810A (en) * | 2020-12-07 | 2021-03-26 | 西安诺瓦星云科技股份有限公司 | Display screen light-mixing removing method and device, storage medium and processor |
CN112561810B (en) * | 2020-12-07 | 2023-09-08 | 西安诺瓦星云科技股份有限公司 | Light-mixing removing method and device for display screen, storage medium and processor |
CN112634182A (en) * | 2020-12-18 | 2021-04-09 | 平安普惠企业管理有限公司 | Image correction method, device and equipment based on light field and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109040729B (en) | 2020-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107205125B (en) | An image processing method, device, terminal and computer-readable storage medium | |
CN109101873B (en) | Electronic device for providing characteristic information of an external light source for an object of interest | |
CN108881875B (en) | Image white balance processing method and device, storage medium and terminal | |
CN107613202B (en) | Shooting method and mobile terminal | |
CN104488258A (en) | Method and apparatus for dual camera shutter | |
CN107422587A (en) | Intelligent lighting device | |
CN109040729B (en) | Image white balance correction method and device, storage medium and terminal | |
US8289435B2 (en) | Method for displaying image by virtual illumination and portable terminal using the same | |
US20180240213A1 (en) | Information processing system, information processing method, and program | |
CN109120863A (en) | Shooting method, shooting device, storage medium and mobile terminal | |
CN107810472B (en) | Electronic device and method for controlling display of panoramic images | |
CN109040524A (en) | Artifact eliminating method, device, storage medium and terminal | |
CN109327691B (en) | Image shooting method and device, storage medium and mobile terminal | |
WO2020192692A1 (en) | Image processing method and related apparatus | |
CN112116690A (en) | Video special effect generation method and device and terminal | |
CN109120864B (en) | Filling light processing method, device, storage medium and mobile terminal | |
CN108665510B (en) | Rendering method and device of continuous shooting image, storage medium and terminal | |
CN111459466A (en) | Code generation method, device, equipment and storage medium | |
CN108960213A (en) | Method for tracking target, device, storage medium and terminal | |
CN108805095A (en) | Picture processing method and device, mobile terminal and computer readable storage medium | |
CN109040588A (en) | Face image photographing method and device, storage medium and terminal | |
CN108769538B (en) | Automatic focusing method and device, storage medium and terminal | |
CN107622473A (en) | Image rendering method, device, terminal and computer-readable storage medium | |
CN108055461B (en) | Self-photographing angle recommendation method and device, terminal equipment and storage medium | |
US11636675B2 (en) | Electronic device and method for providing multiple services respectively corresponding to multiple external objects included in image |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20200407 |