CN108182679A - Haze detection method and device based on photo - Google Patents

Haze detection method and device based on photo Download PDF

Info

Publication number
CN108182679A
CN108182679A CN201711446926.3A CN201711446926A CN108182679A CN 108182679 A CN108182679 A CN 108182679A CN 201711446926 A CN201711446926 A CN 201711446926A CN 108182679 A CN108182679 A CN 108182679A
Authority
CN
China
Prior art keywords
component
lightness
saturation degree
photo
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711446926.3A
Other languages
Chinese (zh)
Other versions
CN108182679B (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.)
Shanghai Chuanying Information Technology Co Ltd
Original Assignee
Shanghai Chuanying Information Technology Co 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 Shanghai Chuanying Information Technology Co Ltd filed Critical Shanghai Chuanying Information Technology Co Ltd
Priority to CN201711446926.3A priority Critical patent/CN108182679B/en
Publication of CN108182679A publication Critical patent/CN108182679A/en
Application granted granted Critical
Publication of CN108182679B publication Critical patent/CN108182679B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30181Earth observation
    • G06T2207/30192Weather; Meteorology

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Spectrometry And Color Measurement (AREA)

Abstract

The present invention provides a kind of haze detection method and device based on photo, photo to be detected is divided at least two detection zones first, and obtain the form and aspect component, saturation degree component and lightness component of each detection zone;Then it according to the corresponding all form and aspect components of at least two detection zones, saturation degree component and lightness component, obtains be more than form and aspect component mean value, the aim colour phase component of saturation degree component mean value and lightness component mean value, target saturation degree component and target lightness component respectively;Finally according to aim colour phase component, target saturation degree component and target lightness component, and form and aspect threshold value, saturation degree threshold value and lightness threshold, determine that the photo to be detected whether there is haze, haze detection method provided by the invention has the characteristics that speed is fast, it is simple to calculate, it is detected suitable for the daily haze of user, the hardware, software performance requirement to terminal device is not high.

Description

Haze detection method and device based on photo
Technical field
The present invention relates to image processing techniques more particularly to a kind of haze detection methods and device based on photo.
Background technology
As economic scale expands rapidly the quickening with urbanization process, the occurrence frequency of haze Pollution meteorology weather is also got over Come higher.When haze polluting weather occurs, molecule, steam and a large amount of suspended particulates in air form aerosol to light shape Into serious absorption, scattering and reflex, atmospheric visibility is caused to reduce, to traffic order such as highway, railway, aviation, shippings Generation seriously affects.And a large amount of contaminant particles to suspend in air during haze polluting weather, it even more can be to being exposed in haze People cause great health hazard.Timely and accurately detect haze weather, to people's daily life, vehicle normal traffic and Agricultural production etc. is all of great significance.Haze mainly by sulfur dioxide, nitrogen oxides and pellet this three form, They are combined together with fog, and sky moment is allowed to become cloudy gloomy.People are difficult to differentiate between mist and haze with naked eyes, usually The detecting instrument of profession is needed to be detected haze.
Existing haze detection method, mainly by judging haze to the aerial content of atmospheric aerosol particle Pollution condition.A kind of method is after by sampler, aerosol particle object is sampled, and 0.1 millimeter continuous is focused to using two beams The aerodynamic diameter of laser measurement particulate determines haze according to the particle diameter distribution of aerosol particle.Another kind side Method is that there is scattering and absorption, the property and intensity for making incident radiation to change incident radiation according to particulate Principle, the characteristic of particulate can be then finally inversed by by measuring this change with special instrument, particulate be carried out distant Sensed quantity, it is final to realize haze detection.
However, the measuring instrument that existing haze detection method is dependent on profession is detected ingredient in air, to inspection The profession for surveying instrument is more demanding, and measuring method is complicated.
Invention content
In order to solve the existing above problem, the present invention provides a kind of haze detection method and device based on photo, root Haze testing result is quickly obtained according to the image information in photo, reduces the degree of dependence to special instrument.
According to the first aspect of the invention, a kind of haze detection method based on photo, applied to terminal, the side are provided Method includes:
Photo to be detected is divided at least two detection zones, and obtains the form and aspect component of each detection zone, saturation degree Component and lightness component;
According to the form and aspect component, saturation degree component and lightness component of all detection zones, form and aspect component mean value, saturation degree are determined Component mean value and lightness component mean value;
According to the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively More than the form and aspect component mean value, the saturation degree component mean value and the lightness component mean value aim colour phase component, Target saturation degree component and target lightness component;
According to the aim colour phase component, target saturation degree component and target lightness component and form and aspect threshold value, saturation degree Threshold value and lightness threshold determine that the photo to be detected whether there is haze.
As a kind of realization method, the corresponding detection zone of the photo to be detected is being determined there are during haze, it is described Method further includes:
It identifies the photo to be detected, obtains target object of reference and target ginseng on the photo to be detected According to the target detection area where object;
Obtain the form and aspect component, saturation degree component and lightness component in the target detection area;
Inquiry obtains the reference photo of matched with the target object of reference and non-haze, and obtains described with reference on photo The corresponding form and aspect component of reference detection zone, saturation degree component and lightness component where the target object of reference;
It is examined according to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target Form and aspect component, saturation degree component and the lightness component in area are surveyed, obtains the haze concentration of the photo to be detected.
As a kind of realization method, it is described according to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and bright Component and form and aspect component, saturation degree component and the lightness component in the target detection area are spent, obtains the photo to be detected Haze concentration, including:
It is examined according to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target Form and aspect component, saturation degree component and the lightness component in area are surveyed, determines form and aspect difference, saturation degree difference and lightness difference respectively;
It is closed according to form and aspect difference range, saturation degree difference range and lightness difference range are corresponding with haze concentration respectively System, determines the form and aspect difference, saturation degree difference and the corresponding haze concentration of lightness difference;
If the form and aspect difference, saturation degree difference and lightness difference all correspond to identical haze concentration, will be described identical Haze concentration, be determined as photo haze concentration to be detected;
If the two in the form and aspect difference, saturation degree difference and lightness difference corresponds to identical haze concentration, by institute The corresponding identical haze concentration of the two is stated, is determined as photo haze concentration to be detected;
If the form and aspect difference, saturation degree difference and lightness difference all correspond to different haze concentration respectively, by described in The corresponding haze concentration of target lightness range is determined as photo haze concentration to be detected.
It is described according to the corresponding all form and aspect components of at least two detection zone, saturation degree as a kind of realization method Component and lightness component obtain be more than the form and aspect component mean value, the saturation degree component mean value and the lightness point respectively Aim colour phase component, target saturation degree component and the target lightness component of mean value are measured, including:
In the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively Take the set of the form and aspect component more than the form and aspect mean value, more than the set of saturation degree component of the saturation degree mean value and big In the set of the lightness component of the lightness mean value;
It averages to some or all form and aspect components in the set of the form and aspect component, obtains the target form and aspect point Amount;
It averages to some or all saturation degree components in the set of the saturation degree component, obtains the target saturation Spend component;
It averages to some or all lightness components in the set of the lightness component, obtains the target lightness point Amount.
As a kind of realization method, the part form and aspect component in the set to the form and aspect component is averaged, and is obtained The aim colour phase component, including:It averages, obtains to form and aspect component of the numerical ordering in preceding N in the set of the form and aspect component To the aim colour phase component;The numerical ordering of the set of the form and aspect component is sorts from big to small;
Some or all saturation degree components in the set to the saturation degree component are averaged, and obtain the target Saturation degree component, including:It averages, obtains to saturation degree component of the numerical ordering in preceding M in the set of the saturation degree component The target saturation degree component;The numerical ordering of the set of the saturation degree component is sorts from big to small;
Some or all lightness components in the set to the lightness component are averaged, and obtain the target lightness Component, including:It averages to lightness component of the numerical ordering in preceding K in the set of the lightness component, it is bright to obtain the target Spend component;The numerical ordering of the set of the lightness component is sorts from big to small;
Wherein, N is more than 0 and less than or equal to the integer of form and aspect number of components in the set of the form and aspect component, and M is big The integer of saturation degree number of components in 0 and the set less than or equal to the saturation degree component, K are more than 0 and are less than or wait The integer of lightness component quantity in the set of the lightness component.
As a kind of realization method, form and aspect component, saturation degree component and the lightness component for obtaining each detection zone, packet It includes:
Obtain red component, green component and the blue component of each pixel in the photo;
According to red component, green component and the blue component of each pixel, the form and aspect of each pixel are obtained Component, saturation degree component and lightness component;
It averages to the form and aspect component of all pixels point in each detection zone, obtains each detection zone and correspond to Form and aspect component;
It averages to the saturation degree component of all pixels point in each detection zone, obtains each detection zone pair The saturation degree component answered;
It averages to the lightness component of all pixels point in each detection zone, obtains each detection zone and correspond to Lightness component.
As a kind of realization method, however, it is determined that there are hazes, then the method to further include for the photo to be detected:
Haze is carried out by way of following at least one to user to warn:
Warning information is shown on the display interface of the terminal;
Control the terminal plays preset audio file;
The terminal is controlled to send alarm control information to preset external equipment.
According to the two of the present invention the aspects, a kind of haze detection device based on photo is provided, including:
Photo division module for photo to be detected to be divided at least two detection zones, and obtains each detection zone Form and aspect component, saturation degree component and lightness component;
Mean value determining module for form and aspect component, saturation degree component and the lightness component according to all detection zones, determines color Phase component mean value, saturation degree component mean value and lightness component mean value;
Target component obtains module, for according to the corresponding all form and aspect components of at least two detection zone, saturation degree Component and lightness component obtain be more than the form and aspect component mean value, the saturation degree component mean value and the lightness point respectively Measure aim colour phase component, target saturation degree component and the target lightness component of mean value;
Haze determining module, for according to the aim colour phase component, target saturation degree component and target lightness component, with And form and aspect threshold value, saturation degree threshold value and lightness threshold, determine that the photo to be detected whether there is haze.
As a kind of realization method, haze concentration determination module is further included, is used for:
The photo to be detected is being determined there are the photo to be detected during haze, is identified, acquisition is described to be detected Photo on target object of reference and the target detection area where the target object of reference;Obtain the color in the target detection area Phase component, saturation degree component and lightness component;Inquiry obtains the reference photo of matched with the target object of reference and non-haze, And obtain the corresponding form and aspect component of reference detection zone with reference to where target object of reference described on photo, saturation degree component and Lightness component;It is examined according to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target Form and aspect component, saturation degree component and the lightness component in area are surveyed, obtains the haze concentration of the detection zone.
As a kind of realization method, the haze concentration determination module is specifically used for:
It is examined according to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target Form and aspect component, saturation degree component and the lightness component in area are surveyed, determines form and aspect difference, saturation degree difference and lightness difference respectively;Root According to form and aspect difference range, saturation degree difference range and lightness the difference range correspondence with haze concentration respectively, determine described Form and aspect difference, saturation degree difference and the corresponding haze concentration of lightness difference;If the form and aspect difference, saturation degree difference and bright Degree difference all corresponds to identical haze concentration, then by the identical haze concentration, is determined as photo haze concentration to be detected; It, will be both described right if the two in the form and aspect difference, saturation degree difference and lightness difference corresponds to identical haze concentration The identical haze concentration answered is determined as photo haze concentration to be detected;If the form and aspect difference, saturation degree difference and lightness Difference all corresponds to different haze concentration respectively, then by the corresponding haze concentration of the target lightness range, is determined as to be detected Photo haze concentration.
As a kind of realization method, target component obtains module and is specifically used for:
In the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively Take the set of the form and aspect component more than the form and aspect mean value, more than the set of saturation degree component of the saturation degree mean value and big In the set of the lightness component of the lightness mean value;Equal are asked to some or all form and aspect components in the set of the form and aspect component Value, obtains the aim colour phase component;It averages to some or all saturation degree components in the set of the saturation degree component, Obtain the target saturation degree component;It averages, obtains to some or all lightness components in the set of the lightness component The target lightness component.
As a kind of realization method, target component obtains module and is specifically used for:
In the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively Take the set of the form and aspect component more than the form and aspect mean value, more than the set of saturation degree component of the saturation degree mean value and big In the set of the lightness component of the lightness mean value;To numerical ordering in the set of the form and aspect component preceding N form and aspect component It averages, obtains the aim colour phase component;The numerical ordering of the set of the form and aspect component is sorts from big to small;To described Numerical ordering is averaged in the saturation degree component of preceding M in the set of saturation degree component, obtains the target saturation degree component;It is described The numerical ordering of the set of saturation degree component is sorts from big to small;To numerical ordering in the set of the lightness component in preceding K Lightness component average, obtain the target lightness component;The numerical ordering of the set of the lightness component is from big to small Sequence;Wherein, N is more than 0 and less than or equal to the integer of form and aspect number of components in the set of the form and aspect component, and M is more than 0 And less than or equal to the integer of saturation degree number of components in the set of the saturation degree component, K is more than 0 and less than or equal to institute State the integer of lightness component quantity in the set of lightness component.
As a kind of realization method, photo division module, specifically for photo to be detected is divided at least two inspections Area is surveyed, and obtains red component, green component and the blue component of each pixel in the photo;According to each pixel Red component, green component and the blue component of point obtain the form and aspect component, saturation degree component and lightness point of each pixel Amount;It averages to the form and aspect component of all pixels point in each detection zone, obtains the corresponding color of each detection zone Phase component;It averages to the saturation degree component of all pixels point in each detection zone, obtains each detection zone pair The saturation degree component answered;It averages to the lightness component of all pixels point in each detection zone, obtains each inspection Survey the corresponding lightness component in area.
As a kind of realization method, testing result obtains module and is additionally operable to:
If it is determined that there are hazes for the photo to be detected, then haze is carried out to user by way of following at least one and shown It is alert:
Warning information is shown on the display interface of the terminal;
Control the terminal plays preset audio file;
The terminal is controlled to send alarm control information to preset external equipment.
According to the third aspect of the invention we, a kind of terminal is provided, including:Memory, processor and computer program, institute It states computer program to be stored in the memory, the processor runs the computer program and performs first aspect and first The haze detection method based on photo of the various possible designs of aspect.
According to the fourth aspect of the invention, a kind of storage medium is provided, including:Readable storage medium storing program for executing and computer program, The computer program is used to implement the haze detection based on photo described in first aspect and the various possible designs of first aspect Method.
Haze detection method and device provided by the invention based on photo, in order to improve the inspection to each region in photo Accuracy is surveyed, photo to be detected is divided at least two detection zones first, and obtains the form and aspect component of each detection zone, satisfy With degree component and lightness component, whether there is the letter of haze using form and aspect component, saturation degree component and lightness component as instruction photo Breath has higher indicated efficiency;And it according to the form and aspect component, saturation degree component and lightness component of all detection zones, determines Form and aspect component mean value, saturation degree component mean value and lightness component mean value, using mean value as standard for manual sampling;Then according to extremely The corresponding all form and aspect components of few two detection zones, saturation degree component and lightness component obtain be more than the form and aspect component respectively Mean value, the aim colour phase component of the saturation degree component mean value and the lightness component mean value, target saturation degree component and mesh Mark lightness component;Finally according to the aim colour phase component, target saturation degree component and target lightness component and form and aspect threshold Value, saturation degree threshold value and lightness threshold determine the photo to be detected with the presence or absence of haze, haze detection provided by the invention Method has the characteristics that speed is fast, it is simple to calculate, and is detected suitable for the daily haze of user, hardware, software to terminal device Performance requirement is not high.
Description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, to embodiment or will show below Have technology describe needed in attached drawing do and simply introduce, it should be apparent that, the accompanying drawings in the following description is the present invention Some embodiments, for those of ordinary skill in the art, without creative efforts, can also basis These attached drawings obtain other attached drawings.
Fig. 1 is that a kind of haze based on photo provided in an embodiment of the present invention detects application scenarios;
Fig. 2 is a kind of haze testing process schematic diagram based on photo provided in an embodiment of the present invention;
Fig. 3 divides example for a kind of detection zone provided in an embodiment of the present invention;
Fig. 4 is another haze testing process schematic diagram based on photo provided in an embodiment of the present invention;
Fig. 5 is another haze testing process schematic diagram based on photo provided in an embodiment of the present invention;
Fig. 6 is a kind of haze detection device based on photo provided in an embodiment of the present invention;
Fig. 7 is another haze detection device based on photo provided in an embodiment of the present invention;
Fig. 8 is a kind of hardware architecture diagram of terminal provided by the invention.
Specific embodiment
Purpose, technical scheme and advantage to make the embodiment of the present invention are clearer, below in conjunction with the embodiment of the present invention In attached drawing, the technical solution in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only Only it is part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill Personnel's all other embodiments obtained without making creative work, shall fall within the protection scope of the present invention.
It should be appreciated that the term " comprising " and " having " used in the present invention and their any deformation, it is intended that Cover it is non-exclusive include, for example, containing the process of series of steps or unit, method, system, product or equipment need not limit In those steps or unit for clearly listing, but may include not listing clearly or for these processes, method, production The intrinsic other steps of product or equipment or unit.
Depending on linguistic context, as used in this " if " can be construed to " ... when " or " when ... " or " in response to determining " or " in response to detection ".
It should be appreciated that in the present invention, " form and aspect component ", refer to characterize the component of form and aspect feature in photo.Form and aspect are colors The quality looks that coloured silk is showed, are the most accurate standards for distinguishing various different colors.Each different color in nature It is mutually unlimited abundant such as purplish red, silver grey, orange.The appearance appellation of form and aspect, that is, all kinds of colors.From optical significance, color Phase difference is generated by the length of optical wavelength.Even same class color can also be divided into several form and aspect, as yellow color can be with It is divided into middle Huang, the colour of loess, lemon yellow etc., grey color can then be divided into red grey, bluish grey, purple ash etc..Have in spectrum it is red, orange, yellow, green, Blue, purple six kinds of basic coloured light, the eyes of people can tell the color of about 180 kinds of different form and aspect." saturation degree component ", refers to shine The component of saturation degree feature is characterized in piece.The bright-coloured or distinct degree for representing color with numerical value is referred to as saturation degree.Chromatic colour Various colors all have intensity value, and the intensity value of the color of netrual colour is 0, for the height of the saturation degree of the color of chromatic colour, area Other method is calculated according to the degree containing grey in this color.Saturation degree is different due to the difference of form and aspect, and even if It is identical form and aspect, because of the difference of lightness, saturation degree can also change therewith." lightness component " refers to characterize in photo bright Spend the component of feature.Lightness refers to the light levels of color.Various colored objects are produced due to the difference of their reflection light quantity The light and shade of raw color is strong and weak.Three the available form and aspect of color, saturation degree and lightness features describe.Any colour seen by person Light is all the resultant effect of these three characteristics, these three characteristics are the three elements of color, and the wavelength of wherein tone and light wave has Direct relation, brightness and saturation degree are related with the amplitude of light wave.
The present invention according to the form and aspect component, saturation degree component and lightness component of photo, obtain in photograph taking scene whether There are the testing results of haze, realize the quick real-time detection to haze.Below with specifically embodiment to the present invention's Technical solution is described in detail.These specific embodiments can be combined with each other below, for the same or similar concept Or process may be repeated no more in some embodiments.
Fig. 1 is that a kind of haze based on photo provided in an embodiment of the present invention detects application scenarios.One kind shown in Fig. 1 In application scenarios, example is carried out using mobile phone as terminal, actually terminal can also be such as tablet computer, digital camera, intelligence Other movement equipment of energy glasses capable of taking pictures, can also be the fixed equipment such as monitoring system, Traffic monitoring instrument.In Fig. 1 institutes Can be the haze detection function for starting mobile phone before user gos out in interface is shot first, then in the application scenarios shown It for example builds and takes pictures against outdoor scenery in the shooting interface of haze detection function, mobile phone collects to be detected from camera Photo, and to photo carry out analysis obtain be used to indicate outdoor environment whether there is haze haze testing result.Acquisition is treated The camera for detecting photo can be the camera of mobile phone or mobile phone passes through the external special camera shooting of remote control Head carries out outdoor scenery with special camera shooting and obtains photo to be detected.Such as user's plan gos out and carries out outdoor activities, And whether have haze to understand space for activities, the camera near space for activities can be connected by mobile phone remote, is remotely obtained The photo of space for activities is taken, then the photo of space for activities is analyzed with the haze detection device of invention, obtains haze inspection Survey result.User can think whether ten million space for activities carries out outdoor activities according to haze testing result.The present invention can be with For other haze detection applications, however it is not limited to above application scene.
Fig. 2 is a kind of haze testing process schematic diagram based on photo provided in an embodiment of the present invention.Embodiment illustrated in fig. 2 The executive agent for the method being related to can be terminal, which can be mobile terminal or fixed terminal.Mobile terminal Including but not limited to mobile phone, personal digital assistant (Personal Digital Assistant, PDA), tablet computer, portable set Standby (for example, portable computer, pocket computer or handheld computer) etc. has the mobile equipment of image collecting function. Fixed terminal includes but not limited to monitoring system, Traffic monitoring instrument, gate inhibition, intelligent fixed-line telephone, console etc. and is adopted with image Collect the fixed equipment of function.The embodiment of the present invention does not limit the form of terminal.The method of embodiment illustrated in fig. 2 specifically can be with Including:
Photo to be detected is divided at least two detection zones by S101, and is obtained the form and aspect component of each detection zone, satisfied With degree component and lightness component.
Specifically, can be divided by nine grids, the segmentation of field word, in the form of vertical segmentation or horizontal partition etc., by photo It is divided into two or more detection zones.The division in area is detected to photo, photo different location can be divided Area determines the detection unit for being used for obtaining subsequent parameter, improves the accuracy of analysis detection.For each detection zone, obtain respectively Take form and aspect component, saturation degree component and lightness component.Form and aspect component, saturation degree component and the lightness component of detection zone be respectively According to the form and aspect component of all pixels point, saturation degree component and lightness component in the detection zone come determining.Day is polluted in haze When gas occurs, molecule, steam in air and a large amount of suspended particulates composition aerosol form light serious absorption, scattering and anti- The effect of penetrating, causes atmospheric visibility to reduce.It is usually partially white or partially yellow in the photo of haze weather shooting, cause corresponding form and aspect compared with It is low.Light is stopped by haze, therefore photo is whole partially dark, causes corresponding lightness relatively low.The covering of haze cause around greenery, The coloured scenery visibility of the tool such as building reduces, and causes corresponding saturation degree relatively low.Therefore, with the form and aspect component of photo, full Photo photographed scene with the presence or absence of haze is identified with degree component and lightness component, the accuracy of detection can be improved.
S102, according to the form and aspect component, saturation degree component and lightness component of all detection zones, determine form and aspect component mean value, Saturation degree component mean value and lightness component mean value.
Specifically, with the detection zone quantity of the sum of form and aspect component of all detection zones of photo divided by photo, you can to obtain Obtain form and aspect component mean value.Likewise, the detection zone number of the sum of saturation degree component of all detection zones with photo divided by photo Amount, you can to obtain saturation degree component mean value.The detection zone of the sum of lightness component of all detection zones with photo divided by photo Quantity, you can to obtain lightness component mean value.
S103 according to the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, divides Form and aspect component mean value, the aim colour phase component of the saturation degree component mean value and lightness component mean value, target Huo get be more than Saturation degree component and target lightness component.
Specifically, each detection zone corresponds to a form and aspect component, a saturation degree component and a lightness component.By institute There is the corresponding form and aspect component of detection zone to be compared with form and aspect component mean value, obtained according to the form and aspect component more than form and aspect component mean value To aim colour phase component.Determine that the realization method of aim colour phase component can be with for example, to all colors more than form and aspect component mean value Phase component is averaged, and obtains aim colour phase component.
It is possible to further being to obtain aim colour phase component, target saturation degree component and target lightness in the same way Component is illustrated with obtaining aim colour phase component, can select to obtain according to the distribution situation of all form and aspect components The method of aim colour phase component, such as:
If more than the form and aspect number of components of form and aspect component mean value, 1/ of form and aspect number of components than being less than form and aspect component mean value D is also few, shows that form and aspect number of components variance is larger, and the form and aspect of whole photo may be less than normal, then to be more than form and aspect component mean value Minimum value is as aim colour phase component in form and aspect component;
If more than the form and aspect number of components of form and aspect component mean value, the D of the form and aspect number of components than being less than form and aspect component mean value It is more again, again show that phase component quantity variance is larger, the form and aspect of whole photo may be bigger than normal, then to be more than form and aspect component mean value Form and aspect component in maximum value as aim colour phase component;
If more than the form and aspect number of components of form and aspect component mean value, more than or equal to the form and aspect less than form and aspect component mean value The 1/D of number of components, and less than or equal to D times of the form and aspect number of components less than form and aspect component mean value, show form and aspect Number of components variance is smaller, and COLOR COMPOSITION THROUGH DISTRIBUTION is more uniform, then averages to all form and aspect components more than form and aspect component mean value, obtains Aim colour phase component, above-mentioned D are the number more than 1, and optionally D is 3,4 or 5.
S104, according to aim colour phase component, target saturation degree component and target lightness component and form and aspect threshold value, saturation Threshold value and lightness threshold are spent, determines that the corresponding detection zone of photo to be detected whether there is haze.
Specifically, since form and aspect, saturation degree and lightness are mainly used for describing the bright-coloured degree of color shade of photo, and haze Covering can cause the photo of shooting that dusky scene is presented, the bright-coloured degree of color shade of photo declines, and shows partially dark Or partially light feature, therefore after photo obtains aim colour phase component, target saturation degree component and target lightness component, Ke Yigen Compared according to threshold value of the obtained aim colour phase component, target saturation degree component and target lightness component respectively with three classes component Compared with, determine the corresponding detection zone of photo to be detected whether there is haze.Such as:Judge aim colour phase component, target saturation It spends component and whether target lightness component is respectively less than corresponding form and aspect threshold value, saturation degree threshold value and lightness threshold respectively, if so, It obtains and indicates haze testing result of the photograph taking content there are haze;If it is not, it then obtains in the instruction photograph taking Hold the haze testing result there is no haze.
Wherein, form and aspect threshold value, saturation degree threshold value and lightness threshold can be preset according to threshold information input by user Or before carrying out the detection of above-mentioned haze and obtaining haze testing result, first from the haze of multiple shooting haze phenomenons Picture obtains form and aspect, saturation degree and lightness, and carries out Probability Distribution Analysis respectively, determines most probable respectively from its probability distribution The hue range, saturation degree range and lightness range of haze picture are designated as, finally with hue range, saturation degree range and lightness Each peak in range, as form and aspect threshold value, saturation degree threshold value and lightness threshold.Aim colour phase component, target when photo are satisfied When being both less than form and aspect threshold value, saturation degree threshold value and lightness threshold respectively with degree component and target lightness component, it can be determined that photo There are hazes in the scene of shooting.
Haze detection method provided in this embodiment based on photo, it is accurate in order to improve the detection to each region in photo True property, is divided at least two detection zones by photo to be detected first, and obtains the form and aspect component of each detection zone, saturation degree Whether component and lightness component have the information of haze, tool using form and aspect component, saturation degree component and lightness component as instruction photo There is higher indicated efficiency;And according to the form and aspect component, saturation degree component and lightness component of all detection zones, determine form and aspect point Mean value, saturation degree component mean value and lightness component mean value are measured, using mean value as standard for manual sampling;Then according to described at least two The corresponding all form and aspect components of detection zone, saturation degree component and lightness component are obtained respectively more than the form and aspect component mean value, institute State the aim colour phase component, target saturation degree component and target lightness point of saturation degree component mean value and the lightness component mean value Amount;Finally according to the aim colour phase component, target saturation degree component and target lightness component and form and aspect threshold value, saturation degree Threshold value and lightness threshold determine the corresponding detection zone of the photo to be detected with the presence or absence of haze, mist provided by the invention Haze detection method has the characteristics that speed is fast, it is simple to calculate, and is detected suitable for the daily haze of user, to the hard of terminal device Part, software performance requirement be not high.
In the embodiment shown in Figure 2, it just needs photo being divided at least two detection zones first, it is accurate to improve detection True property, while can also reduce difficulty in computation using block as computing unit, reduces the requirement to terminal capabilities, and detection zone in addition to It is divided, such as the dividing modes such as above-mentioned nine grids with fixed splitting scheme, can be divided with good grounds photo content Realization method illustrates a kind of realization method that Division is detected according to photo content below in conjunction with Fig. 3:
Fig. 3 divides example for a kind of detection zone provided in an embodiment of the present invention.As shown in figure 3, first in photograph taking Appearance is identified, if the object for having building, trees etc. significant, can be determined according to the picture position of building, trees Orientation up and down in photo, such as the top of trees have larger aberration with sky, and the root of trees is connected with the earth, aberration It is smaller, it thereby determines that orientation up and down, the vertical direction of content of shooting in photo is determined further according to the overall profile of trees.If according to There is portrait in piece, then can also orientation, such as the triangle formed with eyes and lip up and down be identified according to human face five-sense-organ, determined The vertical direction of content of shooting in photo.On the basis of above-mentioned, can also according in photo it is multiple have significant scenery, Portrait determines the vertical direction of content of shooting in photo jointly.For example, the alternative vertical direction that will be determined by multiple objects It is compared, excludes one or two maximum alternate item of difference;To remaining alternative vertical direction, with relatively same reference side To drift angle be averaging drift angle;Finally the direction of average drift angle will be deviated relative to reference direction as content of shooting in photo Vertical direction.In the photo is determined after the vertical direction of content of shooting, the photo is divided into along the vertical side To at least two detection zones of arrangement.Photo is divided into sky, building top, built by the detection zone arranged along the vertical direction Build bottom and ground.According to the distribution of haze it is recognized that while haze is suspended in entire space, but is mainly reflected in photo Building top, sky areas it is dim.Since ground self color is partially dark, with the form and aspect, saturation degree and lightness on ground into The detection of row haze will bring large error, and the detection zone vertically arranged comes out sky, building top region division, The precision of haze detection can be improved.Normal sky has more bright gay colours, the form and aspect of place detection zone Component, saturation degree component and lightness component all can be higher, and once detect the form and aspect component of these detection zones, saturation degree point Amount and lightness component are significantly lower than threshold value, then caused by being likely to haze covering.Therefore, photo is divided into vertically At least two detection zones of arrangement can improve the recall rate to haze.
Fig. 4 is another haze testing process schematic diagram based on photo provided in an embodiment of the present invention.Determine it is to be checked The photo of survey is there are during haze, and the above method also further obtains the haze concentration of photo to be detected, with reference to Fig. 1 and figure Photo to be detected shown in 3 and flow diagram shown in Fig. 4 carry out the haze concentration for how obtaining photo to be detected It is described in detail.
S201 identifies photo to be detected, obtains the target object of reference on photo to be detected and target object of reference institute Target detection area.
Specifically, after determining that photo to be detected is there are haze as shown in Figure 1, identify the color of each object on photo, The image feature informations such as shape are known according to the object that these characteristics of image determine to shoot in photo, such as according to preset photo Other Model Identification goes out photo to be detected shown in FIG. 1 and includes office block, sky, bushes, ground.Target object of reference can be with It is preset, for example, after portrait, building and plant is detected, using this three as target object of reference.Target reference Object can be one or two or more.Further, in the realization method for setting a target object of reference In, the determining priority of target object of reference, such as pre-set priority can also be set to be followed successively by from high in the end:Building, plant, Portrait.After building and plant is detected, preferentially using building as target object of reference.It, will after target object of reference is determined Region where target object of reference is determined as target detection area.
S202 obtains form and aspect component, saturation degree component and the lightness component in target detection area.
For example, in photo to be detected shown in Fig. 1, using the region where building as target detection area, then obtain Take the form and aspect component, saturation degree component and lightness component of partial building on photo.
S203, inquiry obtain the reference photo of matched with target object of reference and non-haze, and obtain with reference to mesh on photo Mark the corresponding form and aspect component of reference detection zone, saturation degree component and the lightness component where object of reference.
Specifically, in one implementation, it can be non-haze is obtained from internet reference photo, for example, will Internet is uploaded to the shooting of photo to be detected and the photo, in existing Online Map website near inquiry shooting ground Street photo, the non-haze photo of target object of reference is matched in the photo of Zai Conggai streets.In another implementation, may be used To be the reference photo that non-haze is obtained from the non-haze photo that user shoots in advance, for example, user is in advance in non-haze A photo is shot under fair weather to office building to be used as with reference to photo, storage is in the terminal as spare.It is inquiring and is obtaining To with reference to after photo, form and aspect component, saturation degree component and the lightness component for referring to same reference detection zone on photo are obtained.Example Such as, photo to be detected is equally shooting this office block just using the front of office block as target object of reference with reference to photo Face then obtains form and aspect component, saturation degree component and lightness component in office block image-region.
S204, according to reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and target detection area Form and aspect component, saturation degree component and lightness component, obtain the haze concentration of photo to be detected.
Specifically, since the presence of haze affects shading value and color saturation of photo to be detected etc., Can be according to reference to the corresponding form and aspect component of detection zone, saturation degree component and the form and aspect in lightness component and target detection area Gap between component, saturation degree component and lightness component obtains the haze concentration of photo to be detected.
For how to obtain the haze concentration of photo to be detected, said below by a kind of optional realization method It is bright.
First, according to reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and target detection area Form and aspect component, saturation degree component and lightness component, determine form and aspect differences, saturation degree difference and lightness difference respectively.
Then, according to form and aspect difference range, saturation degree difference range and lightness difference range pair with haze concentration respectively It should be related to, determine form and aspect difference, saturation degree difference and the corresponding haze concentration of lightness difference.Wherein, form and aspect difference range, Saturation degree difference range and lightness the difference range correspondence with haze concentration respectively, can be previously according to a large amount of haze Photo carries out Parameter Clustering acquisition.
Finally, according to three kinds of situations of form and aspect difference, saturation degree difference and the corresponding haze concentration of lightness difference, sentence Fixed photo haze concentration to be detected:
If the form and aspect difference, saturation degree difference and lightness difference all correspond to identical haze concentration, will be described identical Haze concentration, be determined as photo haze concentration to be detected;
If the two in the form and aspect difference, saturation degree difference and lightness difference corresponds to identical haze concentration, by institute The corresponding identical haze concentration of the two is stated, is determined as photo haze concentration to be detected;
If the form and aspect difference, saturation degree difference and lightness difference all correspond to different haze concentration respectively, by described in The corresponding haze concentration of target lightness range is determined as photo haze concentration to be detected.
In order to clearly describe above-described embodiment, below to obtain aim colour phase component, target saturation degree component and The process of target lightness component is described in detail.
First, after the corresponding form and aspect component of all detection zones, saturation degree component and lightness component is obtained, due to number It is worth smaller form and aspect component, saturation degree component and lightness component and is likely to ground or shadow area, therefore by minimum form and aspect Component, saturation degree component and lightness component do not have Clinical significance of detecting as comparative quantity, therefore at least two detection zone Corresponding all form and aspect components, saturation degree component and lightness component respectively with corresponding form and aspect mean value, saturation degree mean value and bright Degree mean value is compared, so as to which acquisition is more than the set of the form and aspect component of form and aspect mean value, more than the saturation degree mean value respectively The set of the set of saturation degree component and lightness component more than the lightness mean value.
Then, it synchronizes or following three operations acquisition aim colour phase component, target saturation degree is successively carried out with random order Component and target lightness component:
It averages to some or all form and aspect components in the set of form and aspect component, obtains aim colour phase component;
It averages to some or all saturation degree components in the set of saturation degree component, obtains target saturation degree component;
It averages to some or all lightness components in the set of lightness component, obtains target lightness component.
In an optional implementation manner, it averages to the part form and aspect component in the set of form and aspect component, obtains institute Stating a kind of realization method of aim colour phase component can be:To numerical ordering in the set of the form and aspect component preceding N form and aspect Component is averaged, and obtains the aim colour phase component;The numerical ordering of the set of the form and aspect component is sorts from big to small.
In an optional implementation manner, equal are asked to some or all saturation degree components in the set of saturation degree component Value, obtaining a kind of realization method of the target saturation degree component can be:Numerical value in the set of the saturation degree component is arranged Saturation degree component of the sequence in preceding M is averaged, and obtains the target saturation degree component;The numerical value row of the set of the saturation degree component Sequence is sorts from big to small.
In an optional implementation manner, it averages to some or all lightness components in the set of lightness component, Obtaining a kind of realization method of the target lightness component can be:To numerical ordering in the set of the lightness component in preceding K Lightness component average, obtain the target lightness component;The numerical ordering of the set of the lightness component is from big to small Sequence
Wherein, N is more than 0 and less than or equal to the integer of form and aspect number of components in the set of the form and aspect component, and M is big The integer of saturation degree number of components in 0 and the set less than or equal to the saturation degree component, K are more than 0 and are less than or wait The integer of lightness component quantity in the set of the lightness component.
Fig. 5 is another haze testing process schematic diagram based on photo provided in an embodiment of the present invention.Reality shown in Fig. 2 On the basis of applying example, with reference to Fig. 5 to one kind of the form and aspect component of each detection zone of acquisition, saturation degree component and lightness component Implementation process is described in detail.
S301 obtains red component, green component and the blue component of each pixel in photo.
Specifically, rgb color pattern is a kind of general color standard of industrial quarters, is by red (r), green (g), the variation of blue (b) three Color Channels and their mutual superpositions obtain miscellaneous color, rgb It is the color component for representing three channels of red, green, blue.The photo generally yielded is all the photo of rgb patterns, therefore can be fast Fast ground gets red component, green component and the blue component of each pixel in photo according to color display mode.
S302 according to the red component, green component and blue component of each pixel, obtains the form and aspect of each pixel Component, saturation degree component and lightness component.
Specifically, can be that the photo of rgb is transformed into HSV patterns, so as to obtain the parameter value of h, s and v of photo.Its In, HSV patterns are to describe color with three form and aspect (h), saturation degree (s), lightness (v) parameters.Following equation, root can be passed through According to the red component (r) of each pixel, green component (g) and blue component (b), the form and aspect point of each pixel are obtained Measure (h), saturation degree component (s) and lightness component (v).
U=max
Wherein, max represents the maximum value in red component (r), green component (g) and blue component (b), and min represents red Minimum value in colouring component (r), green component (g) and blue component (b).
S303 averages to the form and aspect component of all pixels point in each detection zone, obtains each detection The corresponding form and aspect component in area;It averages to the saturation degree component of all pixels point in each detection zone, obtains each institute State the corresponding saturation degree component of detection zone;It averages, obtains to the lightness component of all pixels point in each detection zone Each corresponding lightness component of the detection zone.
The present embodiment is arrived according to red component, green component and the blue component of pixel each in photo by rgb The conversion of hsv, and seek each detection zone the mean value of hsv, so as to obtain the form and aspect component of each detection zone, saturation degree component and Lightness component using a component mean value of detection zone as the unit of account in follow-up compare, reduces calculation amount, it is difficult to reduce calculating Degree and complexity.
In the above-described embodiments, however, it is determined that the photo to be detected is there are haze, then the method to obtain haze inspection It surveys after result, also carrying out haze to user by way of following at least one warns:
Carrying out a kind of mode for warning of haze to user can be:Alarm signal is shown on the display interface of the terminal Breath, such as show haze pattern or haze prompt text in the display unit user that reaches the standard grade of terminal;
Carrying out the another way warned of haze to user can be:Control the terminal plays preset audio file, example Such as control terminal sends out the voice prompt for detecting haze or preset warning the tinkle of bells, and audio file can be It is default storage of uniting or pre-stored according to user's input;
Carrying out the yet another approach warned of haze to user can be:The terminal is controlled to be sent to preset external equipment Alarm control information, such as control terminal send alarm control information to Bluetooth audio device or onboard system, and Bluetooth audio device receives The voice document included in alarm control information is played after alarm control information, after onboard system receives alarm control information, It is opened according to alarm control information except haze module.
Fig. 6 is a kind of haze detection device based on photo provided in an embodiment of the present invention.Device shown in fig. 6 includes:
Photo division module 11 for photo to be detected to be divided at least two detection zones, and obtains each detection Form and aspect component, saturation degree component and the lightness component in area;
Mean value determining module 12 for form and aspect component, saturation degree component and the lightness component according to all detection zones, determines Form and aspect component mean value, saturation degree component mean value and lightness component mean value;
Target component obtains module 13, for according to the corresponding all form and aspect components of at least two detection zone, saturation Component and lightness component are spent, obtains be more than the form and aspect component mean value, the saturation degree component mean value and the lightness respectively Aim colour phase component, target saturation degree component and the target lightness component of component mean value;
Haze determining module 14, for according to the aim colour phase component, target saturation degree component and target lightness component, And form and aspect threshold value, saturation degree threshold value and lightness threshold, determine that the photo to be detected whether there is haze.
The terminal of embodiment illustrated in fig. 6 accordingly can be used for performing the step of terminal performs in embodiment of the method shown in Fig. 2, Its implementing principle and technical effect is similar, and details are not described herein again.
Fig. 7 is another haze detection device based on photo provided in an embodiment of the present invention.In the base of above-described embodiment On plinth, embodiment shown in Fig. 7 further includes haze concentration determination module 15, is used for:
The photo to be detected is being determined there are the photo to be detected during haze, is identified, acquisition is described to be detected Photo on target object of reference and the target detection area where the target object of reference;Obtain the color in the target detection area Phase component, saturation degree component and lightness component;Inquiry obtains the reference photo of matched with the target object of reference and non-haze, And obtain the corresponding form and aspect component of reference detection zone with reference to where target object of reference described on photo, saturation degree component and Lightness component;It is examined according to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target Form and aspect component, saturation degree component and the lightness component in area are surveyed, obtains the haze concentration of the detection zone.
On the basis of above-described embodiment, the haze concentration determination module 15 is specifically used for:
It is examined according to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target Form and aspect component, saturation degree component and the lightness component in area are surveyed, determines form and aspect difference, saturation degree difference and lightness difference respectively;Root According to form and aspect difference range, saturation degree difference range and lightness the difference range correspondence with haze concentration respectively, determine described Form and aspect difference, saturation degree difference and the corresponding haze concentration of lightness difference;If the form and aspect difference, saturation degree difference and bright Degree difference all corresponds to identical haze concentration, then by the identical haze concentration, is determined as photo haze concentration to be detected; It, will be both described right if the two in the form and aspect difference, saturation degree difference and lightness difference corresponds to identical haze concentration The identical haze concentration answered is determined as photo haze concentration to be detected;If the form and aspect difference, saturation degree difference and lightness Difference all corresponds to different haze concentration respectively, then by the corresponding haze concentration of the target lightness range, is determined as to be detected Photo haze concentration.
On the basis of above-described embodiment, target component obtains module 13 and is specifically used for:
In the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively Take the set of the form and aspect component more than the form and aspect mean value, more than the set of saturation degree component of the saturation degree mean value and big In the set of the lightness component of the lightness mean value;Equal are asked to some or all form and aspect components in the set of the form and aspect component Value, obtains the aim colour phase component;It averages to some or all saturation degree components in the set of the saturation degree component, Obtain the target saturation degree component;It averages, obtains to some or all lightness components in the set of the lightness component The target lightness component.
On the basis of above-described embodiment, target component obtains module 13 and is specifically used for:
In the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively Take the set of the form and aspect component more than the form and aspect mean value, more than the set of saturation degree component of the saturation degree mean value and big In the set of the lightness component of the lightness mean value;To numerical ordering in the set of the form and aspect component preceding N form and aspect component It averages, obtains the aim colour phase component;The numerical ordering of the set of the form and aspect component is sorts from big to small;To described Numerical ordering is averaged in the saturation degree component of preceding M in the set of saturation degree component, obtains the target saturation degree component;It is described The numerical ordering of the set of saturation degree component is sorts from big to small;To numerical ordering in the set of the lightness component in preceding K Lightness component average, obtain the target lightness component;The numerical ordering of the set of the lightness component is from big to small Sequence;Wherein, N is more than 0 and less than or equal to the integer of form and aspect number of components in the set of the form and aspect component, and M is more than 0 And less than or equal to the integer of saturation degree number of components in the set of the saturation degree component, K is more than 0 and less than or equal to institute State the integer of lightness component quantity in the set of lightness component.
On the basis of above-described embodiment, photo division module 11, specifically for photo to be detected is divided at least Two detection zones, and obtain red component, green component and the blue component of each pixel in the photo;According to each institute The red component, green component and blue component of pixel are stated, obtains the form and aspect component of each pixel, saturation degree component and bright Spend component;It averages to the form and aspect component of all pixels point in each detection zone, obtains each detection zone and correspond to Form and aspect component;It averages to the saturation degree component of all pixels point in each detection zone, obtains each detection The corresponding saturation degree component in area;It averages to the lightness component of all pixels point in each detection zone, obtains each institute State the corresponding lightness component of detection zone.
On the basis of above-described embodiment, testing result obtains module 14 and is additionally operable to:
If it is determined that there are hazes for photo to be detected, then haze is carried out to user by way of following at least one and warned:
Warning information is shown on the display interface of the terminal;
Control the terminal plays preset audio file;
The terminal is controlled to send alarm control information to preset external equipment.
Fig. 8 is a kind of hardware architecture diagram of terminal provided by the invention.As shown in figure 8, the terminal includes:Processor 611 and memory 612;Wherein
Memory 612, for storing computer program, which can also be flash memory (flash).
Processor 611, for performing the execute instruction of memory storage, to realize the above-mentioned haze detection side based on photo Each step that terminal performs in method.The specific associated description that may refer in previous methods embodiment.
Optionally, memory 612 can also be integrated with processor 611 either independent.
When the memory 612 is independently of the device except processor 611, the terminal can also include:
Bus 613, for connecting the memory 612 and processor 611.The terminal of Fig. 8 can further include hair Device (being not drawn into figure) is sent, for sending alarm control information to preset external equipment.
The present invention also provides a kind of readable storage medium storing program for executing, execute instruction is stored in readable storage medium storing program for executing, when terminal extremely When a few processor performs the execute instruction, terminal performs the inspection of the haze based on photo that above-mentioned various embodiments provide Survey method.
The present invention also provides a kind of program product, which includes execute instruction, which is stored in readable In storage medium.At least one processor of terminal can read the execute instruction, at least one processing from readable storage medium storing program for executing Device performs the execute instruction and terminal is caused to implement the haze detection method based on photo that above-mentioned various embodiments provide.
In above-mentioned terminal or the embodiment of server, it should be appreciated that processor can be central processing unit (English: Central Processing Unit, referred to as:CPU), it can also be other general processors, digital signal processor (English: Digital Signal Processor, referred to as:DSP), application-specific integrated circuit (English:Application Specific Integrated Circuit, referred to as:ASIC) etc..General processor can be microprocessor or the processor can also be Any conventional processor etc..Hardware processor can be embodied directly in reference to the step of the method disclosed in the present to have performed Completion is performed into or with hardware in processor and software module combination.
Finally it should be noted that:The above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe is described in detail the present invention with reference to foregoing embodiments, it will be understood by those of ordinary skill in the art that:Its according to Can so modify to the technical solution recorded in foregoing embodiments either to which part or all technical features into Row equivalent replacement;And these modifications or replacement, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (10)

1. a kind of haze detection method based on photo, which is characterized in that applied to terminal, the method includes:
Photo to be detected is divided at least two detection zones, and obtains the form and aspect component of each detection zone, saturation degree component And lightness component;
According to the form and aspect component, saturation degree component and lightness component of all detection zones, form and aspect component mean value, saturation degree component are determined Mean value and lightness component mean value;
According to the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively big In aim colour phase component, the target of the form and aspect component mean value, the saturation degree component mean value and the lightness component mean value Saturation degree component and target lightness component;
According to the aim colour phase component, target saturation degree component and target lightness component and form and aspect threshold value, saturation degree threshold value And lightness threshold, determine that the photo to be detected whether there is haze.
2. according to the method described in claim 1, it is characterized in that, determining the corresponding detection zone of the photo to be detected There are during haze, the method further includes:
It identifies the photo to be detected, obtains the target object of reference on the photo to be detected and the target object of reference The target detection area at place;
Obtain the form and aspect component, saturation degree component and lightness component in the target detection area;
Inquiry obtains the reference photo of matched with the target object of reference and non-haze, and obtains described with reference to described on photo The corresponding form and aspect component of reference detection zone, saturation degree component and lightness component where target object of reference;
According to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target detection area Form and aspect component, saturation degree component and lightness component, obtain the haze concentration of the photo to be detected.
3. according to the method described in claim 2, it is characterized in that, described divide according to described with reference to the corresponding form and aspect of detection zone Amount, saturation degree component and the lightness component and form and aspect component in the target detection area, saturation degree component and lightness component, are obtained The haze concentration of the photo to be detected is taken, including:
According to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target detection area Form and aspect component, saturation degree component and lightness component, determine form and aspect differences, saturation degree difference and lightness difference respectively;
According to form and aspect difference range, saturation degree difference range and lightness the difference range correspondence with haze concentration respectively, really The fixed form and aspect difference, saturation degree difference and the corresponding haze concentration of lightness difference;
If the form and aspect difference, saturation degree difference and lightness difference all correspond to identical haze concentration, by the identical mist Haze concentration is determined as photo haze concentration to be detected;
If the two in the form and aspect difference, saturation degree difference and lightness difference corresponds to identical haze concentration, by described two The corresponding identical haze concentration of person, is determined as photo haze concentration to be detected;
If the form and aspect difference, saturation degree difference and lightness difference all correspond to different haze concentration respectively, by the target The corresponding haze concentration of lightness range is determined as photo haze concentration to be detected.
4. according to any methods of claim 1-3, which is characterized in that described to be corresponded to according at least two detection zone All form and aspect components, saturation degree component and lightness component, obtained respectively more than the form and aspect component mean value, the saturation degree point Aim colour phase component, target saturation degree component and the target lightness component of mean value and the lightness component mean value are measured, including:
In the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively big Set in the form and aspect component of the form and aspect mean value, more than the saturation degree mean value saturation degree component set and more than institute The set of the lightness component of degree of stating clearly mean value;
It averages to some or all form and aspect components in the set of the form and aspect component, obtains the aim colour phase component;
It averages to some or all saturation degree components in the set of the saturation degree component, obtains the target saturation degree point Amount;
It averages to some or all lightness components in the set of the lightness component, obtains the target lightness component.
5. according to the method described in claim 4, it is characterized in that, part form and aspect in the set to the form and aspect component Component is averaged, and obtains the aim colour phase component, including:To numerical ordering in the set of the form and aspect component preceding N color Phase component is averaged, and obtains the aim colour phase component;The numerical ordering of the set of the form and aspect component is sorts from big to small;
Some or all saturation degree components in the set to the saturation degree component are averaged, and obtain the target saturation Component is spent, including:It averages, obtains described to saturation degree component of the numerical ordering in preceding M in the set of the saturation degree component Target saturation degree component;The numerical ordering of the set of the saturation degree component is sorts from big to small;
Some or all lightness components in the set to the lightness component are averaged, and obtain the target lightness point Amount, including:It averages to lightness component of the numerical ordering in preceding K in the set of the lightness component, obtains the target lightness Component;The numerical ordering of the set of the lightness component is sorts from big to small;
Wherein, N is more than 0 and less than or equal to the integer of form and aspect number of components in the set of the form and aspect component, and M is more than 0 And less than or equal to the integer of saturation degree number of components in the set of the saturation degree component, K is more than 0 and less than or equal to institute State the integer of lightness component quantity in the set of lightness component.
6. method according to claim 1 or 2, which is characterized in that the form and aspect component for obtaining each detection zone, saturation Component and lightness component are spent, including:
Obtain red component, green component and the blue component of each pixel in the photo;
According to red component, green component and the blue component of each pixel, obtain each pixel form and aspect component, Saturation degree component and lightness component;
It averages to the form and aspect component of all pixels point in each detection zone, obtains the corresponding color of each detection zone Phase component;
It averages to the saturation degree component of all pixels point in each detection zone, it is corresponding to obtain each detection zone Saturation degree component;
It averages to the lightness component of all pixels point in each detection zone, it is corresponding bright to obtain each detection zone Spend component.
7. a kind of haze detection device based on photo, which is characterized in that including:
Photo division module for photo to be detected to be divided at least two detection zones, and obtains the color of each detection zone Phase component, saturation degree component and lightness component;
Mean value determining module for form and aspect component, saturation degree component and the lightness component according to all detection zones, determines form and aspect point Measure mean value, saturation degree component mean value and lightness component mean value;
Target component obtains module, for according to the corresponding all form and aspect components of at least two detection zone, saturation degree component And lightness component, it obtains respectively equal more than the form and aspect component mean value, the saturation degree component mean value and the lightness component Aim colour phase component, target saturation degree component and the target lightness component of value;
Haze determining module, for according to the aim colour phase component, target saturation degree component and target lightness component, Yi Jise Phase threshold value, saturation degree threshold value and lightness threshold determine that the photo to be detected whether there is haze.
8. device according to claim 7, which is characterized in that further include haze concentration determination module, be used for:Determining Photo to be detected is stated there are during haze, identifies the photo to be detected, obtains the target ginseng on the photo to be detected According to the target detection area where object and the target object of reference;Obtain form and aspect component, the saturation degree point in the target detection area Amount and lightness component;Inquiry obtains the reference photo of matched with the target object of reference and non-haze, and obtains the reference The corresponding form and aspect component of reference detection zone, saturation degree component and lightness component on photo where the target object of reference;According to It is described to divide with reference to the corresponding form and aspect component of detection zone, saturation degree component and the form and aspect in lightness component and the target detection area Amount, saturation degree component and lightness component obtain the haze concentration of the detection zone.
9. device according to claim 8, which is characterized in that the haze concentration determination module is specifically used for:
According to described with reference to the corresponding form and aspect component of detection zone, saturation degree component and lightness component and the target detection area Form and aspect component, saturation degree component and lightness component, determine form and aspect differences, saturation degree difference and lightness difference respectively;According to color Phase difference range, saturation degree difference range and lightness the difference range correspondence with haze concentration respectively, determine the form and aspect Difference, saturation degree difference and the corresponding haze concentration of lightness difference;If the form and aspect difference, saturation degree difference and luminosity equation Value all corresponds to identical haze concentration, then by the identical haze concentration, is determined as photo haze concentration to be detected;If institute It states the two in form and aspect difference, saturation degree difference and lightness difference and corresponds to identical haze concentration, then it will be both described corresponding Identical haze concentration is determined as photo haze concentration to be detected;If the form and aspect difference, saturation degree difference and lightness difference Different haze concentration is all corresponded to respectively, then by the corresponding haze concentration of the target lightness range, is determined as photograph to be detected Piece haze concentration.
10. according to any devices of claim 7-9, which is characterized in that the target component obtains module, specific to use In:
In the corresponding all form and aspect components of at least two detection zone, saturation degree component and lightness component, obtain respectively big Set in the form and aspect component of the form and aspect mean value, more than the saturation degree mean value saturation degree component set and more than institute The set of the lightness component of degree of stating clearly mean value;It averages to some or all form and aspect components in the set of the form and aspect component, Obtain the aim colour phase component;It averages, obtains to some or all saturation degree components in the set of the saturation degree component To the target saturation degree component;It averages to some or all lightness components in the set of the lightness component, obtains institute State target lightness component.
CN201711446926.3A 2017-12-27 2017-12-27 Haze detection method and device based on photos Active CN108182679B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711446926.3A CN108182679B (en) 2017-12-27 2017-12-27 Haze detection method and device based on photos

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711446926.3A CN108182679B (en) 2017-12-27 2017-12-27 Haze detection method and device based on photos

Publications (2)

Publication Number Publication Date
CN108182679A true CN108182679A (en) 2018-06-19
CN108182679B CN108182679B (en) 2020-07-28

Family

ID=62547860

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711446926.3A Active CN108182679B (en) 2017-12-27 2017-12-27 Haze detection method and device based on photos

Country Status (1)

Country Link
CN (1) CN108182679B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110458815A (en) * 2019-08-01 2019-11-15 北京百度网讯科技有限公司 There is the method and device of mist scene detection
CN113920700A (en) * 2021-09-23 2022-01-11 国网山西省电力公司晋中供电公司 Dust deposition degree detection system based on color recognition
CN117596489A (en) * 2024-01-18 2024-02-23 荣耀终端有限公司 Image processing method, image processing apparatus, electronic device, and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779349A (en) * 2012-06-30 2012-11-14 东南大学 Foggy day detecting method based on image color spatial feature
CN102980859A (en) * 2012-11-22 2013-03-20 中国气象科学研究院 Haze monitoring device and haze monitoring method
CN103164847A (en) * 2013-04-03 2013-06-19 上海理工大学 Method for eliminating shadow of moving target in video image
CN103487437A (en) * 2013-09-17 2014-01-01 北京农业信息技术研究中心 Method and system for detecting aerial pesticide spraying droplet distribution index
CN104316974A (en) * 2014-11-04 2015-01-28 无锡北斗星通信息科技有限公司 Forest smoke area detecting system
CN105528581A (en) * 2015-12-10 2016-04-27 华南理工大学 Video smoke event detection method based on bionic color sensing model
US20160217346A1 (en) * 2012-10-05 2016-07-28 Pixon Imaging, Inc. Imaging through aerosol obscurants

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779349A (en) * 2012-06-30 2012-11-14 东南大学 Foggy day detecting method based on image color spatial feature
US20160217346A1 (en) * 2012-10-05 2016-07-28 Pixon Imaging, Inc. Imaging through aerosol obscurants
CN102980859A (en) * 2012-11-22 2013-03-20 中国气象科学研究院 Haze monitoring device and haze monitoring method
CN103164847A (en) * 2013-04-03 2013-06-19 上海理工大学 Method for eliminating shadow of moving target in video image
CN103487437A (en) * 2013-09-17 2014-01-01 北京农业信息技术研究中心 Method and system for detecting aerial pesticide spraying droplet distribution index
CN104316974A (en) * 2014-11-04 2015-01-28 无锡北斗星通信息科技有限公司 Forest smoke area detecting system
CN105528581A (en) * 2015-12-10 2016-04-27 华南理工大学 Video smoke event detection method based on bionic color sensing model

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
YUNAN LI ET AL.: "Single inage haze removal based on haze physical characteristics and adaptive sky region detection", 《NEUROCOMPUTING》 *
付文晓: "基于基图像的室外有雾场景光照分析", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
何林远: "基于亮度反馈的彩色雾霾图像增强算法", 《电子学报》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110458815A (en) * 2019-08-01 2019-11-15 北京百度网讯科技有限公司 There is the method and device of mist scene detection
CN110458815B (en) * 2019-08-01 2023-05-30 阿波罗智能技术(北京)有限公司 Method and device for detecting foggy scene of automatic driving
CN113920700A (en) * 2021-09-23 2022-01-11 国网山西省电力公司晋中供电公司 Dust deposition degree detection system based on color recognition
CN117596489A (en) * 2024-01-18 2024-02-23 荣耀终端有限公司 Image processing method, image processing apparatus, electronic device, and storage medium

Also Published As

Publication number Publication date
CN108182679B (en) 2020-07-28

Similar Documents

Publication Publication Date Title
US20160260306A1 (en) Method and device for automated early detection of forest fires by means of optical detection of smoke clouds
CN100538757C (en) Fire-disaster monitoring device based on omnibearing vision sensor
JP4493050B2 (en) Image analysis apparatus and image analysis method
CN102201146B (en) Active infrared video based fire smoke detection method in zero-illumination environment
CN108182679A (en) Haze detection method and device based on photo
CN106131376B (en) A kind of indoor and outdoor scene determines method and device
CN107067412A (en) A kind of video flame smog detection method of Multi-information acquisition
CN105424655A (en) Visibility detection method based on video images
CN104634784B (en) atmospheric visibility monitoring method and device
JP2020021300A (en) Fire monitoring device, fire monitoring system, and program for fire monitoring device
CN114863489B (en) Virtual reality-based movable intelligent auxiliary inspection method and system for construction site
CN112989989A (en) Security inspection method, device, equipment and storage medium
JP5266486B2 (en) Green visibility measuring apparatus, method and program
CN112861676B (en) Smoke and fire identification marking method, system, terminal and storage medium
CN104602413A (en) Method and system for adjusting lighting device
CN106556579A (en) Group's mist image all-weather self-adapting detection method based on laser
CN114022820A (en) Intelligent beacon light quality detection method based on machine vision
CN113593170A (en) Intelligent early warning system based on remote smoke detection
CN106524913B (en) The position mark method and device in light beam incident point
CN109685083A (en) The multi-dimension testing method of driver's driving Misuse mobile phone
CN114384534A (en) Tree barrier growth prediction analysis method for unmanned aerial vehicle line patrol
Sharma et al. An edge-controlled outdoor autonomous UAV for colorwise safety helmet detection and counting of workers in construction sites
Indrabayu et al. Blob adaptation through frames analysis for dynamic fire detection
CN113160340A (en) City color quantitative analysis and evaluation method, system and storage medium
CN110927166A (en) Visibility measuring device and method for high-speed foggy masses

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant