Summary of the invention
It is an object of the present invention to overcome the above-mentioned drawbacks of the prior art and provide a kind of with white printing paper
Make the method that object of reference restores object color.
The purpose of the present invention can be achieved through the following technical solutions:
A method of making object of reference with white printing paper and restore object color, this method comprises the following steps:
(1) object photo is obtained using white printing paper as object of reference;
(2) the object average color and white printing paper blank parts average color in object photo are obtained;
(3) object average color and white printing paper blank parts average color are input to artificial neural network trained in advance
Network color Restoration model obtains object color;
The artificial neural network color Restoration model input includes that a certain input color is flat in white printing paper
Homochromatic and white printing paper blank parts average color, the output of artificial neural network color Restoration model are that the input color is corresponding
Reference colour.
Training obtains the artificial neural network color Restoration model as follows:
(11) select a set of color set as reference colour;
(12) multiple color is chosen in the color set and is printed on white printing paper;
(13) acquisition is printed with the photo of the white printing paper of color block, obtains training sample, and the training sample is defeated
Enter the reference colour that data include the average color of each color block, printing paper blank parts average color and corresponding color block;
(14) artificial neural network is created, training sample is trained to obtain artificial neural network color Restoration model.
Step (12) specifically: the N kind color { c for the concentration that gets colorsi, i=1,2 ..., N }, ciIndicate i-th kind of color
Reference colour prints on N kind color on white printing paper in the form of uniform color lump.
Step (13) specifically:
(13a) obtains the photo for being printed with the white printing paper of color block respectively under different light environments, and then obtains
Obtain M photos;
(13b) obtains following data to any one photo: the average color c ' of the color block of i-th kind of color of acquisitioniWith
And printing paper blank parts average color c ' in the photop;
(13c) constructs N number of training sample for the photo in step (13b), wherein i-th of training sample are as follows:
samplei={ inputi,outputi, inputi=(c 'i,c′p), outputi=c 'i, i=1,2 ..., N;
(13d) executes step (13b)~(13c) to M photos respectively, obtains M × N number of training sample.
Step (14) specifically: creation artificial neural network, the artificial neural network are averaged each color block
Color and printing paper blank parts average color are as input, using the reference colour of corresponding color block as desired output, using instruction
Practice sample artificial neural network is trained to obtain artificial neural network color Restoration model.
Step (1) specifically: by object and white printing paper close to putting together or then directly place object
It takes pictures on white printing paper, keeps illumination consistent when taking pictures, the object photo of acquisition is reference with white printing paper
Object.
Compared with prior art, the present invention has the advantage that
(1) present invention restores the method for object standard color by white printing paper, can will be in different light environments
The color of the lower resulting same object of acquisition is all restored on the standard color of the target, to eliminate photo environment difference institute band
The influence come;
(2) present invention requires with white printing paper to put object together and take pictures in training stage and application stage,
And make them close as far as possible, the consistency of illumination is kept, target object area average color and printing paper region average color in photo
Construct input sample, and the input as neural network, and using reference colour as the desired output of neural network, so that
As a result more accurate and reliable;
(3) the method for the present invention by means of white paper out at, white printing paper is article very common in daily life,
It is easy to obtain, and then this method is easy, it is easily operated.
Embodiment
As shown in Figure 1, a kind of make the method that object of reference restores object color with white printing paper, this method includes as follows
Step:
(1) object photo is obtained using white printing paper as object of reference;
(2) the object average color and white printing paper blank parts average color in object photo are obtained;
(3) object average color and white printing paper blank parts average color are input to artificial neural network trained in advance
Network color Restoration model obtains object color;
The input of artificial neural network color Restoration model include a certain average color of the input color in white printing paper with
And white printing paper blank parts average color, the output of artificial neural network color Restoration model are the corresponding standard of input color
Color.
To sum up, the present invention includes two stages: training stage and application stage, and the training stage, i.e. training was artificial in advance
Neural network color Restoration model, the application stage is i.e. using training artificial neural network color Restoration model in advance to recovery target
The stage of object color.
One, the training stage
Training obtains artificial neural network color Restoration model as follows:
(11) select a set of color set as reference colour, present invention aim to the photo color of object is restored
Onto some color in the color set.
(12) multiple color is chosen in the color set and is printed on white printing paper, and specifically: get colors concentration
N kind color { ci, i=1,2 ..., N }, ciThe reference colour for indicating i-th kind of color beats N kind color in the form of uniform color lump
It is printed on white printing paper, the size of N determines the accuracy for restoring color in the future, and N is bigger, and precision is higher.
(13) acquisition is printed with the photo of the white printing paper of color block, obtains training sample, training sample input data
The reference colour of average color, printing paper blank parts average color and corresponding color block including each color block, specifically includes
Following sub-step:
(13a) obtains the photo for being printed with the white printing paper of color block respectively under different light environments, and then obtains
Obtain M photos;
(13b) obtains following data to any one photo: the average color c ' of the color block of i-th kind of color of acquisitioniWith
And printing paper blank parts average color c ' in the photop;
(13c) constructs N number of training sample for the photo in step (13b), wherein i-th of training sample are as follows:
samplei={ inputi,outputi, inputi=(c 'i,c′p), outputi=c 'i, i=1,2 ..., N;
(13d) executes step (13b)~(13c) to M photos respectively, obtains M × N number of training sample.
(14) artificial neural network is created, training sample is trained to obtain artificial neural network color Restoration model,
Specifically: creation artificial neural network, artificial neural network equal the average color of each color block and printing paper blank parts
Equal color is as input, using the reference colour of corresponding color block as desired output, using training sample to artificial neural network into
Row training obtains artificial neural network color Restoration model.
Two, the application stage
In use, by object and white printing paper close to putting together or object is then directly placed at white
It takes pictures on printing paper, keeps illumination consistent when taking pictures, the object photo of acquisition is using white printing paper as reference substance.
Paper white area and target object area are extracted in the object photo taken, and calculates separately its average color,
Wherein, object average color is c ', and white printing paper blank parts average color is c 'p, construct input sample input=(c ', c
′p), by input=(c ', c 'p) it is input to artificial neural network color Restoration model, it obtains artificial neural network color and restores mould
The output output=c of type, c are the standard color to c ' reconstruction, also as object color.
As an embodiment, the method for recovery forearm skin color described herein to reference colour.In the example, use
One five layers full connection artificial neural network, but the adoptable artificial neural network of the present invention is not limited to this.Using RGB
Color space, but the present invention is not required for being confined to RGB color, the input of sample are as follows:And the input vector input of sample can also be defined as
By aim colour c 'iWith blank sheet of paper color c 'pOther vector forms come are combined into, as long as in training and keeping one in two stages of application
Cause.
Specifically:
Sample collection:
(1) in this example, reference colour set is using whole colors in RGB color.It is empty in the color of this cube
Between 2500 points of middle sampling, obtain 2500 kinds of color { ci=(Ri,Gi,Bi), i=1,2 ..., N }, N=2500.
(2) according to these color values, 2500 uniform color segments is generated by computer, are arranged with 50x50, and pass through
The higher printer of color fidelity prints to these color blocks on white printing paper, while reserving on white printing paper certain
Blank parts.
(3) it under a variety of different light environments, takes pictures to the color block printed.To taking pictures to obtain any
Digital photograph does following processing: the wherein average color of each color block and the average color of printing paper white space are acquired,
Obtain { c 'i=(R 'i,G′i,B′i), i=1,2 ..., N }, c 'p=(R 'p,G′p,B′p)。
(4) it is based on above-mentioned average color, constructs N number of sample, samplei={ inputi,outputi, i=1,2 ..., N,
In,outputi=ci=(Ri,Gi,Bi), superscript 2
For square.
(5) due to can shoot a large amount of photo in (3), such as M=100, therefore available a large amount of sample, such as
MxN=100*2500=250000 sample.
Model training:
(6) artificial neural network is created, uses one 5 layers of full Connection Neural Network, the neuron of each layer here
Quantity are as follows: first layer (i.e. input layer) 12, the second layer 100, third layer 300, the 4th layer 100, layer 5 (exports
Layer) 3.Second and third, four layers below all follow one dropout layers, loss ratio rate is set as 0.25.
(7) artificial neural network is trained with above-mentioned 250000 samples, wherein inputiAs input, and
outputiAs desired output.After training, an artificial neural network color Restoration model Model is obtained.
Model application:
(8) it in use, in order to restore the reference colour of small skin of arm (i.e. object) from digital photograph, needs taking pictures
When one A4 white printing paper and forearm are placed among A4 white printing paper close to putting together, or forearm.Then right
They take pictures, and make uniform illumination as far as possible.
(9) in this photo taken, paper white area and skin area are extracted, and calculates separately its average face
Color obtains average color c '=(R ', G ', B ') of the small skin of arm and average color c ' of blank sheet of paperp=(R 'p,G′p,B′p).And
Input sample is established according to this:
(10) input is input in artificial neural network color Restoration model Model, obtains it and exports output=
(R,G,B).Here output is the reference colour rebuild for skin color c'.
Above embodiment is only to enumerate, and does not indicate limiting the scope of the invention.These embodiments can also be with other
Various modes are implemented, and can make in the range of not departing from technical thought of the invention it is various omit, displacement, change.