Method and device for printing longitudinal high PASS number image and storage medium
By accurately reading PRN file information and calculating PASS number by stepping the method, the ink droplet distribution is optimized, and the problems of vertical high PASS number image printing uniformity and large nozzle burden in the prior art are solved, and high-quality and high-precision printing effect is achieved.
Patent Information
- Application Number
- CN202411676370.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-21
AI Technical Summary
When printing vertical high PASS images, the interleaving PASS, random PASS and group PASS methods have their own disadvantages, which leads to difficult to ensure image uniformity, high burden on the nozzle, uneven distribution of ink droplets, which affects the printing quality.
By accurately reading PRN file information and calculating the PASS number by jumping, ensuring that the vertical resolution of the image can be restored as needed, and the details are presented clearly, avoiding blur or missing. Optimize the distribution of ink drops, and the color transition is natural and smooth, avoiding defects such as color faults, dark and horizontal lines.
High-quality and high-precision longitudinal high PASS number image printing is achieved, ensuring the uniformity and visual effect of the image, reducing the burden on the nozzle, and improving the printing efficiency and quality.
Smart Images

Figure CN119620968A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of printers, and in particular to a method, a device and a storage medium for printing a longitudinal image with a high PASS number. Background Art
[0002] At present, inkjet printers have a reference resolution (also called PASS resolution, that is, the resolution when printing 1PASS, PassDPI) when they leave the factory. For example, common resolutions are 360x300DPI and 360*600DPI, of which 360 is called the horizontal reference resolution (XPassDPI) and 300 / 600 is called the vertical reference resolution (YPassDPI). The reference resolution is generally related to the physical resolution of the grating / magnetic grating and the nozzle. The resolution of the printed image must be an integer multiple of the reference resolution. When the horizontal resolution of the printed image is equal to the horizontal reference resolution of the printer, and the vertical resolution of the printed image is an integer multiple of the vertical reference resolution of the printer, it is called vertical high PASS printing. When printing with vertical high PASS, different PASS orders and walking methods will have different effects on the uniformity of the final inkjet print.
[0003] (1) Staggered PASS (such as alternating odd and even lines), which has high algorithm requirements and is prone to matching problems: This PASS order relies on a relatively complex algorithm to accurately control the timing and position matching of the ink droplets of odd and even lines. If the printer's control algorithm is not accurate enough, there may be deviations in the longitudinal alignment or connection of the ink droplets of odd and even lines, resulting in a local sense of misalignment in the image and destroying the overall uniformity. For example, when printing a fine grid pattern, you may see that the grid lines appear staggered, affecting the printing effect, increasing the burden on the printhead and the risk of inkjet instability: the printhead needs to frequently switch the spray state between odd and even lines. Compared with sequential PASS, the working rhythm of the printhead is more complicated, which may increase the burden on the printhead and cause the printhead to become fatigued or experience short-term inkjet instability. Once this instability occurs, due to the staggered arrangement, it may cause irregular ink drop distribution differences, resulting in uneven density of ink dots in certain areas of the printed image, which in turn affects uniformity and places higher requirements on paper and ink compatibility: staggered PASS has stricter requirements on paper's ink absorption performance and ink drying speed. If the paper absorbs ink unevenly or the ink dries too quickly or too slowly, it is more likely to cause ink smudges and inconsistent penetration during the alternating ejection of ink droplets in odd and even rows, resulting in uneven color depth and blurred boundaries of the printed image, reducing uniformity. When using different brands and types of paper and ink together, it may be difficult to ensure that the ideal uniform printing effect can always be achieved.
[0004] (2) The uniformity of random PASS (performed in a randomly determined row order) is extremely difficult to control: Since the inkjet order of each row is random and there is almost no fixed pattern to follow, the distribution of ink droplets on the paper becomes very difficult to predict and control, and it is easy for local ink droplets to be too dense or sparse. For example, when printing a solid color background, some patches of different shades may appear randomly, seriously damaging the overall uniformity effect, making it difficult to meet the task requirements that have certain requirements for printing quality. Debugging and error correction are complex: Once the problem of uneven printing occurs, it will be extremely complicated to solve it by adjusting the printer parameters or troubleshooting the cause of the fault. Because there is no clear sequential logic, it is difficult to determine whether it is a problem with the nozzle itself, a problem with the paper feed, or which link in the execution of the random algorithm causes the unevenness, which is not conducive to quickly locating and solving the problem, thereby affecting printing efficiency and the final print quality.
[0005] Not suitable for regular image printing: For the printing of regular geometric figures, tables, texts, etc., it is difficult to ensure the neat edges and uniform internal filling of these elements by randomly selecting the PASS order. Often, there will be uneven outlines of the figures and uneven thickness of the text strokes, which cannot achieve the clear and uniform visual effect expected by regular printing tasks.
[0006] (3) Disadvantages of grouping PASS (grouping multiple lines into one group, following a specific order within the group, and another order between groups): Differences in the connection between groups are easy to occur: when switching between groups, since different groups may use different inkjet sequences or rhythms, it is easy to have differences in ink droplet distribution at the connection, which is manifested as unnatural color transitions at the boundaries between groups, slight changes in depth, or discontinuous textures. For example, when printing large-format continuous-tone images, this problem of inter-group connection may cause horizontal traces on the screen, destroying the overall uniformity and visual beauty. Parameter adjustment relies on experience and trial and error: Determining the reasonable number of groups, the number of lines in each group, and the specific PASS order within and between groups requires a lot of practical experience and repeated trial and error. Different image content, printer performance, and paper and ink characteristics may affect the setting of the best parameters. If the parameters are not set properly, it is easy to cause uneven printing, and it is difficult for operators to quickly find the correct adjustment direction, which increases the difficulty of obtaining ideal uniform printing effects and places stringent requirements on the precision of the nozzles: In order to ensure the uniformity of ink droplet distribution within and between groups, the requirements for the inkjet precision and position control precision of the nozzles are more stringent. When the nozzles switch between different groups and perform sequential inkjet within a group, any slight position deviation or change in ink volume may be magnified, resulting in local unevenness in the printed image, especially when printing images with high precision and high quality requirements, the impact of this nozzle precision will be more obvious.
[0007] Therefore, there is an urgent need for a method for printing a longitudinal high PASS number image that solves the shortcomings of the above three PASS stepping methods. Summary of the invention
[0008] In order to solve the above-mentioned technical problems, the present invention provides a method for printing a longitudinal high PASS number image.
[0009] The technical solution of the present invention is achieved in this way:
[0010] A method for printing a longitudinal high PASS number image comprises the following steps:
[0011] S1, obtain the printing image information, and read the basic information of the image from the printing PRN file;
[0012] S2, calculate the number of PASS in the Y direction of printing through the read PRN information;
[0013] S3, obtaining the index of the data row according to the PASS number obtained in step S2;
[0014] S4, obtaining each swath step according to the index of the data row in step S3;
[0015] S5, driving the printing software, sending the step value data of each swath pre-processed in steps S1-S4 to the printer control board, and controlling the inkjet to print white ink and color ink images.
[0016] Preferably, in step S1, information including resolution, number of PASS, number of colors, and BytesPerLine of the image is read from the print PRN file, wherein the resolution is read by reading the header information in the PRN file and inputting y_dpi=struct.unpack('I',f.read(4n))[0];
[0017] The specific method of reading the PASS number is: pass_num = ord (f.read (n));
[0018] The specific method for reading the color number is: color_num = ord(f.read(1)). The 1 in the function means reading 1 byte and converting it into an integer to obtain the color number.
[0019] The specific reading of BytesPerLine is:
[0020] bytes_per_line = struct.unpack('I', f.read(4))[0], parse 4 bytes according to the unsigned integer format and get the BytesPerLine value.
[0021] Preferably, in step S2, the resolution of the image in the Y direction is expressed as ImageYDPI, and the printer reference Y direction resolution is expressed as PrintYDPI; the number of PASSes in the printing Y direction is calculated:
[0022] ImageYDPI÷PrintYDPI=YPassNum, where YPassNum is the image's Y-direction resolution divided by the printer's base Y-direction resolution I.
[0023] Preferably, the step S3 is specifically as follows: set index as the print data line index, PRNLineSeq as the line number of the PRN file data that increases line by line, and when PRNLineSeq is an even number, index=PRNLineSeq / 2+
[0024] YPassNum / 2, when PRNLineSeq is an odd number, index=(PRNLineSeq-1) / 2.
[0025] Preferably, the step S4 is specifically to set the effective printing height of the nozzle of the printer as PrintHeight, and when the PRNLineSeq is obtained to be an even number, the step value formula of swath is calculated as follows:
[0026] step=PrintHeight / YPASSNum-(YPASSNum / 2-1);
[0027] When the PRNLineSeq is an odd number, the formula for calculating the step value of swath is:
[0028] step=PrintHeight / YPASSNum+(YPASSNum / 2+1).
[0029] Preferably, in step S2, obtaining the index of the data row according to the number of printed PASSes includes: determining the total number of vertical rows of the printed image according to the number of bytes per row of the printed image, the number of colors of the printed image and the vertical resolution of the printed image, and the specific printing data row index is used to indicate the row of the printed image.
[0030] A printing device includes a processor, a memory, and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the above-mentioned method for printing a longitudinal high PASS number image is implemented.
[0031] A storage medium stores computer program instructions, which, when executed by a processor, implement the above-mentioned method for printing a longitudinal image with a high PASS number.
[0032] The present invention solves the shortcomings of various PASS stepping methods in the prior art. It accurately reads the PRN file information and calculates the PASS number by skipping steps, thereby ensuring that the vertical resolution of the image can be restored as needed, and the details are clearly presented without blur or loss. It is suitable for optimizing ink droplet distribution in different situations, and the color transition is natural and smooth without defects such as color faults, dark and light horizontal stripes, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic diagram of a method for printing a longitudinal high PASS number image according to the present invention. DETAILED DESCRIPTION
[0034] In order to further explain the technical means and effects taken by the present invention to achieve the predetermined invention purpose, exemplary embodiments will be described in detail here, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of methods and systems consistent with some aspects of the present application as detailed in the attached claims.
[0035] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0036] Example 1
[0037] The present invention provides a method for printing a longitudinal high PASS number image, comprising the following steps:
[0038] S1, obtain the printing image information, read the basic information of the image from the printing PRN file; parse the printing PRN file to extract the basic information of the image that plays a key supporting role in the subsequent printing process. The PRN file is the core instruction file for the printer to perform printing tasks. The information contained in it, such as resolution, number of PASS, number of colors, BytesPerLine, etc., is related to the printer's image processing method and the final printing effect. Through a specific reading mechanism, the present invention can accurately obtain the above information, provide a data basis for subsequent steps, and realize refined control of the printing process; in step S1, focus on parsing the printing PRN file to extract key image information. The PRN file carries all the instructions and data required by the printer, and arranges the storage structure according to established specifications. Among them, resolution information determines the pixel fineness of the image in the vertical and horizontal dimensions, and is an indicator to measure whether the image can be accurately restored; the PASS number represents the number of times the printer nozzle repeatedly sprays ink on the same area in the vertical direction, which is related to printing efficiency and image quality; the color number specifies the type of ink color that needs to be mixed and sprayed during the printing process, and plays a key role in restoring the original color of the image; BytesPerLine describes the number of bytes occupied by each line of image data, reflects the storage layout of the image data in the file, and provides a basis for subsequent line-by-line data processing. The targeted reading algorithm designed by the present invention breaks through the limitations of information extraction in the prior art, accurately obtains various key information, lays the foundation for subsequent calculations and control operations based on accurate data, and ensures that the printing process proceeds in an orderly manner as expected;
[0039] In step S1, the information of the image including resolution, number of PASS, number of colors, and BytesPerLine is read from the print PRN file, wherein the resolution is read by reading the header information in the PRN file and inputting y_dpi=struct.unpack('I',f.read(4n))[0]; the number of PASS is read by pass_num=ord(f.read(n)); the number of colors is read by color_num=ord(f.read(1)), where 1 in the function means reading 1 byte and converting it to an integer to obtain the number of colors; the BytesPerLine is read by bytes_per_line=struct.unpack('I',f.read(4))[0], parsing 4 bytes in unsigned integer format to obtain the BytesPerLine value.
[0040] S2, calculate the number of PASS in the Y direction of printing through the read PRN information;
[0041] Preferably, in step S2, the resolution of the image in the Y direction is expressed as ImageYDPI, and the printer reference Y direction resolution is expressed as PrintYDPI; the number of PASSes in the printing Y direction is calculated:
[0042] ImageYDPI÷PrintYDPI=YPassNum, where YPassNum is the image's Y-direction resolution divided by the printer's base Y-direction resolution I.
[0043] The formula (YPassNum = ImageYDPI ÷ PrintYDPI) is used to determine the number of PASSes in the Y direction of printing. ImageYDPI is determined by factors such as the original generation format of the image, the creative intent, and the editing process, and reflects the richness of details that the image is expected to present in the vertical direction; PrintYDPI is determined by factors such as the physical structure of the printer's nozzle (such as the nozzle arrangement density, the minimum inkjet spacing, etc.), the internal mechanical transmission system (such as the accuracy of the paper feed mechanism to drive the paper to move vertically), and the built-in control algorithm, reflecting the printer's ability to stably and accurately spray ink droplets per inch in the vertical direction to form an image. Through this calculation formula, the image characteristics are combined with the printer's hardware capabilities, and the PASS number obtained represents the number of times the nozzle repeats inkjet required to present a complete and high-quality image in the vertical direction. Because the actual calculation result may not be an integer, and the PASS number in the actual printing scenario must be an integer, the present invention provides rounding strategies such as rounding up, rounding down, and rounding off, and specifies the selection basis for different printing demand scenarios (such as high-precision professional image printing tasks preferably use rounding up strategies to ensure image details; general document printing can use rounding up or rounding down strategies to balance quality and efficiency according to the situation) to ensure that the PASS number meets the requirements of printing quality and efficiency in actual applications.
[0044] S3, obtaining the index of the data row according to the PASS number obtained in step S2;
[0045] Preferably, the step S3 is specifically as follows: set index as the print data line index, PRNLineSeq as the line number of the PRN file data that increases line by line, and when PRNLineSeq is an even number, index=PRNLineSeq / 2+
[0046] YPassNum / 2, when PRNLineSeq is an odd number, index=(PRNLineSeq-1) / 2.
[0047] After determining the number of PASS (YPassNum) in the Y direction of printing in step S2, step S3 focuses on obtaining the print data row index (index). The line number (PRNLineSeq) of the PRN file data that increases line by line is introduced, and different calculation formulas are used to determine the index according to its parity. When PRNLineSeq is an even number, the formula index = PRNLineSeq / 2 + YPassNum / 2 is used; when PRNLineSeq is an odd number, the formula index = (PRNLineSeq-1) / 2 is used. The index acquisition mechanism based on parity judgment abandons the traditional data selection logic and constructs a jumping data distribution order. In actual printing, the printer is affected by factors such as paper feeding errors (such as uneven friction between paper and paper feeding mechanism, differences in the physical properties of the paper itself causing longitudinal displacement deviation of the paper), mechanism assembly accuracy (assembly tolerances of components such as nozzles and paper feeding mechanisms affect the ink droplet landing point), etc. The conventional data selection mode is prone to uneven distribution of ink droplets on the paper, affecting the printing quality, and causing deep and shallow horizontal stripes, local color deviations, etc. The jump-type data distribution order of the present invention disrupts the regular error factor, making the ink drop distribution more reasonable and overcoming the problem of uneven printing. At the same time, in the scene of printing artistic abstract patterns, simulating natural textures (such as marble patterns, wood textures), etc., it can create a unique printing effect, optimize the ink drop distribution law, and enhance the visual presentation effect of the printed image.
[0048] S4, according to the index of the data row of step S3, obtain each swath step; the step S4 is specifically to set the effective printing height of the printer's nozzle to PrintHeight, and when the PRNLineSeq is obtained to be an even number, the step value formula of the swath is calculated as follows:
[0049] step=PrintHeight / YPASSNum-(YPASSNum / 2-1);
[0050] When the PRNLineSeq is an odd number, the formula for calculating the step value of swath is:
[0051] step=PrintHeight / YPASSNum+(YPASSNum / 2+1).
[0052] In step S4, based on the data row index index obtained in step S3, combined with the effective printing height PrintHeight of the printer nozzle, according to the parity of PRNLineSeq, a specific calculation formula is used to obtain the step value step of each swath. "Swath" refers to the area that the nozzle can cover and print ink in one lateral movement. The swath step value step controls the vertical spacing between two adjacent processing of the same swath area when the nozzle moves vertically. In inkjet printing, the vertical stepping operation of the nozzle is closely related to the distribution of ink droplets on the paper. If the step value is set unreasonably, such as being too large, it may cause vacancies in the vertical direction of the ink droplets, and being too small may cause ink droplets to overlap, which in turn causes printing quality problems such as image texture disorder and uneven color. The present invention uses a differentiated calculation formula based on the parity of PRNLineSeq. When PRNLineSeq is an even number, the formula step=PrintHeight / YPASSNum-(YPASSNum / 2-1) is used; when PRNLineSeq is an odd number, the formula step=PrintHeight / YPASSNum+(YPASSNum / 2+1) is used. This method organically integrates the data row index situation with the effective print height of the nozzle, considers the interaction characteristics between the nozzle and paper corresponding to different data row indexes, ensures the coordination of the nozzle walking operation with the data acquisition and inkjet operation, ensures that the ink droplets are evenly and orderly distributed on the paper, and achieves high-quality, flawless printing effects, overcoming the problem that the existing technology is difficult to accurately control the walking when dealing with such complex printing scenarios, resulting in poor printing quality.
[0053] S5, driving the printing software, sending the step value data of each swath pre-processed in steps S1-S4 to the printer control board, and controlling the inkjet to print white ink and color ink images.
[0054] In step S5, the connection from data preprocessing to actual printing operation is completed. After processing in steps S1 to S4, the step value data of each swath is obtained, and these data carry the key information of high-quality printing of vertical high PASS number images. By driving the printing software, the step value data is sent to the printer control board. As the core control hub of the printer hardware architecture, the printer control board integrates a microprocessor and various control circuits, and has the ability to accurately control the vertical and horizontal movement of the printer spray car, the inkjet operation of white ink and color ink. After receiving the step value data, according to its built-in control algorithm, the spray car is commanded to move in an orderly manner in the vertical and horizontal directions according to the established step value, and the parameters such as the injection timing, ink drop size and injection position of white ink and color ink are accurately controlled, and the digital image information is converted into an actual printed image, realizing seamless connection from data processing to physical printing, overcoming the problems of data and hardware control in the prior art, unsatisfactory printing effect, etc., and ensuring that the vertical high PASS number image is presented on the printing medium with high quality and high precision.
[0055] In one of the preferred embodiments of the present invention, the printed image is accurately divided into Swaths based on the actual width that the nozzle can stably and effectively cover with inkjet in one lateral movement. First, the effective inkjet width value of the nozzle is determined by measuring or referring to the technical parameters provided by the printer manufacturer. For example, the effective inkjet width of the nozzle of a certain model of printer is a specific value. Based on this value, the printed image is divided into Swaths in the horizontal direction according to the principle of equal width. The advantage of such division is that the nozzle can completely process the data in a Swath area and spray ink each time it moves horizontally, avoiding the idle inkjet capacity of the nozzle or the inkjet edge effect (such as excessive or insufficient spraying of ink droplets at the Swath boundary) due to unreasonable Swath division, ensuring that the ink droplets are evenly and reasonably distributed in the horizontal direction, giving full play to the inkjet efficiency of the nozzle, improving the printing accuracy and overall quality, and solving the problem of print quality fluctuation caused by inaccurate Swath division in the prior art.
[0056] In a preferred embodiment of the present invention, for high-resolution printed images, the Swath is finely divided in combination with factors such as the lateral resolution of the image and the minimum inkjet accuracy of the nozzle. The high-resolution image itself contains richer details and more delicate color transition requirements. By considering its lateral resolution and the minimum inkjet accuracy of the nozzle, the width of the Swath is reduced. In this way, when the nozzle moves laterally, it can process different areas more times and process image details more accurately, such as hair in portrait photos, fine textures in artworks, etc. It can also make the color transition between different areas more natural, reduce color stratification, color banding and other phenomena, improve printing quality, meet the high quality requirements for high-resolution image printing, and overcome the problem that the existing technology is difficult to finely present details and color transition effects when processing such images.
[0057] In a preferred embodiment of the present invention, in view of the inevitable paper feeding errors (due to paper tension changes, mechanical wear of the paper feeding mechanism, etc., which lead to paper movement speed or position deviation) and inkjet errors (such as nozzle blockage, uneven ink droplet size, etc., which affect the accuracy of ink droplet landing points) that will occur during the printing process, a dynamic error compensation mechanism is introduced when obtaining each swath step value. During the operation of the printer, the above-mentioned error conditions are monitored in real time with the help of sensors (such as high-precision paper displacement sensors, ink droplet detection sensors, etc.), and the monitored data is fed back to the control unit. The control unit dynamically adjusts the swath step value according to the size and direction of the error based on the preset error compensation algorithm. For example, if it is detected that the paper is slightly accelerated in the longitudinal paper feeding, resulting in a trend of shrinking longitudinal spacing of ink droplets, the control unit will appropriately increase the step value so that the ink droplets can be evenly distributed; on the contrary, if it is found that the inkjet nozzle is partially blocked, resulting in a sparse ink drop area, the step value is correspondingly reduced to make up for the gap to ensure complete ink drop coverage. Through this dynamic error compensation mechanism, the ink droplets are always evenly and accurately distributed on the paper, which enhances the stability of printing quality and effectively addresses the problem that existing technologies are unable to handle various errors in the printing process in real time, thus affecting the printing effect.
[0058] In this preferred embodiment of the present invention, the grayscale distribution characteristics of the image are fully considered to optimize the distribution of the PASS number. In the printing preparation stage, the image is scanned using an image analysis algorithm to obtain the grayscale value information of each pixel, and based on this, statistical data such as a grayscale distribution histogram is constructed to identify areas with complex grayscale changes in the image (such as facial contours in portraits with rich light and shadow levels, cloud layers in landscape photos with delicate light and shadow transitions, etc.) and areas with relatively uniform grayscale (such as solid color backgrounds, large areas filled with simple tones, etc.). For areas with complex grayscale changes and rich details, the corresponding Y-direction PASS number is appropriately increased, so that the nozzle can restore the image details more finely through more repeated inkjet operations in these areas, ensuring that every subtle grayscale change can be accurately presented; and in areas with relatively uniform grayscale, the PASS number is reasonably reduced to reduce unnecessary inkjet times and speed up printing. Through this differentiated allocation method of PASS numbers based on image grayscale distribution, the printing efficiency is effectively improved while ensuring the overall printing quality, overcoming the problems of poor quality or low efficiency caused by the unified use of a fixed PASS number for the entire image in the prior art, and better meeting the diverse requirements of different image contents for printing effects and speeds.
[0059] Preferably, in step S2, obtaining the index of the data row according to the number of printed PASSes includes: determining the total number of vertical rows of the printed image according to the number of bytes per row of the printed image, the number of colors of the printed image and the vertical resolution of the printed image, and the specific printing data row index is used to indicate the row of the printed image.
[0060] A printing device includes a processor, a memory, and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the above-mentioned method for printing a longitudinal high PASS number image is implemented.
[0061] A storage medium stores computer program instructions, which, when executed by a processor, implement the above-mentioned method for printing a longitudinal image with a high PASS number.
[0062] Example 2
[0063] This embodiment is different from Embodiment 1, and is specifically a method for printing a vertical high PASS number image, comprising the following steps:
[0064] S1, before starting the printing operation, use mature edge detection algorithms to process the printed image, specifically using Sobel operator, Canny edge detection algorithm, etc. These algorithms determine the edge-related information of objects in the image based on the grayscale change characteristics of image pixels;
[0065] Taking architectural drawings as an example, the drawings contain many elements such as wall outlines, door and window frames, beam and column structures, etc., which are composed of horizontal and vertical lines. When using the Sobel operator, it accurately locates the pixel position of each line edge by calculating the grayscale change gradient of the image pixel points in the horizontal and vertical directions. For the horizontal edge of the wall, the area where the pixel grayscale value changes significantly along this direction can be accurately detected, thereby determining the pixel row and column position where the horizontal wall edge is located; similarly, for the vertical column edge and the oblique stair handrail, pipeline direction and other line edges, their starting and ending points and the pixel positions along the line can also be accurately captured.
[0066] On this basis, the Canny edge detection algorithm further determines the direction and sharpness of the edge. For the outer contour lines of the building, because they are usually represented by clear drawing lines, after processing by the Canny algorithm, they can be determined as clear edges with clear directions; while for the lines representing hidden structures or schematics inside the building, because they are faded or gradually transitioned with surrounding elements during drawing, the algorithm can accurately identify them as relatively fuzzy transition edges and mark the range of fuzziness and direction changes.
[0067] Taking high-definition photography as an example, the picture includes the outline of flowers in the foreground, the mountain skyline in the background, and the edges of objects such as branches and leaves in the middle. The Sobel operator and Canny edge detection algorithm can also accurately lock the edge position of each object and distinguish the direction and sharpness of the edges of different objects.
[0068] S2, optimizing the acquisition of data row indexes according to edge information. Specifically, in the step of acquiring data row indexes, the present invention adaptively adjusts the calculation formula based on the parity of PRNLineSeq according to the row number and direction characteristics of the edge obtained by edge detection, so as to optimize the distribution of ink droplets in the image, especially to achieve a more ideal presentation effect in the edge area.
[0069] Taking architectural drawings as an example, for the rows with sharp edges representing the boundaries of building facades in the vertical direction, according to the traditional calculation method that does not consider edge factors, the data row index obtained based on the parity of PRNLineSeq will cause the ink droplets to be distributed at a relatively uniform spacing in these edge areas. However, this will cause the boundaries of the building facades to be unclear in the printing effect, and the distinction from the surrounding wall areas is insufficient, and even the edge blur problem occurs.
[0070] The present invention optimizes and adjusts according to edge information. For such vertical sharp edge rows, when the row number is an even number (assuming that the index value obtained by the original calculation formula is a certain value), the spacing of the corresponding row index is increased in combination with its edge characteristics. In this way, during actual inkjet printing, the ink droplets form a more obvious density contrast on both sides of the edge, clearly distinguishing the edge from the surrounding wall area, and more accurately restoring the line accuracy requirements on the architectural drawings.
[0071] For the edge rows of the transition area between the foreground flowers and the blurred background in high-definition photographs, the edge sharpness is low and the direction is irregular. When calculating the data row index, the index value change rule is fine-tuned according to the specific edge direction and the relationship with the surrounding area. For example, at the turning point of the edge curve, the change range of the index spacing is appropriately changed so that the ink droplets can naturally follow the edge shape distribution when crossing the turning area, ensuring that the flower outline is also clearly discernible at the junction with the blurred background, which not only retains the original artistic effect of the photographic work, but also ensures the clarity and continuity of the edge.
[0072] When obtaining the data row index, read the edge-related features corresponding to the current processing row from the stored edge information. Determine whether there is an edge in the row. If so, further determine the direction of the edge and the parity of the row number. If the row number is even and the edge is a sharp edge in the vertical direction (taking the building facade boundary in the architectural engineering drawing as an example), according to the preset adjustment rules, the spacing of the corresponding row index is increased by adding a specific value based on the basic calculation formula based on the parity of PRNLineSeq; if it is other types of edges (such as irregular edges in the transition area between flowers and backgrounds in high-definition photography works), then according to its specific edge direction and relationship with the surrounding area, the corresponding index value adjustment strategy is adopted to ensure that the ink droplets can be reasonably distributed in the edge area and the surrounding area, so as to optimize the image details and overall effect.
[0073] S3, dynamically adjust the swath step value in combination with edge information. Specifically, in calculating each swath step value, the present invention combines information such as edge sharpness and direction obtained by edge detection to perform dynamic fine adjustment, so that ink droplets can be distributed in a manner that better fits the edge shape when crossing the edge area, thereby enhancing the clarity and continuity of the image edge and improving the quality of the printed image.
[0074] Taking architectural drawings as an example, the complex oblique edges at the junction of walls and beams are very sharp and have variable directions. The traditional fixed swath step value calculation method does not fully consider such edge features, which can easily lead to uneven distribution of ink droplets when crossing the edge area, resulting in ink droplet accumulation or vacancies at the edge, affecting edge clarity and accurate presentation of the overall structure.
[0075] The present invention dynamically adjusts the step value according to the sharpness and specific direction angle of the oblique edge. For example, at the beginning of the edge, the step value is reduced according to the angle between the edge and the adjacent wall and the initial angle of ink droplet ejection, so that the ink droplets cover the edge starting area more densely and clearly outline the edge starting point; as the edge extends along the oblique direction, the step value is gradually fine-tuned according to the change in its direction and the relative position relationship with the surrounding structure to ensure that the ink droplets are evenly and closely distributed in the shape of the edge during the process of crossing the entire oblique edge, accurately restore the complex details of the intersection of the building structure, and avoid jagged or blurred printing effects.
[0076] For the edge of the tree branches and the sky background in high-definition photography, because the edge of the tree branches usually has an irregular curvature and moderate sharpness, when calculating the swath step value, the step value is dynamically adjusted according to factors such as the curvature change of each branch edge and the color contrast with the sky background. In the curved part with large curvature of the branch edge, increase the step value to allow the ink droplets to diffuse naturally along the curved direction to avoid too dense ink droplets at the curved part, resulting in too dark color and affecting the layering of the picture; in the relatively flat part of the branch edge, fine-tune the step value accordingly to ensure that the ink droplets are evenly distributed, maintain clear and smooth edges, so that the branches present a natural and realistic outline effect against the sky background, and enhance the visual beauty of the picture.
[0077] Through the above-mentioned all-round optimization method based on image edge detection, ink droplets can be reasonably distributed in the edge areas of various images, whether they are the edges of geometric figures in architectural engineering drawings or the contour edges of natural objects in high-definition photography works, in accordance with the image logic. This overcomes the problems that affect the visual quality when processing image edges in the existing technology, makes the printed image clearer and more realistic, and effectively meets the printing tasks such as engineering drawings and high-definition photography works that have high requirements on image edge details, thereby improving the overall printing quality.
[0078] When calculating each swath step value, the operation is also performed based on the edge information that has been obtained. For edges with complex directions and different sharpness, the sharpness of the edge, the direction such as the specific angle, curve shape, etc., and the relative position of the current ink droplet and the edge are read in real time. At the beginning of the edge, according to its geometric relationship with the surrounding structure and the physical characteristics of the ink droplet injection, the starting distribution of the ink droplet is controlled by reducing or increasing the step value; as the ink droplet crosses the edge, according to the dynamic changes of the edge direction, according to the preset dynamic adjustment algorithm, the step value size is continuously fine-tuned to ensure that the ink droplets are always distributed closely in accordance with the edge shape, ultimately achieving an improvement in the clarity, continuity and overall visual quality of the image edge.
[0079] 1.1.1 In this embodiment, the basic calculations related to image edge detection are:
[0080] The Sobel operator determines the edge position and intensity by calculating the grayscale gradient of the image pixels in the vertical (Gy) direction. The calculation formula is as follows:
[0081]
[0082] Among them, I i,j Represents the grayscale value of the pixel with coordinates in the image.
[0083] The final edge strength G can be calculated by the following formula:
[0084]
[0085] When the value of G exceeds the set threshold, the pixel is judged as an edge point, thereby determining the edge position in the image.
[0086] In this embodiment, the core calculation steps of the Canny edge detection algorithm are:
[0087] Use a Gaussian filter to smooth the original image to reduce the interference of noise in the image on edge detection. The two-dimensional discrete form of the Gaussian filter is as follows:
[0088]
[0089] Among them, σ is the standard deviation of the Gaussian distribution, which determines the degree of filtering. For each pixel (i, j) in the image, its gray value after filtering is I filtered (i, j), calculated by convolution with a Gaussian filter:
[0090]
[0091] Here, k is usually an integer in the range of (3σ, 3σ) to ensure that most of the Gaussian distribution weights are covered.
[0092] Calculate the gradient magnitude and direction. Similar to the Sobel operator, calculate the gradient magnitude and direction of each pixel in the filtered image, but use a more accurate difference calculation method. The specific formula is as follows:
[0093] Gradient magnitude: M(i, j):
[0094]
[0095] Among them, I x (i, j) and I y (i, j) represent the gradient values in the horizontal and vertical directions respectively. The calculation method can refer to the difference calculation method similar to the Sobel operator, but it is more sophisticated.
[0096] Gradient direction, θ(i, j):
[0097]
[0098] The angle range is usually limited to (0, 2Π) or (-Π, 5Π) for subsequent non-maximum suppression steps.
[0099] In this embodiment, non-maximum suppression is performed on the gradient amplitude of each pixel along the gradient direction to determine whether the pixel is a local maximum. If it is not a local maximum, its gradient amplitude is set to 0 to refine the edge. The specific judgment logic divides the gradient into four intervals (e.g., horizontal, vertical, positive oblique, and negative oblique) according to the gradient direction, and compares the amplitude with the adjacent pixels in the corresponding interval to determine whether to retain the edge information of the pixel.
[0100] In this embodiment, dual threshold detection is connected with the edge, setting the high threshold T h and low threshold T l ,(T h >T l ), process the image after non-maximum suppression. The pixel gradient amplitude is greater than T h The direct judgment is the edge point; the amplitude is less than T l is determined as a non-edge point; if the amplitude is between the two and is connected to the determined edge point, it is determined as an edge point. In this way, the discontinuous edges are connected to obtain the final edge image, and the sharpness and direction information of the edge are also determined.
[0101] 1.1.2 In this embodiment, the calculation formula for obtaining the data row index is adjusted based on the edge information optimization.
[0102] Suppose the original formula for obtaining the data row index based on the parity of PRNLineSeq is:
[0103] When PRNLineSeq is even:
[0104]
[0105] When PRNLineSeq is an odd number:
[0106]
[0107] Among them, index original,even and index original,odd They represent the index values corresponding to the original even and odd lines respectively. PRNLineSeq is the line number of the PRN file data that increases line by line. YPassNum is the number of PASSes in the Y direction of printing.
[0108] In this embodiment, when a vertical sharp edge is detected in a row and PRNLineSeq is an even number, the adjusted index value is
[0109] index adjusted,even The calculation formula is:
[0110] indexadjusted,even =index original,even +Δ vertical,even ;
[0111] Among them, Δ vertical,even The index adjustment increment for the even-numbered lines where vertical sharp edges are located is determined according to factors such as image resolution, edge sharpness, and printer head characteristics.
[0112] In this embodiment, when there are vertical sharp edges in odd-numbered rows, the adjusted index value index can be obtained similarly. adjusted,odd Calculation formula:
[0113] index adjusted,odd =index original,odd +Δ vertical,odd ;
[0114] Among them, Δ vertical,odd The determination method of Δ vertical,even same.
[0115] In this embodiment, the row where the irregular edge is located is calculated. For the row where the irregular edge is located, the index value adjustment needs to consider the curve direction of the edge and the relationship with the surrounding area. The adjusted index value calculation formula index adjusted,even It can be expressed as:
[0116]
[0117] Where n represents the number of discrete points that the edge curve passes through in this row (represented by the pixel points after edge detection), Δ irregular (i) represents the index adjustment value corresponding to the i-th discrete point. Its calculation involves multiple factors such as the edge curvature at the point, the grayscale change difference with the adjacent area, and the printing accuracy of the printer. For example, it can be expressed by a comprehensive function as follows:
[0118]
[0119] Among them, k2 is the comprehensive proportional coefficient, and C(i) is the edge curvature at the i-th discrete point.
[0120] ΔG(i) is the grayscale change difference between the point and the adjacent area, P print Indicates the minimum printing precision of the printer.
[0121] 1.1.3 In this embodiment, the calculation formula for dynamically adjusting the swath step value is combined with edge information:
[0122] Assume that when the original swath step value is obtained, the calculation formula when PRNLineSeq is an even number is:
[0123]
[0124] When PRNLineSeq is an odd number, the calculation formula is:
[0125]
[0126] Among them, step original,even and step original,odd They represent the swath step values corresponding to the original even and odd lines respectively. PrintHeight is the effective printing height of the printer's nozzle. YPASSNum is the number of PASSes in the Y direction of printing.
[0127] In this embodiment, the formula after dynamic adjustment based on image edge detection is as follows:
[0128] For cases with sharp edges and clear directions, when a line is detected to have a sharp edge (such as the oblique structural edge in a construction engineering drawing) and PRNLineSeq is an even number, the adjusted swath step value step adjusted,even The calculation formula is:
[0129] step adjusted,even =step original,even +Δ step,even ;
[0130] Among them, Δ step,even The increment of the swath step value is adjusted for the even-numbered rows where the sharp edge is located. The value is related to factors such as the sharpness of the edge, the direction angle, and the relative position relationship between the nozzle and the paper.
[0131] In this embodiment, for irregular curved edges, taking even-numbered rows as an example, for the row where the irregular curved edge is located, the adjusted swath step value step adjusted,even The calculation formula can be expressed as:
[0132]
[0133] Among them, m represents the number of discrete points that the edge curve passes through in this row, Δ step,irregular (i) represents the swath step adjustment value corresponding to the i-th discrete point, the calculation of which involves the edge curvature at the point, the diffusion characteristics of the ink droplet at the point, and the color contrast with the surrounding area.
[0134] Through the above series of calculation formula adjustments based on image edge detection, various characteristics of the image edge are fully considered in the process of obtaining the data row index and the swath step value, so as to achieve a reasonable distribution of ink droplets in the edge area of the image, improve the quality of the printed image, and meet the requirements of different types of printing tasks for image edge details.
[0135] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technical personnel in this field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.
Claims
1. A method for printing a longitudinal high PASS number image, characterized in that: The steps include: S1, obtain the printing image information, and read the basic information of the image from the printing PRN file; S2, calculate the number of PASS in the Y direction of printing through the read PRN information; S3, obtain the PASS number of S2 according to the steps and obtain the index of the data row; S4, obtaining each swath step according to the index of the data row in step S3; S5, driving the printing software, sending the step value data of each swath pre-processed in steps S1-S4 to the printer control board, and controlling the inkjet to print white ink and color ink images.
2. A method for printing a longitudinal high PASS number image according to claim 1, characterized in that: Including, as in the step S1, reading the image information including resolution, number of PASS, number of colors, and BytesPerLine from the print PRN file, wherein the resolution is read by reading the header information in the PRN file, inputting y_dpi=struct.unpack('I',f.read(4n))[0]; The specific method of reading the PASS number is: pass_num = ord (f.read (n)); The specific method for reading the color number is: color_num = ord(f.read(1)). The 1 in the function means reading 1 byte and converting it into an integer to obtain the color number. The specific reading of BytesPerLine is: bytes_per_line = struct.unpack('I', f.read(4))[0], parse 4 bytes according to the unsigned integer format and get the BytesPerLine value.
3. A method for printing a longitudinal high PASS number image according to claim 1, characterized in that: In step S2, the resolution of the image in the Y direction is expressed as ImageYDPI, and the printer's reference Y direction resolution is expressed as PrintYDPI; the number of PASSes in the printing Y direction is calculated: ImageYDPI÷PrintYDPI=YPassNum, where YPassNum is the image's Y-direction resolution divided by the printer's base Y-direction resolution I.
4. A method for printing a longitudinal high PASS number image according to claim 1, characterized in that: Specifically, step S3 is as follows: set index as the print data line index, PRNLineSeq as the line number of the PRN file data that increases line by line, when PRNLineSeq is an even number, index=PRNLineSeq / 2+YPassNum / 2, when PRNLineSeq is an odd number, index=(PRNLineSeq-1) / 2.
5. A method for printing a longitudinal high PASS number image according to claim 1, characterized in that: The step S4 is specifically to set the effective printing height of the nozzle of the printer as PrintHeight, and when the PRNLineSeq is obtained to be an even number, the step value formula of the swath is calculated as follows: step=PrintHeight / YPASSNum-(YPASSNum / 2-1); When the PRNLineSeq is an odd number, the formula for calculating the step value of swath is: step=PrintHeight / YPASSNum+(YPASSNum / 2+1).
6. A method for printing a longitudinal high PASS number image according to claim 1, characterized in that: In step S2, obtaining the index of the data row according to the number of printed PASSes includes: determining the total number of vertical rows of the printed image according to the number of bytes per row of the printed image, the number of colors of the printed image and the vertical resolution of the printed image, and the specific printing data row index is used to indicate the row of the printed image.
7. A printing device, characterized in that: The method comprises a processor, a memory and computer program instructions stored in the memory, and when the computer program instructions are executed by the processor, the method according to any one of claims 1 to 6 is implemented.
8. A storage medium, characterized in that: Computer program instructions are stored thereon, and when the computer program instructions are executed by a processor, the method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Single PASS data transfer printing control system and method of controlling same
CN108481912A
Jet printing control method, controller and digital printer
CN114889346A
Stepping distance control method, device and equipment for multi-Pass printing and storage medium
CN115476602A
Method and device for improving pass number and color block uniformity and storage medium
CN117453163A
Treatment method and equipment for improving white ink gloss oil effect and storage medium
CN117806575A