Background technology
Because the use of printer, scanner is day by day frequent, and people also improve day by day for the requirement of print quality, and the file that not only requires to print is wanted clear perfection, also requires the speed of printing.And on general printer, the method for its printing adopts following two kinds of shadow tones (halftone) method usually:
(1) order is broken up method (ordered dither): utilize the minimizing of resolution to increase the number of GTG, just the imagery exploitation dot pattern coding in a zone was simulated the GTG effect of finding of naked eye afterwards.
(2) error-diffusion method (error diffusion): utilize the GTG error of specific direction pixel, judge afterwards that through adding up of special ratios next pixel is black or white.
Though above-mentioned two kinds of methods can obtain good effect on image, but it is desirable not to the utmost in the processing of literal, therefore be necessary the special quality of printing to improve of handling partly made in literal, and at present aspect print quality, the more existing patents of the theory and technology that adopts picture and text to separate propose, as:
(1) the Taiwan patent No. 143707, " picture and text tripping device automatically ", patentee: landblink honor.The Taiwan patent No. 201350, " picture and text automatic separation process ", patentee: Wang Demei, Wang Bozhi, gold dragon.
(2) United States Patent (USP) the 4411015th, 4503556,4504972,4513442,5091964,5280367,5335290,5375197, No. 5381241.
But, the purpose of these methods mostly is to be used for asking cutting apart of literal block and image block, utilize the similarity of pixel gray level or connectivity to carry out the merging of pixel and cut apart, again the block after cutting apart being carried out feature judges, the shape that comprises gray scale histogram or block is so that judge that the attribute of block is literal or image.These methods need bigger block usually, even the data-signal of whole image, just can obtain correct cutting apart.And the result after cutting apart also must just can obtain perfect print result through literal and image individual treated.Therefore just inapplicable on the device that some need be printed immediately or storer is little, as facsimile recorder and duplicating machine.
Industrial Technology Research Institute's (No. the 201350th, Taiwan patent) is though the method that is proposed can solve the problem of instant printing, but the statistical value that is set at past experience because of its rim condition, when setting up, rim condition cooperate halftoning method to force segmenting edge, though it is comparatively clear to make literal print, but improve limitedly, also be easy to generate the discontinuous situation in burr or edge.
Summary of the invention
The objective of the invention is to propose a kind of method that improves print quality, the reinforcement that it is not only applicable to the literal print quality of gray scale image also is applicable to the reinforcement of the literal print quality of RGB coloured image, and does not influence the print quality of image as far as possible.
Another object of the present invention is to propose a kind of method that improves print quality, it proposes type variable (adaptive) edge threshold value and is used as the restraint-type that the edge is judged, utilize each row edge of image feature to revise the edge threshold value, with the restraint-type of judging as the next column image border, with the feature and the satisfied instant effect of printing of realistic image.
A further object of the present invention is to propose a kind of method that improves print quality, it proposes a cover logical operation rule, can choose an only edge feature from a plurality of edge feature values distributes to carry out the edge, not only eliminate the directivity difference that the sub-order of operation difference of boundary operation is produced, it is unsmooth also to have eliminated the caused edge of error-diffusion method, has improved last print quality.
The present invention is used for instant handling image that institute desires print file and the method for literal is achieved in that this method is applicable to colour and gray scale image processing, it is as follows that it comprises step: the A.CMYK halftone process: the image that will desire print file is changed via CMYK, produce the CMYK image, again four colors of CMYK are carried out halftone process simultaneously, to determine the color of the required printing of this image pixel; The B.CMY conversion: the image that will desire print file is changed via CMY, produces the CMY image, so that three colors of CMY are carried out edge detection simultaneously; C. edge detection: utilize the grayscale difference of the view data of input, whether decision has an edge feature, if edge feature does not exist, does not then do any processing, if edge feature exists, then carries out the representative record of edge pixel; D. print-mode switchover: the representative record of edge pixel is carried out pixel according to the difference of printing model distribute, whether print to determine each edge pixel; E.CMYK print-mode switchover: convert the edge pixel of CMY the edge pixel of CMYK to, to cooperate actual printing model.
Wherein the step that further comprises of edge detection is: the A. initialization: decision is the genesis initial value on one side; B. edge feature: calculate a m * n, the view data m in the form, n utilize boundary operation to ask the grayscale difference at edge between 2 to 5, with as the edge feature value, in order to revise the edge threshold value; And utilize boundary operation to ask the directivity at edge, and so that carry out the representative record of edge pixel, required form size when wherein m * n is meant edge detection; C. revise the edge threshold value: with all are used for revising the edge threshold value greater than the edge feature value of edge initial value through after the average weighted computing in each row image, with the restraint-type of judging as the next column image border; D. representative record: utilize two bit groups to represent an edge feature that pixel had, comprise position distribution, edge modifications coefficient, the direction character of black picture element and the direction character of white pixel of black picture element; E. characteristic allocation: when edge feature greater than the edge initial value, represent that the view data in this m * n form may have an edge, must be by interpolation method and error diffusion ratio juris, with algorithm with the representative record at edge in only pixel; F. edge modifications: utilize two row to have the data of direction characteristic, the data of facing mutually when two diagonal angles, have the identical feature of black picture element and directivity simultaneously, then this diagonal angle data of facing mutually have one must revise, and the edge direction that makes two pixels is all near the consecutive point center.
Wherein the step of print-mode switchover is: according to the difference of printing model, the direction character of edge pixel is distributed to pixel under the printing model according to representative record, to the black picture element feature, utilize algorithm such as OR computing by the white pixel feature, print the addition of pixel characteristic under the pattern; White pixel under the corresponding printing model of the direction character of each white pixel; The black picture element of ad-hoc location under the corresponding printing model of the direction character of each black picture element.
Wherein the CMYK print-mode switchover is: when the CMY of a pixel three looks state for printing simultaneously, and the state of K then for printing, and CMY three looks change the state of not printing into; When the CMY of a pixel three looks are the state do not printed simultaneously, then K also is necessary for the state of not printing.
Wherein interpolation method is when edge feature during greater than the edge initial value, according to the directivity of edge feature, the GTG of the view data in this m * n form is carried out linear interpolation, to produce the GTG pixel of 2m * 2n.
Wherein the error diffusion ratio juris is after the GTG of the view data in this form carrying out interpolation, produce the GTG pixel of 2m * 2n, directivity according to edge feature, making the pixel gray level after the interpolation is black or white, and the pixel of its error accumulation to the next interpolation, GTG after error accumulation is turned black by bleach look or white of black, then sets up representative record in the view data of m * n, with the feature at record edge.
Wherein logical operation rule is in the representative record of the view data of m * n, if there has been the record of edge feature, then must utilization algorithm such as OR computing, keeping the record of different edge features, and utilization algorithm such as AND computing are to eliminate the record of same edge feature.
The present invention be used for instant handle desire the image of print file and the another kind of method of literal is achieved in that the processing of this method applicable to colour and gray scale image, it is as follows that it comprises step: the A.CMYK halftone process: the image that will desire print file is changed via CMYK, produce the CMYK image, again four colors of CMYK are carried out halftone process simultaneously, to determine the color of the required printing of this image pixel; The B.CMY conversion: the image that will desire print file is changed via CMY, produces the CMY image, so that three colors of CMY are carried out edge detection simultaneously; C. edge detection: utilize the grayscale difference of the view data of input, whether decision has an edge feature, if edge feature does not exist, does not then do any processing, if edge feature exists, then carries out the representative record of edge pixel; And calculate the view data in a m * n form, utilize boundary operation to ask the grayscale difference at edge, with as the edge feature value, in order to revise the edge threshold value; And utilize boundary operation to ask the directivity at edge, so that carry out the representative record of edge pixel; And with all are used for revising the edge threshold value greater than the edge feature value of edge initial value through after the average weighted computing in each row image, with the restraint-type of judging as the next column image border; D. print-mode switchover: the representative record of edge pixel is carried out pixel according to the difference of printing model distribute, whether print to determine each edge pixel; E.CMYK print-mode switchover: convert the edge pixel of CMY the edge pixel of CMYK to, to cooperate actual printing model.
The present invention partly does suitable processing with image in the view data and literal, makes the printing of image and literal more clear and undistorted.It is characterized in that to handle the view data that desire is printed immediately, and do not need complete viewdata signal.Its method is the difference with gray-scale distribution in the image, utilizes the principle of error-diffusion method (errordiffusion) to carry out redistributing of edge pixel, makes the edge more clear and level and smooth.
Embodiment
The shortcoming that The present invention be directed to the traditional prints method is improved, an instant photomechanical printing or Method of printing is provided, can do to strengthen processing at literal and lines, and not influence the GTG effect of image as far as possible, therefore applicable to general printing, fax, copy and Flame Image Process.
With the color print image is example, the flow process of its disposal system as shown in Figure 1, at first with the original copy of file after scanning module scanning sampling, form digitized RGB data input, strengthen handling via CMYK conversion, halftone process and picture and text, produce the CMYK half tone image, print via printing module more at last.In the process of printing, with the color inkjet printer of present low to medium price level, normal (normal) resolution of its printing is usually based on 600dpi; And color is based on CMYK four looks, and each color dot all has only prints and does not print two kinds of outputs.Therefore being sampled to print file from scanning all must be through CMYK conversion, halftone process, and the position that the proper arrangement shades of colour is printed is so that human eye can be experienced the variation of color and GTG.Carry out the processing that picture and text are strengthened simultaneously, do not influencing under the variation of color and GTG as far as possible, make the printing of literal and lines clearer.
Do picture and text and strengthen, the characteristic of necessary first Study document, generic-document generally includes two major parts:
The first kind is the part that limbus is arranged with background, for example literal, lines, special symbol etc., and itself color and GTG are all very simple.
Second class is the part that does not have limbus with background, for example image partly, the variation of tool color and GTG is all very abundant.
According to above-mentioned difference, can utilize an edge whether to exist to come suitable cutting apart done in literal and image.It is example that the picture and text that are applied in coloured image with the present invention are strengthened, and must first do suitable conversion to the RGB image so that carry out edge detection, and the flow process of its reinforcement below illustrates it respectively as shown in Figure 2:
(1) CMY conversion: the RGB image transitions be become the colour print pattern, just must do the CMY conversion earlier.Though actual colour print pattern is CMYK, if but the RGB image is directly changed into the CMYK image, will have influence on the rim detection of later step, its reason is because the formation of K look is the Partial Feature of absorbing CMY three looks respectively, also because so formation of K look, will reduce the edge feature of CMY three looks, and cause the edge of CMYK four looks all to be difficult to monitoring.Therefore can only do simple CMY conversion here earlier, its formula is as follows:
Wherein f (x) is the GTG of x pixel.
(2) edge threshold value: whether will judge a marginal existence traditionally, just must set an edge threshold value, and the setting of this edge threshold value, normal according to some thumb rule or the statistic of whole image, the feature that does not often meet real image maybe can't satisfy the effect of instant printing.And the present invention adopts type variable edge threshold value to be used as the restraint-type that the edge is judged, utilizes each row edge of image feature to revise the edge threshold value, with the restraint-type of judging as the next column image border.
At first set the edge initial value according to thumb rule, make the edge threshold value equal the edge initial value, utilize one 3 * 3 boundary operation to ask edge feature again, its feature comprises the coordinate of pixel, the direction and the edge feature value at edge.When edge feature value weighted mean edge feature value then during, when a row image finishes, then with weighted mean correction edge threshold value greater than the edge initial value.If the edge threshold value less than the edge initial value, then makes the edge threshold value equal the edge initial value, its flow process as shown in Figure 4.
(3) edge detection and distribution: the present invention utilizes one 3 * 3 boundary operation to monitor edge feature, because edge feature has directivity, so the present invention also utilizes the feature of this directivity to carry out the edge distribution.In order to write down the feature of directivity really, the present invention utilizes two bit groups to represent a feature that pixel had, and comprises position distribution, edge modifications coefficient, the direction character of black picture element and the direction character of white pixel of black picture element.When edge feature value during greater than the edge threshold value, at first find out the direction of maximal margin eigenwert, distribute rule to convert thereof into the position allocated code according to pixel, be recorded in the center pixel of boundary operation, and the data-signal of removing center pixel original position distribution, and then carry out the direction character distribution of other pixels, and allow edge feature distribute to edge pixel really, its flow process is as shown in Figure 5.
(4) direction character distributes: with regard to general pattern, if GTG be dark pixels in the left side and light pixel on the right side, then the variation of its GTG generally is to be gradual to increase progressively.Therefore with regard to the edge of a real image, after computing via boundary operation, the edge feature value that may obtain a plurality of edge pixels is greater than the edge threshold value, how to have in the pixel of edge feature at these, black picture element and white pixel are distributed in correct marginal position, will have influence on last print quality.The present invention proposes a cover logical operation rule, can choose an only edge feature from a plurality of edge feature values distributes to carry out the edge, not only eliminate the directivity difference that the sub-order of operation difference of boundary operation is produced, it is unsmooth also to have eliminated the caused edge of error-diffusion method, has improved last print quality.
This logical operation method is to utilize the directivity of each pixel to be AND (﹠amp; ) or OR (|) computing.For example, if in the image GTG be dark pixels in the left side and light pixel on the right side, via boundary operation from top to bottom by a left side after the right computing, when new edge feature occurs and directivity be left, then check the pixel of the sub-left of boundary operation earlier, whether possessed the feature of white pixel direction,, represented that then the pixel of left has been set to white pixel if the pixel of left has possessed the feature of white pixel direction for a left side for a left side.Since the direction in dark pixels all is set to white, it is left that thing followed center pixel also will be set to white and directivity.
If the pixel of the sub-left of boundary operation does not possess the feature of white pixel direction for a left side, then utilize interpolation method and error diffusion ratio juris to decide, the black picture element direction be write the pixel of the sub-left of boundary operation or the center pixel of boundary operation for left feature.
When decision will write center pixel for left feature with the black picture element direction, just must remove earlier that the black picture element direction is left feature in the sub-left pixel of boundary operation, be that the feature on a left side repeats in identical edge feature to avoid edge black picture element direction.Must remove also simultaneously that the white pixel direction writes the sub right-hand pixel of boundary operation for left feature in the center pixel.
If decision will write the black picture element direction pixel of the sub-left of boundary operation for the feature on a left side, then whether possessed the feature of black picture element direction in the pixel of inspection left earlier for a left side, if the pixel of left has possessed the feature of black picture element direction for a left side, then remain stationary.Otherwise the black picture element direction is write the pixel of the sub-left of boundary operation for the feature on a left side, and the white pixel direction is write center pixel for left feature.
If new edge feature occurs, and its directivity is not a left side, and then the direction character distribution method is identical, and allocation flow is slightly different.
(5) interpolation method and error principle: owing to be generally 300dpi by the resulting image of scanner, and normal (normal) resolution of printing is usually based on 600dpi, although before printing, the RGB image transitions of 300dpi must be become the CMYK image of 600dpi, but in edge detection and branch timing, if handle with the data volume of 600dpi, not only consuming time and account for storer, and be easy to cause the loss of edge feature to the conversion of 600dpi at 300dpi.The present invention then is a ultimate principle of utilizing interpolation method and error diffusion, and the edge of simulating 600dpi with the 300dpi edge feature distributes.Interpolation method wherein is to do the linear interpolation of GTG at the pixel in 3 * 3 boundary operation, to produce 6 * 6 GTG pixel.And then the ultimate principle of utilizing error diffusion decides and the black picture element direction will be write the pixel of r direction in boundary operation or the center pixel of boundary operation for the feature of r, and the position of decision black picture element is distributed.And the principle of error diffusion is the state of GTG value for printing or not printing after the hypothesis interpolation, its error amount equals the GTG value after the print state value cuts interpolation, to be accumulated to the GTG of next interpolated pixel by propagation of error coefficient (t) according to the directivity at edge, when the accumulated value of GTG error by changing to greater than 127 or by changing to smaller or equal to 127 greater than 127, the expression marginal point is arranged in interpolated pixel smaller or equal to 127.Therefore can utilize the method to decide and the black picture element direction will be write the pixel of the sub-r direction of boundary operation or the center pixel of boundary operation for the feature of r.
Mixing at the position of black picture element branch then is the principle of utilizing error diffusion, decides the pixel of r direction or the position of its black picture element of center pixel whether to meet its directivity.Generally speaking, the position of black picture element is identical with its directivity usually, but if the correction of black picture element position then still will be done, to avoid the displacement at edge in the position that the GTG accumulated value of error diffusion is not enough to produce black picture element.So can determine the position of black picture element to distribute, make more the gear to actual circumstances GTG of image of locations of pixels distribute.
(6) edge modifications: though above-mentioned edge distributes the GTG effect that can obtain approximate original image, but difference because of original image and print image resolution, will make the edge of same direction, the difference of having only a pixel at low-res, after improving resolution, produce the difference of two or more pixels, and make the edge appear to have zigzag or discontinuous.In order to solve this puzzlement, the present invention utilizes two row to have the data of direction characteristic, make edge modifications, check whether the adjacent data in diagonal angle have black picture element and the identical feature of directivity simultaneously, if have, represent that then this edge pixel is discontinuous, then this diagonal angle data of facing mutually have one must revise, make these two black picture element position differences that data write down unlikely too big, and look like continuous appearance.
(7) print-mode switchover: by the gray scale variation of original image, can obtain the direction character of each edge pixel, but since the difference of printing model the direction character of edge pixel must be redistributed, to improve print quality.In this normal colour print pattern at 600dpi, the RGB image of general 300dpi must just can reach the effect of 600dpi earlier by the conversion of printing model, so the direction character of edge pixel also must just can reach the effect of 600dpi by the conversion of printing model.Generally speaking, each pixel has eight neighbors usually, therefore we can say that also each pixel has eight directivity, and under the normal print mode, the pixel of an original image can produce 4 positions under the normal print mode, therefore the pixel of eight directions must be assigned to 4 positions under the normal print mode.And the present invention utilizes a bit group possible position of encoding under all normal print modes to distribute, comprising the position of black picture element, white pixel distribute and during edge modifications the position of black picture element, white pixel distribute.
In other words, in the pixel of original image, each edge pixel all can be with two bit group record edge feature data, correspond to the printing model coding of a bit group again according to the difference of printing model, just can learn by the printing model coding whether each pixel will be printed, and its flow process as shown in Figure 6.
(8) CMYK conversion: by the resulting result of above-mentioned steps is the edge pixel distribution of CMY under the printing model, and actual printing model is CMYK, therefore be necessary the edge pixel of CMY is distributed the pattern that converts CMYK to, so not only can reduce the consumption of color inkjet printer, also can avoid the CMY three looks superimposed inaccurate deviation that causes color pigment.The steps include: that under printing model when a pixel has edge feature, and CMY three looks are all must print the time, then replace and print, and CMY three looks are not printed, when a pixel has edge feature by the K look, and when CMY three looks were not printed, then the K look was not printed.When all the other do not have edge feature when pixel, then do not change its printing opportunity, its process flow diagram such as Fig. 7.
Cooperate Fig. 8-Figure 11, a specific embodiment of the present invention is described.At this GTG with monochrome image is example: the GTG of supposing the 300dpi image that one scan is come in as shown in Figure 8.Its gray scale variation fades to 0 edge that expressed possibility by 255 and exists, and at this with 3 * 3 boundary operation monitoring, its step is as shown in Figure 9.If three resulting edge feature values of boundary operation of the last figure of hypothesis then must be found out only marginal position all greater than the edge threshold value in these three boundary operation.Suppose that at first these three boundary operation all have only an edge feature value, then utilize linear interpolation with its gray-scale distribution interpolation, and then utilize the error diffusion ratio juris, direction along edge feature, it is the direction that GTG successively decreases, this row error diffusion (coefficient of diffusion is assumed to be 0.5), its step following (referring to Figure 10):
First step: known boundary operation 1 resulting edge feature value is greater than the edge threshold value, at first distribute rule in the resulting pixel of pixel C record maximal margin eigenwert, and then edge operator 1 is carried out interpolation, if the GTG b ' after the interpolation is assumed to be not print state (GTG is 255), then its error 255-b ' multiply by coefficient of diffusion 0.5 and is accumulate to GTG c, the GTG error accumulation value that can find c remains inclined to one side white greater than 127; If GTG c ' is assumed to be not print state (GTG is 255), then its error 255-c ' multiply by coefficient of diffusion 0.5 and is accumulate to GTG d, the GTG error accumulation value that can find d is less than 127 inclined to one side black, that is to say by pixel C to pixel D, its GTG is black by leucismus, marginal existence is arranged, and therefore must write down the white pixel direction in pixel C is right record, and record black picture element direction is right record in pixel D.
In addition, utilize the principle of error diffusion to determine whether the direction that the edge distributes among the pixel D needs to revise again, just GTG c ' is assumed to be not print state, then its error 255-c ' multiply by coefficient of diffusion 0.5 and is accumulate to GTG d, the GTG error accumulation value that can find d is less than 127 inclined to one side black, so the black picture element at edge should be distributed in the direction of GTG d, but not the direction of GTG d '.
Second step: after boundary operation 1 finishes, carry out the computing of boundary operation 2, can find boundary operation 2 resulting edge feature values greater than the edge threshold value, the expression marginal existence; At first distribute rule in the resulting pixel of pixel D record maximal margin eigenwert, and then edge operator 2 is carried out interpolation, and calculate with the error diffusion ratio juris, obtain pixel C to pixel D, its GTG is black by leucismus, but there have been the edge feature record in pixel C and pixel D, therefore must use the edge feature record of logical operation rule correction pixel C and pixel D, just increase new direction character, and keep same characteristic features.Does the last direction of the principle decision pixel D edge distribution of error diffusion of utilizing again need to revise? its result is identical with step 1.
Third step: after boundary operation 2 finishes, carry out the computing of boundary operation 3, can find boundary operation 3 resulting edge feature values greater than the edge threshold value, the expression marginal existence; At first distribute rule in the resulting pixel of pixel E record maximal margin eigenwert, whether the direction (pixel D just) that next checks white edge has possessed the black picture element direction and has been right record, if having then be left intact, the expression edge exists, and need not revise.
Comprehensive above-mentioned three steps can obtain pixel C record white pixel direction and be right record, and record black picture element direction are right record in pixel D, and direction are revised left.If 300dpi edge image gray-scale distribution such as Figure 11 a that hypothesis is above-mentioned, after computing through traditional error-diffusion method, suppose to print with the 600dpi normal mode, the possibility of result of its printing model is shown in Figure 11 b, wherein B representative printing or not in the w representative, can find that its edge variation is not remarkable, therefore the result by edge detection of the present invention is improved, pixel C record white pixel direction is encoded into the state of not printing for right record, record black picture element direction among the pixel D is revised the state that print in the left side that is encoded into left for the record and the direction on the right side, remainder does not then change, result behind its coding is shown in Figure 11 c, again the distribution at layout edge effectively makes the edge more level and smooth and reduce the interference of noise.