Embodiment
At length set forth to the main realization principle of embodiment of the invention technical scheme, embodiment and to the beneficial effect that should be able to reach below in conjunction with each accompanying drawing.
Be illustrated in figure 1 as in the embodiment of the invention, half tone image frequency-modulation screening process flow figure, its concrete processing procedure is as follows:
Step 11 is determined threshold matrix required when output equipment carries out the processing of half tone image frequency-modulation screening;
The all corresponding threshold matrix of each output equipment, this output equipment adopt this threshold matrix that each pending image through this equipment is carried out the halftoning frequency-modulation screening and handle.
Determine output equipment carry out the half tone image frequency-modulation screening when handling required threshold matrix can but be not limited to following manner:
At first according to predefined line number n and columns m, generate the initial threshold matrix T, each element value in this initial threshold matrix T has nothing in common with each other, according to initial threshold matrix T that generates and default displacement factor v, determine the sign matrix D, wherein v is a positive integer, the dark value e in position according to output equipment, determine the frequency-modulation screening hierachy number L of this output equipment,, determine (L-1) individual permutation matrix A according to sign matrix D of determining and frequency-modulation screening hierachy number L, according to each permutation matrix A that determines, determine that output equipment carries out half tone image frequency-modulation screening required threshold matrix G when handling, wherein the line number of threshold matrix G is (L-1), and columns is (n * m).
In the embodiment of the invention, can but be not limited to determine the frequency-modulation screening hierachy number L of output equipment based on following manner:
L=2
e
For example, position dark value e=2, the frequency-modulation screening hierachy number L=4 of this output equipment so of output equipment.
Step 12 at each pixel in the pending image, according to each numerical value in the sequence of values of being determined by the dark value in position of output equipment, is determined and this numerical value corresponding threshold in above-mentioned threshold matrix successively;
Wherein, this sequence of values can for 1,2 ... i ... L-1}, i are the numerical value in this sequence of values, promptly i ∈ 1,2 ... i ... L-1}.
According to the numerical value i in the above-mentioned sequence of values determine corresponding threshold can but be not limited to following process:
At first, calculate this numerical value i corresponding threshold index value h according to numerical value i
i, then according to the threshold value index value h that calculates
i, in the threshold matrix G that determines, search corresponding threshold.
Wherein, based on following manner evaluation i corresponding threshold index value h
i:
h
i=(q%n)×m+(p%m)+i×m×n
P is this pixel residing line number in pending image, and q is this pixel residing columns in pending image.
Step 13 at each pixel in the pending image, compares the input pixel value of this pixel and the threshold value of determining, and is not more than the threshold value of determining until the input pixel value that relatively obtains this pixel;
If the input pixel value that relatively obtains this pixel then continues to determine corresponding threshold according to next data greater than the threshold value of determining.
Step 14 at each pixel in the pending image, according to the above-mentioned threshold value value corresponding of determining, determines that the above-mentioned output equipment of this pixel process carries out the output pixel value after the half tone image frequency-modulation screening is handled.
When the input pixel value that relatively obtains this pixel when step 14 is not more than the threshold value of determining, at this pixel, do not need to continue again to determine threshold value, but directly determine that according to current numerical value output pixel value gets final product, if the numerical value of this moment is i, promptly the input pixel value of this pixel is not more than numerical value i corresponding threshold, and this pixel is L-1-i through the output pixel value that above-mentioned output equipment carries out after the half tone image frequency-modulation screening is handled so.
By above-mentioned processing procedure as can be known, in the embodiment of the invention technical scheme, at first determine threshold matrix required when output equipment carries out the processing of half tone image frequency-modulation screening, then at each pixel in the pending image, successively according to each numerical value in the sequence of values of determining by the dark value in position of this output equipment, in above-mentioned threshold matrix, determine and this numerical value corresponding threshold, and the input pixel value of this pixel and the threshold value determined compared, be not more than the threshold value of determining until the input pixel value that relatively obtains this pixel, according to the threshold value value corresponding of determining, determine that the above-mentioned output equipment of this pixel process carries out the output pixel value after the half tone image frequency-modulation screening is handled, this shows, in embodiment of the invention technical scheme, pre-determine output equipment corresponding threshold matrix, then at each pixel of each pending image, only the input pixel value of this pixel need be compared with the threshold value of determining and get final product, no longer all carrying out complicated error diffusion at each pixel in the pending image handles, therefore reduced the computational complexity of half tone image frequency-modulation screening, reduced operation time, save the processing resource effectively, improved the treatment effeciency of half tone image frequency-modulation screening.
Provide more detailed execution mode below.
As shown in Figure 2, in the embodiment of the invention, determine the method flow diagram of threshold matrix G, its concrete processing procedure is as follows:
Step 21 according to default line number n and columns m, generates the initial threshold matrix T;
Line number n and columns m can preestablish n and columns m, for example n and m all are made as 32.
The initial threshold matrix T that generates is
T wherein
XyBe the element value of the capable y row of x in the initial threshold matrix T, because the element value in the initial threshold matrix T need have nothing in common with each other, and the element number in this matrix is m * n, then can make in this matrix each element all 1,2 ..., value, i.e. t in m * n}
Xy∈ 1,2 ..., m * n}, and satisfy the characteristic that has nothing in common with each other.
More detailed, the concrete steps that generate the initial threshold matrix T are as follows:
(1) given initial seed: z=1;
(2) calculate first element value t in the initial threshold matrix T in the following way
11:
t
11=z&255
(3) recomputate initial seed z:
Its C code implementation procedure is as follows:
For(i=0;i<8;i++){
d=(z&268435456)>>28
h=(z&67108864)>>26
z=((z<<1)&536870910)|((d^h)&1)
}
(4) repeating step (2) calculates other element value t in the initial threshold matrix T successively to step (4)
12, t
13..., t
21, t
22..., t
Nm
Step 22 according to initial threshold matrix T that generates and default displacement factor v, is determined the sign matrix D, wherein v can but be not limited to be set to 2, the line number of this sign matrix D and columns equate with the line number and the columns of initial threshold matrix T respectively;
If the sign matrix D is
d
XyBe the element value of the capable y row of x in the sign matrix D, then should identify each element value d in the matrix D
XyAccount form be: d
Xy=t
Xy-(m * n)/v.
Step 23 according to the dark value e in position of output equipment, is determined the frequency-modulation screening hierachy number L of this output equipment;
If e=3, L=8 then, promptly the frequency-modulation screening level of this output equipment is: 0,1,2,3,4,5,6,7.
Step 24 according to sign matrix D of determining and frequency-modulation screening hierachy number L, is determined (L-1) individual permutation matrix A, and the line number of each permutation matrix and columns line number and the columns with the initial threshold matrix T respectively are equal;
I ∈ (1,2 ... i ..., L-1}, i permutation matrix is A among the individual permutation matrix A of (L-1) that determines
i,
(a wherein
i)
XyBe i permutation matrix A
iIn the element value of the capable y of x row, this permutation matrix A
iIn each element value (a
i)
XyAccount form be:
Step 25, initialization are determined each parameter of threshold matrix G;
The parameter of determining threshold matrix G comprises: M, S
i, I, i, C.
Wherein M is made as (L-1) * n * m, this value is the number of all elements among the threshold matrix G, and the line number of this threshold matrix G is (L-1), and columns is n * m;
S
iFor the accumulative total array, comprise (L-1) individual value in this accumulative total array, during initialization each numerical value all is changed to 0;
I is an accumulative total group index value, during initialization this value is changed to 0;
I ∈ 1,2 ... i ..., L-1} is changed to 1 with this value during initialization;
C is the threshold value aggregate-value, should be worth set 1 during initialization.
Step 26 according to index value I, is calculated permutation matrix element value a;
At first calculate x and y according to index value I, x=I%m, y=I/n is then at permutation matrix A
iIn, search the parameter (a that the capable y of x is listed as
i)
Xy, make a=(a
i)
Xy, wherein, % represents " mould " computing, (during n * m)=0, i is set to i+1 as I%.
Step 27 is according to a that calculates, at accumulative total array S
iIn search S
a
Step 28 is judged a and S
aWhether satisfy condition: a≤(L-1), and S
a<(n * m), if judged result for being, then goes to step 29, if judged result then goes to step 212 for not;
Step 29 is determined and S in the initial threshold matrix T
aThe element value t that equates
Ru, wherein r is the element value t that finds
RuResiding line number in the initial threshold matrix T, u is the element value t that finds
RuResiding columns in the initial threshold matrix T;
Step 210, i among the threshold matrix G is capable, and the (u * m+r) the element value assignment of row is threshold value aggregate-value C;
Step 211, threshold value aggregate-value C is set to C+1, with S
aBe set to S
a+ 1, go to step 213 then;
Step 212, revising a is (L-1), goes to step 213 then;
Step 213, I is set to I+1;
Step 214, whether the C after judgement is provided with is greater than (L-1) * n * m, if judged result for being, then goes to step 26, if judged result then goes to step 215 for not;
Step 215, the end process flow process.
As shown in Figure 3, in the embodiment of the invention, according to the threshold matrix G that determines pending image is carried out the process flow figure of half tone image frequency-modulation screening, its concrete processing procedure is as follows:
Step 31 scans pending image, obtains the corresponding pixel value matrix U of pending image;
u
PqBe the element value of the capable q row of p in the pixel value matrix U, the line number of this pixel value matrix U is k, and columns is 1.
Step 32 is at the current pixel u that needs processing
Pq, successively according to sequence of values 1,2 ... i ... each numerical value i in the L-1} calculates this numerical value corresponding threshold index value h
i
h
i=(q%n)×m+(p%m)+i×m×n
Step 33 is according to the threshold value index value h that calculates
i, in the threshold matrix G that determines, search corresponding threshold g
j
Wherein threshold matrix G sorts since first row, first row, and first row, first column element is first element, and the first row secondary series element is second element, and the like, determine threshold value index value h
iAfter, in threshold matrix G, search the threshold value g of correspondence position
j
Step 34 is judged u
PqWhether greater than g
j, if judged result then goes to step 35 for not, if judged result is for being then to go to step 32;
Step 35 is with this pixel u
PqThe output pixel value that carries out after the half tone image frequency-modulation screening is handled through output equipment is defined as L-1-i;
Step 36 judges whether all pixels in this pending image are all handled, if judged result then goes to step 37 for not, if judged result is for being then to go to step 38;
Step 37 is determined the next pixel that needs processing, goes to step 32 then;
Step 38, the end process flow process.
Accordingly, the embodiment of the invention also provides a kind of half tone image frequency-modulation screening processing unit, its structure comprises first determining unit 41, second determining unit 42, comparing unit 43 and the 3rd determining unit 44 as shown in Figure 4, wherein:
First determining unit 41 is used for determining that output equipment carries out half tone image frequency-modulation screening required threshold matrix when handling;
Second determining unit 42, be used for each pixel at pending image, according to each numerical value in the sequence of values of determining by the dark value in position of described output equipment, in the threshold matrix that first determining unit 41 is determined, determine and this numerical value corresponding threshold successively;
Comparing unit 43 is used for each pixel at pending image, and the threshold value that the input pixel value and second determining unit 42 of this pixel are determined compares;
The 3rd determining unit 44, be used for each pixel at pending image, when the input pixel value that relatively obtains this pixel at comparing unit 43 is not more than the threshold value of determining, according to the threshold value value corresponding that second determining unit 42 is determined, determine that the above-mentioned output equipment of this pixel process carries out the output pixel value after the half tone image frequency-modulation screening is handled.
Preferably, first determining unit 41 comprises that specifically generating subelement, first determines subelement, second definite subelement, the 3rd definite subelement and the 4th definite subelement, wherein:
Generate subelement, be used for according to predefined line number n and columns m, generate the initial threshold matrix T, each element value in the initial threshold matrix T has nothing in common with each other;
First determines subelement, is used for determining the sign matrix D according to initial threshold matrix T that generates the subelement generation and default displacement factor v;
Second determines subelement, is used for the dark value e in position according to output equipment, determines the frequency-modulation screening hierachy number L of output equipment;
The 3rd determines subelement, is used for determining the frequency-modulation screening hierachy number L that subelement is determined according to the sign matrix D and second that first definite subelement is determined, and determines (L-1) individual permutation matrix A;
The 4th determines subelement, is used for determining each permutation matrix A that subelement is determined according to the 3rd, determines that output equipment carries out half tone image frequency-modulation screening required threshold matrix G when handling, and wherein the line number of threshold matrix G is (L-1), and columns is (n * m).
More preferably, second definite subelement is determined the frequency-modulation screening hierachy number L of described output equipment based on following manner:
L=2
e
More preferably, if generate the initial threshold matrix T of subelement generation be
T wherein
XyBe the element value of the capable y row of x in the initial threshold matrix T, then t
Xy∈ 1,2 ..., m * n}.
More preferably, determine that as if first the sign matrix D that subelement is determined is
D wherein
XyBe the element value of the capable y row of x in the sign matrix D, then d
Xy=t
Xy-(m * n)/v, v is a positive integer.
More preferably, be A if the 3rd definite subelement is determined i permutation matrix
i,
(a wherein
i)
XyBe i permutation matrix A
iIn the element value of the capable y of x row, i ∈ 1,2 ... i ..., L-1}, then
More preferably, the 4th determines that subelement specifically comprises:
Search module, be used for according to i and accumulative total group index value I, at permutation matrix A
iIn search corresponding element value a;
First determination module is used for determining the S in the accumulative total array according to searching the element value a that module searches arrives
a
First judge module, be used to judge search module searches to the element value a and first determination module determine S
aWhether satisfy following condition: a≤(L-1) and S
a<(n * m);
Second determination module is used in the judged result of first judge module determining and S in the initial threshold matrix T when being
aThe element value t that equates
Ru, wherein r is the element value t that finds
RuResiding line number in the initial threshold matrix T, u is the element value t that finds
RuResiding columns in the initial threshold matrix T;
The assignment module is used for described threshold matrix G i capablely, and the (u * m+r) the element value assignment of row is threshold value aggregate-value C;
Module is set, is used for C and is set to C+1, I is set to I+1;
Second judge module is used to judge whether C after module is set to be provided with satisfies following condition: C>(L-1) * n * m, and in judged result for not the time, go to and search module and handle.
More preferably, above-mentioned sequence of values be 1,2 ... i ... L-1}.
More preferably, the output pixel value determined of the 3rd determining unit 44 is L-1-i.
More preferably, second determining unit 42 specifically comprises computation subunit and search subelement, wherein:
Computation subunit is used for successively calculating this numerical value corresponding threshold index value h according to each the numerical value i in the above-mentioned sequence of values
i
Search subelement, be used for the threshold value index value h that calculates according to computation subunit
i, in the threshold matrix G that first determining unit 41 is determined, search corresponding threshold.
More preferably, computation subunit is based on following manner evaluation i corresponding threshold index value h
i:
h
i=(q%n)×m+(p%m)+i×m×n
Wherein, p is this pixel residing line number in described pending image;
Q is this pixel residing columns in described pending image.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.