Image edge scaling method, device, equipment and medium
By translating and merging the line data to be printed, the problems of low scaling efficiency and poor real-time performance in the inkjet printing edge in the prior art are solved, and more efficient and real-time image edge scaling is achieved.
Patent Information
- Application Number
- CN202510032823.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-09
AI Technical Summary
In the existing inkjet printing technology, edge scaling efficiency is low and real-time performance is poor, resulting in the inability to effectively process edge scaling of the image to be printed during the printing process.
By acquiring the image to be printed and its scaling level, the ink drop pixel point data in the row data is translated, and the row data, the first row data and the second row data are combined according to the scaling level to achieve scaling of the image edge.
It improves the edge scaling efficiency and real-timeness of the image to be printed during inkjet printing, reduces the scaling time, and is suitable for real-time scaling requirements during high-speed printing.
Smart Images

Figure CN119444560B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of inkjet printing, and in particular relates to an image edge scaling method, device, equipment and medium. Background Art
[0002] Inkjet printing has the advantages of good printing quality and environmentally friendly printing process, and the demand in the printing market is growing steadily, and it shows a good development prospect. In the process of inkjet printing, the content to be printed may exceed the printing range, or be within the printing range but the display is too small, resulting in unclear problems. Therefore, in the process of inkjet printing, an edge scaling algorithm is needed to process the image to be printed. Conventional edge scaling algorithms include nearest neighbor interpolation algorithm, bilinear interpolation algorithm and cubic convolution algorithm, which are usually used for images in JPG or PNG format. In JPG and PNG format images, each pixel usually has a grayscale value of 0-255. Among them, the nearest neighbor algorithm calculates the coordinate position of each pixel in the scaled image in the image before scaling according to the scaling ratio, and finally determines the grayscale value of each pixel in the scaled image according to the grayscale value of the nearest pixel in the image before scaling. The improved existing edge scaling algorithm applied to the PRT or PRN format to be scaled image in the printing scene will result in low scaling efficiency and poor real-time scaling due to the high complexity of the algorithm.
[0003] Therefore, how to improve the efficiency and real-time performance of edge scaling of an image to be printed during inkjet printing is a technical problem to be solved by those skilled in the art. Summary of the invention
[0004] The purpose of the present invention is to solve the technical problems of low edge scaling efficiency and low real-time performance during inkjet printing in the prior art, so as to improve the edge scaling efficiency of the image to be printed during inkjet printing.
[0005] To achieve the above technical objectives, on the one hand, the present invention provides an image edge scaling method, the method comprising:
[0006] Get the image to be printed and its zoom level;
[0007] Performing a translation operation in a first direction and a translation operation in a second direction on ink droplet pixel point data in the line data of the image to be printed, respectively, in the line data to obtain first line data and second line data, wherein the first direction is specifically a moving direction from the end point of the line to the starting point of the line, and the second direction is specifically a moving direction from the starting point of the line to the end point of the line;
[0008] The row data, the first row data, and the second row data are either operated or combined with an operation according to the zoom level.
[0009] Further, the ink droplet pixel data is specifically represented by one-bit data or two-bit data. When represented by the one-bit data, the ink droplet pixel data specifically includes 0 and 1, wherein 0 indicates no ink droplets, and 1 indicates the presence of ink droplets. When represented by the two-bit data, the ink droplet pixel data specifically includes 00, 01, 10 and 11, wherein 00 indicates no ink droplets, 01 indicates small-sized ink droplets, 10 indicates medium-sized ink droplets, and 11 indicates large-sized ink droplets.
[0010] Further, when the ink droplet pixel data is represented by two-bit data, before the ink droplet pixel data is translated, the small-sized ink droplets and the medium-sized ink droplets in the ink droplet pixel data are first adjusted to large-sized ink droplets.
[0011] Further, when the ink drop pixel data is represented by two-bit data, the zoom level specifically includes horizontal zoom, horizontal zoom times, vertical zoom and vertical zoom times, and the horizontal zoom times is consistent with the translation operation times, or the operation times or the operation times.
[0012] Further, the performing or operating the row data, the first row data and the second row data, or merging them with the operation specifically includes:
[0013] Using the row data as reference row data;
[0014] If the horizontal scaling is specifically horizontal reduction, an AND operation is performed, wherein the AND operation specifically retains only the ink droplet pixel point data in the reference row data that exist in the same data bit as the first row data and the second row data, and then replaces all the remaining data bits in the reference row data with non-ink droplet pixel point data;
[0015] If the horizontal scaling is specifically horizontal enlargement, an OR operation is performed, and the OR operation is specifically to replace the data bits that are non-ink drop pixel data in the reference row data but are ink drop pixel data in the first row data or the second row data with corresponding ink drop pixel data.
[0016] Furthermore, the method further comprises:
[0017] Using the line data in the image to be printed as original line data;
[0018] Using the upper and lower adjacent rows of data of the original row data as first adjacent row data and second adjacent row data respectively;
[0019] If the vertical scaling is specifically vertical reduction, performing an AND operation on the original row data, the first adjacent row data, and the second adjacent row data to obtain reduced row data;
[0020] If the vertical scaling is specifically vertical enlargement, then the enlarged row data is obtained by performing an OR operation on the original row data, the first adjacent row data and the second adjacent row data.
[0021] Further, the method further comprises, after acquiring the image to be printed and its zoom level, when the horizontal zoom is specifically horizontal reduction, or the vertical zoom is specifically vertical reduction, performing a filling operation on the image to be printed, the filling operation specifically comprising a preset number of enlargement operations, a restoration operation, and an anti-distortion operation performed in sequence, the restoration operation specifically restoring the enlarged image to be printed to its original size, the anti-distortion operation specifically performing an AND operation on the image to be printed after the restoration operation and the original image to be printed, the enlargement operation specifically comprising:
[0022] Using the line data in the image to be printed as the line data to be enlarged;
[0023] Using the upper and lower adjacent lines of data of the line data to be amplified as the third adjacent line data and the fourth adjacent line data respectively;
[0024] The amplified row data is obtained by performing an OR operation on the row data to be amplified, the third adjacent row data and the fourth adjacent row data.
[0025] On the other hand, the present invention further provides an image edge scaling device, characterized in that the device comprises:
[0026] An acquisition module, used for acquiring the image to be printed and its zoom level;
[0027] A translation module, used for performing a translation operation in a first direction and a translation operation in a second direction on the ink droplet pixel point data in the line data of the image to be printed, respectively, to obtain first line data and second line data, wherein the first direction is specifically a moving direction from the end point of the line to the starting point of the line, and the second direction is specifically a moving direction from the starting point of the line to the end point of the line;
[0028] A merging module is used to perform an OR operation or merge and operate the row data, the first row data and the second row data according to the zoom level.
[0029] In another aspect, the present invention further provides an electronic device, comprising:
[0030] processor;
[0031] a memory for storing instructions executable by the processor;
[0032] The processor is configured to execute the method as described above.
[0033] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the image edge scaling method as described above.
[0034] The present invention provides an image edge scaling method, device, equipment and medium. Compared with the prior art, the present invention first obtains an image to be printed and its scaling level; then performs a first direction translation operation and a second direction translation operation on ink droplet pixel point data in the line data of the image to be printed in the line data, respectively, to obtain first line data and second line data, wherein the first direction is specifically a moving direction from the end point of the line to the starting point of the line, and the second direction is specifically a moving direction from the starting point of the line to the end point of the line; finally, according to the scaling level, the line data, the first line data and the second line data are subjected to an OR operation or an AND operation to be merged. By performing an OR operation or an AND operation on the line data in the image to be scaled in the printing scene, the present invention greatly shortens the scaling time compared with the traditional method of taking positions one by one according to coordinates, and improves the image edge scaling efficiency in the printing scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 The figure is a schematic diagram of the process of the image edge scaling method provided by the embodiment of this specification;
[0037] Figure 2 FIG. 1 is a schematic diagram of the structure of an image edge scaling device provided in an embodiment of the present specification. DETAILED DESCRIPTION
[0038] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0039] In the description of the present application, the terms "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and cannot be understood as indicating or implying relative importance, nor can they be understood as requiring or implying any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
[0040] like Figure 1 The flowchart of the image edge scaling method provided by the embodiment of this specification is shown. Although this specification provides the method operation steps or device structures shown in the following embodiments or drawings, the method or device may include more or fewer operation steps or module units after partial merging based on routine or no creative labor. In the steps or structures where there is no necessary causal relationship logically, the execution order of these steps or the module structure of the device is not limited to the execution order or module structure shown in the embodiments of this specification or drawings. When the method or module structure is applied in an actual device, server or terminal product, it can be executed sequentially or in parallel according to the method or module structure shown in the embodiment or drawings.
[0041] The image edge scaling method provided in the present embodiment can be applied to various inkjet printers, such as Figure 1 As shown, the method specifically comprises the following steps:
[0042] Step S101, obtaining an image to be printed and its zoom level.
[0043] Specifically, an image to be printed in an inkjet printing scene is obtained. The image to be printed in the scene is generally in a PRN or PRT format. In the image to be printed, or in other words, in the row data of the image to be printed, each pixel contains ink droplet pixel data, wherein the ink droplet pixel data at least includes ink droplet existence information. More specifically, the ink droplet pixel data is specifically represented by one-bit data or two-bit data. When represented by the one-bit data, the ink droplet pixel data specifically includes 0 and 1, wherein 0 represents no ink droplet, and 1 represents the presence of an ink droplet. When represented by the two-bit data, the ink droplet pixel data specifically includes 00, 01, 10 and 11, wherein 00 indicates no ink droplet, 01 indicates a small-sized ink droplet, 10 indicates a medium-sized ink droplet, and 11 indicates a large-sized ink droplet. It may also include ink droplet size information and / or ink droplet color information. In other words, in a specific application scenario, in an image to be printed in a PRN or PRT format, a pixel at least stores information about the existence of an ink droplet, that is, whether an ink droplet exists. When the existence information indicates that an ink droplet does not exist, the pixel is a non-ink droplet. Pixels, in addition to storing information about the presence of ink droplets, can also include information about the size and color of ink droplets. The color information can be four colors, YMCK (cyan, magenta, yellow, and black), or six colors, LC and LM (light cyan and light red ink) added to the four colors, or eight colors, LK and LY (light black and light yellow) added to the six colors. The size information can be divided into three categories, large ink droplets, medium ink droplets, and small ink droplets. In actual work, each pixel can be represented by bit data, for example, one bit of data can be used. When used to represent pixel points, 0 represents no ink droplets, and 1 represents ink droplets. The row data of each row can be represented as 000000011111111000, which is information about the existence of ink droplets. When the ink droplet size is added, two bits of data are used to represent the pixel points, such as: 00 represents no ink droplets, 01 represents small ink droplets, 10 represents medium ink droplets, and 11 represents large ink droplets. The row data of each row can be represented as 000000011011111000. Then, when the basic four colors are added, three bits of data are used to represent each pixel point, such as 01Y and 11C. If the existing image scaling algorithm based on interpolation or sampling is applied to an image in PRN or PRT format, it is necessary to obtain the coordinates of each pixel point in the image in PRN or PRT format, and adjust the pixel point data according to the coordinate value. This image scaling method is inefficient. The present application solution does not need to obtain the coordinates of each pixel point, but only needs to process the pixel point data, which greatly improves the image scaling efficiency.
[0044] Step S102, performing a translation operation in a first direction and a translation operation in a second direction on the ink droplet pixel data in the row data of the image to be printed, respectively, to obtain a first row of data and a second row of data, wherein the first direction is specifically a moving direction from the end point of the row to the starting point of the row, and the second direction is specifically a moving direction from the starting point of the row to the end point of the row.
[0045] Specifically, the first direction is the moving direction from the end point of the row to the starting point of the row, and the second direction is the moving direction from the starting point of the row to the end point of the row. It should be noted that the translation operation only shifts the ink droplet pixel data in the row data by one data bit. For example, if the row data is 000000011111111000, the first row data obtained after the translation operation in the first direction is 000000111111110000, and the second row data obtained after the translation operation in the second direction is 000000001111111100.
[0046] In one embodiment, the translation operation for pixel point data can be divided into left shift and right shift operations. Among them, the left shift operation and the right shift operation are commonly used bit operations in computer programming. The left shift operator << in the computer can move all binary bit data of the target row to the left, and the right shift operator >> in the computer can move all binary bit data of the target row to the right. In this embodiment, the scheme of shifting the row data to the left and right is simple and easy to implement, and has high implementation efficiency.
[0047] Among them, when the ink droplet pixel data is represented by two-bit data, before the ink droplet pixel data is translated, the small-sized ink droplets and medium-sized ink droplets in the ink droplet pixel data are first adjusted to large-sized ink droplets. This is because when processing the ink droplet pixel data, it is possible to avoid the problem of distortion when scaling the image to be printed due to the pixels being too small.
[0048] Step S103: perform an operation or merge an operation on the row data, the first row data and the second row data according to the zoom level.
[0049] It should be emphasized that in traditional technology, left shift and right shift operations are usually used to implement applications such as fast multiplication and division, bit mask generation, data encoding and decoding, and circular shift. However, the present application achieves horizontal zooming and shrinking of the image edge according to the original pixel points in the image by shifting the print data to the left and right, and then performing an OR operation or an AND operation on the source data and the left-shifted data and the right-shifted data, thereby greatly improving the efficiency of image edge scaling in the print data. In traditional technology, there is no technical solution that applies data left shift and right shift operations to the pre-processing scenario before zooming and shrinking the image edge according to the original pixel points in the print image. It is the result of the applicant's creative labor and has excellent results.
[0050] It should also be emphasized that in the conventional technology, there is also an operation of dilating and corroding the convolution kernel along the image from top to bottom and from left to right. Although it can realize specific morphological processing of the image, the convolution kernel needs to perform a bit operation after each movement, and the efficiency of the morphological processing of the image is low. However, the present application shifts the data to the left, that is, the translation in the second direction to obtain the left-shifted data, and shifts the data to the right, that is, the translation in the first direction to obtain the right-shifted data, and then performs an OR operation or an AND operation on the left-shifted data, the right-shifted data and the original data. Only one OR / AND operation is required to realize the morphological processing of the image. It can be seen that the applicant's scheme has doubled the efficiency compared with the morphological processing in the conventional technology. The scheme in this embodiment performs fast edge scaling for printed images in PRT and PRN formats, without the need to use RIP software to convert the image format, and without the need to perform operations such as image decompression, which allows users to perform edge scaling in real time in printed images in PRN and PRT formats. If the morphological processing scheme in the conventional technology is applied to the printed image scaling scenario, the image scaling speed cannot keep up with the printing speed. In the conventional technology, before performing image morphological processing on images in non-printing formats such as JPG, it is necessary to perform image edge detection through an edge detection algorithm, which results in a complicated scaling process and low scaling efficiency. The solution in this embodiment can be applied to real-time scaling scenarios of printed images in PRN or PRT formats, has high image scaling efficiency, and can perform real-time scaling according to scaling instructions during the printing process. Among them, for each color channel of an image in PRN or PRT format, the solution in this application can be used to perform image edge scaling.
[0051] It is understandable that there is no solution for edge scaling of printed images in PRT or PRN format in traditional technology, and there is only edge scaling for non-printed images in JPG format. Before scaling, edge detection needs to be performed using an edge detection algorithm, and then the edges are scaled using a scaling algorithm. After scaling, a RIP operation is required to convert the image into the format required for printing. The scaling efficiency is low and it is not adaptable to real-time scaling of image edges during high-speed printing. The present application performs bit processing on printed images in PRT or PRN format, and there is no need to perform a RIP format conversion process. The process is simpler, and the bit processing is also a simple shift and AND / OR operation. The edge scaling operation can be achieved through two shifts and one AND / OR operation. There is no need to perform edge detection or build a window function as a convolution kernel for multiple morphological processing. The processing method is simple and can be used to receive edge scaling instructions and levels sent by the user in real time during the printing process to perform edge scaling. In actual printing scenarios, some printing processes are continuous and high-speed. If the edge scaling solution for JPG format images in traditional technology is applied to the printing scenario, it will definitely not meet the demand for real-time edge scaling of the printed image during the printing process. The edge scaling solution for PRN or PRT format images provided in this application has a high edge scaling efficiency. During the test process, it can meet the real-time scaling of the printed image according to user needs during the printing process without reducing the normal printing speed of the printer. In addition, in some large-scale printing scenarios, it is necessary to perform image edge scaling processing on a large number of different print jobs before printing. Using the edge scaling processing of the present application solution can quickly perform the preprocessing process. The more print jobs there are and the larger the size, the more preprocessing time the present application solution saves compared to the traditional technology solution.
[0052] Specifically, in order to zoom the image to be printed more quickly and conveniently, the zoom level specifically includes horizontal zoom, number of horizontal zooms, vertical zoom and number of vertical zooms. The number of horizontal zooms is the number of translation operations, or the number of operations, or is consistent with the number of operations. The zoom level specifically includes horizontal zoom and its number of zooms. The zoom level can also be pre-set by relevant personnel, such as setting horizontal zooming five times as the first horizontal zooming level, setting horizontal zooming three times as the second horizontal zooming level, and setting horizontal zooming once as the third horizontal zooming level. This embodiment does not limit this.
[0053] When the zoom level is the horizontal zoom and the number of zoom times is one, performing an OR operation on the row data, the first row data and the second row data or merging them with an operation specifically includes:
[0054] Using the row data as reference row data;
[0055] If the horizontal scaling is specifically horizontal reduction, an AND operation is performed, wherein the AND operation specifically retains only the ink droplet pixel point data in the reference row data that exist in the same data bit as the first row data and the second row data, and then replaces all the remaining data bits in the reference row data with non-ink droplet pixel point data;
[0056] If the horizontal scaling is specifically horizontal enlargement, an OR operation is performed, and the OR operation is specifically to replace the data bits that are non-ink drop pixel data in the reference row data but are ink drop pixel data in the first row data or the second row data with corresponding ink drop pixel data.
[0057] Specifically, when the image to be printed is scaled horizontally, the present embodiment obtains the bit data of the row pixels of the image to be printed row by row, takes the bit data of the row pixels to be scaled as the first original data, i.e., the row data, performs a left shift operation, i.e., a translation operation in the first direction, on the row data to be scaled, to obtain the first row data; performs a right shift operation, i.e., a translation operation in the second direction, on the bit data of the row pixels to be scaled, to obtain the second row data; performs an AND operation on the bit data of the pixel points with the first row data and the second row data, i.e., a horizontal reduction operation, to obtain the final horizontal reduction data; the present embodiment performs an OR operation on the bit data of the pixel points with the first horizontal scaling data and the second horizontal scaling data, i.e., a horizontal enlargement operation, to obtain the final horizontal enlargement data, and the corresponding ink droplet pixel data is the data of the same data bit in the first row data or the data of the same data bit in the second row data.
[0058] Exemplarily, when the zoom level is the horizontal reduction and the number of zooms is once, the bit data of the row pixel to be enlarged is used as the first original data, the first original data is: 000000011111111000, the first original data is shifted left, and the first horizontal zoom data is: 000000111111110000, the first original data is shifted right, and the second horizontal zoom data is: 000000001111111100, the first original data, the first horizontal zoom data, and the second horizontal zoom data are ANDed, and the bit data of the reduced row pixel is: 000000001111110000.
[0059] When the zoom level is the horizontal zoom and the zoom times is once, the bit data of the row pixel to be enlarged is used as the first original data, the first original data is: 000000011111111000, the first original data is shifted left, and the first horizontal zoom data is: 000000111111110000, the first original data is shifted right, and the second horizontal zoom data is: 000000001111111100, the first original data, the first horizontal zoom data, and the second horizontal zoom data are or-operated, and the bit data of the enlarged row pixel is: 000000111111111100.
[0060] In addition, the above is an execution process of horizontal scaling once. When the number of scaling is two or more, the above execution process is repeated the same number of times. For example, when the number of scaling is two, the result row data obtained by scaling the row data once is scaled again to obtain the final scaled row data.
[0061] In an optional embodiment of the present application, in order to make the image to be printed more fully scaled and avoid image distortion caused by only horizontal scaling of the printed image, the scaling level also includes vertical scaling and its scaling times. When the scaling level is vertical scaling and the scaling times is one, the method further includes:
[0062] Using the line data in the image to be printed as original line data;
[0063] Using the upper and lower adjacent rows of data of the original row data as first adjacent row data and second adjacent row data respectively;
[0064] If the vertical scaling is specifically vertical reduction, performing an AND operation on the original row data, the first adjacent row data, and the second adjacent row data to obtain reduced row data;
[0065] If the vertical scaling is specifically vertical enlargement, then the enlarged row data is obtained by performing an OR operation on the original row data, the first adjacent row data and the second adjacent row data.
[0066] Specifically, in actual application scenarios, when scaling an image to be printed, it may be necessary not only to scale the image to be printed horizontally but also to scale the image to be printed vertically. In an embodiment of the present application, when scaling the image to be printed vertically, the bit data of the row pixels of the image to be scaled is also obtained row by row, and the bit data of the row pixels to be scaled is used as the original row data, the bit data of the row pixels adjacent to the original row data above is used as the first adjacent row data, and the bit data of the row pixels adjacent to the original row data below is used as the second adjacent row data. An AND operation is performed on the original row data and the first adjacent row data and the second adjacent row data, which is a vertical reduction operation, to obtain the final vertical reduction data; an OR operation is performed on the original row data and the first adjacent row data and the second adjacent row data, which is a vertical enlargement operation, to obtain the final vertical enlarged data.
[0067] Exemplarily, when the zoom level is vertical zoom and the number of zooms is once, the bit data of the row pixel to be reduced is used as the original row data, the original row data is: 000011111111111000, the first adjacent row data is: 000000111111000000, and the second adjacent row data is: 000000011111111100. An AND operation is performed on the original row data, the first adjacent row data, and the second adjacent row data to obtain the row data after vertical reduction: 000000011111000000.
[0068] Similar to horizontal scaling, the above is the execution process of vertical scaling once. When the number of scaling is two or more, the above execution process is repeated the same number of times. For example, when the number of scaling is two, the result row data obtained by scaling the row data once is vertically scaled again to obtain the final vertically scaled row data.
[0069] In the embodiment of the present application, after horizontal scaling and vertical scaling of the image to be printed, the final image in PRN or PRT format is obtained, and the scaling is completed. When it is necessary to horizontally scale the image to be printed, it is also necessary to vertically scale the image to be printed. The processing order of horizontal scaling and vertical scaling is not limited.
[0070] For example, when the image to be printed needs to be horizontally enlarged once, the overall operation flow of the image to be printed in a specific application scenario may be as follows:
[0071] When one bit of data is used to represent a pixel, the original data of the image to be printed is: 0000000000000000 0000000010000000 0000100010010000 0001000110111000 0000101100010000 0000011011000000 0000000010000000 0000000000000000
[0080] In this example, one bit is used to represent a pixel point. Optionally, horizontal magnification is performed once. First, a translation operation is performed on the image to be printed in a first direction to obtain the following group A of image data: 0000000000000000 0000000100000000 0001000100100000 0010001101110000 0001011000100000 0000110110000000 0000000100000000 0000000000000000
[0089] The image to be printed is translated in the second direction to obtain the following group B image data: 0000000000000000 0000000001000000 0000010001001000 0000100011011100 0000010110001000 0000001101100000 0000000001000000 0000000000000000
[0098] The original data of the printed image, the image data of group A and the image data of group B are operated or processed to be horizontally enlarged, and the following image data after horizontal enlargement is obtained: 0000000000000000 0000000111000000 0001110111101000 0011101111111100 0001111110110000 0000111111100000 0000000111000000 0000000000000000
[0107] This solution avoids the need in existing scaling algorithms to obtain the coordinates of each pixel in the image to be printed and adjust the pixel data according to the coordinate values. This solution only requires one comparison to complete a scaling operation, which shortens the scaling time and improves the real-time performance of scaling.
[0108] In an optional embodiment of the present application, in order to avoid image distortion due to a scaling operation, the method further includes, after acquiring the image to be printed and its scaling level, when the horizontal scaling is specifically horizontal reduction, or the vertical scaling is specifically vertical reduction, performing a filling operation on the image to be printed, the filling operation specifically including a preset number of enlargement operations, a restoration operation, and an anti-distortion operation performed in sequence, the restoration operation specifically restoring the enlarged image to be printed to its original size, the anti-distortion operation specifically performing an AND operation on the image to be printed after the restoration operation and the original image to be printed, the enlargement operation specifically including:
[0109] Using the line data in the image to be printed as the line data to be enlarged;
[0110] Using the upper and lower adjacent lines of data of the line data to be amplified as the third adjacent line data and the fourth adjacent line data respectively;
[0111] The amplified row data is obtained by performing an OR operation on the row data to be amplified, the third adjacent row data and the fourth adjacent row data.
[0112] It is understandable that in a two-bit image reduction scenario, when two-bit data is used to represent the pixel points for AND operation (reduction), the small point 01 and the middle point 10 will become 00 after the AND operation, thus causing image distortion. Therefore, before performing the two-bit AND operation, a pre-processing operation is required to convert the small and middle points into large points, that is, 01 and 10 into 11, so as to avoid image data distortion in the two-bit image reduction scenario. In a one-bit image scaling scenario and a two-bit image enlargement scenario, such pre-processing operation is not required.
[0113] Specifically, in order to solve the problem of image scaling distortion caused by data loss due to OR operation when the high bit (i.e., 1) of the pixel point is sparse during the actual scaling process of the data to be scaled, this embodiment first fills the inside of the image to be printed before data scaling. The filling operation can be implemented by performing OR operation on the data bits of the image to be printed, specifically including a preset number of zoom-in operations, a recovery operation, and an anti-distortion operation performed in sequence. To improve data filling efficiency, this embodiment only performs a vertical OR operation on the data bits, and can fill according to the area divided by the user, or can fill according to the pixel column number range input by the user. The specific example of the zoom-in operation is: taking the row data to be reduced as the row data to be filled, taking the upper row adjacent to the row data to be filled as the third adjacent row data, and taking the lower row adjacent to the filling row data as the fourth adjacent row data. The row data to be filled is: 00000111111000000, and the third adjacent row data is: 00000001111111000, The fourth adjacent row data is: 00011110011000000, and the row data to be filled, the third adjacent row data and the fourth adjacent row data are obtained to obtain the enlarged row data: 0001111111111111000, and the enlargement operation is performed on all the row data to be enlarged. When the enlargement operation is completed, the recovery operation is performed on them. For example, the preset number of times is five times, that is, it is enlarged five times. When it is restored, it is reduced five times to obtain the image to be printed after the recovery operation, and then the image to be printed after the recovery operation is performed with the image to be printed before the enlargement to obtain the final filling image. After the image to be printed is scaled, the data bits that are actually changed during the enlargement and reduction process are retained, and all other data bits are performed with the original image to be scaled to restore the filling operation.
[0114] In an optional embodiment, whether printing an image for one-bit data or two-bit data, when receiving the print image edge reduction instruction and reduction level sent by the user, the image is first enlarged to achieve filling inside the image to avoid data distortion after reduction. For example: if the user wants to reduce the edge of the printed image by 3 times horizontally, that is, perform 3 horizontal or operations, the printed image can be enlarged 5 times horizontally to achieve filling of the internal pixels of the printed image and then perform 8 horizontal edge reduction operations on the enlarged image. It has been found through testing that under normal circumstances, the enlargement and filling operation can reduce the distortion effect to the expected level by only performing horizontal operations, and no filling operation is required in the vertical direction. After the enlarged printed image is reduced by 8 times, the image obtained by 8 times reduction and the original image are operated, which retains the valid data while further improving the accuracy of image edge scaling and avoids distortion caused by the filling process.
[0115] This solution avoids image distortion caused by the reduction operation of the image to be scaled and improves the filling efficiency by performing a filling operation on the image to be scaled before performing the scaling operation on the image to be scaled in the printing scene.
[0116] Based on the above-mentioned image edge scaling method, one or more embodiments of this specification also provide a platform and terminal for image edge scaling. The platform or terminal may include a device, software, module, plug-in, server, client, etc. that uses the method described in the embodiments of this specification and is combined with a device for implementing necessary hardware. Based on the same innovative concept, the system in one or more embodiments provided in the embodiments of this specification is as described in the following embodiments. Since the implementation scheme and method for solving the problem of the system are similar, the implementation of the specific system in the embodiments of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. The terms "unit" or "module" used below can be a combination of software and / or hardware that implements predetermined functions. Although the system described in the following embodiments is preferably implemented in software, hardware and a combination of software and hardware are also possible and conceived.
[0117] Specifically, Figure 2 is a schematic diagram of the module structure of an embodiment of the image edge scaling device provided in this specification, such as Figure 2 As shown, the image edge scaling device provided in this specification includes:
[0118] An acquisition module 201 is used to acquire an image to be printed and its zoom level;
[0119] The translation module 202 is used to perform a translation operation in a first direction and a translation operation in a second direction on the ink droplet pixel point data in the line data of the image to be printed, respectively, to obtain the first line data and the second line data, wherein the first direction is specifically a moving direction from the end point of the line to the starting point of the line, and the second direction is specifically a moving direction from the starting point of the line to the end point of the line;
[0120] The merging module 203 is configured to perform an OR operation or merge an operation on the row data, the first row data and the second row data according to the zoom level.
[0121] In an optional embodiment of the present application, the ink droplet pixel data is specifically represented by one-bit data or two-bit data. When represented by the one-bit data, the ink droplet pixel data specifically includes 0 and 1, and the 0 indicates no ink droplets, and the 1 indicates the presence of ink droplets. When represented by the two-bit data, the ink droplet pixel data specifically includes 00, 01, 10 and 11, and the 00 indicates no ink droplets, the 01 indicates small-sized ink droplets, the 10 indicates medium-sized ink droplets, and the 11 indicates large-sized ink droplets.
[0122] In an optional embodiment of the present application, when the ink droplet pixel data is represented by two-bit data, the translation module 202 is also used to adjust small-sized ink droplets and medium-sized ink droplets in the ink droplet pixel data to large-sized ink droplets before translating the ink droplet pixel data.
[0123] In an optional embodiment of the present application, the zoom level specifically includes horizontal zoom, horizontal zoom times, vertical zoom and vertical zoom times, and the horizontal zoom times is consistent with the translation operation times, or the operation times, or the operation times.
[0124] In an optional embodiment of the present application, the merging module 203 is specifically used for:
[0125] Using the row data as reference row data;
[0126] If the horizontal scaling is specifically horizontal reduction, an AND operation is performed, wherein the AND operation specifically retains only the ink droplet pixel point data in the reference row data that exist in the same data bit as the first row data and the second row data, and then replaces all the remaining data bits in the reference row data with non-ink droplet pixel point data;
[0127] If the horizontal scaling is specifically horizontal enlargement, an OR operation is performed, and the OR operation is specifically to replace the data bits that are non-ink drop pixel data in the reference row data but are ink drop pixel data in the first row data or the second row data with corresponding ink drop pixel data.
[0128] In an optional embodiment of the present application, the merging module 203 is further specifically configured to:
[0129] Using the line data in the image to be printed as original line data;
[0130] Using the upper and lower adjacent rows of data of the original row data as first adjacent row data and second adjacent row data respectively;
[0131] If the vertical scaling is specifically vertical reduction, performing an AND operation on the original row data, the first adjacent row data, and the second adjacent row data to obtain reduced row data;
[0132] If the vertical scaling is specifically vertical enlargement, then the enlarged row data is obtained by performing an OR operation on the original row data, the first adjacent row data and the second adjacent row data.
[0133] In an optional embodiment of the present application, the image edge scaling device further includes a filling module, the filling module is used to perform a filling operation on the image to be printed when the horizontal scaling is specifically horizontal reduction, or the vertical scaling is specifically vertical reduction, the filling operation specifically includes a preset number of enlargement operations, a restoration operation and an anti-distortion operation performed in sequence, the restoration operation specifically restores the enlarged image to be printed to its original size, the anti-distortion operation specifically performs an AND operation on the image to be printed after the restoration operation and the original image to be printed, and the enlargement operation specifically includes:
[0134] Using the line data in the image to be printed as the line data to be enlarged;
[0135] Using the upper and lower adjacent lines of data of the line data to be amplified as the third adjacent line data and the fourth adjacent line data respectively;
[0136] The amplified row data is obtained by performing an OR operation on the row data to be amplified, the third adjacent row data and the fourth adjacent row data.
[0137] It should be noted that the above-mentioned system may also include other implementation modes according to the description of the corresponding method embodiment. The specific implementation modes may refer to the description of the above-mentioned corresponding method embodiment, which will not be described one by one here.
[0138] The present application also provides an electronic device, including:
[0139] processor;
[0140] a memory for storing instructions executable by the processor;
[0141] The processor is configured to execute the method provided in the above embodiment.
[0142] The electronic device provided by the embodiment of the present application stores executable instructions of the processor in a memory. When the processor executes the executable instructions, it can first obtain the image to be printed and its zoom level; then perform a first direction translation operation and a second direction translation operation on the ink droplet pixel point data in the row data of the image to be printed in the row data, respectively, to obtain the first row data and the second row data, wherein the first direction is specifically the moving direction from the end point of the row to the starting point of the row, and the second direction is specifically the moving direction from the starting point of the row to the end point of the row; finally, perform an OR operation or a AND operation on the row data, the first row data and the second row data according to the zoom level, and merge them. By performing an OR operation or an AND operation on the row data in the image to be zoomed in the printing scene, the present invention greatly shortens the zooming time compared to the traditional method of taking positions one by one according to coordinates, and improves the efficiency of image edge zooming in the printing scene.
[0143] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0144] The methods or devices described in the above embodiments provided in this specification can implement business logic through computer programs and record them on storage media, and the storage media can be read and executed by computers to achieve the effects of the solutions described in the embodiments of this specification, such as:
[0145] Get the image to be printed and its zoom level;
[0146] Performing a translation operation in a first direction and a translation operation in a second direction on ink droplet pixel point data in the line data of the image to be printed, respectively, in the line data to obtain first line data and second line data, wherein the first direction is specifically a moving direction from the end point of the line to the starting point of the line, and the second direction is specifically a moving direction from the starting point of the line to the end point of the line;
[0147] The row data, the first row data, and the second row data are either operated or combined with an operation according to the zoom level.
[0148] The storage medium may include a physical device for storing information, which is usually a medium that digitizes information and then stores it in an electrical, magnetic or optical manner. The storage medium may include: a device that stores information in an electrical energy manner, such as various memories, such as RAM, ROM, etc.; a device that stores information in a magnetic energy manner, such as a hard disk, a floppy disk, a magnetic tape, a magnetic core memory, a magnetic bubble memory, a USB flash drive; a device that stores information in an optical manner, such as a CD or a DVD. Of course, there are other readable storage media, such as quantum memory, graphene memory, etc.
[0149] The embodiments of this specification are not limited to complying with industry communication standards, standard computer resource data update and data storage rules, or the situations described in one or more embodiments of this specification. Certain industry standards or slightly modified implementation plans based on the implementation described in the custom method or embodiment can also achieve the same, equivalent or similar, or predictable implementation effects after deformation of the above-mentioned embodiments. The embodiments obtained by using these modified or deformed data acquisition, storage, judgment, processing methods, etc. can still fall within the scope of the optional implementation plans of the embodiments of this specification.
[0150] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a computer-readable medium such as a microprocessor or processor and a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, ATMEL AT91SAM, MICROCHIP PIC18F26K20, and SILICONE LABS C8051F320. The memory controller can also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.
[0151] The device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. There may be other divisions in actual implementation, such as multiple units or plug-ins may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interface, indirect coupling or communication connection of the device or unit, which may be electrical, mechanical or other forms.
[0152] These computer program instructions may also be loaded onto a computer or other programmable resource data updating device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0153] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. In the description of this specification, the description of the reference term "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.
[0154] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. A method for image edge scaling, characterized in that: The method comprises: Acquire the image to be printed and its zoom level, wherein the zoom level specifically includes horizontal zoom, horizontal zoom times, vertical zoom and vertical zoom times, wherein the horizontal zoom times is consistent with the translation operation times, the operation times or the operation times; Performing a translation operation in a first direction and a translation operation in a second direction on ink droplet pixel point data in the line data of the image to be printed, respectively, in the line data to obtain first line data and second line data, wherein the first direction is specifically a moving direction from the end point of the line to the starting point of the line, and the second direction is specifically a moving direction from the starting point of the line to the end point of the line; performing or merging an operation on the line data, the first line data, and the second line data according to the zoom level; The performing or operating on the row data, the first row data and the second row data or merging them with the operation specifically includes: Using the row data as reference row data; If the horizontal scaling is specifically horizontal reduction, an AND operation is performed, wherein the AND operation specifically retains only the ink droplet pixel point data in the reference row data that exist in the same data bit as the first row data and the second row data, and then replaces all the remaining data bits in the reference row data with non-ink droplet pixel point data; If the horizontal scaling is specifically horizontal enlargement, an OR operation is performed, wherein the OR operation is specifically replacing data bits that are non-ink droplet pixel data in the reference row data but are ink droplet pixel data in the first row data or the second row data with corresponding ink droplet pixel data; Wherein, the method further comprises: Using the line data in the image to be printed as original line data; Using the upper and lower adjacent rows of data of the original row data as first adjacent row data and second adjacent row data respectively; If the vertical scaling is specifically vertical reduction, performing an AND operation on the original row data, the first adjacent row data, and the second adjacent row data to obtain reduced row data; If the vertical scaling is specifically vertical enlargement, then the enlarged row data is obtained by performing an OR operation on the original row data, the first adjacent row data and the second adjacent row data.
2. The image edge scaling method according to claim 1, wherein: The ink droplet pixel data is specifically represented by one-bit data or two-bit data. When represented by the one-bit data, the ink droplet pixel data specifically includes 0 and 1, wherein 0 indicates no ink droplets, and 1 indicates the presence of ink droplets. When represented by the two-bit data, the ink droplet pixel data specifically includes 00, 01, 10 and 11, wherein 00 indicates no ink droplets, 01 indicates small-sized ink droplets, 10 indicates medium-sized ink droplets, and 11 indicates large-sized ink droplets.
3. The image edge scaling method according to claim 2, wherein: The method further includes: when the ink droplet pixel data is represented by two-bit data, before translating the ink droplet pixel data, first adjusting small-sized ink droplets and medium-sized ink droplets in the ink droplet pixel data to large-sized ink droplets.
4. The image edge scaling method according to claim 1, wherein: The method further includes, after acquiring the image to be printed and its zoom level, when the horizontal zoom is specifically horizontal reduction, or the vertical zoom is specifically vertical reduction, performing a filling operation on the image to be printed, the filling operation specifically including a preset number of enlargement operations, a restoration operation, and an anti-distortion operation performed in sequence, the restoration operation specifically restoring the enlarged image to be printed to its original size, the anti-distortion operation specifically performing an AND operation on the image to be printed after the restoration operation and the original image to be printed, the enlargement operation specifically including: Using the line data in the image to be printed as the line data to be enlarged; Using the upper and lower adjacent lines of data of the line data to be amplified as the third adjacent line data and the fourth adjacent line data respectively; The amplified row data is obtained by performing an OR operation on the row data to be amplified, the third adjacent row data and the fourth adjacent row data.
5. An image edge scaling device, characterized in that: The device comprises: An acquisition module, used for acquiring the image to be printed and its zoom level, wherein the zoom level specifically includes horizontal zoom, horizontal zoom times, vertical zoom and vertical zoom times, wherein the horizontal zoom times is consistent with the translation operation times, the operation times or the operation times; A translation module, used for performing a translation operation in a first direction and a translation operation in a second direction on the ink droplet pixel point data in the line data of the image to be printed, respectively, to obtain first line data and second line data, wherein the first direction is specifically a moving direction from the end point of the line to the starting point of the line, and the second direction is specifically a moving direction from the starting point of the line to the end point of the line; a merging module, configured to perform an operation or merge an operation on the row data, the first row data and the second row data according to the zoom level; The performing or operating on the row data, the first row data and the second row data or merging them with the operation specifically includes: Using the row data as reference row data; If the horizontal scaling is specifically horizontal reduction, an AND operation is performed, wherein the AND operation specifically retains only the ink droplet pixel point data in the reference row data that exist in the same data bit as the first row data and the second row data, and then replaces all the remaining data bits in the reference row data with non-ink droplet pixel point data; If the horizontal scaling is specifically horizontal enlargement, an OR operation is performed, wherein the OR operation is specifically replacing data bits that are non-ink droplet pixel data in the reference row data but are ink droplet pixel data in the first row data or the second row data with corresponding ink droplet pixel data; Wherein, the merging module is also used for: Using the line data in the image to be printed as original line data; Using the upper and lower adjacent rows of data of the original row data as first adjacent row data and second adjacent row data respectively; If the vertical scaling is specifically vertical reduction, performing an AND operation on the original row data, the first adjacent row data, and the second adjacent row data to obtain reduced row data; If the vertical scaling is specifically vertical enlargement, then the enlarged row data is obtained by performing an OR operation on the original row data, the first adjacent row data and the second adjacent row data.
6. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of an image edge scaling method as described in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Image zooming method and device, computer readable storage medium and terminal equipment
CN114418844A
Image printing processing method, device and equipment and computer storage medium
CN118605821A