CN104023165A - Rapid color discrimination method - Google Patents
Rapid color discrimination method Download PDFInfo
- Publication number
- CN104023165A CN104023165A CN201410248050.1A CN201410248050A CN104023165A CN 104023165 A CN104023165 A CN 104023165A CN 201410248050 A CN201410248050 A CN 201410248050A CN 104023165 A CN104023165 A CN 104023165A
- Authority
- CN
- China
- Prior art keywords
- subscript
- value
- color
- color table
- array
- 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
Landscapes
- Image Analysis (AREA)
- Color Image Communication Systems (AREA)
Abstract
The invention relates to a discrimination method, in particular to a rapid color discrimination method. The invention designs a three-dimensional array A, wherein one dimensionality is 3 and a value of each dimensionality is 0-255, and each element in the array A comprises two parameters H and B; the filling arrangement sequence of the elements of the array of a color table is as follows: three subscripts B, G and R are given to the elements in the array A, so that one element can be represented as A[B][G][R], the organization sequence of array structures is that the subscripts are changed according to the following rule: firstly, the subscript B is increased from 0-255 in sequence; secondly, the subscript G is increased from 0-255 in sequence; thirdly the subscript R is increased from 0-255 in sequence; and lastly, as for a pixel, which needs color discrimination, RGB (Red, Green and Blue component) values of the pixel are obtained, the R value corresponds to the subscript R in the color table, the G value corresponds to the subscript G in the color table, and the B value corresponds to the subscript B in the color table. Owing to adaption of the technical scheme, the rapid color discrimination method has the advantages and the positive effects of logic and reasonable discrimination method, effective and accurate result, and easiness in implementation.
Description
Technical field
The present invention relates to a kind of method of discrimination, particularly a kind of color method of discrimination fast.
Background technology
At present, the conventional picture format that the Digital Image Processing such as computer system, digital camera, scanner adopts adopts red green blue tricolor system (RGB) to describe the color of concrete some points conventionally.RGB pattern is suitable for on-screen display system, has also brought the versatility of image processing.But be unaccommodated for the color segmentation of image.Because R, G, 3 components of B are height correlations, as long as brightness changes, 3 components all can correspondingly change, and because RGB is a kind of non-homogeneousization color space, express two kinds of differences (aberration) between color, cannot draw by comparatively simple manner of comparison.Because colors all in this system is all synthetic by these three kinds of colors, so be difficult to judge accurately that the color of a certain concrete RGB numerical value representative is that the yellowish green ultramarine of the conventional blood orange of people is purple and waits any in color.
According to the feature of color recognition, the hue value Hue of color is an important color distinguishing rule, and brightness B mainly plays the effect of auxiliary judgment gray scale clutter.
Adopt form and aspect, saturation and brightness (HSB) color space of color to process rgb color, must relate to the conversion of image, but RGB data are transformed into HSB formatted data need to be through multiple logic judgement and multistep multiplication and division computing, if in real time every some data of a digital pictures are calculated and will be taken a large amount of computing times.So its use is subject to larger restriction, conventionally all in the real-time video image processing below 1,000,000 pixels or non real-time sampled images, use, the application conditions such as its measuring range, precision and testee motion state are subject to considerable restraint under requirement of real time.
Summary of the invention
Technical problem to be solved by this invention is: a kind of color method of discrimination is fast provided, can be accurate fast, and based on the principle of tabling look-up, adopt necessary influencing factor color to be discriminated to be made to the method for color judgement.
The technical solution adopted for the present invention to solve the technical problems is: it is 3 that the present invention has designed a dimension, the three-dimensional array A that each dimension value is 0-255, and in array A, each element comprises H and two parameters of B;
The element of color table array fills to put in order: by given element in array A three subscript B, G, R, a certain element can be expressed as A[B] [G] [R], the tissue order of structure of arrays is that subscript changes by following rule: first subscript B is increased successively by 0-255, then subscript G is increased successively by 0-255, then subscript R increases variation successively by 0-255, for the pixel that need to carry out color identification, first obtain its RGB(RGB component) numerical value, and by the subscript R in R value corresponding color table, by the subscript G in G value corresponding color table, by the subscript B in B value corresponding color table, each group RGB numerical value can simply find the H(form and aspect of corresponding lower target element in color table by look-up table) value and B(brightness) value, and need not carry out again the real-time calculating of formula 1, save a large amount of operation time, the experiment proved that and can make color conversion efficiency improve 80%, at the color Discern and judge of the enterprising circumstances in which people get things ready for a trip in this HB color table basis, only need to read corresponding H and the B data in color table according to tri-components of color RGB to be judged, then judge that by color flow process judges according to this two value, can realize the identification of any RGB color based on above method, comprise the steps:
Step 001. initialization generates a color table array A, and a dimension is 3, the three-dimensional array A that each dimension value is 0-255, and in array A, each element comprises H and two parameters of B, now countless certificates in array;
The element of step 002. color table fills to put in order: by given element in array A three subscript B, G, R, a certain element can be expressed as A[B] [G] [R], the tissue order of structure of arrays is that subscript changes by following rule: first subscript B is increased successively by 0-255, then subscript G is increased successively by 0-255, and then subscript R increases variation (see figure 2) successively by 0-255;
H value and the B value of the each element of step 003. color table are calculated as follows, by preserving this color table A after all numerical computations, for follow-up;
Step 004. is obtained the pixel RGB(RGB component that need to carry out color identification) numerical value, by the subscript R in R value corresponding color table, by the subscript G in G value corresponding color table, by the subscript B in B value corresponding color table, each group RGB numerical value can find the H(form and aspect of corresponding lower target element in color table) value and B(brightness) value;
Step 005. when gather RGB data point obtained after corresponding HB value, first judge that whether tone is in a certain target colored region, be generally the interval of positive and negative 30 degree, between this boundary condition slightly changes according to the difference of identification requirement, judge it is specific colored point if meet this condition, then judge whether this brightness value is greater than threshold value and disturbs Grey Point (see figure 1) to get rid of.
In described step 002, the sortord of described color table A, what also comprise that the subscript definition of order of its each element and each element comprise is two numerical value.In described step 005, judge according to H value and B value whether color is a certain object color component.
As a preferred technical solution of the present invention: in described step 003, the storage means of these data is for adopting binary mode storage, mainly store statement use C language representation as follows:
…………
for(int r=0;r<256;r++)
{ for(int g=0;g<256;g++)
{ for(int b=0;b<256;b++)
{ RGB2HSB(r,g,b,&h,&s,&bright);
fp.Write(&h,sizeof(int));
bright=r*0.30+g*0.59 + b*0.11;
fp.Write(&bright,sizeof(int));
} } }
…………
The present invention is because the advantage and the good effect that adopt technique scheme to have are: the one, and the color conversion method that the present invention designs has been abandoned real-time computing technique, adopt and calculate in advance the color table evaluation of tabling look-up storing, RGB is converted under the plenty of time saving in line computation of HSB data, conversion efficiency is high, can not produce mistake in computation; The 2nd, the color recognition method that the present invention designs, is only used two principal element H form and aspect and the B brightness of differentiating color, ignores S saturation, makes specific color table size reduce 1/3rd, and simple in structure, search efficiency is high; The 3rd, in the color method of discrimination that the present invention designs, hue value is judged to color area as main Rule of judgment, brightness value is filtered out to form and aspect as auxiliary judgment condition and change violent grey interference range, determination methods logic is reasonable, result is effectively accurate, is easy to realize.
Brief description of the drawings
Below in conjunction with drawings and Examples, the invention will be further described.
Fig. 1 is design colours decision flow chart of the present invention.
Fig. 2 is design colours table three-dimensional array A structure chart of the present invention.
Fig. 3 is that the present invention designs application example process chart.
Embodiment
To extract redness as example from an image.
Step 001. is obtained the pixel RGB(RGB component that need to carry out color identification) numerical value, by the subscript R in R value corresponding color table, by the subscript G in G value corresponding color table, by the subscript B in B value corresponding color table;
Step 002. can find the H(form and aspect of corresponding lower target element in color table to each RGB numerical value) value and B(brightness) value;
Step 003., according to default red Rule of judgment, judges whether H value and B value belong to red area.First judge whether tone (is generally the interval of positive and negative 30 degree in a certain target colored region, this boundary condition slightly changes according to the difference of identification requirement) between, judge it is specific colored point if meet this condition, then judge whether this brightness value is greater than threshold value and disturbs Grey Point (because grey is for not luminous to get rid of, its form and aspect alter a great deal, but its brightness value B is less than certain threshold value) if this point (blacking) of mark, if not this point being painted with to white;
Adopt the technical program, due to the specific evaluation technique of tabling look-up in step 002, whole image (1024X1024) the handling process needs that only can meet real-time processing and detection for 7ms. consuming time.
Claims (3)
1. a quick color recognition method, is characterized in that: it is 3 that the present invention has designed a dimension, the three-dimensional array A that each dimension value is 0-255, and in array A, each element comprises H and two parameters of B;
The element of color table array fills to put in order: by given element in array A three subscript B, G, R, a certain element can be expressed as A[B] [G] [R], the tissue order of structure of arrays is that subscript changes by following rule: first subscript B is increased successively by 0-255, then subscript G is increased successively by 0-255, then subscript R increases variation successively by 0-255, for the pixel that need to carry out color identification, first obtain its RGB(RGB component) numerical value, and by the subscript R in R value corresponding color table, by the subscript G in G value corresponding color table, by the subscript B in B value corresponding color table, each group RGB numerical value can simply find the H(form and aspect of corresponding lower target element in color table by look-up table) value and B(brightness) value, and need not carry out again the real-time calculating of formula 1, save a large amount of operation time, the experiment proved that and can make color conversion efficiency improve 80%, at the color Discern and judge of the enterprising circumstances in which people get things ready for a trip in this HB color table basis, only need to read corresponding H and the B data in color table according to tri-components of color RGB to be judged, then judge that by color flow process judges according to this two value, can realize the identification of any RGB color based on above method, comprise the steps:
Step 001. initialization generates a color table array A, and a dimension is 3, the three-dimensional array A that each dimension value is 0-255, and in array A, each element comprises H and two parameters of B, now countless certificates in array;
The element of step 002. color table fills to put in order: by given element in array A three subscript B, G, R, a certain element can be expressed as A[B] [G] [R], the tissue order of structure of arrays is that subscript changes by following rule: first subscript B is increased successively by 0-255, then subscript G is increased successively by 0-255, and then subscript R increases variation successively by 0-255;
H value and the B value of the each element of step 003. color table are calculated as follows, by preserving this color table A after all numerical computations, for follow-up;
Step 004. is obtained the pixel RGB(RGB component that need to carry out color identification) numerical value, by the subscript R in R value corresponding color table, by the subscript G in G value corresponding color table, by the subscript B in B value corresponding color table, each group RGB numerical value can find the H(form and aspect of corresponding lower target element in color table) value and B(brightness) value;
Step 005. when gather RGB data point obtained after corresponding HB value, first judge that whether tone is in a certain target colored region, be generally the interval of positive and negative 30 degree, between this boundary condition slightly changes according to the difference of identification requirement, judge it is specific colored point if meet this condition, then judge whether this brightness value is greater than threshold value and disturbs Grey Point to get rid of.
2. a kind of color recognition method fast according to claim 1, is characterized in that: in described step 002, and the sortord of described color table A, what also comprise that the subscript definition of order of its each element and each element comprise is two numerical value.
3. a kind of color recognition method fast according to claim 1, is characterized in that: in described step 005, judge according to H value and B value whether color is a certain object color component.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410248050.1A CN104023165A (en) | 2014-06-05 | 2014-06-05 | Rapid color discrimination method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410248050.1A CN104023165A (en) | 2014-06-05 | 2014-06-05 | Rapid color discrimination method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104023165A true CN104023165A (en) | 2014-09-03 |
Family
ID=51439717
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410248050.1A Pending CN104023165A (en) | 2014-06-05 | 2014-06-05 | Rapid color discrimination method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104023165A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108389234A (en) * | 2018-02-05 | 2018-08-10 | 深圳市恒晨电器有限公司 | A kind of heterochromatic detection algorithm of tablet LCD, storage device and mobile terminal |
CN112710394A (en) * | 2019-10-25 | 2021-04-27 | 崧腾电子(苏州)有限公司 | Color detection method for mixed color illumination system |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002022537A (en) * | 2000-07-07 | 2002-01-23 | Hokkei Industries Co Ltd | Color recognition device |
CN101064009A (en) * | 2006-04-28 | 2007-10-31 | 夏普株式会社 | Image processing apparatus, image forming apparatus, image reading apparatus and image processing method |
CN101123078A (en) * | 2006-08-09 | 2008-02-13 | 英华达(上海)电子有限公司 | Method for improving display effect of display screen on mobile device |
CN101635835A (en) * | 2008-07-25 | 2010-01-27 | 深圳市信义科技有限公司 | Intelligent video monitoring method and system thereof |
CN101673402A (en) * | 2008-09-08 | 2010-03-17 | 索尼株式会社 | Apparatus and method for image processing, and program |
CN102752606A (en) * | 2011-11-21 | 2012-10-24 | 新奥特(北京)视频技术有限公司 | Method for performing color spatial switching based on SSE2 (Streaming SIMD Extensions 2) |
CN103106668A (en) * | 2011-11-09 | 2013-05-15 | 佳能株式会社 | Method and system for describing image region based on color histogram |
-
2014
- 2014-06-05 CN CN201410248050.1A patent/CN104023165A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002022537A (en) * | 2000-07-07 | 2002-01-23 | Hokkei Industries Co Ltd | Color recognition device |
CN101064009A (en) * | 2006-04-28 | 2007-10-31 | 夏普株式会社 | Image processing apparatus, image forming apparatus, image reading apparatus and image processing method |
CN101123078A (en) * | 2006-08-09 | 2008-02-13 | 英华达(上海)电子有限公司 | Method for improving display effect of display screen on mobile device |
CN101635835A (en) * | 2008-07-25 | 2010-01-27 | 深圳市信义科技有限公司 | Intelligent video monitoring method and system thereof |
CN101673402A (en) * | 2008-09-08 | 2010-03-17 | 索尼株式会社 | Apparatus and method for image processing, and program |
CN103106668A (en) * | 2011-11-09 | 2013-05-15 | 佳能株式会社 | Method and system for describing image region based on color histogram |
CN102752606A (en) * | 2011-11-21 | 2012-10-24 | 新奥特(北京)视频技术有限公司 | Method for performing color spatial switching based on SSE2 (Streaming SIMD Extensions 2) |
Non-Patent Citations (1)
Title |
---|
周冬波: "颜色识别及其在智能机器人控制***中的应用研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108389234A (en) * | 2018-02-05 | 2018-08-10 | 深圳市恒晨电器有限公司 | A kind of heterochromatic detection algorithm of tablet LCD, storage device and mobile terminal |
CN108389234B (en) * | 2018-02-05 | 2021-10-08 | 深圳市恒晨电器有限公司 | Flat LCD (liquid Crystal display) heterochromatic detection method, storage device and mobile terminal |
CN112710394A (en) * | 2019-10-25 | 2021-04-27 | 崧腾电子(苏州)有限公司 | Color detection method for mixed color illumination system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103186904B (en) | Picture contour extraction method and device | |
US10592754B2 (en) | Shadow removing method for color image and application | |
CN103400150B (en) | A kind of method and device that road edge identification is carried out based on mobile platform | |
CN105354599B (en) | A kind of color identification method based on improved SLIC super-pixel segmentation algorithm | |
CN107609555B (en) | License plate detection method, vehicle type identification method applying license plate detection method and related device | |
CN109034017A (en) | Head pose estimation method and machine readable storage medium | |
CN105678310A (en) | Infrared thermal image contour extraction method and device | |
CN109218695A (en) | Video image enhancing method, device, analysis system and storage medium | |
CN106815587B (en) | Image processing method and device | |
CN107767379A (en) | Pcb board marks print quality inspection method | |
CN104766344B (en) | Vehicle checking method based on movement edge extractor | |
CN106529432A (en) | Hand area segmentation method deeply integrating significance detection and prior knowledge | |
CN105426816A (en) | Method and device of processing face images | |
CN106803078A (en) | A kind of SAR image Ship Target dividing method | |
CN112164055A (en) | Photovoltaic cell color difference classification method based on color segmentation | |
CN106558044A (en) | The resolution measuring method of image module | |
CN104023165A (en) | Rapid color discrimination method | |
US8971619B2 (en) | Method and a device for extracting color features | |
Han | Tree height measurement based on image processing with 3-points correction | |
CN109919973A (en) | Multi-angle of view target association method, system and medium based on multiple features combining | |
Wang et al. | An efficient method of shadow elimination based on image region information in HSV color space | |
Mai et al. | An improved method for Vietnam License Plate location | |
CN111325209B (en) | License plate recognition method and system | |
KR101521269B1 (en) | Method for detecting snow or rain on video | |
CN112949367A (en) | Method and device for detecting color of work clothes based on video stream data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20140903 |
|
RJ01 | Rejection of invention patent application after publication |