CN107481199B - Image defogging method and device, storage medium and mobile terminal - Google Patents
Image defogging method and device, storage medium and mobile terminal Download PDFInfo
- 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
- defogging
- image
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000012545 processing Methods 0.000 claims abstract description 102
- 238000003672 processing method Methods 0.000 claims abstract description 8
- 238000002834 transmittance Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 12
- 238000003384 imaging method Methods 0.000 description 6
- 238000004422 calculation algorithm Methods 0.000 description 4
- 238000003705 background correction Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 239000000872 buffer Substances 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 239000000428 dust Substances 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20172—Image enhancement details
- G06T2207/20182—Noise 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
Technical Field
The invention relates to the technical field of computers, in particular to an image defogging method and device, a storage medium and a mobile terminal.
Background
The photographing is an indispensable work and entertainment project in people's life, however, the scene of photographing is often complicated and changeable. For example, light tends to be dim in an indoor environment and light tends to be bright in an outdoor environment. However, the weather of outdoor environment is more changeable, and the requirements and the processing mode are different when the user takes photos in different weather such as sunny days, rain, snow, heavy fog and the like.
When images are taken in outdoor environments with low visibility, the images taken tend to be unclear. For pictures with insufficient sharpness, it is often necessary to improve the sharpness of the image by means of physical or software processing. The defogging process is a commonly used means for improving the image definition, that is, the noise causing the image to be unclear in the image is removed by a software processing mode. However, the defogging process generally requires processing for each pixel of the picture.
Disclosure of Invention
The embodiment of the invention provides an image defogging method and device, a storage medium and a mobile terminal, which can improve the image processing efficiency.
An image defogging processing method, 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 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.
An image defogging processing device, the device comprising:
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;
and the defogging processing module is used for performing defogging processing on the image to be processed according to a preset defogging mode if the number exceeds a threshold value.
A storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
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.
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 steps of:
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 provided by the embodiment of the invention, the dark channel value corresponding to each pixel in the image to be processed is firstly obtained, the number of the dark channel values in the preset range is counted, and the image to be processed is defogged if the number exceeds the threshold value. Before defogging the image to be processed, 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 subjected to defogging processing, so that all the images are prevented from being subjected to defogging processing. The efficiency of image processing is improved, the power consumption of the image processing device is reduced.
Drawings
FIG. 1 is a schematic diagram showing an internal structure of an electronic apparatus according to an embodiment;
FIG. 2 is a diagram illustrating an internal architecture of a server according to an embodiment;
FIG. 3 is a flowchart of a method of image defogging processing according to one embodiment;
FIG. 4 is a flowchart of an image defogging processing method in another embodiment;
FIG. 5 is a schematic diagram showing the structure of an image defogging device according to an embodiment;
FIG. 6 is a schematic structural diagram of an image defogging processing device in another embodiment;
FIG. 7 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 schematic diagram of an internal structure of an electronic device in one embodiment. As shown in fig. 1, the electronic apparatus includes a processor, a nonvolatile storage medium, an internal memory, and a network interface, a display screen, and an input device, which are connected by a system bus. Wherein 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 a method of image defogging processing. The processor is used for providing calculation and control capability and supporting the operation of the whole electronic equipment. Internal memory in the electronic device provides an environment for the execution of computer-readable instructions in the non-volatile storage medium. The network interface is used for carrying out network communication with the server, such as sending an image defogging processing request to the server, receiving a defogged image returned by the server, and the like. The display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen, and the input device may be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on a housing of the electronic device, or an external keyboard, a touch pad or a mouse. The electronic device may be a mobile phone, a tablet computer, or a personal digital assistant or a wearable device, etc. Those skilled in the art will appreciate that the architecture shown in fig. 1 is a block diagram of only a portion of the architecture associated with the subject application, and does not constitute a limitation on the electronic devices to which the subject application may be applied, and that a particular electronic device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Fig. 2 is a schematic diagram of an internal structure of the server in one 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 a method of image defogging processing. The processor of the server is used for providing calculation and control capacity and supporting the operation of the whole server. The network interface of the server is used for communicating with an external terminal through network connection, such as receiving an image defogging processing request sent by the terminal and returning a defogged image to the terminal. The server may be implemented as a stand-alone server or as a server cluster consisting of a plurality of servers. Those skilled in the art will appreciate that the architecture shown in fig. 2 is a block diagram of only a portion of the architecture associated with the subject application, and does not constitute a limitation on the servers to which the subject application applies, as a particular server may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
FIG. 3 is a flowchart of an image defogging processing method according to an embodiment. As shown in fig. 3, the image defogging method includes steps 302 to 306, wherein:
In the embodiment provided by the invention, the image to be processed refers to an image which needs to be subjected to defogging processing, and can be acquired through the image acquisition device. The image capturing device refers to a device for capturing an image, and for example, the image capturing device may be a camera, a camera of a mobile terminal, a video camera, or the like.
It can be understood that, in the embodiment of the present invention, the to-be-processed image may be acquired directly through the image acquisition device, or may be acquired from a preset storage space, where the preset storage space is a preset storage space for storing the to-be-processed image. That is to say, before the image defogging processing is performed, the photographing instruction can be directly initiated to acquire the to-be-processed image which needs to be defogged through the image acquisition device, and the to-be-processed image which needs to be defogged can also be directly acquired from the preset storage space.
And 304, 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.
It can be understood that the image to be processed is composed of a plurality of pixels, and each pixel has a corresponding RGB three-channel value, which is used to represent information such as color and brightness of the pixel in the image. The RGB three-channel values respectively represent the component sizes of three colors of red, green, blue and the like of each pixel in the image to be processed, and the dark channel value refers to the minimum channel value in the RGB three-channel values of the image to be processed. It is considered that the smaller the dark channel value, the less the corresponding pixel is affected by the haze concentration.
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 the dark channel value with the relatively small value may be screened out through the preset range, so that pixels less affected by the fog concentration may be screened out.
And step 306, if the number exceeds the threshold value, performing defogging treatment on the image to be treated according to a preset defogging mode.
In the embodiment provided by the invention, in heavy fog, rain and snow or haze weather, the outdoor shooting is often influenced, so that the shot image is particularly unclear and objects in the image cannot be seen clearly. The defogging process is a process for restoring an image by removing noise such as fog and dust which make the image unclear from the image. The preset defogging mode refers to a preset defogging mode for the image to be processed.
For example, if the preset defogging method is a dark channel prior defogging 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))
wherein, I (x) is an image to be processed, J (x) is an image obtained after the image to be processed is subjected to defogging treatment, t (x) is the transmissivity, and A is the atmospheric light value. Generally, assuming that a is a known value, a channel with a very low channel value exists in three channels of RGB in the image to be processed, and the channel value is close to zero, then:
the transmittance obtained from the above formula is:
the transmittance can be adjusted by introducing a weight ω between 0 and 1, and the final transmittance expression is as follows:
in order to ensure the defogging effect, a transmittance threshold t may be set for the transmittance0Then, the defogged image can be obtained according to the following expression:
specifically, if the number exceeds the threshold, defogging processing is performed on the image to be processed according to a preset defogging mode. The threshold value is a preset value for determining whether the number of dark channel values in the preset range meets the condition. In the embodiment of the invention, if the number of the dark channel values in the preset range exceeds the threshold, the image to be processed is considered to be greatly influenced by the fog concentration, and the defogging processing is required to be carried out, so that the image to be processed is restored into the fog-free image.
In other embodiments provided by the present invention, the defogging region in the image to be processed may be extracted according to the dark channel value, and then the defogging region in the image to be processed may be subjected to defogging processing according to the preset defogging manner. The defogging area refers to an area which needs defogging processing in the image to be processed. Generally, the image to be processed includes areas with different fog concentrations, some areas have high fog concentrations, and some areas have low fog concentrations. Therefore, the image to be processed may be first divided into different regions according to the degree of the fog density before the defogging is performed.
The defogging area can be divided according to a dark channel value corresponding to each pixel in the image to be processed, an area corresponding to the dark channel value within a preset range is divided into the defogging area, and an area corresponding to the dark channel value outside the preset range is divided into a non-defogging area. And then carrying out defogging treatment on the defogging area, wherein the defogging treatment is not carried out on the non-defogging area.
Furthermore, the dark channel values can be divided into different value grades, the defogging area is divided into a plurality of defogging grade areas according to the value grades of the dark channel values, and the defogging grade areas are processed according to the defogging modes corresponding to the defogging grade areas. Namely, the dark channel values in the preset range are graded, the dark channel values in different grades correspond to different defogging grade areas, and then the defogging grade areas are defogged in different grades.
The image defogging method comprises the steps of firstly obtaining a dark channel value corresponding to each pixel in an image to be processed, counting the number of the dark channel values within a preset range, and conducting defogging processing on the image to be processed if the number exceeds a threshold value. Before defogging the image to be processed, 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 subjected to defogging processing, so that all the images are prevented from being subjected to defogging processing. The efficiency of image processing is improved, the power consumption of the image processing device is reduced.
FIG. 4 is a flowchart of an image defogging method according to another embodiment. As shown in fig. 4, the image defogging method includes steps 402 to 408, wherein:
In one embodiment, the acquired image to be processed may be pre-stored in a preset storage space, or may be directly acquired by the image acquisition device. For example, when an image to be processed is acquired through a camera of the mobile terminal, a user inputs a photographing instruction through the mobile terminal, and after the mobile terminal detects the photographing instruction, the image to be processed is acquired through the camera. The photographing instruction may be triggered by a physical key or a touch screen operation of the mobile terminal, or may be a voice instruction or the like.
In the embodiment provided by the invention, each pixel in the image to be processed has three RGB channel values, the three RGB channel values respectively represent the sizes of the components of the three colors of red, green and blue of the pixel of the image to be processed, the value range of each channel value is between 0 and 255, and the larger the value is, the larger the component of the corresponding color channel is. In general, for each pixel of the image to be processed, there exists a minimum channel value in the RGB three-channel values, and the minimum channel value is the corresponding dark channel value of the pixel.
Generally, in the case that the light is bright and is not affected by the fog concentration, the dark channel value is a very small value, and we can consider that the smaller the dark channel value is, the less the pixel is affected by the fog concentration; conversely, the larger the dark channel value, the more affected the pixel is by the fog concentration.
In one embodiment, the RGB three-channel values of each pixel in the image to be processed may be traversed to obtain the dark channel value corresponding to each pixel, so as to obtain the dark channel map of the entire image to be processed. And traversing the dark channel map, screening out dark channel values in a preset range, and counting the number of the dark channel values in the preset range. In general, the smaller the number of dark channel values within a preset range, the less the influence of the fog density on the image to be processed is considered.
And 406, if the number exceeds the threshold value, acquiring a fog concentration parameter corresponding to the image to be processed, and performing defogging processing on the image to be processed according to the fog concentration parameter.
In one embodiment, the fog concentration parameter of each pixel in the image to be processed is obtained according to a preset model, and the defogging processing is performed on each pixel in the image to be processed according to the fog concentration parameter. And after each pixel in the image to be processed is subjected to defogging processing, the image to be processed after defogging processing can be obtained.
Furthermore, acquiring a fog concentration parameter of each channel in RGB three channels in the image to be processed; 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 image to be treated respectively.
In one embodiment, the fog concentration parameters may include, but are not limited to, atmospheric light values and transmittance; the defogging process on the image to be processed according to the preset defogging mode may include: acquiring an atmospheric light value of an image to be processed and a transmittance factor of each channel in RGB three channels; acquiring the transmittance of each channel in the three RGB channels according to the transmittance factor; and defogging the RGB three channels according to the atmospheric light value and the transmissivity of each channel in the RGB three channels.
Specifically, the influence of fog pollution on three channels of RGB is different, and when the defogging algorithm is used to defogg the image as a whole, the fog on the G channel and the B channel in the image cannot be completely removed. Further, the influence of the fog with the same concentration on the three channels of RGB is different, wherein the transmissivity of the R channel is the highest, the transmissivity of the B channel is the lowest, and the transmissivity of the G channel is located between the two channels; and as the fog concentration increases, the difference between the three channels RGB also increases. In this embodiment, the transmittance factor ω is preset for three channels of RGBR、ωG、ωBWhich isThe method comprises the following steps:
ωR=1
ωG=(0.9+0.1*t(x))2
ωB=(0.7+0.3*t(x))2
obtaining the transmissivity t of each channel of the three channels of RGB according to a preset transmissivity factorR、tG、tB。
tR=ωR*t(x)=t(x)
tG=ωG*t(x)=t(x)*(0.9+0.1*t(x))2
tB=ωB*t(x)=t(x)*(0.7+0.3*t(x))2
Wherein, t (x) is the transmittance of the image to be processed, and assuming that the atmospheric light value a of the image to be processed is a known value, according to the formula:
replacing t (x) in the above formula with tR、tG、tBAnd then the defogging treatment can be sequentially carried out on the RGB three channels in the image to be treated.
In other embodiments provided by the present invention, the scene type of the image to be processed may be obtained; and carrying out defogging treatment on the image to be treated according to the defogging mode corresponding to the scene type. The scene type refers to the type of the scene in the image to be processed, for example, the scene type may be a building, sky, beach, tree, etc. Specifically, an attribute parameter of the image to be processed may be extracted, and the scene type of the image to be processed may be determined according to the attribute parameter.
For example, the scene type of the image to be processed may be obtained by one or more of the following methods: extracting texture information of the image to be processed, and judging the scene type of the image to be processed according to the texture information; extracting color information of an image to be processed, and judging the scene type of the image to be processed according to the color information; an interface for inputting a scene type is displayed on a user terminal through which a user inputs the scene type.
In the embodiment provided by the invention, the defogging processing modes corresponding to the scene types are different defogging processing modes which are adopted according to different scene types. The different defogging modes can be defogging processing according to different defogging algorithms, or the defogging processing with different degrees by adopting the same defogging algorithm.
For example, when the scene type of the image to be processed is a building, the color is usually dim, the fog concentration is relatively small, and the image to be processed can be processed by adopting the defogging treatment with a relatively shallow degree; when the scene type of the image to be processed is sky, the image to be processed can be processed by deep defogging processing if the color is bright and the fog concentration is deep.
In an embodiment, the image to be processed may be further divided, divided regions in the image to be processed are obtained, a region type of each divided region is obtained, and the divided regions are processed according to a defogging processing manner corresponding to the region type. For example, the image to be processed is divided into a sky area, a tree area, a land area, and the like, and then the three areas are subjected to defogging processing, respectively.
The image defogging method comprises the steps of firstly obtaining a dark channel value corresponding to each pixel in an image to be processed, counting the number of the dark channel values within a preset range, and conducting defogging processing on the image to be processed if the number exceeds a threshold value. Before defogging the image to be processed, 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 subjected to defogging processing, so that all the images are prevented from being subjected to defogging processing. The efficiency of image processing is improved, the power consumption of the image processing device is reduced.
Fig. 5 is a schematic structural diagram of an image defogging processing device in one embodiment. As shown in fig. 5, the image defogging processing device 500 includes an image acquisition module 502, a quantity acquisition module 504, and a defogging processing module 506. Wherein:
an image obtaining module 502, configured to obtain an image to be processed.
The number obtaining module 504 is configured to 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.
And a defogging processing module 506, configured to perform defogging processing on the image to be processed according to a preset defogging manner if the number exceeds a threshold value.
The image defogging device firstly acquires the dark channel value corresponding to each pixel in the image to be processed, counts the number of the dark channel values in a preset range, and performs defogging on the image to be processed if the number exceeds a threshold value. Before defogging the image to be processed, 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 subjected to defogging processing, so that all the images are prevented from being subjected to defogging processing. The efficiency of image processing is improved, the power consumption of the image processing device is reduced.
Fig. 6 is a schematic structural diagram of an image defogging processing device in another embodiment. As shown in fig. 6, the image defogging processing device 600 includes an image acquisition module 602, a number acquisition module 604, a type acquisition module 606 and a defogging processing module 608. Wherein:
an image obtaining module 602, configured to obtain an image to be processed.
The number obtaining module 604 is configured to obtain a dark channel value corresponding to each pixel in the image to be processed, and count the number of the dark channel values within a preset range.
A type obtaining module 606, configured to obtain a scene type of the image to be processed.
A defogging processing module 608, configured to perform defogging processing on the image to be processed according to a preset defogging manner if the number exceeds a threshold value.
The image defogging device acquires the dark channel value corresponding to each pixel in the image to be processed, counts the number of the dark channel values within a preset range, and performs defogging on the image to be processed if the number exceeds a threshold value. Before defogging the image to be processed, 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 subjected to defogging processing, so that all the images are prevented from being subjected to defogging processing. The efficiency of image processing is improved, the power consumption of the image processing device is reduced.
In an embodiment, the defogging processing module 608 is further configured to obtain a fog concentration parameter corresponding to the image to be processed, and perform defogging processing on the image to be processed according to the fog concentration parameter.
In one embodiment, the defogging processing module 608 is further configured to obtain a fog concentration parameter of each of three RGB channels in the image to be processed; 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 image to be treated respectively.
In one embodiment, the defogging processing module 608 is further configured to extract a defogging area in the image to be processed according to the dark channel value; and carrying out defogging treatment on the defogging area in the image to be treated according to a preset defogging mode.
The division of the modules in the image defogging processing device is only used for illustration, and in other embodiments, the image defogging processing device may be divided into different modules as needed to complete all or part of the functions of the image defogging processing device.
The embodiment of the invention also provides a storage medium. A storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
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.
In an embodiment of the present invention, the performing, by a processor, the defogging process on the image to be processed according to a preset defogging manner includes:
acquiring a fog concentration parameter corresponding to an image to be processed, and performing defogging processing on the image to be processed according to the fog concentration parameter.
In one embodiment, the obtaining, performed by the processor, a fog concentration parameter corresponding to an image to be processed, and performing a defogging process on the image to be processed according to the fog concentration parameter includes:
acquiring a fog concentration parameter of each channel in RGB three channels in the image to be processed;
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 image to be treated respectively.
In this embodiment, the performing, by the processor, the defogging process on the image to be processed according to the preset defogging manner includes:
extracting a defogging area in the image to be processed according to the dark channel value;
and carrying out defogging treatment on the defogging area in the image to be treated according to a preset defogging mode.
In one embodiment, the defogging processing on the image to be processed according to the preset defogging mode executed by the processor includes:
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.
The embodiment of the invention also provides computer equipment. The computer device includes therein 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. 7 is a schematic diagram of an image processing circuit in one embodiment. As shown in fig. 7, for ease of explanation, only aspects of the image processing techniques related to embodiments of the present invention are shown.
As shown in fig. 7, the image processing circuit includes an ISP processor 740 and control logic 750. The image data captured by the imaging device 710 is first processed by the ISP processor 740, and the ISP processor 740 analyzes the image data to capture image statistics that may be used to determine and/or control one or more parameters of the imaging device 710. The imaging device 710 may include a camera having one or more lenses 712 and an image sensor 714. The image sensor 714 may include an array of color filters (e.g., Bayer filters), and the image sensor 714 may acquire light intensity and wavelength information captured with each imaging pixel of the image sensor 714 and provide a set of raw image data that may be processed by the ISP processor 740. 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.
The ISP processed image data may be sent to a defogging module 760 for defogging the image before being displayed. The defogging module 760 for defogging the image data may include 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; and if the number exceeds the threshold value, performing defogging treatment on the image to be processed according to a preset defogging mode, and the like. The defogging module 760 may be a Central Processing Unit (CPU) or a Graphics Processing Unit (GPU) in the mobile terminal. After the defogging module 760 defoggs the image data, the defogged image data may be transmitted to the encoder/decoder 770 to encode/decode the image data. The encoded image data may be saved and decompressed prior to display on the display 780 device. It is understood that the image data processed by the defogging module 760 may be sent directly to the display 780 for display without passing through the encoder/decoder 770. The image data processed by the ISP processor 740 may also be processed by the encoder/decoder 770 and then processed by the defogging module 760.
The statistical data determined by ISP processor 740 may be sent to control logic 750 unit. For example, the statistical data 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 that executes one or more routines (e.g., firmware) that may determine control parameters of imaging device 710 and control parameters of ISP processor 740 based on the received statistical data. For example, the control parameters may include sensor 720 control parameters (e.g., gain, integration time for exposure control), camera flash control parameters, lens 712 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 712 shading correction parameters.
The following steps are implemented by using the image processing technology in fig. 7 to realize the image defogging processing method:
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.
In an embodiment of the present invention, the performing the defogging process on the image to be processed according to the preset defogging manner includes:
acquiring a fog concentration parameter corresponding to an image to be processed, and performing defogging processing on the image to be processed according to the fog concentration parameter.
In one embodiment, the obtaining of the fog concentration parameter corresponding to the image to be processed and the defogging of the image to be processed according to the fog concentration parameter includes:
acquiring a fog concentration parameter of each channel in RGB three channels in the image to be processed;
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 image to be treated respectively.
In this embodiment, the performing the defogging process on the image to be processed according to the preset defogging manner includes:
extracting a defogging area in the image to be processed according to the dark channel value;
and carrying out defogging treatment on the defogging area in the image to be treated according to a preset defogging mode.
In one embodiment, the defogging processing on the image to be processed according to a preset defogging mode comprises the following steps:
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.
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 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 present 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 (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.
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)
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 | 清华大学 | Foggy day imaging method and device based on image signal-to-noise ratio analysis |
Family Cites Families (5)
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 |
-
2017
- 2017-07-27 CN CN201710625439.7A patent/CN107481199B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN107481199A (en) | 2017-12-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107424198B (en) | Image processing method, image processing device, mobile terminal and computer readable storage medium | |
CN108810418B (en) | Image processing method, image processing device, mobile terminal and computer readable storage medium | |
CN107704798B (en) | Image blurring method and device, computer readable storage medium and computer device | |
CN107395991B (en) | Image synthesis method, image synthesis device, computer-readable storage medium and computer equipment | |
CN109068058B (en) | Shooting control method and device in super night scene mode and electronic equipment | |
CN108419028B (en) | Image processing method, image processing device, computer-readable storage medium and electronic equipment | |
CN107481186B (en) | Image processing method, image processing device, computer-readable storage medium and computer equipment | |
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 | |
CN109089046A (en) | Image denoising method, device, computer readable storage medium and electronic equipment | |
CN107464225B (en) | Image processing method, image processing device, computer-readable storage medium and mobile terminal | |
CN113012081A (en) | Image processing method, device and electronic system | |
CN110213462B (en) | Image processing method, image processing device, electronic apparatus, image processing circuit, and 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 | |
CN107277299A (en) | Image processing method, device, mobile terminal and computer-readable recording medium | |
CN108574803B (en) | Image selection method and device, storage medium and electronic equipment | |
CN108259754B (en) | Image processing method and device, computer readable storage medium and computer device | |
CN107295261B (en) | Image defogging method and device, storage medium and mobile terminal | |
CN107481199B (en) | Image defogging method and device, storage medium and mobile terminal | |
CN107317969A (en) | Image defogging method, device, computer can storage medium and mobile terminals | |
CN107424134B (en) | Image processing method, image processing device, computer-readable storage medium and computer equipment | |
CN107277369B (en) | Image processing method, device, computer readable storage medium and computer equipment | |
CN107392870B (en) | Image processing method, image processing device, mobile terminal and computer readable storage medium |
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 |