CN107481199B - Image defogging method and device, storage medium and mobile terminal - Google Patents

Image defogging method and device, storage medium and mobile terminal Download PDF

Info

Publication number
CN107481199B
CN107481199B CN201710625439.7A CN201710625439A CN107481199B CN 107481199 B CN107481199 B CN 107481199B CN 201710625439 A CN201710625439 A CN 201710625439A CN 107481199 B CN107481199 B CN 107481199B
Authority
CN
China
Prior art keywords
image
defogging
processed
processing
dark channel
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.)
Active
Application number
CN201710625439.7A
Other languages
Chinese (zh)
Other versions
CN107481199A (en
Inventor
袁全
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201710625439.7A priority Critical patent/CN107481199B/en
Publication of CN107481199A publication Critical patent/CN107481199A/en
Application granted granted Critical
Publication of CN107481199B publication Critical patent/CN107481199B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20182Noise reduction or smoothing in the temporal domain; Spatio-temporal filtering

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to an image defogging processing method and device, a storage medium and a mobile terminal. The method comprises the following steps: acquiring an image to be processed; acquiring a dark channel value corresponding to each pixel in the image to be processed, and counting the number of the dark channel values in a preset range; and if the number exceeds a threshold value, carrying out defogging treatment on the image to be treated according to a preset defogging mode. According to the image defogging method and device, the storage medium and the mobile terminal, before the image to be processed is defogged, whether the preset condition is met or not is judged according to the dark channel value, and the image to be processed meeting the preset condition is defogged, so that the defogging process is avoided for all the images. The efficiency of image processing is improved, the power consumption of the image processing device is reduced.

Description

图像去雾处理方法、装置、存储介质和移动终端Image dehazing processing method, device, storage medium and mobile terminal

技术领域technical field

本发明涉及计算机技术领域,特别是涉及一种图像去雾处理方法、装置、存储介质和移动终端。The present invention relates to the field of computer technology, and in particular, to an image defogging processing method, device, storage medium and mobile terminal.

背景技术Background technique

拍照是人们生活中必不可少的工作和娱乐项目,然而拍照的场景往往是复杂多变的。例如,室内环境中光线往往比较昏暗,室外环境光线往往比较明亮。然而室外环境的天气更是变化莫测,对于晴天、雨雪、大雾等不同的天气,拍照时的需求和处理方式都不一样。Taking pictures is an essential work and entertainment project in people's lives, but the scenes of taking pictures are often complex and changeable. For example, indoor environments tend to be dimly lit, and outdoor environments tend to be brighter. However, the weather in the outdoor environment is even more unpredictable. For different weather such as sunny, rainy, snowy, foggy, etc., the needs and processing methods when taking pictures are different.

在能见度较低的室外环境中拍摄图像时,往往会使得拍摄的图像不清晰。对于清晰度不够的照片,通常需要通过物理或者软件处理手段去提高图像的清晰度。去雾处理是一种常用的提高图像清晰度的手段,即通过软件处理方式去除图像中引起图像不清晰的噪声。然而,去雾处理通常需要针对图片的每一个像素进行处理。When capturing images in outdoor environments with low visibility, the captured images tend to be unclear. For photos with insufficient sharpness, it is usually necessary to improve the sharpness of the image by means of physical or software processing. Dehazing is a commonly used method to improve image clarity, that is, to remove noise that causes unclear images in images through software processing. However, dehazing usually needs to be done for every pixel of the image.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供一种图像去雾处理方法、装置、存储介质和移动终端,可以提高图像处理的效率。Embodiments of the present invention provide an image defogging processing method, device, storage medium and mobile terminal, which can improve the efficiency of image processing.

一种图像去雾处理方法,所述方法包括:An image dehazing processing method, the method comprises:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量;Obtain the dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range;

若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。If the number exceeds the threshold, defogging is performed on the image to be processed according to a preset defogging method.

一种图像去雾处理装置,所述装置包括:An image dehazing processing device, the device comprising:

图像获取模块,用于获取待处理图像;Image acquisition module, used to acquire the image to be processed;

数量获取模块,用于获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量;A quantity acquisition module, used to acquire the dark channel value corresponding to each pixel in the to-be-processed image, and count the number of dark channel values within a preset range;

去雾处理模块,用于若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。A defogging processing module, configured to perform defogging processing on the to-be-processed image according to a preset defogging method if the number exceeds a threshold.

一种存储介质,其上存储有计算机程序,该程序被处理器执行时实现如下步骤:A storage medium on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量;Obtain the dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range;

若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。If the number exceeds the threshold, defogging is performed on the image to be processed according to a preset defogging method.

一种移动终端,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如下步骤:A mobile terminal, comprising a memory, a processor and a computer program stored on the memory and running on the processor, the processor implements the following steps when executing the program:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量;Obtain the dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range;

若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。If the number exceeds the threshold, defogging is performed on the image to be processed according to a preset defogging method.

本发明实施例提供的图像去雾处理方法、装置、存储介质和移动终端,首先获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量,若该数量超过阈值则对待处理图像进行去雾处理。在对待处理图像进行去雾之前,根据暗通道值判断是否满足预设条件,满足预设条件的待处理图像才进行去雾处理,避免对所有图像都进行去雾处理。提高了图像处理的效率,降低了图像处理装置的功耗。The image defogging processing method, device, storage medium, and mobile terminal provided by the embodiments of the present invention first obtain the dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range. If the number exceeds the threshold, the image to be processed is dehazed. Before the image to be processed is dehazed, it is judged whether the preset condition is satisfied according to the dark channel value, and only the image to be processed that satisfies the preset condition is dehazed, so as to avoid dehazing of all images. The efficiency of image processing is improved, and the power consumption of the image processing device is reduced.

附图说明Description of drawings

图1为一个实施例中电子设备的内部结构示意图;1 is a schematic diagram of the internal structure of an electronic device in one embodiment;

图2为一个实施例中服务器的内部结构示意图;2 is a schematic diagram of the internal structure of a server in one embodiment;

图3为一个实施例中图像去雾处理方法的流程图;3 is a flowchart of an image dehazing processing method in one embodiment;

图4为另一个实施例中图像去雾处理方法的流程图;4 is a flowchart of an image dehazing processing method in another embodiment;

图5为一个实施例中图像去雾处理装置的结构示意图;5 is a schematic structural diagram of an image defogging device in one embodiment;

图6为另一个实施例中图像去雾处理装置的结构示意图;6 is a schematic structural diagram of an image defogging device in another embodiment;

图7为一个实施例中图像处理电路的示意图。FIG. 7 is a schematic diagram of an image processing circuit in one embodiment.

具体实施方式Detailed ways

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

图1为一个实施例中电子设备的内部结构示意图。如图1所示,该电子设备包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络接口、显示屏和输入装置。其中,电子设备的非易失性存储介质存储有操作系统和计算机可读指令。该计算机可读指令被处理器执行时以实现一种图像去雾处理方法。该处理器用于提供计算和控制能力,支撑整个电子设备的运行。电子设备中的内存储器为非易失性存储介质中的计算机可读指令的运行提供环境。网络接口用于与服务器进行网络通信,如发送图像去雾处理请求至服务器,接收服务器返回的去雾处理后的图像等。电子设备的显示屏可以是液晶显示屏或者电子墨水显示屏等,输入装置可以是显示屏上覆盖的触摸层,也可以是电子设备外壳上设置的按键、轨迹球或触控板,也可以是外接的键盘、触控板或鼠标等。该电子设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。本领域技术人员可以理解,图1中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。FIG. 1 is a schematic diagram of the internal structure of an electronic device in one embodiment. As shown in FIG. 1 , the electronic device includes a processor, a non-volatile storage medium, an internal memory and a network interface, a display screen and an input device connected through a system bus. The non-volatile storage medium of the electronic device stores an operating system and computer-readable instructions. The computer-readable instructions, when executed by a processor, implement an image dehazing processing method. The processor is used to provide computing and control capabilities that support the operation of the entire electronic device. Internal memory in an electronic device provides an environment for the execution of computer-readable instructions in a non-volatile storage medium. The network interface is used for network communication with the server, such as sending an image dehazing processing request to the server, and receiving the dehazing processed image returned by the server. The display screen of the electronic equipment can be a liquid crystal display screen or an electronic ink display screen, etc., and the input device can be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the electronic equipment, or a An external keyboard, trackpad, or mouse, etc. The electronic device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device, and the like. Those skilled in the art can understand that the structure shown in FIG. 1 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may be Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.

图2为一个实施例中服务器的内部结构示意图。如图2所示,该服务器包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络接口。其中,该服务器的非易失性存储介质存储有操作系统和计算机可读指令。该计算机可读指令被处理器执行时以实现一种图像去雾处理方法。该服务器的处理器用于提供计算和控制能力,支撑整个服务器的运行。该服务器的网络接口用于据以与外部的终端通过网络连接通信,比如接收终端发送的图像去雾处理请求以及向终端返回去雾处理后的图像等。服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。本领域技术人员可以理解,图2中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的服务器的限定,具体的服务器可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。FIG. 2 is a schematic diagram of an internal structure of a server in an embodiment. As shown in FIG. 2, the server includes a processor, a non-volatile storage medium, an internal memory and a network interface connected through a system bus. Wherein, the non-volatile storage medium of the server stores an operating system and computer-readable instructions. The computer-readable instructions, when executed by a processor, implement an image dehazing processing method. The server's processor is used to provide computing and control capabilities to support the operation of the entire server. The network interface of the server is used to communicate with an external terminal through a network connection, such as receiving an image dehazing processing request sent by the terminal and returning the dehazing processed image to the terminal. The server can be implemented as an independent server or a server cluster composed of multiple servers. Those skilled in the art can understand that the structure shown in FIG. 2 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied. More or fewer components are shown in the figures, either in combination or with different arrangements of components.

图3为一个实施例中图像去雾处理方法的流程图。如图3所示,该图像去雾处理方法包括步骤302至步骤306,其中:FIG. 3 is a flowchart of an image dehazing processing method in one embodiment. As shown in FIG. 3, the image dehazing processing method includes steps 302 to 306, wherein:

步骤302,获取待处理图像。Step 302, acquiring the image to be processed.

在本发明提供的实施例中,待处理图像是指需要进行去雾处理的图像,可以通过图像采集装置进行采集。图像采集装置是指采集图像的装置,例如图像采集装置可以是照相机、移动终端的摄像头、摄像机等装置。In the embodiments provided by the present invention, the image to be processed refers to an image that needs to be dehazed, and can be collected by an image collection device. The image acquisition device refers to a device for acquiring images, for example, the image acquisition device may be a camera, a camera of a mobile terminal, a video camera, or other devices.

可以理解的是,在本发明实施例中,获取待处理图像可以是直接通过图像采集装置进行获取,也可以是从预设的存储空间中进行获取的,该预设的存储空间是指预先设置的存放待处理图像的存储空间。也就是说,在进行图像去雾处理之前,可以直接发起拍照指令去通过图像采集装置采集需要进行去雾处理的待处理图像,还可以是直接从预设的存储空间中去获取需要进行去雾处理的待处理图像。It can be understood that, in this embodiment of the present invention, the image to be processed may be acquired directly through an image acquisition device, or may be acquired from a preset storage space, where the preset storage space refers to a preset storage space. The storage space for storing images to be processed. That is to say, before the image defogging process is performed, a photographing instruction can be directly initiated to collect the to-be-processed image that needs to be defogged through the image acquisition device, or it can be obtained directly from the preset storage space that needs defogging. The processed image to be processed.

步骤304,获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量。Step 304: Obtain a dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range.

可以理解的是,待处理图像是由若干个像素组成的,每一个像素都有对应的RGB三通道值,用来表示图像中像素的颜色和亮度等信息。其中,RGB三通道值分别表示了待处理图像中每一个像素的红、绿、蓝等三个颜色的分量的大小,暗通道值则是指待处理图像的RGB三个通道值中的最小通道值。一般认为,该暗通道值越小,对应像素受到的雾浓度的影响越小。It can be understood that the image to be processed is composed of several pixels, and each pixel has a corresponding RGB three-channel value, which is used to represent information such as the color and brightness of the pixels in the image. Among them, the RGB three-channel value respectively represents the size of the red, green, blue and other three color components of each pixel in the image to be processed, and the dark channel value refers to the smallest channel among the three RGB channel values of the image to be processed. value. It is generally believed that the smaller the dark channel value, the smaller the influence of the fog density on the corresponding pixel.

在一个实施例中,预设范围是指预先设置的暗通道值的取值范围。具体地,预设范围可以是一个比较小的暗通道值的取值范围,通过该预设范围可以筛选出取值比较小的暗通道值,也就可以筛选出受雾浓度影响较小的像素。In one embodiment, the preset range refers to a preset value range of the dark channel value. Specifically, the preset range may be a value range of a relatively small dark channel value, and through the preset range, a dark channel value with a relatively small value can be filtered out, and thus pixels that are less affected by the fog density can be filtered out .

步骤306,若数量超过阈值,则根据预设去雾方式对待处理图像进行去雾处理。Step 306 , if the number exceeds the threshold, perform a defogging process on the image to be processed according to a preset defogging method.

在本发明提供的实施例中,在大雾、雨雪或者雾霾天气时,在户外拍摄时往往会受到影响,使拍摄出来的图像特别不清晰,看不清图像中的物体。去雾处理是指去除图像中的使图像不清晰的雾气和沙尘等噪声,使图像还原的处理方法。预设去雾方式是指预先设置的对待处理图像进行去雾处理的方式。In the embodiments provided by the present invention, in heavy fog, rain, snow or haze weather, shooting outdoors is often affected, so that the captured image is particularly unclear and objects in the image cannot be seen clearly. Defogging refers to a process that removes noises such as fog and sand that make the image unclear, and restores the image. The preset defogging method refers to a preset defogging method for the image to be processed.

举例来说,若预设去雾方式为暗原色先验去雾算法,假设待处理图像可以表达为如下公式:For example, if the default dehazing method is the dark primary color prior dehazing algorithm, it is assumed that the image to be processed can be expressed as the following formula:

I(x)=J(x)t(x)+A(1-t(x))I(x)=J(x)t(x)+A(1-t(x))

其中,I(x)为待处理图像,J(x)为对待处理图像进行去雾处理之后得到的图像,t(x)为透射率,A为大气光值。一般假设A为已知值,待处理图像中RGB三个通道中存在通道值很低的通道,且该通道值接近于零,则可以得到:Among them, I(x) is the image to be processed, J(x) is the image obtained after the image to be processed is dehazed, t(x) is the transmittance, and A is the atmospheric light value. Generally, assuming that A is a known value, there is a channel with a very low channel value in the three RGB channels in the image to be processed, and the channel value is close to zero, then you can get:

Figure BDA0001362704750000051
Figure BDA0001362704750000051

由上式可以获取到透射率即为:The transmittance can be obtained from the above formula as:

Figure BDA0001362704750000052
Figure BDA0001362704750000052

可以引入一个0到1之间的权值ω对透射率进行调节,则最终的透射率表达式如下:A weight ω between 0 and 1 can be introduced to adjust the transmittance, and the final transmittance expression is as follows:

Figure BDA0001362704750000053
Figure BDA0001362704750000053

为了保证去雾效果,可以对透射率设定一个透射率阈值t0,那么去雾处理后的图像可以有如下表达式得到:In order to ensure the dehazing effect, a transmittance threshold t 0 can be set for the transmittance, then the image after dehazing can be obtained by the following expression:

Figure BDA0001362704750000054
Figure BDA0001362704750000054

具体地,若数量超过阈值,则根据预设去雾方式对待处理图像进行去雾处理。其中,阈值是指预先设置的用于判断在预设范围内的暗通道值的数量是否满足条件的值。在本发明实施例中,如果在预设范围内的暗通道值的数量超过该阈值,则认为该待处理图受到雾浓度的影响较大,需要进行去雾处理,使得待处理图像进行还原成无雾图像。Specifically, if the number exceeds the threshold, the image to be processed is dehazed according to a preset dehazing method. The threshold value refers to a preset value used to determine whether the number of dark channel values within a preset range satisfies a condition. In this embodiment of the present invention, if the number of dark channel values within a preset range exceeds the threshold, it is considered that the image to be processed is greatly affected by the fog density, and a dehazing process needs to be performed, so that the image to be processed is restored to Fog free image.

在本发明提供的其他实施例中,还可以根据暗通道值提取待处理图像中的去雾区域,然后再根据预设去雾方式对待处理图像中的去雾区域进行去雾处理。其中,去雾区域是指待处理图像中需要进行去雾处理的区域。通常来讲,待处理图像中会包含不同雾浓度的区域,有的区域雾浓度高,有的区域雾浓度低。因此,在进行去雾之前可以首先根据雾浓度的程度将待处理图像划分成不同的区域。In other embodiments provided by the present invention, the dehazing area in the image to be processed can also be extracted according to the dark channel value, and then the dehazing area in the image to be processed is dehazed according to a preset dehazing method. The defogging area refers to the area in the image to be processed that needs to be defogged. Generally speaking, the image to be processed will contain areas with different fog density, some areas have high fog density, and some areas have low fog density. Therefore, the to-be-processed image can be divided into different regions according to the degree of haze density before dehazing.

该去雾区域可以根据待处理图像中每一个像素对应的暗通道值进行划分,将在预设范围内的暗通道值对应的区域划分为去雾区域,在预设范围之外的暗通道值对应的区域划分为非去雾区域。然后对去雾区域进行去雾处理,非去雾区域则不进行去雾处理。The dehazing area can be divided according to the dark channel value corresponding to each pixel in the image to be processed, and the area corresponding to the dark channel value within the preset range is divided into the dehazing area, and the dark channel value outside the preset range is divided into the dehazing area. The corresponding areas are divided into non-dehaze areas. Then, the defogging process is performed on the defogging area, and the non-defogging area is not subjected to the defogging process.

进一步地,可以将暗通道值划分为不同的取值等级,根据暗通道值的取值等级将去雾区域划分为多个去雾等级区域,再根据去雾等级区域对应的去雾方式对去雾等级区域进行处理。也就是说,将在预设范围内的暗通道值再进行等级的划分,不同等级的暗通道值对应不同的去雾等级区域,然后通过不同等级的去雾方式对去雾等级区域进行去雾处理。Further, the dark channel value can be divided into different value levels, the dehazing area can be divided into a plurality of dehazing level areas according to the value level of the dark channel value, and then the dehazing level can be compared according to the dehazing method corresponding to the dehazing level area. Fog level areas are processed. That is to say, the dark channel values within the preset range are divided into levels, and the dark channel values of different levels correspond to different dehazing level areas, and then the dehazing level areas are dehazed by different levels of dehazing methods. deal with.

上述图像去雾处理方法,首先获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量,若该数量超过阈值则对待处理图像进行去雾处理。在对待处理图像进行去雾之前,根据暗通道值判断是否满足预设条件,满足预设条件的待处理图像才进行去雾处理,避免对所有图像都进行去雾处理。提高了图像处理的效率,降低了图像处理装置的功耗。The above image dehazing processing method first obtains the dark channel value corresponding to each pixel in the image to be processed, and counts the number of dark channel values within a preset range. If the number exceeds a threshold, the image to be processed is dehazed. Before the image to be processed is dehazed, it is judged whether the preset condition is satisfied according to the dark channel value, and only the image to be processed that satisfies the preset condition is dehazed, so as to avoid dehazing of all images. The efficiency of image processing is improved, and the power consumption of the image processing device is reduced.

图4为另一个实施例中图像去雾处理方法的流程图。如图4所示,该图像去雾处理方法包括步骤402至步骤408,其中:FIG. 4 is a flowchart of a method for image dehazing processing in another embodiment. As shown in FIG. 4 , the image dehazing processing method includes steps 402 to 408, wherein:

步骤402,获取待处理图像。Step 402, acquiring an image to be processed.

在一个实施例中,获取的待处理图像可以是预先存储在预设的存储空间中的,也可以是直接通过图像采集装置进行采集的。举例来说,通过移动终端的摄像头获取待处理图像时,用户通过移动终端输入拍照指令,移动终端在检测到该拍照指令之后,通过摄像头来采集待处理图像。其中,拍照指令可以是移动终端的物理按键或触屏操作触发的,也可以是语音指令等。In one embodiment, the acquired image to be processed may be pre-stored in a preset storage space, or may be directly acquired by an image acquisition device. For example, when the image to be processed is acquired through the camera of the mobile terminal, the user inputs a photographing instruction through the mobile terminal, and after detecting the photographing instruction, the mobile terminal collects the image to be processed through the camera. The photographing instruction may be triggered by a physical button of the mobile terminal or a touch screen operation, or may be a voice instruction or the like.

步骤404,获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量。Step 404: Obtain a dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range.

在本发明提供的实施例中,待处理图像中的每一个像素都有RGB三通道值,RGB三通道值分别表示待处理图像像素的红、绿、蓝三个颜色的分量的大小,每一个通道值的取值范围都在0到255之间,数值越大表示对应的颜色通道的分量越大。而一般情况下,对于待处理图像的每个像素来说,RGB三通道值中都会存在一个最小的通道值,这个最小的通道值就是该像素对应的暗通道值。In the embodiment provided by the present invention, each pixel in the image to be processed has RGB three-channel values, and the RGB three-channel values respectively represent the size of the red, green, and blue color components of the image pixel to be processed, and each The value range of the channel value is between 0 and 255. The larger the value, the larger the component of the corresponding color channel. In general, for each pixel of the image to be processed, there will be a minimum channel value in the RGB three-channel value, and the minimum channel value is the dark channel value corresponding to the pixel.

一般地,在光线明亮不受雾浓度影响的情况下,这个暗通道值是一个非常小的值,我们可以认为这个暗通道值越小,像素受到的雾浓度影响越小;相反,暗通道值越大,像素受到的雾浓度影响越大。In general, when the light is bright and not affected by the fog concentration, the dark channel value is a very small value. We can think that the smaller the dark channel value, the less the pixel is affected by the fog concentration; on the contrary, the dark channel value The larger the value, the more the pixel is affected by the fog density.

在一个实施例中,可以遍历待处理图像中的每一个像素的RGB三通道值,获取每一个像素对应的暗通道值,从而得到整个待处理图像的暗通道图。然后遍历暗通道图,筛选出在预设范围内的暗通道值,并统计在预设范围内的暗通道值的数量。一般地,在预设范围内的暗通道值的数量越少,认为待处理图像受到的雾浓度影响越小。In one embodiment, the RGB three-channel value of each pixel in the image to be processed may be traversed, and the dark channel value corresponding to each pixel may be acquired, thereby obtaining a dark channel map of the entire image to be processed. Then traverse the dark channel map, filter out dark channel values within the preset range, and count the number of dark channel values within the preset range. Generally, the smaller the number of dark channel values within the preset range, the less the image to be processed is considered to be affected by the fog density.

步骤406,若数量超过阈值,则获取待处理图像对应的雾浓度参数,并根据所述雾浓度参数对待处理图像进行去雾处理。Step 406, if the number exceeds the threshold, obtain the fog density parameter corresponding to the image to be processed, and perform dehazing processing on the image to be processed according to the fog density parameter.

在一个实施例中,根据预设模型获取待处理图像中每一个像素的雾浓度参数,根据雾浓度参数对待处理图像中每一个像素进行去雾处理。对待处理图像中的每一个像素进行去雾处理后,就可以得到去雾处理后的待处理图像。In one embodiment, the haze density parameter of each pixel in the image to be processed is acquired according to a preset model, and each pixel in the image to be processed is dehazed according to the fog density parameter. After each pixel in the image to be processed is dehazed, a dehazed image to be processed can be obtained.

更进一步地,获取待处理图像中RGB三个通道中每个通道的雾浓度参数;根据RGB三个通道中每个通道的雾浓度参数,分别对待处理图像中的RGB三个通道进行去雾处理。Further, obtain the fog density parameter of each of the three RGB channels in the image to be processed; according to the fog density parameter of each channel of the three RGB channels, dehaze the three RGB channels in the image to be processed respectively .

在一个实施例中,雾浓度参数可以但不限于包括大气光值和透射率;根据预设去雾方式对待处理图像进行去雾处理可以包括:获取待处理图像的大气光值和RGB三个通道中每个通道的透射率因子;根据透射率因子获取RGB三个通道中每个通道的透射率;根据大气光值和RGB三个通道中每个通道的透射率分别对RGB三个通道进行去雾处理。In one embodiment, the fog density parameter may include, but is not limited to, atmospheric light value and transmittance; performing dehazing processing on the image to be processed according to a preset dehazing method may include: acquiring the atmospheric light value and three RGB channels of the image to be processed The transmittance factor of each channel in the fog treatment.

具体地,雾污染对RGB三个通道的影响不同,在采用去雾算法对图像整体去雾时,图像中G通道和B通道上的雾无法完全去除。进一步的,相同浓度的雾对RGB三个通道的影响不同,其中R通道的透射率最高、B通道的透射率最低、G通道的透射率位于两者之间;且在雾浓度增加时,RGB三个通道之间的差值也增大。本实施例中,对RGB三个通道预设透射率因子ωR、ωG、ωB,其中:Specifically, fog pollution has different effects on the three RGB channels. When the dehazing algorithm is used to dehaze the image as a whole, the fog on the G channel and B channel in the image cannot be completely removed. Further, the fog of the same concentration has different effects on the three RGB channels, wherein the transmittance of the R channel is the highest, the transmittance of the B channel is the lowest, and the transmittance of the G channel is between the two; and when the fog concentration increases, the RGB The difference between the three channels also increases. In this embodiment, the transmittance factors ω R , ω G , and ω B are preset for the three RGB channels, wherein:

ωR=1ω R = 1

ωG=(0.9+0.1*t(x))2 ω G =(0.9+0.1*t(x)) 2

ωB=(0.7+0.3*t(x))2 ω B =(0.7+0.3*t(x)) 2

根据预设的透射率因子求取RGB三个通道每个通道的透射率tR、tG、tBAccording to the preset transmittance factor, the transmittance t R , t G , and t B of each channel of the three RGB channels are obtained.

tR=ωR*t(x)=t(x)t RR *t(x)=t(x)

tG=ωG*t(x)=t(x)*(0.9+0.1*t(x))2 t GG *t(x)=t(x)*(0.9+0.1*t(x)) 2

tB=ωB*t(x)=t(x)*(0.7+0.3*t(x))2 t BB *t(x)=t(x)*(0.7+0.3*t(x)) 2

其中,t(x)为待处理图像的透射率,假设待处理图像的大气光值A为已知值,根据公式:Among them, t(x) is the transmittance of the image to be processed, assuming that the atmospheric light value A of the image to be processed is a known value, according to the formula:

Figure BDA0001362704750000081
Figure BDA0001362704750000081

将上述公式中t(x)依次替换为tR、tG、tB,即可对待处理影像中RGB三个通道依次进行去雾处理。By replacing t(x) in the above formula with t R , t G , and t B in turn, the three RGB channels in the image to be processed can be dehazed in sequence.

在本发明提供的其他实施例中,可以获取待处理图像的景象类型;根据景象类型对应的去雾方式对待处理图像进行去雾处理。其中,景象类型是指待处理图像中的景象的类型,例如景象类型可以是建筑、天空、沙滩、树木等类型。具体地,可以提取待处理图像的属性参数,根据该属性参数来判断待处理图像的景象类型。In other embodiments provided by the present invention, the scene type of the image to be processed may be acquired; the image to be processed is dehazed according to a dehazing method corresponding to the scene type. The scene type refers to the type of scene in the image to be processed, for example, the scene type may be a building, sky, beach, tree, or the like. Specifically, the attribute parameter of the image to be processed can be extracted, and the scene type of the image to be processed can be determined according to the attribute parameter.

举例来说,获取待处理图像的景象类型可以是以下方法中的一种或多种:提取待处理图像的纹理信息,根据该纹理信息来判断待处理图像的景象类型;提取待处理图像的颜色信息,根据该颜色信息来判断待处理图像的景象类型;在用户终端显示输入景象类型的界面,用户通过用户终端来输入景象类型。For example, acquiring the scene type of the image to be processed may be one or more of the following methods: extracting texture information of the image to be processed, and determining the scene type of the image to be processed according to the texture information; extracting the color of the image to be processed information, and determine the scene type of the image to be processed according to the color information; an interface for inputting scene types is displayed on the user terminal, and the user inputs the scene type through the user terminal.

在本发明提供的实施例中,景象类型对应的去雾处理方式,是指根据景象类型的不同而采取的不同的去雾处理方式。不同的去雾方式可以是指根据不同的去雾算法进行去雾处理,也可以是指采用同一种去雾算法的不同程度的去雾处理。In the embodiments provided by the present invention, the defogging processing methods corresponding to the scene types refer to different defogging processing methods adopted according to different scene types. Different dehazing methods may refer to dehazing processing according to different dehazing algorithms, or may refer to different degrees of dehazing processing using the same dehazing algorithm.

举例来说,待处理图像的景象类型为建筑时,通常色彩比较暗淡,雾浓度相对较小,可以对其采用程度较浅的去雾处理对待处理图像进行处理;待处理图像的景象类型为天空时,通常色彩比较鲜亮,雾浓度比较深,则可以对其采用程度较深的去雾处理对待处理图像进行处理。For example, when the scene type of the image to be processed is a building, the color is usually dim and the fog density is relatively small, and the image to be processed can be processed with a lesser degree of dehazing; the scene type of the image to be processed is the sky When the color is relatively bright and the fog density is relatively deep, the image to be processed can be processed with a deeper degree of dehazing.

在一个实施例中,还可以对待处理图像进行进一步的划分,获取待处理图像中的划分区域,并获取每个划分区域的区域类型,根据区域类型对应的去雾处理方式对划分区域进行处理。例如,将待处理图像划分为天空区域、树木区域、土地区域等,然后对这三个区域分别进行去雾处理。In one embodiment, the image to be processed may be further divided, the divided regions in the to-be-processed image may be obtained, the region type of each divided region may be obtained, and the divided regions may be processed according to the dehazing processing method corresponding to the region type. For example, the image to be processed is divided into a sky area, a tree area, a land area, etc., and then the three areas are dehazed separately.

上述图像去雾处理方法,首先获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量,若该数量超过阈值则对待处理图像进行去雾处理。在对待处理图像进行去雾之前,根据暗通道值判断是否满足预设条件,满足预设条件的待处理图像才进行去雾处理,避免对所有图像都进行去雾处理。提高了图像处理的效率,降低了图像处理装置的功耗。The above image dehazing processing method first obtains the dark channel value corresponding to each pixel in the image to be processed, and counts the number of dark channel values within a preset range. If the number exceeds a threshold, the image to be processed is dehazed. Before the image to be processed is dehazed, it is judged whether the preset condition is satisfied according to the dark channel value, and only the image to be processed that satisfies the preset condition is dehazed, so as to avoid dehazing of all images. The efficiency of image processing is improved, and the power consumption of the image processing device is reduced.

图5为一个实施例中图像去雾处理装置的结构示意图。如图5所示,该图像去雾处理装置500包括图像获取模块502、数量获取模块504和去雾处理模块506。其中:FIG. 5 is a schematic structural diagram of an image defogging device in one embodiment. As shown in FIG. 5 , the image dehazing processing apparatus 500 includes an image acquiring module 502 , a quantity acquiring module 504 and a dehazing processing module 506 . in:

图像获取模块502,用于获取待处理图像。The image acquisition module 502 is used to acquire the image to be processed.

数量获取模块504,用于获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量。The quantity acquisition module 504 is configured to acquire the dark channel value corresponding to each pixel in the to-be-processed image, and count the number of dark channel values within a preset range.

去雾处理模块506,用于若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。A defogging processing module 506, configured to perform defogging processing on the to-be-processed image according to a preset defogging method if the number exceeds a threshold.

上述图像去雾处理装置,首先获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量,若该数量超过阈值则对待处理图像进行去雾处理。在对待处理图像进行去雾之前,根据暗通道值判断是否满足预设条件,满足预设条件的待处理图像才进行去雾处理,避免对所有图像都进行去雾处理。提高了图像处理的效率,降低了图像处理装置的功耗。The above image dehazing processing device first obtains the dark channel value corresponding to each pixel in the image to be processed, and counts the number of dark channel values within a preset range, and if the number exceeds a threshold, the image to be processed is dehazed. Before the image to be processed is dehazed, it is judged whether the preset condition is satisfied according to the dark channel value, and only the image to be processed that satisfies the preset condition is dehazed, so as to avoid dehazing of all images. The efficiency of image processing is improved, and the power consumption of the image processing device is reduced.

图6为另一个实施例中图像去雾处理装置的结构示意图。如图6所示,该图像去雾处理装置600包括图像获取模块602、数量获取模块604、类型获取模块606和去雾处理模块608。其中:FIG. 6 is a schematic structural diagram of an image defogging device in another embodiment. As shown in FIG. 6 , the image dehazing processing apparatus 600 includes an image acquiring module 602 , a quantity acquiring module 604 , a type acquiring module 606 and a dehazing processing module 608 . in:

图像获取模块602,用于获取待处理图像。The image acquisition module 602 is used for acquiring the image to be processed.

数量获取模块604,用于获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量。The quantity acquisition module 604 is configured to acquire the dark channel value corresponding to each pixel in the to-be-processed image, and count the number of dark channel values within a preset range.

类型获取模块606,用于获取所述待处理图像的景象类型。A type acquisition module 606, configured to acquire the scene type of the image to be processed.

去雾处理模块608,用于若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。A defogging processing module 608, configured to perform defogging processing on the to-be-processed image according to a preset defogging method if the number exceeds a threshold.

上述图像去雾处理装置,获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量,若该数量超过阈值则对待处理图像进行去雾处理。在对待处理图像进行去雾之前,根据暗通道值判断是否满足预设条件,满足预设条件的待处理图像才进行去雾处理,避免对所有图像都进行去雾处理。提高了图像处理的效率,降低了图像处理装置的功耗。The above image defogging processing device obtains the dark channel value corresponding to each pixel in the image to be processed, and counts the number of dark channel values within a preset range, and if the number exceeds a threshold, the image to be processed is dehazed. Before the image to be processed is dehazed, it is judged whether the preset condition is satisfied according to the dark channel value, and only the image to be processed that satisfies the preset condition is dehazed, so as to avoid dehazing of all images. The efficiency of image processing is improved, and the power consumption of the image processing device is reduced.

在一个实施例中,去雾处理模块608还用于获取待处理图像对应的雾浓度参数,并根据所述雾浓度参数对所述待处理图像进行去雾处理。In one embodiment, the dehazing processing module 608 is further configured to acquire a haze density parameter corresponding to the image to be processed, and perform dehazing processing on the image to be processed according to the haze density parameter.

在一个实施例中,去雾处理模块608还用于获取所述待处理图像中RGB三个通道中每个通道的雾浓度参数;根据所述RGB三个通道中每个通道的雾浓度参数,分别对所述待处理图像中的RGB三个通道进行去雾处理。In one embodiment, the dehazing processing module 608 is further configured to obtain the haze density parameter of each of the three RGB channels in the image to be processed; according to the haze density parameter of each of the three RGB channels, Dehazing is performed on the three RGB channels in the to-be-processed image respectively.

在一个实施例中,去雾处理模块608还用于根据所述暗通道值提取所述待处理图像中的去雾区域;根据预设去雾方式对所述待处理图像中的去雾区域进行去雾处理。In one embodiment, the dehazing processing module 608 is further configured to extract the dehazing area in the to-be-processed image according to the dark channel value; Dehaze treatment.

上述图像去雾处理装置中各个模块的划分仅用于举例说明,在其他实施例中,可将图像去雾处理装置按照需要划分为不同的模块,以完成上述图像去雾处理装置的全部或部分功能。The division of each module in the above image defogging processing apparatus is only used for illustration. In other embodiments, the image defogging processing apparatus may be divided into different modules as required, so as to complete all or part of the above image defogging processing apparatus Function.

本发明实施例还提供了一种存储介质。一种存储介质,其上存储有计算机程序,该程序被处理器执行时实现以下步骤:The embodiment of the present invention also provides a storage medium. A storage medium on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量;Obtain the dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range;

若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。If the number exceeds the threshold, defogging is performed on the image to be processed according to a preset defogging method.

在本发明提供的实施例中,被处理器执行的所述根据预设去雾方式对所述待处理图像进行去雾处理包括:In the embodiment provided by the present invention, the dehazing process performed by the processor on the to-be-processed image according to the preset dehazing method includes:

获取待处理图像对应的雾浓度参数,并根据所述雾浓度参数对所述待处理图像进行去雾处理。Obtain the fog density parameter corresponding to the image to be processed, and perform dehazing processing on the image to be processed according to the fog density parameter.

在一个实施例中,被处理器执行的所述获取待处理图像对应的雾浓度参数,并根据所述雾浓度参数对所述待处理图像进行去雾处理包括:In one embodiment, the acquiring a haze density parameter corresponding to the image to be processed, and performing dehazing processing on the image to be processed according to the haze density parameter performed by the processor includes:

获取所述待处理图像中RGB三个通道中每个通道的雾浓度参数;Obtain the fog density parameter of each channel in the three RGB channels in the image to be processed;

根据所述RGB三个通道中每个通道的雾浓度参数,分别对所述待处理图像中的RGB三个通道进行去雾处理。According to the fog density parameter of each of the three RGB channels, the three RGB channels in the to-be-processed image are dehazed respectively.

在本实施例中,被处理器执行的所述根据预设去雾方式对所述待处理图像进行去雾处理包括:In this embodiment, the dehazing process performed by the processor on the to-be-processed image according to the preset dehazing method includes:

根据所述暗通道值提取所述待处理图像中的去雾区域;extracting the dehazing area in the to-be-processed image according to the dark channel value;

根据预设去雾方式对所述待处理图像中的去雾区域进行去雾处理。Dehazing is performed on the dehazing area in the image to be processed according to a preset dehazing method.

在其中一个实施例中,被处理器执行的根据预设去雾方式对所述待处理图像进行去雾处理包括:In one of the embodiments, the defogging process performed by the processor on the to-be-processed image according to a preset defogging method includes:

获取所述待处理图像的景象类型;obtaining the scene type of the image to be processed;

根据所述景象类型对应的去雾方式对所述待处理图像进行去雾处理。Dehazing is performed on the image to be processed according to a dehazing manner corresponding to the scene type.

本发明实施例还提供一种计算机设备。上述计算机设备中包括图像处理电路,图像处理电路可以利用硬件和/或软件组件实现,可包括定义ISP(Image SignalProcessing,图像信号处理)管线的各种处理单元。图7为一个实施例中图像处理电路的示意图。如图7所示,为便于说明,仅示出与本发明实施例相关的图像处理技术的各个方面。The embodiment of the present invention also provides a computer device. The above computer equipment includes an image processing circuit, and the image processing circuit may be implemented by hardware and/or software components, and may include various processing units that define an ISP (Image Signal Processing, image signal processing) pipeline. FIG. 7 is a schematic diagram of an image processing circuit in one embodiment. As shown in FIG. 7 , for the convenience of description, only various aspects of the image processing technology related to the embodiments of the present invention are shown.

如图7所示,图像处理电路包括ISP处理器740和控制逻辑器750。成像设备710捕捉的图像数据首先由ISP处理器740处理,ISP处理器740对图像数据进行分析以捕捉可用于确定和/或成像设备710的一个或多个控制参数的图像统计信息。成像设备710可包括具有一个或多个透镜712和图像传感器714的照相机。图像传感器714可包括色彩滤镜阵列(如Bayer滤镜),图像传感器714可获取用图像传感器714的每个成像像素捕捉的光强度和波长信息,并提供可由ISP处理器740处理的一组原始图像数据。传感器720可基于传感器720接口类型把原始图像数据提供给ISP处理器740。传感器720接口可以利用SMIA(StandardMobile Imaging Architecture,标准移动成像架构)接口、其它串行或并行照相机接口或上述接口的组合。As shown in FIG. 7 , the image processing circuit includes an ISP processor 740 and a control logic 750 . Image data captured by imaging device 710 is first processed by ISP processor 740 , which analyzes the image data to capture image statistics that can be used to determine and/or control one or more parameters of imaging device 710 . Imaging device 710 may include a camera having one or more lenses 712 and an image sensor 714 . Image sensor 714 may include an array of color filters (eg, Bayer filters), image sensor 714 may obtain light intensity and wavelength information captured with each imaging pixel of image sensor 714 and provide a set of raw materials that may be processed by ISP processor 740. image data. The sensor 720 may provide raw image data to the ISP processor 740 based on the sensor 720 interface type. The sensor 720 interface may utilize a SMIA (Standard Mobile Imaging Architecture) interface, other serial or parallel camera interfaces, or a combination of the above interfaces.

ISP处理器740按多种格式逐个像素地处理原始图像数据。例如,每个图像像素可具有8、10、12或14比特的位深度,ISP处理器740可对原始图像数据进行一个或多个图像处理操作、收集关于图像数据的统计信息。其中,图像处理操作可按相同或不同的位深度精度进行。ISP processor 740 processes raw image data pixel by pixel in various formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits, and the ISP processor 740 may perform one or more image processing operations on the raw image data, collecting statistical information about the image data. Among them, the image processing operations can be performed with the same or different bit depth precision.

ISP处理器740还可从图像存储器730接收像素数据。例如,从传感器720接口将原始像素数据发送给图像存储器730,图像存储器730中的原始像素数据再提供给ISP处理器740以供处理。图像存储器730可为存储器装置的一部分、存储设备、或电子设备内的独立的专用存储器,并可包括DMA(Direct Memory Access,直接直接存储器存取)特征。ISP processor 740 may also receive pixel data from image memory 730 . For example, the raw pixel data is sent from the sensor 720 interface to the image memory 730, and the raw pixel data in the image memory 730 is provided to the ISP processor 740 for processing. The image memory 730 may be a part of a memory device, a storage device, or an independent dedicated memory in an electronic device, and may include a DMA (Direct Memory Access, direct memory access) feature.

当接收到来自传感器720接口或来自图像存储器730的原始图像数据时,ISP处理器740可进行一个或多个图像处理操作,如时域滤波。处理后的图像数据可发送给图像存储器730,以便在被显示之前进行另外的处理。ISP处理器740还可从图像存储器730接收处理数据,对上述处理数据进行原始域中以及RGB和YCbCr颜色空间中的图像数据处理。处理后的图像数据可输出给显示器780,以供用户观看和/或由图形引擎或GPU(GraphicsProcessing Unit,图形处理器)进一步处理。此外,ISP处理器740的输出还可发送给图像存储器730,且显示器780可从图像存储器730读取图像数据。在一个实施例中,图像存储器730可被配置为实现一个或多个帧缓冲器。此外,ISP处理器740的输出可发送给编码器/解码器770,以便编码/解码图像数据。编码的图像数据可被保存,并在显示于显示器780设备上之前解压缩。When receiving raw image data from the sensor 720 interface or from the image memory 730, the ISP processor 740 may perform one or more image processing operations, such as temporal filtering. The processed image data may be sent to image memory 730 for additional processing before being displayed. The ISP processor 740 may also receive processed data from the image memory 730, and perform image data processing in the original domain and in the RGB and YCbCr color spaces on the processed data. The processed image data may be output to the display 780 for viewing by a user and/or further processed by a graphics engine or a GPU (Graphics Processing Unit, graphics processor). In addition, the output of the ISP processor 740 may also be sent to the image memory 730 , and the display 780 may read image data from the image memory 730 . In one embodiment, image memory 730 may be configured to implement one or more frame buffers. Additionally, the output of ISP processor 740 may be sent to encoder/decoder 770 for encoding/decoding image data. The encoded image data can be saved and decompressed prior to display on the display 780 device.

ISP处理后的图像数据可发送给去雾模块760,以便在被显示之前对图像进行去雾处理。去雾模块760对图像数据进行去雾处理可包括获取待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量;若数量超过阈值,则根据预设去雾方式对待处理图像进行去雾处理等。其中,去雾模块760可为移动终端中CPU(CentralProcessing Unit,中央处理器)或GPU(Graphics Processing Unit,图形处理器)等。去雾模块760将图像数据进行去雾处理后,可将去雾处理后的图像数据发送给编码器/解码器770,以便编码/解码图像数据。编码的图像数据可被保存,并在显示与显示器780设备上之前解压缩。可以理解的是,去雾模块760处理后的图像数据可以不经过编码器/解码器770,直接发给显示器780进行显示。ISP处理器740处理后的图像数据还可以先经过编码器/解码器770处理,然后再经过去雾模块760进行处理。The ISP-processed image data may be sent to a defogging module 760 for defogging the image before being displayed. Dehazing the image data by the defogging module 760 may include obtaining a dark channel value corresponding to each pixel in the image to be processed, and counting the number of dark channel values within a preset range; The dehazing method performs dehazing processing on the image to be processed, etc. The defogging module 760 may be a CPU (Central Processing Unit, central processing unit) or a GPU (Graphics Processing Unit, graphics processing unit) or the like in the mobile terminal. After defogging the image data, the defogging module 760 may send the defogged image data to the encoder/decoder 770 for encoding/decoding the image data. The encoded image data can be saved and decompressed before being displayed on the display 780 device. It can be understood that the image data processed by the defogging module 760 may be directly sent to the display 780 for display without going through the encoder/decoder 770 . The image data processed by the ISP processor 740 may also be processed by the encoder/decoder 770 first, and then processed by the defogging module 760 .

ISP处理器740确定的统计数据可发送给控制逻辑器750单元。例如,统计数据可包括自动曝光、自动白平衡、自动聚焦、闪烁检测、黑电平补偿、透镜712阴影校正等图像传感器714统计信息。控制逻辑器750可包括执行一个或多个例程(如固件)的处理器和/或微控制器,一个或多个例程可根据接收的统计数据,确定成像设备710的控制参数以及ISP处理器740的控制参数。例如,控制参数可包括传感器720控制参数(例如增益、曝光控制的积分时间)、照相机闪光控制参数、透镜712控制参数(例如聚焦或变焦用焦距)、或这些参数的组合。ISP控制参数可包括用于自动白平衡和颜色调整(例如,在RGB处理期间)的增益水平和色彩校正矩阵,以及透镜712阴影校正参数。Statistics determined by the ISP processor 740 may be sent to the control logic 750 unit. For example, the statistics may include image sensor 714 statistics such as auto exposure, auto white balance, auto focus, flicker detection, black level compensation, lens 712 shading correction, and the like. Control logic 750 may include a processor and/or microcontroller executing one or more routines (eg, firmware) that may determine control parameters of imaging device 710 and ISP processing based on received statistics control parameters of the controller 740. For example, control parameters may include sensor 720 control parameters (eg, gain, integration time for exposure control), camera flash control parameters, lens 712 control parameters (eg, focal length for focus or zoom), or a combination of these parameters. ISP control parameters may include gain levels and color correction matrices for automatic white balance and color adjustment (eg, during RGB processing), and lens 712 shading correction parameters.

以下为运用图7中图像处理技术实现图像去雾处理方法的步骤:The following are the steps of implementing the image dehazing processing method using the image processing technology in Figure 7:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中每一个像素对应的暗通道值,并统计在预设范围内的暗通道值的数量;Obtain the dark channel value corresponding to each pixel in the image to be processed, and count the number of dark channel values within a preset range;

若所述数量超过阈值,则根据预设去雾方式对所述待处理图像进行去雾处理。If the number exceeds the threshold, defogging is performed on the image to be processed according to a preset defogging method.

在本发明提供的实施例中,所述根据预设去雾方式对所述待处理图像进行去雾处理包括:In the embodiment provided by the present invention, performing the defogging process on the to-be-processed image according to the preset defogging method includes:

获取待处理图像对应的雾浓度参数,并根据所述雾浓度参数对所述待处理图像进行去雾处理。Obtain the fog density parameter corresponding to the image to be processed, and perform dehazing processing on the image to be processed according to the fog density parameter.

在一个实施例中,所述获取待处理图像对应的雾浓度参数,并根据所述雾浓度参数对所述待处理图像进行去雾处理包括:In one embodiment, the acquiring a fog density parameter corresponding to the image to be processed, and performing dehazing processing on the image to be processed according to the fog density parameter includes:

获取所述待处理图像中RGB三个通道中每个通道的雾浓度参数;Obtain the fog density parameter of each channel in the three RGB channels in the image to be processed;

根据所述RGB三个通道中每个通道的雾浓度参数,分别对所述待处理图像中的RGB三个通道进行去雾处理。According to the fog density parameter of each of the three RGB channels, the three RGB channels in the to-be-processed image are dehazed respectively.

在本实施例中,所述根据预设去雾方式对所述待处理图像进行去雾处理包括:In this embodiment, performing the defogging process on the to-be-processed image according to a preset defogging method includes:

根据所述暗通道值提取所述待处理图像中的去雾区域;extracting the dehazing area in the to-be-processed image according to the dark channel value;

根据预设去雾方式对所述待处理图像中的去雾区域进行去雾处理。Dehazing is performed on the dehazing area in the image to be processed according to a preset dehazing method.

在其中一个实施例中,根据预设去雾方式对所述待处理图像进行去雾处理包括:In one embodiment, performing dehazing processing on the to-be-processed image according to a preset dehazing method includes:

获取所述待处理图像的景象类型;obtaining the scene type of the image to be processed;

根据所述景象类型对应的去雾方式对所述待处理图像进行去雾处理。Dehazing is performed on the image to be processed according to a dehazing manner corresponding to the scene type.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium , when the program is executed, it may include the flow of the above-mentioned method embodiments. The storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or the like.

以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present invention, and the descriptions thereof are specific and detailed, but should not be construed as limiting the scope of the patent of the present invention. It should be pointed out that for those skilled in the art, without departing from the concept of the present invention, several modifications and improvements can be made, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention should be subject to the appended claims.

Claims (10)

1. An image defogging processing method, characterized by comprising:
acquiring an image to be processed;
acquiring a dark channel value corresponding to each pixel in the image to be processed, and counting the number of the dark channel values within a preset range, wherein the dark channel value is the minimum channel value of the three channel values of red, green and blue (RGB) of the image to be processed;
if the number exceeds a threshold value, extracting a defogging area in the image to be processed according to the dark channel value;
carrying out defogging treatment on the defogging area in the image to be treated according to a preset defogging mode;
the defogging treatment of the defogging area in the image to be treated according to the preset defogging mode comprises the following steps: dividing the defogging area into a plurality of defogging grade areas according to the value grade of the dark channel value; and processing the defogging grade area according to the defogging mode corresponding to the defogging grade area.
2. The image defogging method according to claim 1, wherein the defogging of the defogging region in the image to be processed according to the preset defogging mode comprises:
and acquiring a fog concentration parameter corresponding to a defogging area in an image to be processed, and defogging the defogging area according to the fog concentration parameter.
3. The image defogging method according to claim 2, wherein the acquiring of the fog concentration parameter corresponding to the defogging region in the image to be processed and the defogging of the defogging region according to the fog concentration parameter comprises:
obtaining a fog concentration parameter of each channel in RGB three channels in the defogging region;
and according to the fog concentration parameter of each channel in the RGB three channels, carrying out defogging treatment on the RGB three channels in the defogging area respectively.
4. The image defogging processing method according to claim 1, wherein the defogging concentration parameters include an atmospheric light value and a transmittance.
5. The image defogging method according to claim 1, wherein the defogging of the image to be processed according to the preset defogging mode comprises:
acquiring the scene type of the image to be processed;
and carrying out defogging treatment on the image to be treated according to the defogging mode corresponding to the scene type.
6. An image defogging processing device, characterized in that the device comprises:
the image acquisition module is used for acquiring an image to be processed;
the quantity acquisition module is used for acquiring a dark channel value corresponding to each pixel in the image to be processed and counting the quantity of the dark channel values within a preset range;
the defogging processing module is used for extracting a defogging area in the image to be processed according to the dark channel value if the number exceeds a threshold value; dividing the defogging area into a plurality of defogging grade areas according to the value grade of the dark channel value; and processing the defogging grade area according to the defogging mode corresponding to the defogging grade area.
7. The image defogging processing device according to claim 6, wherein the defogging processing module is further configured to obtain a fog concentration parameter corresponding to a defogging region in the image to be processed, and perform defogging processing on the defogging region according to the fog concentration parameter.
8. The image defogging processing device according to claim 6, wherein said device further comprises:
the type acquisition module is used for acquiring the scene type of the image to be processed;
and the defogging processing module is also used for defogging the image to be processed according to the defogging mode corresponding to the scene type.
9. A storage medium on which a computer program is stored, characterized in that the program, when executed by a processor, implements the image defogging processing method according to any one of claims 1 to 5.
10. A mobile terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the image defogging method according to any one of claims 1 to 5 when the program is executed.
CN201710625439.7A 2017-07-27 2017-07-27 Image defogging method and device, storage medium and mobile terminal Active CN107481199B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710625439.7A CN107481199B (en) 2017-07-27 2017-07-27 Image defogging method and device, storage medium and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710625439.7A CN107481199B (en) 2017-07-27 2017-07-27 Image defogging method and device, storage medium and mobile terminal

Publications (2)

Publication Number Publication Date
CN107481199A CN107481199A (en) 2017-12-15
CN107481199B true CN107481199B (en) 2020-01-10

Family

ID=60597972

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710625439.7A Active CN107481199B (en) 2017-07-27 2017-07-27 Image defogging method and device, storage medium and mobile terminal

Country Status (1)

Country Link
CN (1) CN107481199B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110930326A (en) * 2019-11-15 2020-03-27 浙江大华技术股份有限公司 Image and video defogging method and related device
CN115412669B (en) * 2022-08-26 2023-06-06 清华大学 Fog imaging method and device based on image signal-to-noise ratio analysis

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5771430B2 (en) * 2011-04-08 2015-08-26 オリンパス株式会社 Wrinkle removal image processing apparatus, wrinkle removal image processing method, and wrinkle removal image processing program
CN104091310A (en) * 2014-06-24 2014-10-08 三星电子(中国)研发中心 Image defogging method and device
JP6488581B2 (en) * 2014-07-25 2019-03-27 株式会社ソシオネクスト 霞 Image discrimination device and discrimination method
CN106033597B (en) * 2015-03-17 2019-02-26 杭州海康威视数字技术股份有限公司 The method and apparatus of image defogging
CN106447639A (en) * 2016-10-18 2017-02-22 乐视控股(北京)有限公司 Mobile terminal photograph processing method and device

Also Published As

Publication number Publication date
CN107481199A (en) 2017-12-15

Similar Documents

Publication Publication Date Title
CN107451969B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107704798B (en) Image blurring method, apparatus, computer-readable storage medium, and computer device
CN107481186B (en) Image processing method, apparatus, computer-readable storage medium, and computer device
CN107395991B (en) Image synthesis method, image synthesis device, computer-readable storage medium and computer equipment
CN107424133A (en) Image defogging method, device, computer storage medium and mobile terminal
CN107277299B (en) Image processing method, device, mobile terminal, and computer-readable storage medium
CN107563979B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN107317967B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107194901B (en) Image processing method, image processing device, computer equipment and computer readable storage medium
CN107341782B (en) Image processing method, image processing device, computer equipment and computer readable storage medium
CN107454317B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN107464225A (en) Image processing method, device, computer readable storage medium and mobile terminal
CN108174173B (en) Photographing method and apparatus, computer-readable storage medium, and computer device
CN107454328B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN107454318B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107481199B (en) Image defogging method and device, storage medium and mobile terminal
CN107317969A (en) Image defogging method, device, computer storage medium and mobile terminal
CN107277369B (en) Image processing method, device, computer readable storage medium and computer equipment
CN107295261B (en) Image dehazing processing method, device, storage medium and mobile terminal
CN107959843B (en) Image processing method and device, computer readable storage medium and computer device
CN107392870B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107317972B (en) Image processing method, apparatus, computer device, and computer-readable storage medium
CN110276730B (en) Image processing method and device and electronic equipment
CN107392871B (en) Image defogging method and device, mobile terminal and computer readable storage medium
CN108520036B (en) Image selection method and device, storage medium and electronic equipment

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: OPPO Guangdong Mobile Communications Co., Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: Guangdong Opel Mobile Communications Co., Ltd.

GR01 Patent grant
GR01 Patent grant