Embodiment
The process flow diagram of the image processing method that Fig. 1 provides for the embodiment of the present invention, as shown in Figure 1, the method comprises:
Step 100, receive pending photo or sketch image, according to the image of anticipating in training set to adopted segmentation rule, by the first image block that described pending photo or sketch image are divided into N number of size identical, determine each first image block and in advance to the image in described training set to the corresponding relation applied between M class that clustering algorithm process obtains;
Image processing apparatus receives pending photo or the sketch image of user's transmission, the image obtained in process training set is regular to adopted segmentation, concrete segmentation rule carries out setting according to the size of pretreatment image and type, such as comprise row and the row of segmentation, whether can repeat segmentation etc., need to set according to concrete practical application.Then regular to adopted segmentation according to the image of anticipating in training set, the first image block being divided into N number of size identical in pending photo or sketch image, after having split, determine each first image block and in advance to the image in training set to the corresponding relation applied between M class that clustering algorithm process obtains, concrete, can by with anticipate clustering algorithm that training set adopts and first clustering processing carried out to N number of first image block after splitting and obtain m class, the similarity between m class and M class is obtained again by proper vector pairing comparision, thus determine the concrete corresponding relation of each first image block and M class, or by obtaining the center vector corresponding with each class in M class, can then obtain the distance of the first image block and each center vector, will be the class of described first image block ownership apart from the class corresponding to minimum center vector.Be understandable that, those skilled in the art can determine the concrete corresponding relation of each first image block and M class in several ways, and namely which kind of in M the class obtained in advance each first image block belong to.It should be noted that the clustering algorithm adopted in the present embodiment comprises: sparse subspace clustering algorithm, hierarchical clustering algorithm, segmentation clustering algorithm, based on constraint clustering algorithm, can select according to practical application.
Step 101, according to training in advance, obtain second image block corresponding with each first image block with the training parameter corresponding to the class that each first image block belongs to, wherein, described training parameter comprises: the first image dictionary, the second image dictionary, error dictionary and the coefficient mapping function between described first image dictionary and described second image dictionary;
Concrete, the treatment scheme of this step is illustrated for first the first image block, if image processing apparatus is determining that first the first image block belongs to the Equations of The Second Kind in M the class obtained in advance, then obtain training in advance, with the training parameter corresponding to Equations of The Second Kind, this training parameter comprises: the first image dictionary, second image dictionary, error dictionary, and the coefficient mapping function between described first image dictionary and described second image dictionary, then applied mathematical model processes these training parameters, thus obtain second image block corresponding with first the first image block.
Step 102, synthesizes and described pending photo or sketch image corresponding to sketch image or photo according to N number of second image block corresponding with described N number of first image block obtained.
Image processing apparatus is according to training in advance, apply after the first formula obtains the second image block corresponding with each first image block with the training parameter corresponding to the class that each first image block belongs to, synthesize and pending photo or sketch image corresponding to sketch image or photo according to N number of second image block corresponding with N number of first image block obtained, concrete synthetic method is depending on concrete segmentation strategy, such as, if segmentation strategy is not for repeating segmentation, then synthetic method directly can be applied composition algorithm of the prior art according to N number of second image block and synthesizes, if segmentation strategy is attached most importance to, subdivision is cut, then lap first adds and averages by synthetic method, apply composition algorithm of the prior art again to synthesize.Because concrete synthetic method belongs to prior art, repeat no more herein.
The image processing method that the present embodiment provides, first regular to adopted segmentation according to the image of anticipating in training set, the first image block being divided into N number of size identical in pending photo or sketch image, then determine each first image block and in advance to the image in training set to the corresponding relation applied between M class that clustering algorithm process obtains, according to training in advance, second image block corresponding with each first image block is obtained with the training parameter corresponding to the class that each first image block belongs to, wherein, described training parameter comprises: the first image dictionary, second image dictionary, error dictionary, and the coefficient mapping function between described first image dictionary and described second image dictionary, finally synthesize and described pending photo or sketch image corresponding to sketch image or photo according to N number of second image block corresponding with described N number of first image block obtained, achieve the mutual synthesis being undertaken between photo and sketch picture by dictionary learning method, avoid occurring made fritter, improve the sharpness of synthetic effect.
The process flow diagram of another image processing method that Fig. 2 provides for the embodiment of the present invention, as shown in Figure 2, the method comprises:
Step 200, receive pending photo or sketch image, according to the image of anticipating in training set to adopted segmentation rule, by the first image block that described pending photo or sketch image are divided into N number of size identical, determine each first image block and in advance to the image in described training set to the corresponding relation applied between M class that clustering algorithm process obtains;
Image processing apparatus receives pending photo or the sketch image of user's transmission, the image obtained in process training set is regular to adopted segmentation, concrete segmentation rule carries out setting according to the size of pretreatment image and type, such as comprise row and the row of segmentation, whether can repeat segmentation etc., need to set according to concrete practical application.Then regular to adopted segmentation according to the image of anticipating in training set, the first image block being divided into N number of size identical in pending photo or sketch image, after having split, determine each first image block and in advance to the image in training set to the corresponding relation applied between M class that clustering algorithm process obtains, concrete, can by with anticipate clustering algorithm that training set adopts and first clustering processing carried out to N number of first image block after splitting and obtain m class, the similarity between m class and M class is obtained again by proper vector pairing comparision, thus determine the concrete corresponding relation of each first image block and M class, or by obtaining the center vector corresponding with each class in M class, can then obtain the distance of the first image block and each center vector, will be the class of described first image block ownership apart from the class corresponding to minimum center vector.Be understandable that, those skilled in the art can determine the concrete corresponding relation of each first image block and M class in several ways, and namely which kind of in M the class obtained in advance each first image block belong to.It should be noted that the clustering algorithm adopted in the present embodiment comprises: sparse subspace clustering algorithm, hierarchical clustering algorithm, segmentation clustering algorithm, based on constraint clustering algorithm, can select according to practical application.
Step 201, according to training in advance, apply the first formula with the training parameter corresponding to the class that each first image block belongs to and obtain second image block corresponding with each first image block, wherein, described training parameter comprises: the first image dictionary, the second image dictionary, error dictionary and the coefficient mapping function between described first image dictionary and described second image dictionary, and described first formula is:
s
i=D
sa
s-E
s(p
i-D
pα
p),
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, p
ibe the first image block, s
ibe the second image block, α
p, α
smeet the second formula, described second formula is:
Wherein, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, γ, λ
p, λ
sit is regularization coefficient;
Concrete, the treatment scheme of this step is illustrated for first the first image block, if image processing apparatus is determining that first the first image block belongs to the Equations of The Second Kind in M the class obtained in advance, then according to training in advance, with the training parameter corresponding to Equations of The Second Kind, this training parameter comprises: the first image dictionary, second image dictionary, error dictionary, and the coefficient mapping function between described first image dictionary and described second image dictionary, then apply the first formula and obtain the second image block corresponding with first the first image block, wherein, described first formula is:
s
i=D
sa
s-E
s(p
i-D
pα
p),
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, p
ibe the first image block, s
ibe the second image block, α
p, α
smeet the second formula, described second formula is:
Wherein, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, γ, λ
p, λ
sbe regularization coefficient, obtain N number of second image block corresponding with N number of first image block according to above-mentioned steps.
Step 202, synthesizes and described pending photo or sketch image corresponding to sketch image or photo according to N number of second image block corresponding with described N number of first image block obtained.
Image processing apparatus is according to training in advance, apply after the first formula obtains the second image block corresponding with each first image block with the training parameter corresponding to the class that each first image block belongs to, synthesize and pending photo or sketch image corresponding to sketch image or photo according to N number of second image block corresponding with N number of first image block obtained, concrete synthetic method is depending on concrete segmentation strategy, such as, if segmentation strategy is not for repeating segmentation, then synthetic method directly can be applied composition algorithm of the prior art according to N number of second image block and synthesizes, if segmentation strategy is attached most importance to, subdivision is cut, then lap first adds and averages by synthetic method, apply composition algorithm of the prior art again to synthesize.Because concrete synthetic method belongs to prior art, repeat no more herein.
The image processing method that the present embodiment provides, first regular to adopted segmentation according to the image of anticipating in training set, the first image block being divided into N number of size identical in pending photo or sketch image, then determine each first image block and in advance to the image in training set to the corresponding relation applied between M class that clustering algorithm process obtains, according to training in advance, apply the first formula with the training parameter corresponding to the class that each first image block belongs to and obtain second image block corresponding with each first image block, wherein, described training parameter comprises: the first image dictionary, second image dictionary, error dictionary, and the coefficient mapping function between described first image dictionary and described second image dictionary, described first formula is: s
i=D
sa
s-E
s(p
i-D
pα
p), wherein, Ds is the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, p
ibe the first image block, s
ibe the second image block, α
p, α
smeet the second formula, described second formula is:
Wherein, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, γ, λ
p, λ
sit is regularization coefficient, finally synthesize and described pending photo or sketch image corresponding to sketch image or photo according to N number of second image block corresponding with described N number of first image block obtained, achieve the mutual synthesis being undertaken between photo and sketch picture by dictionary learning method, avoid occurring made fritter, improve the sharpness of synthetic effect.
Based on above-described embodiment, it should be noted that, concrete segmentation rule carries out setting according to the size of pretreatment image and type, such as, comprise row and the row of segmentation, whether can repeat segmentation etc., needs to set according to concrete practical application.In order to improve the sharpness of Images uniting further, be specially the image block that repeatedly can be divided into fixed size be specifically described by embodiment illustrated in fig. 3 to split rule, the process flow diagram of another image processing method that Fig. 3 provides for the embodiment of the present invention, as shown in Figure 3, the method comprises:
Step 300, according to the segmentation rule preset by training set, the photo of each image pair and the sketch image corresponding with described photo all can repeatedly be divided into the image block that N number of size is identical, application clustering algorithm carries out clustering processing to all image blocks and obtains M class;
Image processing apparatus according to the segmentation rule preset by training set, the photo of each image pair and the sketch image corresponding with described photo all can repeatedly be divided into the image block that N number of size is identical, after having split, application clustering algorithm carries out clustering processing to all image blocks and obtains M class.Be understandable that, those skilled in the art adopt the clustering algorithm of prior art, specifically comprise: sparse subspace clustering algorithm, hierarchical clustering algorithm, segmentation clustering algorithm, based on constraint clustering algorithm, can select according to practical application, thus clustering processing acquisition M class is carried out to all image blocks, repeat no more herein.
Step 301, apply the 3rd formula and obtain the training parameter corresponding with each class in a described M class, wherein, described training parameter comprises: the first image dictionary, the second image dictionary, error dictionary and the coefficient mapping function between described first image dictionary and described second image dictionary, and described 3rd formula is:
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, P
ibe the first image block, γ, λ
p, λ
s, λ
wit is regularization coefficient;
Particularly, after image processing apparatus application clustering algorithm carries out clustering processing acquisition M class to all image blocks, apply the 3rd formula and obtain the training parameter corresponding with each class in a described M class, wherein, described training parameter comprises: the first image dictionary, the second image dictionary, error dictionary and the coefficient mapping function between described first image dictionary and described second image dictionary, and described 3rd formula is:
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, P
ibe the first image block, γ, λ
p, λ
s, λ
wit is regularization coefficient.
Step 302, receives pending photo or sketch image, according to the image of anticipating in training set to adopted segmentation rule, described pending photo or sketch image repeatedly can be divided into the first image block that N number of size is identical;
Image processing apparatus receives pending photo or the sketch image of user's transmission, the image obtained in process training set is regular to adopted segmentation, then regular to adopted segmentation according to the image of anticipating in training set, pending photo or sketch image repeatedly can be divided into the first image block that N number of size is identical.
Step 303, obtains the center vector corresponding with each class in a described M class, obtains the distance of the first image block and each center vector, will be the class of described first image block ownership apart from the class corresponding to minimum center vector;
After having split, image processing apparatus obtains the center vector corresponding with each class in M class, then obtains the distance of the first image block and each center vector, will be the class of described first image block ownership apart from the class corresponding to minimum center vector.
Step 304, according to training in advance, apply the first formula with the training parameter corresponding to the class that each first image block belongs to and obtain second image block corresponding with each first image block, wherein, described training parameter comprises: the first image dictionary, the second image dictionary, error dictionary and the coefficient mapping function between described first image dictionary and described second image dictionary, and described first formula is:
s
i=D
sa
s-E
s(p
i-D
pα
p),
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, p
ibe the first image block, s
ibe the second image block, α
p, α
smeet the second formula, described second formula is:
Wherein, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, γ, λ
p, λ
sit is regularization coefficient;
Concrete, the treatment scheme of this step is illustrated for first the first image block, if image processing apparatus is determining that first the first image block belongs to the Equations of The Second Kind in M the class obtained in advance, then according to training in advance, with the training parameter corresponding to Equations of The Second Kind, this training parameter comprises: the first image dictionary, second image dictionary, error dictionary, and the coefficient mapping function between described first image dictionary and described second image dictionary, then apply the first formula and obtain the second image block corresponding with first the first image block, wherein, described first formula is:
s
i=D
sa
s-E
s(p
i-D
pα
p),
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, p
ibe the first image block, s
ibe the second image block, α
p, α
smeet the second formula, described second formula is:
Wherein, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, γ, λ
p, λ
sbe regularization coefficient, obtain N number of second image block corresponding with N number of first image block according to above-mentioned steps.
Step 305, applied dynamic programming method obtains the minimum border of value differences in the overlapping region of two the second image blocks, border as two the second image blocks is split, and synthesizes and described pending photo or sketch image corresponding to sketch image or photo according to N number of second image block corresponding with described N number of first image block obtained.
The disposal route added due to the direct overlapping region by two the second image blocks and average can cause the result of generation comparatively fuzzy, therefore, image processing apparatus is after obtaining second image block corresponding with each first image block, applied dynamic programming method obtains the minimum border of value differences in the overlapping region of two the second image blocks, border as two the second image blocks is split, apply composition algorithm of the prior art again to synthesize N number of second image block, because concrete synthetic method belongs to prior art, repeat no more herein.
The image processing method that the present embodiment provides, first pending photo or sketch image can be repeated the first image block being divided into N number of size identical, then determine each first image block and in advance to the image in training set to the corresponding relation applied between M class that clustering algorithm process obtains, according to training in advance, apply the first formula with the training parameter corresponding to the class that each first image block belongs to and obtain second image block corresponding with each first image block, wherein, described training parameter comprises: the first image dictionary, second image dictionary, error dictionary, and the coefficient mapping function between described first image dictionary and described second image dictionary, described first formula is: s
i=D
sa
s-E
s(p
i-D
pα
p), wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, p
ibe the first image block, s
ibe the second image block, α
p, α
smeet the second formula, described second formula is:
Wherein, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, γ, λ
p, λ
sit is regularization coefficient, last applied dynamic programming method obtains the minimum border of value differences in the overlapping region of two the second image blocks, border as two the second image blocks is split, again synthesis process is carried out to N number of second image block, achieve the mutual synthesis being undertaken between photo and sketch picture by dictionary learning method, avoid occurring made fritter, further increasing the sharpness of synthetic effect.
One of ordinary skill in the art will appreciate that: all or part of step realizing said method embodiment can have been come by the hardware that programmed instruction is relevant, aforesaid program can be stored in a computer read/write memory medium, this program, when performing, performs the step comprising said method embodiment; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
The structural representation of the image processing apparatus that Fig. 4 provides for the embodiment of the present invention, as shown in Figure 4, this device comprises: segmentation module 11, cluster module 12, processing module 13 and synthesis module 14, wherein, segmentation module 11 is for receiving pending photo or sketch image, according to the image of anticipating in training set to adopted segmentation rule, by the first image block that described pending photo or sketch image are divided into N number of size identical; Cluster module 12 for determine each first image block and in advance to the image in described training set to the corresponding relation applied between M class that clustering algorithm process obtains; Processing module 13 for according to training in advance, obtain second image block corresponding with each first image block with the training parameter corresponding to the class that each first image block belongs to, wherein, described training parameter comprises: the first image dictionary, the second image dictionary, error dictionary and the coefficient mapping function between described first image dictionary and described second image dictionary;
Synthesis module 14 is for synthesizing according to N number of second image block corresponding with described N number of first image block obtained and described pending photo or sketch image corresponding to sketch image or photo.
The function of each module and treatment scheme in the image processing apparatus that the present embodiment provides, can see the embodiment of the method shown in above-mentioned Fig. 1, and it realizes principle and technique effect is similar, repeats no more herein.
Based on above-described embodiment, processing module 13, specifically for according to training in advance, apply the first formula with the training parameter corresponding to the class that each first image block belongs to and obtain second image block corresponding with each first image block, described first formula is:
s
i=D
sa
s-E
s(p
i-D
pα
p),
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, p
ibe the first image block, s
ibe the second image block, α
p, α
smeet the second formula, described second formula is:
Wherein, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, γ, λ
p, λ
sit is regularization coefficient.
The function of each module and treatment scheme in the image processing apparatus that the present embodiment provides, can see the embodiment of the method shown in above-mentioned Fig. 2, and it realizes principle and technique effect is similar, repeats no more herein.
The structural representation of another image processing apparatus that Fig. 5 provides for the embodiment of the present invention, as shown in Figure 5, based on embodiment illustrated in fig. 4, this device also comprises: pretreatment module 15, for before the pending photo of described reception or sketch image, according to the segmentation rule preset by training set, the photo of each image pair and the sketch image corresponding with described photo be divided into the identical image block of N number of size;
Application clustering algorithm carries out clustering processing to all image blocks and obtains M class;
Apply the 3rd formula and obtain the training parameter corresponding with each class in a described M class, wherein, described training parameter comprises: the first image dictionary, the second image dictionary, error dictionary and the coefficient mapping function between described first image dictionary and described second image dictionary, and described 3rd formula is:
Wherein, D
sbe the second image dictionary, E
sfor error dictionary, D
pbe the first image dictionary, W
pfor the coefficient mapping function between described first image dictionary and described second image dictionary, P
ibe the first image block, γ, λ
p, λ
s, λ
wit is regularization coefficient.
Particularly, described cluster module 12 specifically for:
Obtain the center vector corresponding with each class in a described M class;
Obtaining the distance of the first image block and each center vector, will be the class of described first image block ownership apart from the class corresponding to minimum center vector.
Further, if described segmentation rule is specially: the image block that repeatedly can be divided into fixed size, described synthesis module 14 also for:
Applied dynamic programming method obtains the minimum border of value differences in the overlapping region of two the second image blocks, the border as two the second image blocks is split.
The function of each module and treatment scheme in the image processing apparatus that the present embodiment provides, can see the embodiment of the method shown in above-mentioned Fig. 3, and it realizes principle and technique effect is similar, repeats no more herein.
Last it is noted that above embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to previous embodiment to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.