Detailed Description
The embodiment of the invention provides an automatic imposition method and device, which can obtain a cuttable imposition result and avoid waste of printing materials when a layout material needing to transversely or longitudinally penetrate through a layout for cutting is used for performing imposition printing.
As shown in fig. 3, an automatic imposition method provided by an embodiment of the present invention includes:
s301, selecting a blank rectangular area from blank rectangular areas to be impossed on the layout as a current imposition rectangular area.
The current makeup rectangular area can be specifically selected according to the following selection rules: and sorting the blank rectangular areas to be impossed according to the area size, and preferentially selecting the blank rectangular area with the largest area, or preferentially selecting the blank rectangular area with the smallest area.
S302, determining a page to be impossed in each page to be imposed, imposing the page to be imposed in the current imposition rectangular area, wherein at least two boundaries of the page to be imposed are overlapped with two boundary lines of the current imposition rectangular area.
The determined page to be impossibly imposed is within the current imposition rectangular area, namely the range of the imposed page does not exceed the range of the current blank imposition rectangular area.
S303, when determining that the residual region after makeup exists in the current makeup rectangular region, judging whether the shape of the residual region is a rectangle, if so, taking the residual region and the current blank rectangular region on the layout as a blank rectangular region to be makeup, if not, dividing the residual region into two rectangular regions, and taking the two divided rectangular regions and the current blank rectangular region on the layout as a blank rectangular region to be makeup;
and repeating the steps until all pages to be imposred are impossibly completed, or the blank rectangular area to be imposred on the page cannot be impossibly imposed on any page to be imposed.
As shown in fig. 4, a remaining area a exists in the blank rectangular area after page P imposition, which may be divided horizontally to obtain two rectangles B and C, or divided vertically to obtain two rectangles B 'and C'.
The specific division rule, that is, how to determine the horizontal division or the longitudinal division, can be comprehensively considered according to the width, the height and the area of the layout, the width, the height and the area of each page to be imposted, and other factors. For example, for a page p, imposition is in a blank rectangular area f, and the width and height of the page p are Wp、HpThe width and height of the blank rectangular region f are Wf、Hf(ii) a If W isp×(Hf-Hp)≥Hp×(Wf-Wp) And if not, dividing the data in the longitudinal direction. It is also possible to divide the rule as follows if (W)f-Wp)≥(Hf-Hp) And if not, dividing the data in the longitudinal direction.
Different division rules can obtain different makeup results, the utilization rate of the layout is possibly different, the number of last cutting knives is also possibly different, and which division rule is adopted is determined according to actual conditions. Of course, the division rule is not limited to the two rules set forth above, and a cuttable imposition result can be obtained by dividing the remaining area into two rectangles.
In addition, different division schemes can be tried, and the imposition result with the highest layout utilization rate can be determined and then printed.
As shown in fig. 5, before step S301, the method further includes: a blank rectangular area to be impossed of a layout is predetermined; the specific process is as follows:
s501, analyzing the width and the height of all pages to be imposted and analyzing the width and the height of the layout.
S502, inquiring a system knowledge base according to the analysis result, judging whether a makeup mode is used, and if so, executing a step S503; otherwise, step S504 is executed.
The imposition problem can be abstracted as a two-dimensional binning problem (Non-deterministic polynomial, NP) complete problem with high computational complexity (see GAREY M R, JOHNSON D.S. computers and properties [ M ]. San Francisco: Freeman, 1979). In the automatic imposition method in the prior art, the obtained imposition result is approximate suboptimal solution rather than optimal solution, namely, the waste of layout space exists. And the optimal solution exists for the layout with certain characteristics and the page to be imposted. The system knowledge base is a database used for storing the feature data of the layout with the optimal solution and the page to be impossed and storing the corresponding optimal solution, and the optimal solution indicates how to divide an initial blank rectangular area to be impossed on the layout in advance.
And S503, marking off an initial blank rectangular area to be impossed on the layout.
And using an imposition mode, namely preliminarily dividing the layout into initial blank rectangular areas to be imposed according to the optimal solution indicated by the system knowledge base, and determining the width, height and rotation angle of pages allowed to be imposed in each blank rectangular area. When the layout is divided into at least two blank rectangular areas to be impossed, the following requirements are met: partial or all wait to piece together a limit in blank rectangular region can be connected into at least one horizontal line or perpendicular line in order, the start and stop point of horizontal line is located respectively on the left and right border of the space of a whole page, the start and stop point of perpendicular line is located respectively on the upper and lower border of the space of a whole page. That is, the initial division of the blank rectangular area to be imposable also satisfies the requirement of cuttability.
In the embodiment of the invention, a type of page to be imposition is represented by binary tp (w, h, r),w is the page width, h is the page height, r represents the clockwise rotation angle when making up, the category set of all pages to be made up is Stp(ii) a Representing a blank rectangular area by a quadruple gr (x, y, W, H), wherein x and y represent the coordinates of the vertex of the lower left corner of the blank rectangular area on the layout, W represents the width of the blank rectangular area, H represents the height of the blank rectangular area, and the set of all gr is Sgr(ii) a The complete panel is GP. The imposition mode defines StpTo SgrThe mathematical definition of the mapping f, f is as follows:
<math>
<mrow>
<msub>
<mi>S</mi>
<mi>tp</mi>
</msub>
<mover>
<mo>→</mo>
<mi>f</mi>
</mover>
<msub>
<mi>S</mi>
<mi>gr</mi>
</msub>
<mo>,</mo>
<mi>gr</mi>
<mo>=</mo>
<mi>f</mi>
<mrow>
<mo>(</mo>
<mi>tp</mi>
<mo>)</mo>
</mrow>
<mo>,</mo>
<mi>gr</mi>
<mo>∈</mo>
<msub>
<mi>S</mi>
<mi>gr</mi>
</msub>
<mo>,</mo>
<mi>tp</mi>
<mo>∈</mo>
<msub>
<mi>S</mi>
<mi>tp</mi>
</msub>
<mo>,</mo>
<munder>
<mi>∪</mi>
<mrow>
<mi>gr</mi>
<mo>∈</mo>
<msub>
<mi>S</mi>
<mi>gr</mi>
</msub>
</mrow>
</munder>
<mi>gr</mi>
<mo>=</mo>
<mi>GP</mi>
</mrow>
</math>
in addition, in the imposition mode, the mapping relation between the blank rectangular area and the page to be imposed has inheritance. That is, when the remaining region is used as the blank rectangular region to be impossed in step S303, not only the quadruplet gr '(x', y ', W', H ') of the remaining region but also the quadruplet tp' (W ', H', r ') of the imposition page corresponding to the blank rectangular region where the remaining region was present before imposition is recorded and stored in the array (gr' (x ', y', W ', H'), tp '(W', H ', r')). Therefore, only the specified type of page to be imposition can be imposed in the remaining area.
S504, taking the whole layout area as a blank rectangular area to be impossed.
When the imposition mode is not adopted, the mapping relation does not exist between the blank rectangular area and the page to be imposed, which can be imposed in the current imposition rectangular area in any width and height, can be imposed in the current imposition rectangular area. The page to be impossed in the current imposition rectangular area can be imposed by imposition, which means the page to be imposed within a range not exceeding the current imposition rectangular area.
As shown in fig. 6, when the imposition mode is adopted, the method for determining a page to be imposed in step S302 includes:
s601, determining that the width and the height of the page to be impossed in the current imposition rectangular area are respectively the page to be imposition with the width and the height of the page to be imposition allowed in the current imposition rectangular area, or determining that the width and the height of the page to be imposition allowed are respectively the page to be imposition of integral multiples of the width and the height of the page to be imposition after the page to be imposition is rotated according to the rotation angle from the page to be imposition allowed in the current imposition rectangular area.
For example, to imposition a page set to be imposed, which is composed of three types of pages to be imposed, namely tp1(w1, h1), tp2(w2, h2) and tp3(w3, h3), on a certain layout, the layout is divided into three blank rectangular areas according to a system knowledge base: gr1(x1, y1, W1, H1), gr2(x2, y2, W2, H2), gr3(x3, y3, W3, H3); meanwhile, the system knowledge base indicates pages to be imposition to which the respective blank rectangular regions are respectively mapped, and records are (gr1(x1, y1, W1, H1), tp1(W1, H1, r1)), (gr2(x2, y2, W2, H2), tp2(W2, H2, r2)), (gr3(x3, y3, W3, H3), tp3(W3, H3, r 3)). Tp1(W1, H1) after rotation according to r1 is allowed to be spliced into gr1(x1, y1, W1, and H1), tp2(W2, H2) after rotation according to r2 is allowed to be spliced into gr2(x2, y2, W2, and H2), and tp3(W3, H3) after rotation according to r3 is allowed to be spliced into gr3(x3, y3, W3, and H3). Therefore, after the blank rectangular area is determined, the page to be impossed with the corresponding specification is pieced into the blank rectangular area.
In order to enhance the adaptability of the system knowledge base, reduce the classification quantity of pages to be imposition, flexibly process the mapping relation, and also can piece parts of pages to be imposition which do not meet the mapping relation into a blank rectangular area. For example, if tp1(W1, H1), tp4(2 x W1, H1) and tp4 are regarded as two tp1 when determining the mapping relation of the imposition patterns in the page to be imposed, for gr1(x1, y1, W1, H1) allowing to be imposed on tp1(W1, H1), tp4(2 x W1, H1, r1) is also allowed to be imposed on the page to be imposed. Moreover, as the area of tp4 is larger than that of tp1, tp4 can be firstly spliced, and the shortage of subsequent space is avoided. For another example, for the map (gr1(x1, y1, W1, H1), tp1(W1, H1, r1)), assuming that the rotation angle r1 of tp1 spliced into gr1 is 90 degrees, tp5 is allowed to be spliced into gr1 (H1, W1).
S602, selecting a page to be impossed from the determined pages to be imposed.
When a plurality of pages to be impossed are determined to be obtained, selecting one page to be impossed from the determined pages to be impossed; and when the only page to be impossed is determined to be obtained, directly taking the determined page to be impossed as the selected page to be impossed.
As shown in fig. 7, when the imposition mode is not adopted, the method for determining a page to be imposed in step S302 includes:
s701, determining the page to be impossed which meets the principle of least space waste according to the width and the height of each page to be impossed and the width and the height of the current imposition rectangular area.
For example, for a page p to be imposted, the width and height of the page p are respectively Wp、HpShowing that the width and the height of the current imposition rectangular area f are respectively Wf、HfS701 determines the page to be imposition by using the following selection method, as shown in fig. 8, including:
s801, judging whether W exists or notp==WfAnd Hp==HfIf so, W will be satisfiedp==WfAnd Hp==HfThe page to be spliced is taken as the determined page to be spliced, and the process is finished; otherwise, go to step S802;
s802, judging whether W exists or notp==HfAnd Hp==WfIf so, W will be satisfiedp==HfAnd Hp==WfThe page to be spliced is taken as the determined page to be spliced, and the process is finished; otherwise, step S803 is executed;
s803, taking the page with the largest area in the pages to be impossed in the current imposition rectangular area as the determined page to be imposed;
or, the page to be imposable in the current imposition rectangular area is capable of being imposed, Min (W)f-Wp,Hf–Hp) Taking the page with the minimum value as a determined page to be imposted;
or, the page to be imposable in the current imposition rectangular area is capable of being imposed, Min (W)f-Wp,Hf–Hp) And taking the page with the minimum value as the determined page to be imposted.
S702, selecting one page to be imposition from the determined pages to be imposition.
When a plurality of pages to be impossed are determined to be obtained, selecting one page to be impossed from the determined pages to be impossed; and when the only page to be impossed is determined to be obtained, directly taking the determined page to be impossed as the selected page to be impossed.
As shown in fig. 9, in S602 of fig. 6 and S702 of fig. 7, when it is determined that a plurality of pages to be imposition are obtained, the method for selecting one page to be imposition from the determined pages to be imposition includes:
and S901, determining the ink channel direction.
The ink channel direction is the printing direction of the printing surface during printing.
S902, calculating the color approximation degree of each page to be impossed after the current imposition rectangular area and the adjacent page in the ink channel direction.
For any two pages P to be imposteda,Pb,PaAnd PbThe color approximation matrix of (a) is defined as follows:
wherein sizeof represents the page area, Sim (P)a,Pb) The value is one (key) tuple, and the key is P after impositionaAnd PbRelative position (Pos)x,Posy) Value is the calculated color approximation for that relative position.
Constructing a set of pixels S, S comprising Pa、PbIn relative position (Pos)x,Posy) P in the maximum overlapping area after moving along the designated directiona、PbPixel of (d), S { (P)ai,Pbi) In which P isaiIs PaOf one pixel, PbiIs PbIs neutralized with PaiPixels having the same position in the maximum overlapping area. Sim (P)a,Pb) The definition of the function is specifically as follows:n is the number of elements in S,is thatA normalization processing function. The function D is used to calculate the color difference, analyzing two pixels (L) in color space for any CIELABi,ai,bi),(Lj,aj,bj) Has a color difference of The smaller the Sim value, the page Pa,PbThe more similar the colors. If the relative position is different, the Sim value is also different.
Therefore, the color approximation degree of the two pages at the specific relative position is calculated, namely the maximum overlapping area is obtained by moving along the ink channel direction, and the Sim function operation is carried out on the two pages in the overlapping area. As shown in fig. 10, the color approximation degrees of the page 1 and the page 2 are calculated, that is, the shadow area portions of the page 1 and the page 2 are taken to perform Sim function operation.
And S903, selecting one page to be imposition from the determined pages to be imposition according to the color similarity.
Therefore, on the premise of not influencing the area utilization rate of the layout, the typesetting is carried out according to the color approximation degree, and the color effect of the printing can be improved.
Specific examples of the present invention are given below.
In this embodiment, the size of the layout is 855 × 705, and there are 9 layouts to be processedImposition pages of the size of page P1(285 × 420), P2-P9 (285 × 210), wherein the colors of P5, P6 and P7 are Lab (50, 100, 0), the other page colors are Lab (50, 0, 100), and the printing ink channel direction is set to be the longitudinal direction.
As shown in fig. 11, the imposition process includes the following steps:
s1101, determining a selection rule of a page to be imposted: preferentially putting a page to be impossed with a larger area into a current imposition rectangular area;
s1102, determining a use imposition mode, wherein the imposition mode is as follows: (tp)1(285,210,0),gr1(0,0,855,420)),(tp2(285,210,90),gr2(0,420,855,285);
S1103, selecting the largest blank rectangular area from all blank rectangular areas to be impossed as the current imposition rectangular area;
s1104, judging whether a page to be imposred meeting the size requirement of the current imposition rectangular area exists in the page set to be imposed, and if so, executing S1105; otherwise, go to S1108;
s1105, selecting a page to be impossed according to the color similarity, impossing in the current imposition rectangular area according to the corresponding rotation angle, and deleting the selected page to be impossed in the page set to be imposed;
s1106, judging whether the current imposition rectangular area has a residual area, if so, executing S1107; otherwise, go to S1108;
s1107, directly or after dividing the residual area of the current makeup rectangular area, taking the residual area as a blank rectangular area to be subjected to makeup;
s1108, deleting the current makeup rectangular area;
s1109, judging whether blank rectangular areas to be imposed exist or not, and if so, executing the step S1103; otherwise, ending.
According to the steps, P1, P2, P3 and P4 are impossed on the layout in sequence, as shown in FIG. 12. When the fifth page needs to be imposted, the color similarity between P8 and P3 and P5 is calculated to be smaller than the color similarity between P5, P6 and P7 and the color similarity between P3 and P5 respectively, so that P8 is preferentially put in, as shown in FIG. 13. The final imposition results are shown in FIG. 14.
As shown in fig. 15, an embodiment of the present invention provides an automatic imposition device, including:
the imposition unit 1501 is used for selecting a blank rectangular area from blank rectangular areas to be imposed on a layout as a current imposition rectangular area; determining a page to be impossed in each page to be imposed, imposing the page to be imposed in the current imposition rectangular area, wherein at least two boundaries of the page to be imposed are overlapped with two boundary lines of the current imposition rectangular area; repeating the steps until all pages to be imposred are impossibly completed, or the blank rectangular area to be imposred on the layout can not be impossibly made any page to be imposred;
a remaining region dividing unit 1502, configured to, when it is determined that a remaining region after imposition exists in the current imposition rectangular region, determine whether the shape of the remaining region is a rectangle, if so, take the remaining region and a current blank rectangular region on the layout together as a blank rectangular region to be imposed, if not, divide the remaining region into two rectangular regions, and take the two divided rectangular regions and the current blank rectangular region on the layout together as a blank rectangular region to be imposed.
Preferably, the apparatus further comprises: the layout pre-processing unit is used for marking out an initial blank rectangular area to be impossed on the layout in advance;
the layout preprocessing unit is specifically configured to: determining an initial blank rectangular area to be impossed divided on the layout and determining the width, height and rotation angle of a page allowed to be impossed in each blank rectangular area to be impossed according to the width and height of the layout and the width and height of each page to be impossed; when the layout is divided into at least two blank rectangular areas to be impossed, the following requirements are met: partial or all wait to piece together a limit in blank rectangular region can be connected into at least one horizontal line or perpendicular line in order, the start and stop point of horizontal line is located respectively on the left and right border of the space of a whole page, the start and stop point of perpendicular line is located respectively on the upper and lower border of the space of a whole page.
Preferably, the imposition unit 1501 is configured to, when determining a page to be imposed, specifically:
determining that the width and the height of the page to be impossed in the current blank rectangular region are respectively the width and the height of the page to be impossed in the current blank rectangular region, or determining that the width and the height of the page to be impossed in the current blank rectangular region are respectively integral multiples of the width and the height of the page to be impossed after the page to be impossed rotates according to the rotation angle;
and selecting one page to be impossed from the determined pages to be imposed.
Preferably, the remaining area dividing unit 1502 is further configured to: and when determining that the residual region after the imposition exists in the current imposition rectangular region, determining the width, the height and the rotation angle of the page which is allowed to be imposed in the residual region, wherein the width, the height and the rotation angle are respectively the width, the height and the rotation angle of the page which is allowed to be imposed in the current imposition rectangular region.
Preferably, the imposition unit 1501 is configured to select a blank rectangular region from blank rectangular regions to be imposed on a layout, and before the blank rectangular region is used as the current imposition rectangular region, is further configured to: and taking the whole layout area as a blank rectangular area to be impossed.
Preferably, the imposition unit 1501 is configured to, when determining a page to be imposed, specifically:
determining the page to be impossed which meets the principle of least space waste according to the width and the height of each page to be impossed and the width and the height of the current blank rectangular area;
and selecting one page to be impossed from the determined pages to be imposed.
Preferably, the imposition unit 1501 is configured to, when determining the page to be imposed that satisfies the principle of least space waste according to the width and height of each page to be imposed and the width and height of the current blank rectangular region, specifically:
judging whether a first type of page to be impossed with the width and the height respectively equal to those of the current blank rectangular area exists, and if so, taking the first type of page to be impossed as a determined page to be impossed; if not, then,
judging whether a second type of page to be impossed with the height and width respectively equal to the width and the height of the current blank rectangular area exists, if so, taking the second type of page to be impossed as a determined page to be impossed; if not, then,
selecting the page to be impossed with the largest area as the determined page to be impossed from the pages to be impossed which can be impossed in the current blank rectangular area; or, determining the difference value between the width of each page to be impossed and the width of the current blank rectangular area from the pages to be impossed which can be impossed in the current blank rectangular area, determining the difference value between the height of each page to be impossed and the height of the current blank rectangular area, and taking the page to be impossed with the minimum smaller value of the two difference values as the determined page to be impossed; or, determining the difference value between the width of each page to be impossed and the width of the current blank rectangular area from the pages to be impossed which can be impossed in the current blank rectangular area, determining the difference value between the height of each page to be impossed and the height of the current blank rectangular area, and taking the page to be impossed with the minimum larger value of the two difference values as the determined page to be impossed.
Preferably, the imposition unit 1501 is configured to, when selecting one page to be imposed from the determined pages to be imposed, specifically:
determining the ink channel direction;
calculating the color approximation degree of each page to be impossed after the current blank rectangular area and the adjacent page in the ink channel direction;
and selecting one page to be imposition from the determined pages to be imposition according to the color approximation degree.
Preferably, the imposition unit 1501 is configured to, when calculating the color similarity between the determined imposition of each page to be imposed after the current blank rectangular area and the adjacent page in the ink channel direction, specifically:
determining the maximum overlapping area of each determined page to be impossed and the adjacent page after the determined page to be impossed moves along the ink channel direction;
and determining the color similarity of each determined page to be impossed and the adjacent page according to the pixels in the overlapping area of each determined page to be impossed and the pixels in the overlapping area of the adjacent page.
Preferably, the remaining area dividing unit 1502 is configured to, when dividing the remaining area into two rectangles, specifically:
transversely dividing the residual region to obtain two rectangles; or,
and longitudinally dividing the residual region to obtain two rectangles.
In summary, the embodiments of the present invention provide an automatic imposition method and apparatus, which can obtain a cuttable imposition result when performing imposition printing using a layout material requiring cutting of a horizontally or vertically through layout, thereby avoiding waste of printing materials; when the imposition mode is used, the best imposition result can be obtained, and the utilization rate of the layout is improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.