CN107392871B - Image defogging method and device, mobile terminal and computer readable storage medium - Google Patents

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

Info

Publication number
CN107392871B
CN107392871B CN201710626236.XA CN201710626236A CN107392871B CN 107392871 B CN107392871 B CN 107392871B CN 201710626236 A CN201710626236 A CN 201710626236A CN 107392871 B CN107392871 B CN 107392871B
Authority
CN
China
Prior art keywords
image
defogged
transmissivity
wave band
rgb
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
CN201710626236.XA
Other languages
Chinese (zh)
Other versions
CN107392871A (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 CN201710626236.XA priority Critical patent/CN107392871B/en
Publication of CN107392871A publication Critical patent/CN107392871A/en
Application granted granted Critical
Publication of CN107392871B publication Critical patent/CN107392871B/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/73Deblurring; Sharpening
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

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

Abstract

The invention relates to an image defogging method and device, a mobile terminal and a computer readable storage medium. The method comprises the following steps: acquiring an image to be defogged; calculating the original transmittance of the image to be defogged; calculating the wave band transmissivity respectively corresponding to the RGB wave bands in the image to be defogged according to the original transmissivity; and carrying out defogging treatment on the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands. The image defogging method, the image defogging device, the mobile terminal and the computer readable storage medium can effectively remove the fog in the image, and simultaneously can solve the problems of bluish image and color distortion after defogging by using the traditional defogging algorithm, so that the color of the defogged image is more natural and real.

Description

Image defogging method and device, mobile terminal and computer readable storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image defogging method and apparatus, a mobile terminal, and a computer-readable storage medium.
Background
In foggy weather, the imaging equipment is affected by suspended particles in the air, so that the characteristics of the collected images, such as color, texture and the like, are seriously weakened, the definition of the images is often low, and the integral tone of the images tends to be grayed. In order to make the image containing fog clearer, the image containing fog can be subjected to defogging treatment, and the image obtained by defogging the image by using a traditional defogging algorithm, such as a dark primary color prior algorithm, is bluish and has the problem of color distortion.
Disclosure of Invention
The embodiment of the invention provides an image defogging method and device, a mobile terminal and a computer readable storage medium, which can solve the problem of color distortion after defogging by using a traditional defogging algorithm.
An image defogging method comprising:
acquiring an image to be defogged;
calculating the original transmittance of the image to be defogged;
calculating the wave band transmissivity respectively corresponding to the RGB wave bands in the image to be defogged according to the original transmissivity;
and carrying out defogging treatment on the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands.
In one embodiment, the calculating, according to the original transmittance, band transmittances in the image to be defogged corresponding to three RGB bands respectively includes:
acquiring adjustment coefficients respectively corresponding to the three RGB wave bands in the image to be defogged;
and respectively calculating the wave band transmissivity corresponding to the RGB three wave bands according to the original transmissivity and the adjusting coefficient.
In one embodiment, the adjusting coefficient of the R wave band in the image to be defogged is greater than the adjusting coefficient of the G wave band, and the adjusting coefficient of the G wave band is greater than the adjusting coefficient of the B wave band;
the wave band transmissivity of the R wave band is greater than the wave band transmissivity of the G wave band, and the wave band transmissivity of the G wave band is greater than the wave band transmissivity of the B wave band.
In one embodiment, the calculating the original transmittance of the image to be defogged includes:
determining the fog concentration distribution of the image to be defogged;
carrying out region division on the image to be defogged according to the fog concentration distribution;
acquiring the atmospheric light value of each divided area;
and respectively calculating the original transmittance of the corresponding region according to the atmospheric light value of each region.
In one embodiment, the acquiring the atmospheric light values of the divided regions includes:
sequencing all pixel points in the area according to brightness in the dark channel image of the image to be defogged;
extracting pixel points with preset proportion in the region according to the brightness from large to small;
determining the brightness value corresponding to each extracted pixel point in the image to be defogged;
calculating the average brightness value of the region according to the brightness value corresponding to each extracted pixel point;
if the average brightness value is smaller than a preset threshold value, determining the atmospheric light value of the area as the average brightness value, otherwise, determining the atmospheric light value of the area as the preset threshold value.
An image defogging device comprising:
the acquiring module is used for acquiring an image to be defogged;
the original transmittance calculation module is used for calculating the original transmittance of the image to be defogged;
the wave band transmissivity calculating module is used for calculating wave band transmissivity which corresponds to the RGB wave bands in the image to be defogged according to the original transmissivity;
and the defogging module is used for defogging the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands.
In one embodiment, the band transmittance calculation module includes:
the coefficient acquisition unit is used for acquiring adjustment coefficients corresponding to the RGB three wave bands in the image to be defogged;
the wave band transmissivity calculating unit is used for calculating wave band transmissivity corresponding to the RGB three wave bands respectively according to the original transmissivity and the adjusting coefficient;
the adjusting coefficient of an R wave band in the image to be defogged is larger than that of a G wave band, and the adjusting coefficient of the G wave band is larger than that of a B wave band;
the wave band transmissivity of the R wave band is greater than the wave band transmissivity of the G wave band, and the wave band transmissivity of the G wave band is greater than the wave band transmissivity of the B wave band.
In one embodiment, the raw transmittance calculation module includes:
the distribution unit is used for determining the fog concentration distribution of the image to be defogged;
the dividing unit is used for carrying out region division on the image to be defogged according to the fog concentration distribution;
the atmospheric light value acquisition unit is used for acquiring the atmospheric light values of the divided areas;
and the original transmissivity calculating unit is used for respectively calculating the original transmissivity of the corresponding area according to the atmospheric light value of each area.
In one embodiment, the atmospheric light value obtaining unit includes:
the sequencing subunit is used for sequencing all pixel points in the area according to the brightness in the dark channel image of the image to be defogged;
the extraction subunit is used for extracting pixel points with a preset proportion in the region from large to small according to the brightness;
the first determining subunit is used for determining the brightness value corresponding to each extracted pixel point in the image to be defogged;
an average brightness value calculation operator unit, configured to calculate an average brightness value of the region according to the brightness value corresponding to each extracted pixel point;
a second determining subunit, configured to determine, if the average brightness value is smaller than a preset threshold, that the atmospheric light value of the area is the average brightness value, and otherwise, determine that the atmospheric light value of the area is the preset threshold.
A mobile terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method as described above when executing the program.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method as set forth above.
The image defogging method, the image defogging device, the mobile terminal and the computer readable storage medium obtain an image to be defogged, calculate the original transmissivity of the image to be defogged, calculate the wave band transmissivity respectively corresponding to the three RGB wave bands in the image to be defogged according to the original transmissivity, and perform defogging treatment of different programs on the three RGB wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the three RGB wave bands, so that the fog in the image can be effectively removed, and meanwhile, the problems of bluish image and color distortion after defogging by using a traditional defogging algorithm can be solved, and the color of the defogged image is more natural and real.
Drawings
FIG. 1 is a block diagram of a mobile terminal in one embodiment;
FIG. 2 is a flow chart illustrating an exemplary image defogging method;
FIG. 3 is a schematic diagram of a process for calculating band transmittances corresponding to three RGB bands in one embodiment;
FIG. 4 is a schematic diagram of a process for calculating the raw transmittance of an image to be defogged in one embodiment;
FIG. 5 is a schematic flow chart illustrating the process of obtaining the atmospheric light values of the divided regions according to one embodiment;
FIG. 6 is a block diagram of an image defogging device in one embodiment;
FIG. 7 is a block diagram of a raw transmittance calculation module in one embodiment;
FIG. 8 is a schematic diagram of an image processing circuit in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is a block diagram of a mobile terminal in one embodiment. As shown in fig. 1, the mobile terminal includes a processor, a non-volatile storage medium, an internal memory and a network interface, a display screen, and an input device, which are connected through a system bus. The non-volatile storage medium of the mobile terminal stores an operating system and computer-executable instructions, and the computer-executable instructions are executed by the processor to implement the image defogging method provided by the embodiment of the invention. The processor is used to provide computing and control capabilities to support the operation of the entire mobile terminal. The internal memory in the mobile terminal provides an environment for the execution of computer-readable instructions in the non-volatile storage medium. The network interface is used for network communication with the server. The display screen of the mobile terminal can be a liquid crystal display screen or an electronic ink display screen, and the input device can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on a shell of the mobile terminal, or an external keyboard, a touch pad or a mouse. The mobile terminal can be a mobile phone, a tablet computer, a personal digital assistant or a wearable device. Those skilled in the art will appreciate that the architecture shown in fig. 1 is only a block diagram of a portion of the architecture associated with the subject application and does not constitute a limitation on the mobile terminal to which the subject application applies, and that a particular mobile terminal may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
As shown in fig. 2, in one embodiment, there is provided an image defogging method including the steps of:
step 210, obtaining an image to be defogged.
In this embodiment, the image to be defogged refers to an image containing fog, and in a foggy weather, there are many particles such as water droplets in the atmosphere, and the farther the object is from an imaging device, such as a camera, a video camera, or the like, the greater the influence of the atmospheric particles on imaging, and the foggy image generally has problems of low contrast, low saturation, hue shift, and the like due to the influence of the atmospheric particles.
Step 220, calculating the original transmittance of the image to be defogged.
The method comprises the steps that a mobile terminal obtains an image to be defogged, and defogging processing can be carried out on the image to be defogged according to a defogging algorithm, wherein the defogging algorithm can comprise a defogging algorithm based on image enhancement and a defogging algorithm based on image restoration, the defogging algorithm based on image enhancement can comprise a defogging algorithm based on a RetineX theory, a defogging algorithm based on histogram equalization and the like, and the defogging algorithm based on image restoration can comprise a defogging algorithm based on an atmospheric scattering model and the like. In this embodiment, the mobile terminal may perform defogging processing on the image to be defogged through a dark primary color prior algorithm, where the dark primary color prior algorithm belongs to a defogging algorithm based on image restoration.
The dark channel prior algorithm adopts an atmospheric scattering model to describe the image to be defogged, wherein the atmospheric scattering model can be shown as formula (1):
I(x)=J(x)t(x)+A(1-t(x)) (1);
wherein, i (x) represents an image to be defogged, j (x) represents a fog-free image obtained after defogging treatment of the image to be defogged, x represents a spatial position of a certain pixel in the image, t (x) represents a transmittance, and a represents an atmospheric light value. For fog-free images, some pixels will always have at least one color channel in the three RGB (red, green, blue color space) channels with a very low value, the value of which is close to zero. Thus, for any image, its dark channel image can be as shown in equation (2):
wherein, Jdark(x) Representing dark channel images, Jc(y) represents the value of the color channel and Ω (x) represents a window centered on pixel x. According to the formula (1) and the formula (2), the calculation formula of the transmittance can be derived as shown in the formula (3):
Figure BDA0001362885490000062
in real life, even in a fine day, there are some particles in the air, the object far away can still feel the existence of fog, and the existence of fog can make people feel the existence of depth of field, therefore, a factor between [0 and 1] can be introduced to adjust the obtained transmittance, and the transmittance can be calculated by formula (3) as formula (4):
Figure BDA0001362885490000063
in this embodiment, ω represents a factor for adjusting the transmittance, and ω may have a value of 0.95 or other values, but is not limited thereto, and smaller ω represents smaller defogging degree, and larger ω represents larger defogging degree.
After the mobile terminal obtains the image to be defogged, the dark channel image of the image to be defogged can be obtained according to the formula (2), and the atmospheric light value can be obtained, wherein the mobile terminal can sort the pixel points of the dark channel image according to the brightness, extract the first 0.1% of the pixel points according to the brightness from large to small, determine the brightness value of the position corresponding to the extracted pixel point in the image to be defogged, and take the brightness value of the pixel point with the highest brightness value as the atmospheric light value. After the mobile terminal obtains the atmospheric light value, the original transmittance of the image to be defogged can be calculated according to the formula (4).
Further, the calculated atmospheric light value may be compared with a preset threshold, and if the calculated atmospheric light value is not less than the preset threshold, the preset threshold may be used as the atmospheric light value of the image to be defogged to calculate the original transmittance.
And 230, calculating the wave band transmissivity respectively corresponding to the RGB wave bands in the image to be defogged according to the original transmissivity.
Because the influence of the fog on the three RGB bands is different, if the fog removal processing is performed on the three RGB bands to the same degree, the fog in the green band and the blue band may not be completely removed, which may cause the image obtained after the fog removal processing to be bluish and cause the color distortion problem. Aiming at the three RGB wave bands, adjusting coefficients corresponding to the three RGB wave bands can be respectively introduced, and wave band transmissivity which corresponds to the three RGB wave bands in the image to be defogged is recalculated to be t (r), t (g) and t (b) according to the adjusting coefficients.
And 240, performing defogging treatment on the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands.
For the fog with the same concentration, the influence on the three RGB wave bands is increased progressively, so that in the wave band transmissivity which corresponds to the three RGB wave bands in the image to be defogged, the wave band transmissivity t (R) of the R wave band is greater than the wave band transmissivity t (G) of the G wave band, the wave band transmissivity t (G) of the G wave band is greater than the wave band transmissivity t (B) of the B wave band, and the different wave band transmissivity represents that the defogging treatment intensity is different. The mobile terminal can carry out defogging treatment with different degrees on the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands, and can respectively bring the wave band transmissivity t (R), t (G) and t (B) respectively corresponding to the RGB three wave bands into the formula (1), and respectively obtain the values J (R), J (G) and J (B) of the image to be defogged on three channels of the RGB image, wherein the defogging treatment intensity of the RGB three wave bands is increased progressively, namely, the defogging treatment intensity of the R wave band is smaller than the defogging treatment intensity of the G wave band, and the defogging treatment intensity of the G wave band is smaller than the defogging treatment intensity of the B wave band. After the mobile terminal performs defogging processing on the RGB three bands of the image to be defogged, the values j (r), j (g), and j (b) of the RGB three channels after the defogging processing are synthesized to obtain a fog-free image j (x).
According to the image defogging method, the image to be defogged is obtained, the original transmissivity of the image to be defogged is calculated, the wave band transmissivity corresponding to the RGB wave bands in the image to be defogged is calculated according to the original transmissivity, and the defogging treatment with different programs is carried out on the RGB wave bands of the image to be defogged according to the wave band transmissivity corresponding to the RGB wave bands respectively, so that the fog in the image can be effectively removed, the problems of bluish image and color distortion after defogging is carried out by using a traditional defogging algorithm can be solved, and the color of the defogged image is more natural and real.
As shown in fig. 3, in one embodiment, the step 230 of calculating the transmittance of the three wavelength bands corresponding to RGB in the image to be defogged according to the original transmittance includes the following steps:
step 302, obtaining adjustment coefficients corresponding to the three RGB wave bands in the image to be defogged.
The mobile terminal can obtain preset adjusting coefficients corresponding to three RGB wave bands in the image to be defogged respectively, wherein the adjusting coefficient of the R wave band in the image to be defogged is larger than the adjusting coefficient of the G wave band, and the adjusting coefficient of the G wave band is larger than the adjusting coefficient of the B wave band. In one embodiment, the adjustment factor W of the R bandrAdjustment coefficient W of 1, G wave bandgAnd the adjustment coefficient W of B wave bandbCan be calculated according to the formula (5) and the formula (6):
Wg=(0.9+0.1*t)2(5);
Wb=(0.7+0.3*t)2(6);
where t denotes the original transmittance of the image to be defogged.
And step 304, respectively calculating the wave band transmissivity corresponding to the three RGB wave bands according to the original transmissivity and the adjusting coefficient.
The mobile terminal can multiply the adjusting coefficients respectively corresponding to the three RGB bands by the original transmittance, so as to calculate the transmittance of the corresponding band, and the transmittance of the RGB bands can be calculated as shown in formula (7):
t(r)=Wr*t
t(g)=Wg*t
t(b)=Wb*t (7)。
it should be understood that the adjustment coefficients for the three RGB bands are not limited to the calculation of the above equations (5) and (6), and the transmittance of the band is not limited to the calculation of the above equation (7), but may be calculated in other manners.
In the embodiment, adjustment coefficients corresponding to three RGB bands are respectively introduced, band transmittances corresponding to the three RGB bands are respectively calculated according to the adjustment coefficients, and defogging processing with different intensities is performed on the three RGB bands of the image to be defogged, so that the fog in the image can be effectively removed, and meanwhile, the problems of bluish image and color distortion after defogging by using a traditional defogging algorithm can be solved, and the color of the image after defogging is more natural and real.
As shown in FIG. 4, in one embodiment, step 220 of calculating the raw transmittance of the image to be defogged may include the steps of:
step 402, determining the fog concentration distribution of the image to be defogged.
The mobile terminal can obtain the dark channel image of the image to be defogged according to the formula (2), determine the fog concentration distribution of the image to be defogged according to the dark channel image, and estimate the dark channel image as the fog concentration distribution image of the image to be defogged. In one embodiment, the depth of field information of the image to be defogged can also be acquired, and the fog concentration distribution of the image to be defogged is determined according to the depth of field information of the image to be defogged, wherein the fog concentration exponentially increases along with the increase of the depth of field.
And step 404, performing area division on the image to be defogged according to the fog concentration distribution.
The mobile terminal can divide the areas of the image to be defogged according to the fog concentration distribution of the image to be defogged, the fog concentrations in the same area are relatively close, and large jump cannot occur.
And step 408, acquiring the atmospheric light values of the divided areas.
After the image to be defogged is subjected to region division, the mobile terminal can respectively obtain the atmospheric light values of the divided regions, wherein for each divided region, the mobile terminal can sort the pixel points in the dark channel image from high to low according to the brightness, and take the pixel points with the brightness sorted at the top 0.1 percent in advance, then determine the brightness value of the position corresponding to the extracted pixel point in the region in the image to be defogged, and take the brightness value of the pixel point with the highest brightness value as the atmospheric light value of the region.
And step 410, respectively calculating the original transmittance of the corresponding area according to the atmospheric light value of each area.
After the mobile terminal respectively obtains the atmospheric light values of the divided regions, the original transmittance of each region can be respectively calculated according to the formula (4), wherein the original transmittance of the region with high fog concentration is smaller than the original transmittance of the region with low fog concentration. The wave band transmissivity respectively corresponding to the RGB three wave bands in the corresponding region can be calculated according to the original transmissivity of each region, and then the defogging treatment with different degrees is carried out on the RGB three wave bands of each region after the image to be defogged is divided according to the wave band transmissivity respectively corresponding to the RGB three wave bands in each region. The mobile terminal can synthesize each area obtained after the defogging treatment, and then a defogged image can be obtained.
In this embodiment, the image to be defogged may be divided into regions according to the fog concentration, and the original transmittance of each region may be calculated, so that different degrees of defogging processing may be performed on each region, and the defogging effect may be improved.
As shown in fig. 5, in one embodiment, the step 408 of obtaining the atmospheric light values of the divided regions includes the following steps:
step 502, in the dark channel image of the image to be defogged, all the pixel points in the area are sorted according to the brightness.
The mobile terminal can respectively acquire the atmospheric light values of all the divided areas of the image to be defogged, and for each divided area, the mobile terminal can acquire the brightness of each pixel point in the area in the dark channel image of the image to be defogged and sequence the pixel points according to the brightness.
And step 504, extracting pixel points in a preset proportion in the region from large to small according to the brightness.
The mobile terminal can extract pixel points with a preset proportion in the dark channel image from large to small according to the brightness, wherein the preset proportion can be set according to actual requirements, for example, 0.1%, 0.2% and the like, and the pixel points with the maximum brightness of the first 0.1% or 0.2% in the dark channel image are extracted.
Step 506, determining the brightness value corresponding to each extracted pixel point in the image to be defogged.
After the mobile terminal extracts pixel points in a preset proportion in the region from large to small according to the brightness in the dark channel image, the brightness value corresponding to each extracted pixel point can be determined from the position corresponding to the extracted pixel point in the image to be defogged.
Step 508, calculating the average brightness value of the region according to the brightness value corresponding to each extracted pixel point.
The mobile terminal can obtain an average value of brightness values corresponding to the extracted pixel points to obtain an average brightness value in the area, and compare the average brightness value with a preset threshold, if the average brightness value in the area is smaller than the preset threshold, the atmospheric light value of the area can be determined to be the average brightness value, and if the average brightness value in the area is not smaller than the preset threshold, the atmospheric light value of the area can be determined to be the preset threshold. When the atmospheric light value is too high, the image obtained after the defogging process may have color cast and color spots, so the preset threshold may be set, and the defogging process is performed by using the preset threshold as the maximum atmospheric light value.
Step 510, if the average brightness value is smaller than the preset threshold, determining the atmospheric light value of the area as the average brightness value, otherwise, determining the atmospheric light value of the area as the preset threshold.
In the embodiment, the atmospheric light values of all areas in the image to be defogged can be obtained, and the maximum atmospheric light value is set, so that the phenomena of color cast and color spots after defogging treatment are prevented, and the defogged image is more real and natural.
As shown in fig. 6, in one embodiment, an image defogging device 600 is provided, which includes an acquisition module 610, a raw transmittance calculation module 620, a band transmittance calculation module 630 and a defogging module 640.
The acquiring module 610 is configured to acquire an image to be defogged.
And an original transmittance calculating module 620 for calculating an original transmittance of the image to be defogged.
And the wave band transmittance calculating module 630 is configured to calculate, according to the original transmittance, wave band transmittances in the image to be defogged, which correspond to the three RGB wave bands, respectively.
And the defogging module 640 is configured to perform defogging processing on the three RGB bands of the image to be defogged according to the band transmittances respectively corresponding to the three RGB bands.
The image defogging device acquires an image to be defogged, calculates the original transmissivity of the image to be defogged, calculates the wave band transmissivity corresponding to the RGB wave bands in the image to be defogged according to the original transmissivity, and performs defogging treatment of different programs on the RGB wave bands of the image to be defogged according to the wave band transmissivity corresponding to the RGB wave bands respectively, so that the fog in the image can be effectively removed, the problems of bluish image and color distortion after defogging by using a traditional defogging algorithm can be solved, and the color of the image after defogging is more natural and real.
In one embodiment, the band transmittance calculation module 630 includes a coefficient acquisition unit and a band transmittance calculation unit.
And the coefficient acquisition unit is used for acquiring adjustment coefficients corresponding to the three RGB wave bands in the image to be defogged.
And the wave band transmissivity calculating unit is used for calculating wave band transmissivity corresponding to the RGB three wave bands respectively according to the original transmissivity and the adjusting coefficient.
The adjusting coefficient of the R wave band in the image to be defogged is larger than that of the G wave band, and the adjusting coefficient of the G wave band is larger than that of the B wave band.
The band transmittance of the R band is greater than the band transmittance of the G band, which is greater than the band transmittance of the B band.
In the embodiment, adjustment coefficients corresponding to three RGB bands are respectively introduced, band transmittances corresponding to the three RGB bands are respectively calculated according to the adjustment coefficients, and defogging processing with different intensities is performed on the three RGB bands of the image to be defogged, so that the fog in the image can be effectively removed, and meanwhile, the problems of bluish image and color distortion after defogging by using a traditional defogging algorithm can be solved, and the color of the image after defogging is more natural and real.
As shown in fig. 7, in one embodiment, the raw transmittance calculation module 620 includes a distribution unit 622, a dividing unit 624, an atmospheric light value obtaining unit 626, and a raw transmittance calculation unit 628.
A distribution unit 622 for determining the fog density distribution of the image to be defogged.
The dividing unit 624 is configured to perform region division on the image to be defogged according to the fog concentration distribution.
An atmospheric light value obtaining unit 626, configured to obtain the atmospheric light values of the divided regions.
And an original transmittance calculating unit 628 for calculating original transmittance of the corresponding region according to the atmospheric light value of each region.
In this embodiment, the image to be defogged may be divided into regions according to the fog concentration, and the original transmittance of each region may be calculated, so that different degrees of defogging processing may be performed on each region, and the defogging effect may be improved.
In one embodiment, the atmospheric light value obtaining unit 626 includes a sorting subunit, an extracting subunit, a first determining subunit, an average luminance value calculating subunit, and a second determining subunit.
And the sequencing subunit is used for sequencing all pixel points in the region according to the brightness in the dark channel image of the image to be defogged.
And the extraction subunit is used for extracting pixel points in a preset proportion in the region from large to small according to the brightness.
And the first determining subunit is used for determining the brightness value corresponding to each extracted pixel point in the image to be defogged.
And an average luminance value calculation operator unit for calculating an average luminance value of the region from the luminance values corresponding to the extracted respective pixel points.
And the second determining subunit is configured to determine, if the average brightness value is smaller than a preset threshold, that the atmospheric light value of the area is the average brightness value, and otherwise, that the atmospheric light value of the area is the preset threshold.
In the embodiment, the atmospheric light values of all areas in the image to be defogged can be obtained, and the maximum atmospheric light value is set, so that the phenomena of color cast and color spots after defogging treatment are prevented, and the defogged image is more real and natural.
The division of each module in the image defogging device is only used for illustration, and in other embodiments, the recommendation information generation device may be divided into different modules as needed to complete all or part of the functions of the recommendation information generation device.
The embodiment of the invention also provides the mobile terminal. The mobile terminal includes an Image Processing circuit, which may be implemented using hardware and/or software components, and may include various Processing units defining an ISP (Image Signal Processing) pipeline. FIG. 8 is a schematic diagram of an image processing circuit in one embodiment. As shown in fig. 8, for ease of explanation, only aspects of the image processing techniques related to embodiments of the present invention are shown.
As shown in fig. 8, the image processing circuit includes an ISP processor 840 and control logic 850. Image data captured by imaging device 810 is first processed by ISP processor 840, and ISP processor 840 analyzes the image data to capture image statistics that may be used to determine and/or control one or more parameters of imaging device 810. Imaging device 810 may include a camera having one or more lenses 812 and an image sensor 814. Image sensor 814 may include an array of color filters (e.g., Bayer filters), and image sensor 814 may acquire light intensity and wavelength information captured with each imaging pixel of image sensor 814 and provide a set of raw image data that may be processed by ISP processor 840. The sensor 820 may provide raw image data to the ISP processor 840 based on the sensor 820 interface type. The sensor 820 interface may utilize a SMIA (Standard Mobile Imaging Architecture) interface, other serial or parallel camera interfaces, or a combination of the above.
The ISP processor 840 processes the raw image data pixel by pixel in a variety of formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits, and ISP processor 840 may perform one or more image processing operations on the raw image data, collecting statistical information about the image data. Wherein the image processing operations may be performed with the same or different bit depth precision.
ISP processor 840 may also receive pixel data from image memory 830. For example, raw pixel data is sent from the sensor 820 interface to the image memory 830, and the raw pixel data in the image memory 830 is then provided to the ISP processor 840 for processing. The image Memory 830 may be a portion of a Memory device, a storage device, or a separate dedicated Memory within an electronic device, and may include a DMA (Direct Memory Access) feature.
Upon receiving raw image data from the sensor 820 interface or from the image memory 830, the ISP processor 840 may perform one or more image processing operations, such as temporal filtering. The processed image data may be sent to image memory 830 for additional processing before being displayed. ISP processor 840 may also receive processed data from image memory 930 for image data processing in the raw domain and in the RGB and YCbCr color spaces. The processed image data may be output to a display 880 for viewing by a user and/or further processing by a graphics engine or GPU (graphics processing Unit). Further, the output of ISP processor 840 may also be sent to image memory 830 and display 880 may read image data from image memory 830. In one embodiment, image memory 830 may be configured to implement one or more frame buffers. Further, the output of the ISP processor 840 may be transmitted to an encoder/decoder 870 for encoding/decoding the image data. The encoded image data may be saved and decompressed prior to display on a display 880 device.
The step of the ISP processor 840 processing the image data includes: the image data is subjected to VFE (Video Front End) Processing and CPP (Camera Post Processing). The VFE processing of the image data may include modifying the contrast or brightness of the image data, modifying digitally recorded lighting status data, performing compensation processing (e.g., white balance, automatic gain control, gamma correction, etc.) on the image data, performing filter processing on the image data, etc. CPP processing of image data may include scaling an image, providing a preview frame and a record frame to each path. Among other things, the CPP may use different codecs to process the preview and record frames.
The image data processed by the ISP processor 840 may be sent to the defogging module 860 for defogging of the image before being displayed. The defogging module 860 may calculate an original transmittance of the image to be defogged, calculate band transmittances in the image to be defogged corresponding to the three RGB bands, respectively, and perform defogging processing and the like on the three RGB bands of the image to be defogged according to the band transmittances corresponding to the three RGB bands, respectively. The defogging module 860 may be a Central Processing Unit (CPU), a GPU, a coprocessor, or the like. After the defogging module 860 defogges the image data, the defogged image data may be transmitted to the encoder/decoder 870 to encode/decode the image data. The encoded image data may be saved and decompressed prior to display on a display 880 device. It is understood that the image data processed by the defogging module 860 may be directly transmitted to the display 880 for display without passing through the encoder/decoder 870. The image data processed by ISP processor 840 may also be processed by encoder/decoder 870 and then processed by defogging module 860. The encoder/decoder can be a CPU, a GPU, a coprocessor or the like in the mobile terminal.
The statistics determined by ISP processor 840 may be sent to control logic 850 unit. For example, the statistical data may include image sensor 814 statistical information such as auto-exposure, auto-white balance, auto-focus, flicker detection, black level compensation, lens 812 shading correction, and the like. Control logic 850 may include a processor and/or microcontroller that executes one or more routines (e.g., firmware) that may determine control parameters of imaging device 810 and ISP processor 840 based on the received statistical data. For example, the control parameters may include sensor 820 control parameters (e.g., gain, integration time for exposure control), camera flash control parameters, lens 812 control parameters (e.g., focal length for focusing or zooming), or a combination of these parameters. The ISP control parameters may include gain levels and color correction matrices for automatic white balance and color adjustment (e.g., during RGB processing), as well as lens 812 shading correction parameters.
In the present embodiment, the image defogging method described above can be implemented using the image processing technique in fig. 8.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when being executed by a processor, carries out the above-mentioned image defogging method.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (8)

1. An image defogging method, comprising:
acquiring an image to be defogged;
calculating the original transmittance of the image to be defogged;
calculating the wave band transmissivity respectively corresponding to the RGB wave bands in the image to be defogged according to the original transmissivity;
carrying out defogging treatment on the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands;
the calculating of the original transmittance of the image to be defogged comprises:
determining the fog concentration distribution of the image to be defogged;
carrying out region division on the image to be defogged according to the fog concentration distribution;
acquiring the atmospheric light value of each divided area;
respectively calculating the original transmittance of the corresponding region according to the atmospheric light value of each region;
carrying out defogging treatment on the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands, comprising the following steps:
calculating the wave band transmissivity respectively corresponding to the RGB three wave bands in the corresponding region according to the original transmissivity of each region, performing corresponding defogging treatment on the RGB three wave bands of each region after the image to be defogged is divided according to the wave band transmissivity respectively corresponding to the RGB three wave bands in each region, and synthesizing each region obtained after defogging treatment to obtain a defogged image;
the calculating the wave band transmissivity respectively corresponding to the three RGB wave bands in the image to be defogged according to the original transmissivity comprises the following steps:
acquiring adjustment coefficients respectively corresponding to the three RGB wave bands in the image to be defogged, and calculating to obtain the adjustment coefficients respectively corresponding to the three RGB wave bands based on the original transmissivity of the image to be defogged;
and respectively calculating the wave band transmissivity corresponding to the RGB three wave bands according to the original transmissivity and the adjusting coefficient.
2. The method according to claim 1, wherein the adjustment coefficient of the R-band in the image to be defogged is greater than the adjustment coefficient of the G-band, which is greater than the adjustment coefficient of the B-band;
the wave band transmissivity of the R wave band is greater than the wave band transmissivity of the G wave band, and the wave band transmissivity of the G wave band is greater than the wave band transmissivity of the B wave band.
3. The method of claim 1, wherein the obtaining the atmospheric light values of the divided regions comprises:
sequencing all pixel points in the area according to brightness in the dark channel image of the image to be defogged;
extracting pixel points with preset proportion in the region according to the brightness from large to small;
determining the brightness value corresponding to each extracted pixel point in the image to be defogged;
calculating the average brightness value of the region according to the brightness value corresponding to each extracted pixel point;
if the average brightness value is smaller than a preset threshold value, determining the atmospheric light value of the area as the average brightness value, otherwise, determining the atmospheric light value of the area as the preset threshold value.
4. An image defogging device, comprising:
the acquiring module is used for acquiring an image to be defogged;
the original transmittance calculation module is used for calculating the original transmittance of the image to be defogged;
the wave band transmissivity calculating module is used for calculating wave band transmissivity which corresponds to the RGB wave bands in the image to be defogged according to the original transmissivity;
the defogging module is used for defogging the RGB three wave bands of the image to be defogged according to the wave band transmissivity respectively corresponding to the RGB three wave bands;
the raw transmittance calculation module includes:
the distribution unit is used for determining the fog concentration distribution of the image to be defogged;
the dividing unit is used for carrying out region division on the image to be defogged according to the fog concentration distribution;
the atmospheric light value acquisition unit is used for acquiring the atmospheric light values of the divided areas;
the original transmissivity calculating unit is used for respectively calculating the original transmissivity of the corresponding area according to the atmospheric light value of each area;
the defogging module comprises:
calculating the wave band transmissivity respectively corresponding to the RGB three wave bands in the corresponding region according to the original transmissivity of each region, performing corresponding defogging treatment on the RGB three wave bands of each region after the image to be defogged is divided according to the wave band transmissivity respectively corresponding to the RGB three wave bands in each region, and synthesizing each region obtained after defogging treatment to obtain a defogged image;
the band transmittance calculation module includes:
the coefficient acquisition unit is used for acquiring adjustment coefficients corresponding to the RGB three wave bands in the image to be defogged and calculating the adjustment coefficients corresponding to the RGB three wave bands based on the original transmissivity of the image to be defogged;
and the wave band transmissivity calculating unit is used for calculating wave band transmissivity corresponding to the RGB three wave bands respectively according to the original transmissivity and the adjusting coefficient.
5. The apparatus of claim 4,
the adjusting coefficient of an R wave band in the image to be defogged is larger than that of a G wave band, and the adjusting coefficient of the G wave band is larger than that of a B wave band;
the wave band transmissivity of the R wave band is greater than the wave band transmissivity of the G wave band, and the wave band transmissivity of the G wave band is greater than the wave band transmissivity of the B wave band.
6. The apparatus of claim 4, wherein the atmospheric light value obtaining unit comprises:
the sequencing subunit is used for sequencing all pixel points in the area according to the brightness in the dark channel image of the image to be defogged;
the extraction subunit is used for extracting pixel points with a preset proportion in the region from large to small according to the brightness;
the first determining subunit is used for determining the brightness value corresponding to each extracted pixel point in the image to be defogged;
an average brightness value calculation operator unit, configured to calculate an average brightness value of the region according to the brightness value corresponding to each extracted pixel point;
a second determining subunit, configured to determine, if the average brightness value is smaller than a preset threshold, that the atmospheric light value of the area is the average brightness value, and otherwise, determine that the atmospheric light value of the area is the preset threshold.
7. A mobile terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the program implementing the method according to any of claims 1 to 3.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1 to 3.
CN201710626236.XA 2017-07-27 2017-07-27 Image defogging method and device, mobile terminal and computer readable storage medium Active CN107392871B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710626236.XA CN107392871B (en) 2017-07-27 2017-07-27 Image defogging method and device, mobile terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710626236.XA CN107392871B (en) 2017-07-27 2017-07-27 Image defogging method and device, mobile terminal and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN107392871A CN107392871A (en) 2017-11-24
CN107392871B true CN107392871B (en) 2020-01-10

Family

ID=60341828

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710626236.XA Active CN107392871B (en) 2017-07-27 2017-07-27 Image defogging method and device, mobile terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN107392871B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109064426B (en) * 2018-07-26 2021-08-31 电子科技大学 Method and device for suppressing glare in low-illumination image and enhancing image
CN111091501A (en) * 2018-10-24 2020-05-01 天津工业大学 Parameter estimation method of atmosphere scattering defogging model

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968760B (en) * 2011-08-30 2016-08-17 富士通株式会社 image defogging method and system
CN102999883B (en) * 2011-09-08 2016-03-02 富士通株式会社 Image defogging method capable and system
CN103049888A (en) * 2012-12-07 2013-04-17 西安电子科技大学 Image/video demisting method based on combination of dark primary color of atmospheric scattered light
CN104134194A (en) * 2014-07-23 2014-11-05 中国科学院深圳先进技术研究院 Image defogging method and image defogging system
CN105023256B (en) * 2015-08-13 2018-02-13 哈尔滨超凡视觉科技有限公司 A kind of image defogging method and system

Also Published As

Publication number Publication date
CN107392871A (en) 2017-11-24

Similar Documents

Publication Publication Date Title
CN107424198B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107451969B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107317967B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN108419028B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN107509031B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107395991B (en) Image synthesis method, image synthesis device, computer-readable storage medium and computer equipment
CN107563976B (en) Beauty parameter obtaining method and device, readable storage medium and computer equipment
CN107481186B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN107993209B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN107277299B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107194900A (en) Image processing method, device, computer-readable recording medium and mobile terminal
CN109242794B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN107945106B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN107341782B (en) Image processing method, image processing device, computer equipment and computer readable storage medium
CN107194901B (en) Image processing method, image processing device, computer equipment and computer readable storage medium
CN108259754B (en) Image processing method and device, computer readable storage medium and computer device
CN107454317B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN107392870B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107454318B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107392871B (en) Image defogging method and device, mobile terminal and computer readable storage medium
CN110213462B (en) Image processing method, image processing device, electronic apparatus, image processing circuit, and storage medium
CN107277369B (en) Image processing method, device, computer readable storage medium and computer equipment
CN109191398B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN107424134B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN107292853B (en) Image processing method, image processing device, computer-readable storage medium and mobile terminal

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