CN106447603B - A kind of color image gray processing method - Google Patents
A kind of color image gray processing method Download PDFInfo
- Publication number
- CN106447603B CN106447603B CN201610859787.6A CN201610859787A CN106447603B CN 106447603 B CN106447603 B CN 106447603B CN 201610859787 A CN201610859787 A CN 201610859787A CN 106447603 B CN106447603 B CN 106447603B
- Authority
- CN
- China
- Prior art keywords
- color
- color image
- image
- data
- algorithm
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 15
- 238000006243 chemical reaction Methods 0.000 claims abstract description 30
- 238000004458 analytical method Methods 0.000 claims abstract description 23
- 238000000034 method Methods 0.000 claims description 62
- 238000012545 processing Methods 0.000 claims description 27
- 230000008569 process Effects 0.000 claims description 18
- 230000009466 transformation Effects 0.000 claims description 9
- 238000000638 solvent extraction Methods 0.000 claims description 5
- 230000003252 repetitive effect Effects 0.000 abstract description 4
- 239000003086 colorant Substances 0.000 description 11
- 230000011218 segmentation Effects 0.000 description 8
- 230000008859 change Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 239000011159 matrix material Substances 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 238000003064 k means clustering Methods 0.000 description 4
- 238000011160 research Methods 0.000 description 4
- 238000012546 transfer Methods 0.000 description 4
- 230000008901 benefit Effects 0.000 description 3
- 101100136092 Drosophila melanogaster peng gene Proteins 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000005242 forging Methods 0.000 description 2
- 238000003709 image segmentation Methods 0.000 description 2
- 238000012804 iterative process Methods 0.000 description 2
- 238000005259 measurement Methods 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005336 cracking Methods 0.000 description 1
- 238000007418 data mining Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 235000013399 edible fruits Nutrition 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 239000005022 packaging material Substances 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000007480 spreading Effects 0.000 description 1
- 238000003892 spreading Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/04—Context-preserving transformations, e.g. by using an importance map
-
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Probability & Statistics with Applications (AREA)
- Facsimile Image Signal Circuits (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a kind of color image gray processing method, 1) color analysis is carried out to color image A, the color of image A is classified to obtain several color value;2) data are converted to after extending the color value of classification, different color gamuts is represented with different data;3) it is directed to color image B identical with color image A shape and color, directly gradation conversion is carried out using above-mentioned data and obtains corresponding grayscale image B.The present invention solves the problems, such as the repetitive operation in the conversion of multiimage color, improves conversion speed, image data is reduced 2/3.
Description
Technical field
The invention belongs to field of information processing, and in particular to a kind of color image gray processing method.
Background technique
A large amount of color images bring visual enjoyment in daily life, therefore requirement of the people to cromogram is increasingly
It is high, cromogram using more and more extensive, such as advertisement, packaging material.
At present in the expression of image, it is broadly divided into gray level image and color image.One byte representation of gray level image,
The size of its value is three byte representations of 0--255. color image, and the color of each pixel is divided into tri- components of R, G, B, and
Each component is 0--255, and such a pixel can have the color change of 2,55*,255,*25,5=1,600 ten thousand.Distinguish color
Details, color change, brightness change relative difficulty are bigger.It is highly H if picture traverse is W, then data of piece image
For 3*W*H, this data is three times of same size gray level image.
Common processing method is that color image is converted to gray level image processing, is on the one hand to utilize greyscale image data
Advantage relatively small, more than the mature Processing Algorithm of gray level image, while image procossing complexity is reduced, therefore, general cromogram
As Processing Algorithm is color image to be first converted to gray level image, then handled for gray level image.
The transfer algorithm of gray level image is converted to color image, numerous scientific workers have conducted extensive research work:
Li Dong (a kind of color changeover method [J] Xinxiang University journal .2015 based on color theme of Li Dong, 32 (9): 29--32.)
It is proposed a kind of color changeover method based on color theme, this method can maintain the space in region while controlling color ratio
Consistency helps people to realize the reception and registration of certain artistic conception;(Li Ruijuan, Chu Gaoli, Deng Qian, the king such as Li Ruijuan, Chu Gaoli, Deng Qian
Na print quality detects color transformation model research: Packaging Engineering .2015,36 (11): 145--148.) survey based on color target
It measures data and RGB and CIE L*a*b* color space conversion model is established using three dimensional lookup table method and polynomial regression respectively
Method obtain relatively good effect;Wang Hui, old small carving, Wang Yigang (Wang Hui, old small carving, the improved non-linear overall situation of Wang Yigang
Map [J] the CAD of gray processing method and graphics journal [J], 2013,25 (10): 1476-1479,1488.)
Improved non-linear global map gray processing method is proposed, to enhance the edge feature of gray level image;Song Mingli, Wang Huiqiong,
Chen Chun (color conversion [J] CAD and graphics of Song Mingli, Wang Huiqiong, the Chen Chun based on gauss hybrid models
2008,20 (11): journal 1471-1476,1482.) proposes a kind of color conversion method based on gauss hybrid models;Zhang Jian
Moral, Shao Dinghong (improved image gray processing algorithm [J] machinery and electronics based on color space distance of Zhang Jiande, Shao Dinghong,
2008, (1): 63--65) propose a kind of improved image gray processing algorithm based on color space distance, introduce Gauss operator
It is handled, target and the background in image is separated;Zhang Quanfa Yang Haibin courts etc. (Zhang Quanfa, Yang Haibin, Ren Chaodong,
Quick high-fidelity gray processing technique study [J] Zhengzhou University's journal (Edition) of Li Huan color image, 201, (3): 66--
69.) a kind of quick high-fidelity gray processing method for proposing color image is obtained by the weight of reasonable approximate red, green, blue component
To fidelity, the cracking calculation formula of very high and conversion speed completes color image and is converted to gray level image;Liu Qingxiang Jiang Tianfa
(Liu Qingxiang, Jiang Tianfa it is colored transfer algorithm between gray level image research [J] Wuhan University of Technology journal (traffic science with
Engineering version) .2003, (3): 344--346.) propose a kind of HLS model that 32 color images are converted into 8 gray level images
Transfer algorithm;Zhou Jin and a kind of Peng Futang (selectable image gray processing method [J] computer work of Zhou Jinhe, Peng Futang
Journey, 2006, (20): 198--200.) propose that a kind of random color gray scale that will be chosen turns to black, and got over the color distance
Remote color, the higher method of gray value realize conversion;Zhang Zhijun, (Zhang Zhijun, Sun Zhihui is based on VC platform by Sun Zhihui
Gray processing technology [J] the automatic technology and application of color image, 2005,24 (1): 61--64.) it is real using palette techniques
The gray processing of color image now based on VC platform;(Zhang Mingjun, Li Xuan, Wang Yujia are based on gray scale by Zhang Mingjun, Li Xuan, Wang Yujia
Change underwater color images [J] the Harbin Engineering University journal of weighed value adjusting, 2015,36 (5): 707--713.)
(Zhang,Mingjun;Li,Xuan;Wang, Yujia, Underwater color image segmentation based
on weight adjustment for color-to-gray[J]。Harbin Gongcheng Daxue Xuebao/
Journal of Harbin Engineering University, v 36, n 5, p 707-713, May 25,2015.) it proposes
A kind of underwater color image segmentation method based on gray processing weighed value adjusting;Old forging raw Song Fengfei, Zhang Qun (old forging life, Song Fengfei,
A kind of adaptive global map method [J] the computer system application of color image gray processing of Zhang Qun, 2013,22 (9):
164-167,171.) a kind of adaptive global map method for proposing color image gray processing, to the cromogram with theme color
As the gray level image visual effect significantly improved can be obtained;Guo Yanling, Peng Jinye, Wang great Kai (Guo Yanling, Peng Jinye, Wang great
It is triumphant.Colour-gray level image transform method [C] the computer engineering and application of TV restoration model are improved, 2009,45 (07):
It 192--194.) proposes a kind of colour-gray level image transform method for improving TV restoration model, is proposed using Sapiro etc.
The level set concept of vector image establishes new transformation model in conjunction with full Variational Restoration;Zhang Weixiang, Zhou Bingfeng (Zhang Weixiang,
A kind of color image based on gradient field of Zhou Bingfeng turns method [J] image technology of gray level image, and 2007, (03): 20--
22.) 0 propose that a kind of color image based on gradient field turns the method for gray level image.
Color image is converted to gray level image, and there are many kinds of methods, in RGB model, if when R=G=B, colour is table
Show a kind of greyscale color, wherein the value of R=G=B is called gray value.Therefore, each pixel of gray level image only needs a byte to deposit
Put gray value (also known as brightness value), tonal range 0-255.With the process of a pixel of a byte representation image colour
Image gray processing.
The gray processing of image is handled, and there are commonly following four design schemes:
1, weighted mean method
According to importance and other indexs, three components are weighted and averaged with different weights.Since human eye is not to
Different with the susceptibility of color, therefore, more reasonable gray level image can be obtained by being weighted and averaged to RGB three-component.
Different weights is assigned to R, G, B according to importance or other indexs, and is weighted and averaged the value of R, G, B, i.e.,
R=G=B=(WrR+WgG+WbB)/3
Wherein Wr, Wg, Wb are respectively the weight of R, G, B.Wr, Wg, Wb take different values, and weighted average method is just formed not
Same gray level image.Since human eye is to the susceptibility highest of green, red is taken second place, minimum to blue, therefore makes Wg > Wr > Wb will
Obtain the reasonable gray level image of comparison.Experiment and theory deduction prove, work as Wr=0.30, when Wg=0.59, Wb=0.11, that is, work as
Vgray=0.30R+0.59G+0.11B
When R=G=B=Vgray, reasonable gray level image can be obtained.
2, mean value method: average value is found out using the value of R, G, B, i.e.,
R=G=B=(R+G+B)/3
This average value is the gray value of gray level image.
3, maximum value process: the value of R, G, B is made to be equal in 3 values maximum one, i.e.,
R=G=B=max (R, G, B)
Taking the maximum value is the gray value of gray level image.
4,256 kinds of gray values LUT Method: are obtained using the combination of 256 R, G, B values.
But for the color image of some limited kind of colors, the above method will be transported once for each image
It calculates, reduces efficiency.
Summary of the invention
The purpose of the present invention is to provide a kind of color image gray processing methods, to overcome the problems of the prior art, this
Invention solves the problems, such as the repetitive operation in the conversion of multiimage color, improves conversion speed, image data is reduced 2/
3.Extensive lookups table method improves the reliability of conversion to a certain extent, selects different error ranges, and conversion can be improved
Tolerance and precision.
In order to achieve the above objectives, the present invention adopts the following technical scheme:
A kind of color image gray processing method, comprising the following steps:
1) color analysis is carried out to color image A and records and analyzes process, the color of image A is classified to obtain several
Kind color value;
2) data are converted to after extending the color value of classification, different color gamuts is represented with different data;
3) it is directed to color image B identical with color image A shape and color, the directly above-mentioned data of application carry out gray scale turn
Get corresponding grayscale image B in return.
Further, color analysis is carried out to color image A in step 1) and records and analyzes process, by the color of image A
Classify method particularly includes:
1.1) color value of any pixel in color image A is set as c (r, g, b), wherein r=0,1,2 ..., 255, g
=0,1,2 ..., 255, b=0,1,2 ..., 255;
1.2) for two color image pixel ci=(ri,gi,bi) and cj=(rj,gj,bj), i, j=0,1,2 ..., M*
N-1, if met: F (ri,gi,bi,rj,gj,bj(Δ r, Δ g, Δ b), then the two pixels are identical, i.e. color phase by)≤Δ f
Together, otherwise, the two pixels are different, i.e., color is different;Wherein M, N indicate that the columns and line number of color image A, F indicate pixel
Between parser, Δ f be a kind of criterion;
1.3) after color analysis, color image A is indicated using n kind color, respectively c0=(r0,g0,b0)、c1
=(r1,g1,b1)、...、cn-1=(rn-1,gn-1,bn-1)。
Further, the parser between pixel is partitioning algorithm, clustering algorithm or transformation algorithm;Criterion be Euclidean away from
From, mahalanobis distance or function.
Further, step 2) specifically: to color value c (c0,c1,...,cn-1) converted, c0Be converted to d0、c1Turn
It is changed to d1、...、cn-1Be converted to dn-1, it is described to be converted to indirect assignment, or linearly or nonlinearly to convert.
Further, the method in step 3) directly to color image B gray processing are as follows:
For any pixel c of color image Bk=(rk,gk,bk) (k=0,1,2,3 ..., M*N-1), if it and coloured silk
Analysis result c of the chromatic graph as Al=(rl,gl,bl) meet between (l=0,1,2 ... n-1)
Then think that the two pixels are identical, i.e., color is identical;The same number d of identical colori(i=0,1,2,
... n-1) it indicates, in formula K, G are respectively a kind of transformation, Δ rlIndicate rlOffset, Δ glIndicate glOffset, Δ bl
Indicate blOffset, l=0,1,2 ..., n-1.
Further, the actual conditions met between any pixel of color image B and the analysis result of color image A
Are as follows:
Further, in step 3) application color image A classification results, according to extensive lookups table to color image B into
Row gradation conversion, specific steps are as follows:
1) it constructs extensive lookups table: obtained n kind color expansion will be analyzed and indicated with n data, d is respectively as follows:0=
(r0,g0,b0)、d0=(r0,g0,b0±Δb)、d0=(r0,g0±Δg,b0)、d0=(r0±Δr,g0,b0)、d0=(r0,g0±
Δg,b0±Δb)、d0=(r0±Δr,g0±Δg,b0)、d0=(r0±Δr,g0,b0±Δb)、d0=(r0±Δr,g0±
Δg,b0±Δb)、...、di=(ri,gi,bi)、di=(ri,gi,bi±Δb)、di=(ri,gi±Δg,bi)、di=(ri±
Δr,gi,bi)、di=(ri,gi±Δg,bi±Δb)、di=(ri±Δr,gi±Δg,bi)、di=(ri±Δr,gi,bi±
Δb)、di=(ri±Δr,gi±Δg,bi±Δb)、...、dn-1=(rn-1±Δr,gn-1±Δg,bn-1±Δb);
2) color image B is indicated using this n data, realizes and the gray processing of color image B is converted.
Compared with prior art, the invention has the following beneficial technical effects:
The present invention is split color image A, is partitioned into different colours, and different colors is represented with different numbers,
The number had both represented color while can be regarded as a kind of gray value, can be used for simultaneously in the processing of colored and gray level image, i.e.,
Can to the data application Color Image Processing algorithm, can also to the data application gray level image Processing Algorithm, for and it is color
Chromatic graph can be converted directly using above-mentioned segmentation result as A shape, the identical image B of color, so only need to carry out
Segmentation result, is then applied in a large amount of identical images by primary segmentation operation, so as to largely reduce data volume, improve algorithm
Speed reduces algorithm difficulty, solves the problems, such as the repetitive operation in the conversion of multiimage color, improves conversion speed, will scheme
As data reduction 2/3, extensive lookups table method can further improve conversion speed.
Detailed description of the invention
Fig. 1 is method flow schematic diagram of the invention;
Fig. 2 is color analysis algorithm flow chart of the invention;
Fig. 3 is K- means clustering algorithm flow chart;
Fig. 4 is FCM clustering algorithm flow chart;
Fig. 5 is construction extensive lookups table algorithm flow chart;
Fig. 6 is extensive lookups table color transfer algorithm flow chart.
Specific embodiment
Present invention is further described in detail with reference to the accompanying drawing:
Referring to Fig. 1, it is contemplated that, for the color image of some limited kind of colors, if color of image is fewer, color is opposite
The little application of the variation of single, shade, change of color brightness, it may be considered that with fewer data indicate color,
Gradation conversion is carried out than faster conversion method.First color is analyzed, analysis result is then applied to gray scale and is turned
In changing, the color image gray processing algorithm steps based on color analysis are as follows:
1, color image A is split, records intermediate result, is partitioned into different colours;
2, intermediate result is extended in conjunction with segmentation result;
3, different color gamuts is represented with different numbers, which had both represented color while can be regarded as a kind of ash
Angle value can be used in the processing of colored and gray level image, it can, can also to the data application Color Image Processing algorithm simultaneously
To the data application gray level image Processing Algorithm;
4, for image B identical with shape, color in clustering algorithm, directly turned using above-mentioned segmentation result
It changes.
The advantage of doing so is that only needing to carry out once to divide operation, segmentation result is then applied to a large amount of identical images
In, so as to largely reduce data volume, improve algorithm speed, reduction algorithm difficulty.
Speed can be further increased by the method for establishing extensive lookups table, extended method is as shown in Figure 5.
As shown in Fig. 2, the purpose of color analysis is that color is classified, same color is divided into one kind, different colours
Be divided into different classes, if in color image any pixel color value be c (r, g, b), wherein r=0,1,2 ..., 255, g
=0,1,2 ..., 255, b=0,1,2 ..., 255, M, N indicate the columns and line number of image, r indicate red, g indicate green,
B indicates blue.After color analysis, color image can be indicated with n kind color, respectively c0=(r0,g0,b0)、c1=
(r1,g1,b1)、...、cn-1=(rn-1,gn-1,bn-1), Δ riIndicate riOffset, Δ giIndicate giOffset, Δ biIt indicates
biOffset, i=0,1,2 ..., n-1.
For two color image pixel ci=(ri,gi,bi) and cj=(rj,gj,bj), i, j=0,1,2 ..., M*N-1,
If met:
F(ri,gi,bi,rj,gj,bj)≤Δf(Δr,Δg,Δb)
Then think that the two pixels are identical, i.e., color is identical;Otherwise, then it is assumed that the two pixels are different, i.e., color is different;
Identical pixel (color) is with same color ci=(ri,gi,bi) (or ci) (i=0,1,2 ..., n-1) indicate, n is this
The number of colours of image.F indicates the parser between pixel, such as partitioning algorithm, clustering algorithm, transformation algorithm, analysis in formula
Intermediate result is recorded in algorithm;Δ f is a kind of criterion, such as Euclidean distance, mahalanobis distance, function.
Color value c (the c that above-mentioned color analysis is obtained0,c1,...,cn-1) converted, c0Be converted to d0、c1It is converted to
d1..., conversion here can be indirect assignment, is also possible to certain and linearly or nonlinearly converts.
If analyzed with the method for cluster, n kind color has n cluster centre ci=(ri,gi,bi), i=0,1,
2 ..., n-1, each cluster centre ciA kind of color is represented, clustering algorithm is relatively more, there are commonly K- mean cluster and obscures
Cluster.
1, K- mean cluster
K- mean cluster (K-Means clustering) is that one kind that Mac Queen James B is proposed is non-supervisory in real time
Clustering algorithm, as shown in Figure 3.The algorithm belongs to the clustering algorithm based on distance, since the efficiency of the algorithm is higher, so in section
It learns in industrial circle, is widely used when being clustered to large-scale data, is a kind of extremely influential technology.
The basic ideas of K- means clustering algorithm be data are divided on the basis of minimizing objective function it is scheduled
Class number K, principle is simple, is suitble to handle mass data.The operational process of K- means clustering algorithm are as follows: first specify cluster
Value, the condition of convergence or the maximum number of iterations of number K, K initial cluster center, then according to specified similarity measurement criterion
Each data in data set are distributed to the cluster centre of " nearest " or " most like ", record allocation result by (distance), are formed
K different classes, then respectively using the mean vector of data in each class as this kind of new cluster centres, by data according to phase
It is redistributed like property measurement criterion, by cluster when meeting the condition of convergence or reaching maximum number of iterations that iterates
Process terminates.
Sample in sample space is divided into K class, the center of every one kind is, with indicating sample xiCorresponding
Cluster centre cjThe distance between, then the summation target at a distance from cluster centre where it of all data points in sample space
Function J indicates, mathematic(al) representation are as follows:
The cluster centre value of each class are as follows:
njIndicate the number of same class data.
Objective function J directly reflects the quality of Clustering Effect, is worth smaller, then it represents that the cluster is compacter, more independent.Cause
This can improve and optimize clustering schemes by constantly reducing the value of objective function, the cluster when J minimalization, as most
Excellent clustering schemes.It needs to record and analyze process during the algorithm is realized.
2, fuzzy clustering
FCM Algorithms (Fuzzy C-Means) abbreviation FCM.This method is proposed at first by Dunn, then by Bezdek
Develop and promoted FCM algorithm.FCM algorithm is the current most popular fuzzy clustering method based on objective function, its core
Thought thinks that data set is exactly divided into multiple class clusters, and the mutual similitude of data object in same class cluster is very big, no
Data object similitude in similar cluster is very small.FCM is the algorithm based on Fuzzy Set Theory, and cluster is attributed to one by it
With certain constraint nonlinear programming problem, by an iterative process constantly optimization object function and obtain data set
Fuzzy division and cluster result.FCM algorithm is the earliest clustering algorithm based on objective function, is also based on objective function cluster
Theoretical research obtains relatively sufficient algorithm in algorithm, oneself is widely used in image procossing, computer vision, mode at present
The different fields such as identification and data mining.
By sample space X={ x0,x1,…,xi,…,xn-1Sample be divided into C subset S0, S1,…,Sc-1, cluster centre
For C={ c0,c1,…,cj,…,cc-1, use dij=(xi,cj) indicate sample xiCorresponding center cjThe distance between, uij
Indicate sample xiTo jth class SjDegree of membership, then the objective function J of FCM algorithmFCMMathematical expression are as follows:
ui jMeet constraint condition:
uij≥0,0≤j≤c-1,0≤i≤n-1.
Subordinated-degree matrix U={ uijIt is c × n matrix.
dijFor i-th of the sample and the distance between j-th of cluster centre in sample space, m ∈ [1, ∞) be greater than etc.
In 1 Fuzzy Exponential, the effect of m is the fog-level for adjusting subordinated-degree matrix U, and m value is bigger, then subordinated-degree matrix U's is fuzzy
Degree is higher, and the optimum valuing range by experimental analysis discovery m is [1.5,2.5], and ordinary circumstance is ordered m=2.FCM cluster
The cluster process of algorithm is substantially to objective function JFCMThe process minimized in an iterative process, data are in each cluster
The degree of membership u of the heartijIt is to be calculated according to Lagrange Multiplier Method:
The process of FCM clustering algorithm is as shown in Figure 4:
Can be seen that FCM clustering algorithm according to the process of FCM algorithm is actually repeatedly excellent during iteration
Change the process of cluster centre and subordinated-degree matrix, therefore this method is also commonly known as K means method or dynamic state clustering.FCM
Not only calculation method simple operation speed is fast for clustering algorithm, but also has more intuitive geometry meaning, but it can only use phase
The cluster centre answered relatively is applicable in the data class cluster of the non-convex shape such as bulbous-style, and calculate to indicate entire class
Method is all more sensitive to noise data under normal circumstances.By constantly proving, which has been proved:
FCM algorithm can converge to its objective function J along an iteration subsequence since any given initial pointFCMLocal minimum point
Or saddle point.It needs to record and analyze process during the algorithm is realized.
3, process is recorded and analyzed
Different from general partitioning algorithm, this algorithm when clustering according to the method described above, different data between record lower class
Mapping, such as Ci (Ri, Gi, Bi) -- > Di, Ci (Ri+1, Gi, Bi) -- thus > Di etc. can form a conversion table, such as 1 institute of table
Show, table 1 is usually a discontinuous table, it is the enumerated table of cluster result.
1 look-up table configuration of table
R | G | B | D |
… | … | … | … |
Ri-1 | Gi-1 | Bi-1 | Di |
Ri-1 | Gi-1 | Bi | Di |
Ri-1 | Gi | Bi | Di |
Ri+1 | Gi+1 | Bi+1 | Di |
Rj | Gj | Bj | Dj |
… | … | … | … |
Image B identical for, color number identical with image A color, the segmentation result of direct application image A are become
It changes, conversion method has:
1, extension conversion
For any pixel c of color image Bk=(rk,gk,bk) (k=0,1,2,3 ..., M*N-1), if it and coloured silk
Analysis result c of the chromatic graph as Al=(rl,gl,bl) meet between (l=0,1,2 ... n-1)
Then think that the two pixels are identical, i.e., color is identical;Identical pixel (color) is with the same number di(i=0,
1,2 ..., n-1) it indicates, it is believed that the algorithm is color image gray processing algorithm.Otherwise, then it is assumed that the two pixels are different,
I.e. color is different, and color does not need to distribute new value simultaneously.K, G are certain transformation, Δ r in formulalIndicate rlOffset, Δ gl
Indicate glOffset, Δ blIndicate blOffset, l=0,1,2 ..., n-1.Due to display format, usual n is small
In 256, and number of colours is far longer than n.
It is most typical such as:
Then think ck=(rk,gk,bk) and cl=(rl,gl,bl) color is identical, identical color can with identical value come
It indicates.
2, extensive lookups table is converted
It, can be in the method for application construction extensive lookups table: being found respectively according to color analysis first in order to improve arithmetic speed
The color value and range of class construct extensive lookups table: d according to color value and range0=(r0,g0,b0)、d0=(r0,g0,b0±Δ
b)、d0=(r0,g0±Δg,b0)、d0=(r0±Δr,g0,b0)、d0=(r0,g0±Δg,b0±Δb)、d0=(r0±Δr,
g0±Δg,b0)、d0=(r0±Δr,g0,b0±Δb)、d0=(r0±Δr,g0±Δg,b0±Δb)、...、di=(ri,
gi,bi)、di=(ri,gi,bi±Δb)、di=(ri,gi±Δg,bi)、di=(ri±Δr,gi,bi)、di=(ri,gi±Δg,
bi±Δb)、di=(ri±Δr,gi±Δg,bi)、di=(ri±Δr,gi,bi±Δb)、di=(ri±Δr,gi±Δg,
bi±Δb)、...、dn-1=(rn-1±Δr,gn-1±Δg,bn-1± Δ b), extensive lookups table structure are as shown in table 2.
2 extensive lookups table structure of table
Application extension look-up table is converted, it is necessary first to construct color table, the method for constructing color table has:
1) it, is inserted into intermediate result item: during analyzing color, having saved the periphery centered on some color
The data are entirely insertable in look-up table by the total data of color, and assign these data data identical with color center (such as
Table 1);
2) be inserted into extension: extension is around some color center be considered as same color whole colors, assign
Extension data identical with color center, i.e., be extended, spreading result is as shown in table 2 according to Δ r, Δ g, Δ b.
If the robustness of color image algorithm is relatively good, same width color image is divided with same partitioning algorithm
It cuts the result is that identical;For shape and the identical image of color, the color value of corresponding points is almost the same, it follows that such as
Fruit divides other width figure using the color segmentation result of a width figure, as a result should be identical;In this way, we can answer
With the above results, gradation conversion is carried out to color image according to extensive lookups table.Flow chart is as shown in Figure 6.
For any pixel P (r in image Bi,gi,bi), the process of application extension look-up table are as follows:
1, r is found in extensive lookups tableiRow;
2, it finds in extensive lookups table and riIdentical giRow;
3, it finds in extensive lookups table and ri、giIdentical biRow, the corresponding value of the row is transformation result gray value;
4, in extensive lookups table if there is no with riOr giOr biIdentical row is modified extensive lookups table, is inserted into new
Classification data simultaneously assigns new value;
5,1-4 is repeated until the data for having traversed all images B.
For m same color image: p1、p2、...、pm-1If whether to detect them identical, conventional algorithm is to use
This m color image of same algorithm process, then comparison result, such benefit are that algorithm is fixed, and shortcoming is processing
Data volume it is big, processing the time it is long.
Dominant ideas of the invention are first to find out the whole in image to width color image applied analysis algorithm therein
Color and with color gamut similar in each color, then give various colors distribute a data, indicate one with a data
(color error caused by the influence in view of parser and other factors indicates one with a number to kind color gamut
Color in range, i.e., the corresponding multiple color values of one number);Then by this analysis result apply with other images, exist first
Traverse all colours in other images, then by these color corresponding conversions be with data as before, to realize to whole
The conversion process of image;The analysis to all images is avoided in this way, and parser is reduced to 1/m.
The present invention solves the problems, such as the repetitive operation in the conversion of multiimage color, conversion speed is improved, by picture number
According to reducing 2/3.
Claims (4)
1. a kind of color image gray processing method, which comprises the following steps:
1) color analysis is carried out to color image A and records and analyzes process, the color of image A is classified to obtain several face
Color value, method particularly includes:
1.1) color value of any pixel in color image A is set as c (r, g, b), wherein r=0,1,2 ..., 255, g=0,
1,2 ..., 255, b=0,1,2 ..., 255;
1.2) for two color image pixel ci=(ri,gi,bi) and cj=(rj,gj,bj), i, j=0,1,2 ..., M*N-1,
If met: F (ri,gi,bi,rj,gj,bj(Δ r, Δ g, Δ b), then the two pixels are identical, i.e., color is identical, no by)≤Δ f
Then, the two pixels are different, i.e., color is different;Wherein M, N indicate that the columns and line number of color image A, F indicate between pixel
Parser, Δ f are a kind of criterion;
1.3) after color analysis, color image A is indicated using n kind color, respectively c0=(r0,g0,b0)、c1=
(r1,g1,b1)、...、cn-1=(rn-1,gn-1,bn-1);
2) data are converted to after extending the color value of classification, different color gamuts is represented with different data, specifically: it is right
Color value c (c0,c1,...,cn-1) converted, c0Be converted to d0、c1Be converted to d1、...、cn-1Be converted to dn-1, the conversion
For indirect assignment, or linearly or nonlinearly to convert;
3) it is directed to color image B identical with color image A shape and color, directly carries out gradation conversion using above-mentioned data and obtains
To corresponding grayscale image B, the directly method to color image B gray processing are as follows:
For any pixel c of color image Bk=(rk,gk,bk) (k=0,1,2,3 ..., M*N-1), if it and cromogram
As the analysis result c of Al=(rl,gl,bl) meet between (l=0,1,2 ... n-1)
Then think that the two pixels are identical, i.e., color is identical;The same number d of identical colori(i=0,1,2 ... n-1)
It indicates, in formula K, G are respectively a kind of transformation, Δ rlIndicate rlOffset, Δ glIndicate glOffset, Δ blIndicate bl's
Offset, l=0,1,2 ..., n-1.
2. a kind of color image gray processing method according to claim 1, which is characterized in that the parser between pixel
For partitioning algorithm, clustering algorithm or transformation algorithm;Criterion is Euclidean distance, mahalanobis distance or function.
3. a kind of color image gray processing method according to claim 1, which is characterized in that any picture of color image B
The actual conditions met between element and the analysis result of color image A are as follows:
4. a kind of color image gray processing method according to claim 1, which is characterized in that apply cromogram in step 3)
As the classification results of A, gradation conversion, specific steps are carried out to color image B according to extensive lookups table are as follows:
1) it constructs extensive lookups table: obtained n kind color expansion will be analyzed and indicated with n data, d is respectively as follows:0=(r0,g0,
b0)、d0=(r0,g0,b0±Δb)、d0=(r0,g0±Δg,b0)、d0=(r0±Δr,g0,b0)、d0=(r0,g0±Δg,b0
±Δb)、d0=(r0±Δr,g0±Δg,b0)、d0=(r0±Δr,g0,b0±Δb)、d0=(r0±Δr,g0±Δg,b0
±Δb)、...、di=(ri,gi,bi)、di=(ri,gi,bi±Δb)、di=(ri,gi±Δg,bi)、di=(ri±Δr,gi,
bi)、di=(ri,gi±Δg,bi±Δb)、di=(ri±Δr,gi±Δg,bi)、di=(ri±Δr,gi,bi±Δb)、di
=(ri±Δr,gi±Δg,bi±Δb)、...、dn-1=(rn-1±Δr,gn-1±Δg,bn-1±Δb);
2) color image B is indicated using this n data, realizes and the gray processing of color image B is converted.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610859787.6A CN106447603B (en) | 2016-09-28 | 2016-09-28 | A kind of color image gray processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610859787.6A CN106447603B (en) | 2016-09-28 | 2016-09-28 | A kind of color image gray processing method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106447603A CN106447603A (en) | 2017-02-22 |
CN106447603B true CN106447603B (en) | 2019-04-12 |
Family
ID=58171178
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610859787.6A Active CN106447603B (en) | 2016-09-28 | 2016-09-28 | A kind of color image gray processing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106447603B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108230405A (en) * | 2017-11-30 | 2018-06-29 | 中原智慧城市设计研究院有限公司 | Image white balancing treatment method based on gray processing |
CN108765501B (en) * | 2018-04-16 | 2020-01-14 | 深圳技术大学(筹) | Image graying method and storage medium |
CN114268704A (en) * | 2021-12-20 | 2022-04-01 | 北京镁伽科技有限公司 | Image data conversion method, conversion device, signal generator, and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101064766A (en) * | 2006-04-26 | 2007-10-31 | 夏普株式会社 | Image processing method and image processing apparatus |
CN101137067A (en) * | 2006-08-29 | 2008-03-05 | 扬智科技股份有限公司 | Color fast simplifying method |
CN102881001A (en) * | 2011-07-13 | 2013-01-16 | 富士通株式会社 | Device and method for converting color image into grey scale image |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140320505A1 (en) * | 2013-04-30 | 2014-10-30 | Kobo Incorporated | Greyscale animation |
-
2016
- 2016-09-28 CN CN201610859787.6A patent/CN106447603B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101064766A (en) * | 2006-04-26 | 2007-10-31 | 夏普株式会社 | Image processing method and image processing apparatus |
CN101137067A (en) * | 2006-08-29 | 2008-03-05 | 扬智科技股份有限公司 | Color fast simplifying method |
CN102881001A (en) * | 2011-07-13 | 2013-01-16 | 富士通株式会社 | Device and method for converting color image into grey scale image |
Non-Patent Citations (3)
Title |
---|
两种改进的彩色图像灰度化算法研究;罗婷婷;《中国优秀硕士学位论文全文数据库 信息科技辑》;20150515(第5期);第I138-1147页 |
关于彩色化灰度图像的算法研究及实现;刘勇;《中国优秀硕士学位论文全文数据库 信息科技辑》;20070315(第3期);第I138-103页 |
基于模糊聚类的彩色图像分割方法的研究;赵晨炜;《中国优秀硕士学位论文全文数据库 信息科技辑》;20121015(第10期);第I138-2543页 |
Also Published As
Publication number | Publication date |
---|---|
CN106447603A (en) | 2017-02-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Zhang et al. | Skin color enhancement based on favorite skin color in HSV color space | |
CN1302669C (en) | Device and method of colour compensation | |
CN106447603B (en) | A kind of color image gray processing method | |
CN102223547B (en) | Image color enhancement device and method | |
CN103854261B (en) | The bearing calibration of colour cast image | |
CN106897972A (en) | A kind of self-adapting histogram underwater picture Enhancement Method of white balance and dark primary | |
CN106228581A (en) | By GPU, pixel format is converted to by ARGB the method and system of NV12 | |
CN103617596A (en) | Image color style transformation method based on flow pattern transition | |
CN102945556B (en) | Seven look algorithm of color separations of Neugebauer equation are divided based on cell element | |
CN107146258B (en) | Image salient region detection method | |
EP3518531B1 (en) | Color gamut maintaining system and method | |
CN101277369A (en) | Image forming apparatus and control method thereof | |
CN102542526A (en) | Image decolorizing method | |
WO2022120799A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
CN106599185B (en) | HSV-based image similarity identification method | |
CN102957919A (en) | Digital image brightness enhancement method | |
Dong et al. | Vehicle color recognition based on license plate color | |
CN104505053B (en) | Show signal conversion method and device | |
Mathur et al. | Performance analysis of color image segmentation using K-means clustering algorithm in different color spaces | |
CN114898718B (en) | Real-time color conversion method for color electrowetting electronic paper | |
CN111105383A (en) | Image fusion color enhancement method for three-color vision | |
CN100535984C (en) | Color image enhancing device and method | |
CN115830343A (en) | Color identification method based on HSV color space | |
CN103021375B (en) | Image intensity regulating circuit | |
CN105303515B (en) | A kind of color misregistration correction method under special illumination condition in closed experimental box |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |