CN110020673A - A kind of method of HSV color space color identification and noise filtering - Google Patents
A kind of method of HSV color space color identification and noise filtering Download PDFInfo
- Publication number
- CN110020673A CN110020673A CN201910183375.9A CN201910183375A CN110020673A CN 110020673 A CN110020673 A CN 110020673A CN 201910183375 A CN201910183375 A CN 201910183375A CN 110020673 A CN110020673 A CN 110020673A
- Authority
- CN
- China
- Prior art keywords
- image
- color
- subclass
- value
- hue
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
- G06F18/232—Non-hierarchical techniques
- G06F18/2321—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
- G06F18/23213—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/56—Extraction of image or video features relating to colour
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Probability & Statistics with Applications (AREA)
- Life Sciences & Earth Sciences (AREA)
- Multimedia (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a kind of methods of HSV color space color identification and noise filtering, it includes the following steps: one, image is transformed to HSV color space from rgb color space;Two, the hue value of all pixels in image-region is clustered;Three, the noise in image is filtered using hue value cluster result;Four, the method progress color identification that the distance of subset of colours cluster centre is weighted is used;Then the present invention avoids hue circle jump problem and histogram separation issues, provides better effect for color identification and noise filtering by carrying out clustering to pixel in image.
Description
Technical field
The present invention relates to artificial intelligence and computer vision field, and in particular to a kind of identification of HSV color space color and
The method of noise filtering.
Background technique
The color of object is stated using color space, and color is handled and identified, is artificial intelligence, is calculated
Extremely common application in machine vision and field of image processing.HSV color space be it is a kind of it is extremely common, frequency of use is high
Color space.Since the statement of color can be decomposed into three form and aspect, saturation degree and brightness factors by it, it is well suited for mankind's progress
Understand, while also more meeting the visual perception rule of human brain.
Form and aspect Hue feature in HSV color space is the most commonly used feature for distinguishing color.Researcher passes through structure
A hue circle is made, various colors is mapped on a continuous annular space, so that the statement to color, it is only necessary to
One numerical value can be accomplished.And the form and aspect of purple, it is adjacent on hue circle with red form and aspect.This meet human eye for
The similitude of color is felt.The invention of hue circle brings great convenience to the design and calculating of algorithm.
But the form and aspect loop technique in HSV color space still has the drawback that
1, seven kinds of primary colors --- the yellowish green ultramarine of blood orange is purple, arranges on hue circle in sequence, hue value
The interval range being sequentially mapped between [0,359], and continuous distribution is presented.Although red is on hue circle with purple
It is adjacent, on visual sense feeling it is red with purple also very close to but its corresponding hue value is not continuous, there is pole
Big difference.Such as: red hue value is near 0, and the hue value of purple is then near 359, the numerical value of the two hue value
Difference is up to 300 or more, the judgement considerably beyond human eye to both color similarities.
This phenomenon is known as hue circle jump problem by the present invention.And the position for being 359 by hue value, referred to as hue circle
Jump.Hue circle jump problem brings huge puzzlement to the similitude judgement of color, so that being much based on HSV color space
Algorithm occur abnormal, cause to calculate inaccuracy.
2, the phenomenon that similar color is separated on histogram
Due to the ring structure of hue circle, if so that color in some region relatively red or purple when,
Even if whole region color is than more consistent, but the phenomenon for being also easy to appear hue value while being distributed near 0 or 359.It is uniting
When counting form and aspect histogram, the color in the region can then appear in the both ends of histogram simultaneously.
This phenomenon is known as histogram separating phenomenon by the present invention.To find out its cause, being exactly caused by hue circle jump.It is this
Phenomenon causes huge trouble to processing such as color identification and noise filterings.
Such as carry out color identification when, it is more likely that need to calculate the average value of form and aspect, but form and aspect average value at this time because
Lead to not accurate calculation for form and aspect jump problem.
Meanwhile when carrying out noise filtering, it is also desirable to calculate standard deviation.But standard deviation is then because of average value inaccuracy, together
Sample can not also calculate.
If the problem of the problem of hue circle jumps and histogram separate cannot effectively be solved, HSV color space
Using will be seriously hampered.
Summary of the invention
It is an object of the invention to encountered when color is identified with noise filtering using HSV color space for current
Problem, provide it is a kind of clustering is carried out by pixel in image, then avoid hue circle jump problem and histogram point
Every the method for problem.This method can identify for color and noise filtering provides better effect.
To achieve the above object, the technical solution adopted by the present invention is that: it is comprised the following steps:
One, image is transformed into HSV color space from rgb color space;
Two, the Hue value of all pixels in image-region is clustered;
Three, the noise in image is filtered using hue value cluster result;
Four, the method progress color identification that the distance of subset of colours cluster centre is weighted is used.
Further, clustered that specific step is as follows in step 2 to the hue value of all pixels in image-region:
(1) in statistical picture all pixels form and aspect histogram;
(2) subclass numbers are set as the case may be;
(3) initial cluster center of each subclass is set;
(4) method for utilizing average drifting, obtains the cluster centre of each subclass by successive ignition;
(5) according to the form and aspect central value of subclass, classify to pixel all in image, obtain each pixel subset;
(6) Gauss modeling is carried out to each pixel subset;
(7) weight of the subset is calculated according to the number of pixels of subset and image total pixel number purpose ratio.
Further, the specific steps of noise filtering are carried out such as using the Gauss modeling result of each subclass in step 3
Under:
(1) be directed to each pixel, calculate it to each subclass center hue value distance;
(2) if distance value is less than the standard deviation of the subclass, which can be attributed to the subclass;
(3) if distance value cannot be less than the standard deviation of any subclass, which is attributed to noise, is filtered out;
(4) Gauss modeling is re-started to each subclass, calculates mean value and standard deviation and weight.
Further, to whole image progress color identification, specific step is as follows in step 4:
(1) it is directed to current goal color value, calculates its form and aspect distance difference for arriving each subset of colours cluster centre;
(2) added at a distance from the subset of colours to current goal color value using the weight of each subset of colours
Power summation, obtain whole image to current goal color value Weighted distance;
(3) investigation whole image, will be apart from the corresponding classification of the smallest color of object to the distance of all target color values
Number, the color recognition result final as the image.
After adopting the above scheme, the present invention solves calculating by carrying out more subclass clusters to the hue value in the region
When hue circle jump problem caused by color identification, noise filtering trouble.It has a characteristic that
1, algorithm is simple, and calculating speed is fast;
2, interference of the hue circle jump to color identification, noise filtering is solved the problems, such as;
3, interference of the histogram separation issues to color identification, noise filtering is solved.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is the flow chart that color identification and noise filtering is carried out in HSV color space;
Fig. 2 is the flow chart that specific embodiment step 2 clusters the hue value of all pixels in image-region;
Fig. 3 is the process that specific embodiment step 3 carries out noise filtering using the Gauss modeling result of each subclass
Figure;
Fig. 4 is the flow chart that specific embodiment step 4 carries out color identification to whole image;
Specific embodiment
With reference to the accompanying drawing, the present invention is described further:
Present embodiment the technical solution adopted is that: it include following step:
One, colour space transformation is carried out to image to be processed, transforms to HSV color space from rgb color space
The color-values of the pixel are transformed to HSV color sky from rgb space by each pixel for traversing image to be processed
Between.
Wherein H, S, V distinguish hue value, intensity value and the brightness value of HSV color space.The value range of Hue value is
For integer in [0,359] as described in technical background, hue value Hue has hue circle chattering.
Two, the Hue value of all pixels in image-region is clustered
(1) the corresponding histogram of hue value of all pixels in image-region to be processed is counted:
Statistics with histogram is carried out to the hue value Hue of all pixels in image-region to be processed, obtains form and aspect histogram.
In statistic histogram, 360 subintervals are set in total.The statistical value Hist in each subinterval of form and aspect histogrami, expression
It is in image-region, the total number for the pixel that hue value is i is Histi。
Due to the presence of hue circle jump, Hue histogram is caused to be possible to histogram separating phenomenon occur.Same width figure
The pixel content of picture, even if can also appear in histogram simultaneously very close to (when especially close to reddish violet) on color
Left and right ends form the small cluster of two separation.The present invention carries out the modeling of the multiple subclasses of hue value using clustering method.
(2) determination of clusters number: for convenient for introducing solution details, if subclass numbers are set as 2. images by the present invention
There are multicolour in region, can regard the value that actual conditions flexibly determine subclass numbers N.
(3) particular procedures of hue value cluster:
A, the initial position at each subclass center is set
The all pixels in image-region are traversed, the smallest hue value Hue is obtainedmin, obtain maximum hue value Huemax。
Calculate the line of demarcation of the two subclasses:
With [Huemin,Huemid] be the corresponding hue value of first subclass interval range;With [Huemid,Huemax] it is the
The interval range of the corresponding hue value of two subclasses.
In first interval, the initial value of subclass center is set:
In second interval, the initial value of subclass center is set:
B, final each subclass is obtained on form and aspect histogram by successive ignition using the method for average drifting
Cluster centre.Method is as follows:
The size of search window is set as the half of subclass interval range:
Using the initial centered value of current interval as starting point, the window's position is set, starts to search for.Such as the search of first interval
The initial value of the central point of window is Hue_init1.Find the extreme higher position Hue_max of corresponding histogram in current window.
With extreme higher position Hue_max for new central point, search window position is reset, new highest order is picked up
It sets.It is recycled with this, until center no longer changes.
Using final center point as the central point Hue_center of subclass1.Subclass 2 is obtained with same method
Central point Hue_center2。
C, according to the form and aspect central value of subclass, classify to all pixels in image-region:
Each pixel is traversed, is assigned it in specific subclass according to hue value.Using following formula, calculate current
Distance of the hue value of pixel i to the center of subclass j:
Hue_distij=| Huei-Hue_centerj|
if(Hue_distij≥180)
Hue_distij=360-Hue_distij
Since hue circle is ring structure, the difference of two hue values does not exceed 180.
In this way, each pixel is computed at a distance from all subclass centers.It then will be in that the smallest class
The corresponding classification of the heart, the label as the affiliated subclass of the pixel.
So far, the classification results of all pixels in image have been obtained, in this specific embodiment mode, they constitute two pictures
Sub-prime collection S1、S2。
D, Gauss modeling is carried out to each pixel subset
It is concentrated in current sub-blocks of pixels, needs not worry about hue circle jump problem.It therefore can be directly using in the subset
The hue value of all pixels calculates the form and aspect mean value of subset:
Wherein, N is the sum of all pixels mesh of current pixel subset.HuejFor the color for j-th of pixel that current sub-blocks of pixels is concentrated
Mutually it is worth.Then standard deviation is calculated again using mean value;
E, the weight of each subset is determined:
The weight of subset, in subsequent step for needing to use when carrying out color identification.In specific calculate, only need
It will be according to the sum of all pixels mesh of the subset, divided by the total number-of-pixels of image-region.Specific formula is as follows:
Wherein, numberiIt is the number of the pixel of subset i.And total_number is image pixel number summation.ωiIt is
The weight of current subnet.
Three, the noise filtering in image
Can all there be noise pixel in any image.The presence of noise pixel, the color identification for image is that have interference
's.Before being identified, need first to carry out noise filtering.
To each of image-region pixel, by analyzing its hue value, it is carried out as follows filtering:
(1) each pixel is traversed, its hue value h is extracted;
(2) hue value h is compared with the class center of each subclass.If meeting following condition:
|h-Hue_meani| < Hue_ σi
With regard to illustrating that it belongs to this subclass.At this point, this pixel is not noise, need to retain.Wherein, Hue_meaniIt is
The class center of current subclass, Hue_ σiIt is the standard deviation of current subclass;
(3) if the hue value h of the pixel is still not belonging to any one subclass after having traversed all subclasses,
Then illustrate that this pixel is noise, needs to filter out.
(4) to the image-region filtered out after noise, re-start the Gauss modeling of subclass, recalculate subclass mean value,
Standard deviation and weight.The method that subclass re-starts Gauss modeling, is consistent with step 2.
Four, the color identification method being weighted based on the distance to subset of colours cluster centre
Assuming that secondary a total of N number of color of object classification of identification mission.The hue value of i-th of target category is Hue_
desti, the hue value of all target categories all has stored in database.The purpose of color identification mission: pass through analysis
The hue value of all pixels of present image area judges the hue value Hue_ of the image-region Yu which target category
destiIt is closest, then belonged to such.The specific method is as follows:
(1) each color of object is traversed.The hue value of current goal color is denoted as Hue_desti。
(2) it is directed to current goal color, traverses each subset of colours Sj, calculate the form and aspect center Hue_mean of the subsetj
To color of object Hue_destiDistance distji:
Distance is calculated between two hue values, refers to the shortest distance on hue circle between two hue values.Hue circle
It is certain there are two distance between upper two hue values, select numerical value it is smaller that.It is related to two hue value differences any
When calculating or in the case of two hue value subtractions, require to select that smaller distance.It is specific as follows:
distji=| Hue_meanj-Hue_desti|
if(distji≥180)
distji=360-distji
(3) it is weighted using the weight of each subset of colours, the image being averaged to each color of object is calculated
Distance:
Wherein M is the number of subset of colours.In this embodiment, M=2.ωjSubset of colours SjWeight, and
distjiIt is form and aspect center Hue_meanjTo color of object Hue_destiDistance;
(4) distance of present image to all color of objects is compared.It will be wherein apart from that the smallest target institute
Corresponding classification number, the color recognition result final as the image.
Wherein, distiIt is average distance of the image obtained in step (3) to each color of object.
The limitation that technical solution of the present invention is not limited to the above specific embodiments, it is all to do according to the technique and scheme of the present invention
Technology deformation out, falls within the scope of protection of the present invention.
Claims (4)
1. a kind of method of HSV color space color identification and noise filtering, it is characterised in that it is comprised the following steps:
One, image is transformed into HSV color space from rgb color space;
Two, the hue value of all pixels in image-region is clustered;
Three, the noise in image is filtered using hue value cluster result;
Four, the method progress color identification that the distance of subset of colours cluster centre is weighted is used.
2. the method for a kind of HSV color space color identification and noise filtering according to claim 1, it is characterised in that step
Clustered that specific step is as follows in rapid two to the hue value of all pixels in image-region:
(1) in statistical picture all pixels form and aspect histogram;
(2) subclass numbers are set as the case may be;
(3) initial cluster center of each subclass is set;
(4) method for utilizing average drifting, obtains the cluster centre of each subclass by successive ignition;
(5) according to the form and aspect central value of subclass, classify to pixel all in image, obtain each pixel subset;
(6) Gauss modeling is carried out to each pixel subset;
(7) weight of the subset is calculated according to the number of pixels of subset and image total pixel number purpose ratio.
3. the method for a kind of HSV color space color identification and noise filtering according to claim 1, it is characterised in that step
Using the Gauss modeling result progress noise filtering of each subclass, specific step is as follows in rapid three:
(1) be directed to each pixel, calculate it to each subclass center hue value distance;
(2) if distance value is less than the standard deviation of the subclass, which can be attributed to the subclass;
(3) if distance value cannot be less than the standard deviation of any subclass, which is attributed to noise, is filtered out;
(4) Gauss modeling is re-started to each subclass, calculates mean value and standard deviation and weight.
4. the method for a kind of HSV color space color identification and noise filtering according to claim 1, it is characterised in that step
Carrying out color identification to whole image in rapid four, specific step is as follows:
(1) it is directed to current goal color value, calculates its form and aspect distance difference for arriving each subset of colours cluster centre;
(2) it is weighted and asks at a distance from the subset of colours to current goal color value using the weight of each subset of colours
With, obtain whole image to current goal color value Weighted distance;
(3) whole image is investigated to the distance of all target color values, will be made apart from the corresponding classification number of the smallest color of object
For the color recognition result that the image is final.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910183375.9A CN110020673A (en) | 2019-03-12 | 2019-03-12 | A kind of method of HSV color space color identification and noise filtering |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910183375.9A CN110020673A (en) | 2019-03-12 | 2019-03-12 | A kind of method of HSV color space color identification and noise filtering |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110020673A true CN110020673A (en) | 2019-07-16 |
Family
ID=67189462
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910183375.9A Pending CN110020673A (en) | 2019-03-12 | 2019-03-12 | A kind of method of HSV color space color identification and noise filtering |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110020673A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113570817A (en) * | 2021-08-05 | 2021-10-29 | 广东电网有限责任公司 | Fire safety alarm method and device, computer equipment and storage medium |
CN116090163A (en) * | 2022-11-14 | 2023-05-09 | 深圳大学 | A method of color selection for mosaic tiles and related equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102800094A (en) * | 2012-07-13 | 2012-11-28 | 南京邮电大学 | Fast color image segmentation method |
CN107194348A (en) * | 2017-05-19 | 2017-09-22 | 北京云识图信息技术有限公司 | The domain color recognition methods of target object in a kind of image |
CN108734198A (en) * | 2018-04-20 | 2018-11-02 | 句容市宝启电子科技有限公司 | A kind of interactive instant extracting method of the color information based on mobile terminal |
CN108961265A (en) * | 2018-05-30 | 2018-12-07 | 南京汇川图像视觉技术有限公司 | A kind of precision target dividing method based on color conspicuousness and Gauss model |
-
2019
- 2019-03-12 CN CN201910183375.9A patent/CN110020673A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102800094A (en) * | 2012-07-13 | 2012-11-28 | 南京邮电大学 | Fast color image segmentation method |
CN107194348A (en) * | 2017-05-19 | 2017-09-22 | 北京云识图信息技术有限公司 | The domain color recognition methods of target object in a kind of image |
CN108734198A (en) * | 2018-04-20 | 2018-11-02 | 句容市宝启电子科技有限公司 | A kind of interactive instant extracting method of the color information based on mobile terminal |
CN108961265A (en) * | 2018-05-30 | 2018-12-07 | 南京汇川图像视觉技术有限公司 | A kind of precision target dividing method based on color conspicuousness and Gauss model |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113570817A (en) * | 2021-08-05 | 2021-10-29 | 广东电网有限责任公司 | Fire safety alarm method and device, computer equipment and storage medium |
CN116090163A (en) * | 2022-11-14 | 2023-05-09 | 深圳大学 | A method of color selection for mosaic tiles and related equipment |
CN116090163B (en) * | 2022-11-14 | 2023-09-22 | 深圳大学 | Mosaic tile color selection method and related equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112070772B (en) | Blood leukocyte image segmentation method based on UNet++ and ResNet | |
CN106548165B (en) | A kind of face identification method of the convolutional neural networks based on image block weighting | |
US8774503B2 (en) | Method for color feature extraction | |
Almogdady et al. | A flower recognition system based on image processing and neural networks | |
CN105205804B (en) | Caryoplasm separation method, sorting technique and the device of leucocyte in blood cell image | |
CN106934418B (en) | Insulator infrared diagnosis method based on convolution recursive network | |
CN105893925A (en) | Human hand detection method based on complexion and device | |
CN106909870A (en) | The search method and device of facial image | |
CN115457004B (en) | Intelligent detection method of zinc paste based on computer vision | |
CN106651966B (en) | Picture color identification method and system | |
CN109558825A (en) | A kind of pupil center's localization method based on digital video image processing | |
CN109829425B (en) | Farmland landscape small-scale ground feature classification method and system | |
CN105069816B (en) | A kind of method and system of inlet and outlet people flow rate statistical | |
Agrawal et al. | Survey on image segmentation techniques and color models | |
CN111292321A (en) | Method for identifying defect image of insulator of power transmission line | |
CN109344842A (en) | A Pedestrian Re-identification Method Based on Semantic Region Representation | |
CN115205977A (en) | Method and system for identifying unsafe behaviors of subway construction operators | |
CN110020673A (en) | A kind of method of HSV color space color identification and noise filtering | |
Ferdosi et al. | White blood cell detection and segmentation from fluorescent images with an improved algorithm using k-means clustering and morphological operators | |
Dhanuja et al. | Areca nut disease detection using image processing technology | |
Castelo-Quispe et al. | Optimization of brazil-nuts classification process through automation using colour spaces in computer vision | |
CN111191659B (en) | Multi-shape clothes hanger identification method for clothing production system | |
CN112613452A (en) | Person line-crossing identification method, device, equipment and storage medium | |
CN106340038B (en) | A kind of depth order inference method based on object in monocular image | |
CN114463630A (en) | Method for accurately judging growth situations of various plants in fast-growing forest |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190716 |
|
WD01 | Invention patent application deemed withdrawn after publication |