A method, system, device and storage medium for compressing a limited gray scale image
By converting the original grayscale image into M grayscale levels and mapping them to control codes, the problems of data redundancy and control complexity in traditional inkjet printing systems are solved, achieving efficient image compression and inkjet printing integration.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU ZHONO ELECTRONICS TECH CO LTD
- Filing Date
- 2025-07-18
- Publication Date
- 2026-07-14
AI Technical Summary
In traditional inkjet printing systems, 8-bit grayscale images present data redundancy and printing control complexity issues in industrial and commercial applications, especially in scenarios using a few discrete grayscale levels.
The original grayscale image is converted into a grayscale image with M grayscale levels, and each pixel is mapped to a control code. The image is then compressed to form a compressed image file. The printing device determines the inkjet printing parameters based on the correspondence between the control codes and the inkjet parameters.
Reduce data redundancy, lower transmission and storage pressure, simplify printing control process, and achieve integration of image compression and inkjet printing.
Smart Images

Figure CN120856832B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of image processing and printing technology, and in particular to a method, system, apparatus and storage medium for compressing finite grayscale images. Background Technology
[0002] In traditional inkjet printing systems, images are typically stored and transmitted in 8-bit grayscale image format (i.e., each pixel occupies 8 bits), supporting 256 levels of grayscale. While this design is general, it becomes redundant in specific industrial and commercial applications. For example, in scenarios such as QR code printing, label printing, industrial graphic control, and black-and-white graphic output, only a few discrete grayscale levels are actually used to meet visual and functional requirements. In such cases, continuing to use 8-bit grayscale would result in: data redundancy, wasted transmission and storage resources; the printing system would need intermediate decoding; inkjet control would not directly correspond to image grayscale, leading to complex control paths. Summary of the Invention
[0003] In view of this, the purpose of the embodiments of the present invention is to provide a method, system, apparatus and storage medium for compressing finite grayscale images, which can reduce the amount of data and reduce the complexity of printing control.
[0004] On one hand, embodiments of the present invention provide a method for compressing finite grayscale images, including:
[0005] Obtain the original grayscale image and convert it into a converted grayscale image with M grayscale levels; M is determined according to the number of bits in the control code.
[0006] Each pixel of the converted grayscale image is mapped to a control code, and the control codes are compressed to form a compressed image file;
[0007] The image compression file is sent to the printing device so that the printing device can determine the inkjet printing parameters based on the image compression file and the correspondence between the control code and the inkjet parameters.
[0008] Optionally, converting the original grayscale image into a converted grayscale image with M grayscale levels includes:
[0009] The original grayscale image is divided into M intervals, and the original grayscale image is converted into a converted grayscale image with M grayscale levels according to the M intervals.
[0010] Optionally, converting the original grayscale image into a converted grayscale image with M grayscale levels includes:
[0011] The original grayscale image is processed by M-value conversion according to the error diffusion jitter algorithm to obtain the converted grayscale image.
[0012] Optionally, converting the original grayscale image into a converted grayscale image with M grayscale levels includes:
[0013] Based on the gray value distribution of the original grayscale image, M-1 boundary thresholds are adaptively determined to define M intervals. Based on the M intervals, the original grayscale image is converted into a converted grayscale image with M gray levels.
[0014] Optionally, mapping each pixel of the converted grayscale image to a control code includes:
[0015] The grayscale level of each pixel in the converted grayscale image is converted into a binary number, and a control code is determined based on the binary number.
[0016] Optionally, compressing the control code to form an image compressed file includes:
[0017] Several control codes are merged into one byte, and several bytes are compressed to form an image compressed file.
[0018] Optionally, the inkjet parameters include inkjet voltage, nozzle opening time, and droplet volume. The correspondence between the control code and the inkjet parameters is determined by the following method:
[0019] The inkjet voltage is determined based on the minimum voltage, the voltage step value, and the value of the control code;
[0020] The nozzle opening time is determined based on the minimum opening time, the time step value, and the value of the control code.
[0021] The ink droplet volume is determined based on the minimum ink volume, the ink volume step value, and the value of the control code.
[0022] Optionally, the method further includes:
[0023] A printed image is acquired, and the printed image is subjected to resolution calibration and color space conversion to obtain the original grayscale image.
[0024] On the other hand, embodiments of the present invention provide a compression system for finite grayscale images, comprising:
[0025] The first module is used to acquire the original grayscale image and convert the original grayscale image into a converted grayscale image with M grayscale levels; M is determined according to the number of bits of the control code.
[0026] The second module is used to map each pixel of the converted grayscale image to a control code, and compress the control code to form an image compressed file;
[0027] The third module is used to send the image compression file to the printing device, so that the printing device can determine the inkjet printing parameters according to the image compression file and the correspondence between the control code and the inkjet parameters.
[0028] On the other hand, embodiments of the present invention provide a compression device for finite grayscale images, comprising:
[0029] At least one processor;
[0030] At least one memory for storing at least one program;
[0031] When the at least one program is executed by the at least one processor, the at least one processor performs the method described above.
[0032] On the other hand, embodiments of the present invention provide a computer-readable storage medium storing a processor-executable program, which, when executed by a processor, is used to perform the above-described method.
[0033] On the other hand, embodiments of the present invention provide a printing device, including the compression system or the compression device described above.
[0034] On the other hand, embodiments of the present invention provide a printing system for finite grayscale images, including a printing device and a computer device connected to the printing device; wherein,
[0035] The printing device is used to receive image compression files and determine inkjet printing parameters based on the image compression files and the correspondence between control codes and inkjet parameters.
[0036] The computer device includes:
[0037] At least one processor;
[0038] At least one memory for storing at least one program;
[0039] When the at least one program is executed by the at least one processor, the at least one processor performs the method described above.
[0040] Implementing the embodiments of the present invention has the following beneficial effects: This embodiment acquires the original grayscale image, converts the original grayscale image into a converted grayscale image with M grayscale levels, where M is determined according to the number of bits in the control code, reducing data redundancy and reducing transmission and storage pressure. Each pixel of the converted grayscale image is mapped to a control code, and the control code is compressed to form an image compressed file. The image compressed file is sent to the printing device, so that the printing device determines the inkjet printing parameters according to the image compressed file and the correspondence between the control code and the inkjet parameters. The image grayscale is represented by the control code, which directly drives the printing device without intermediate decoding. Image compression and transmission to the printing control are integrated, reducing the control complexity of the printing system. Attached Figure Description
[0041] Figure 1 This is a flowchart illustrating the steps of a method for compressing a finite grayscale image according to an embodiment of the present invention.
[0042] Figure 2 This is a flowchart illustrating the steps for determining the correspondence between control codes and inkjet parameters according to an embodiment of the present invention.
[0043] Figure 3 This is a structural block diagram of a finite grayscale image compression system provided in an embodiment of the present invention;
[0044] Figure 4 This is a structural block diagram of a limited grayscale image compression device provided in an embodiment of the present invention;
[0045] Figure 5 This is a structural block diagram of a finite grayscale image printing system provided in an embodiment of the present invention;
[0046] Figure 6 This is a structural block diagram of another finite grayscale image printing system provided in an embodiment of the present invention;
[0047] Figure 7 This is a structural block diagram of a printing device provided in an embodiment of the present invention. Detailed Implementation
[0048] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. The step numbers in the following embodiments are only for ease of explanation and do not limit the order of the steps. The execution order of each step in the embodiments can be adapted according to the understanding of those skilled in the art.
[0049] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., used in the specification, claims, and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatuses.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0051] like Figure 1 As shown, this embodiment of the invention provides a method for compressing a finite grayscale image, including steps S100 to S300:
[0052] S100. Obtain the original grayscale image and convert it into a converted grayscale image with M grayscale levels; M is determined according to the number of bits in the control code.
[0053] When the control code is N bits, N represents a natural number greater than 0 and less than 8, and the number of gray levels that can be represented is 2^32. N For example: 2-bit control code → 4 grayscale levels; 3-bit control code → 8 grayscale levels; 4-bit control code → 16 grayscale levels. The control code used in this embodiment of the invention is not limited to 2-bit binary encoding. In specific applications, the control code can be extended to 3, 4, or even higher bits depending on the accuracy requirements or grayscale level needs of the printing system. Each increase of one bit in the control code doubles the number of grayscale levels that can be represented (for example, 3 bits can represent 8 grayscale levels, and 4 bits can represent 16 grayscale levels).
[0054] S200: Map each pixel of the converted grayscale image to a control code, and compress the control code to form a compressed image file.
[0055] Each pixel in a converted grayscale image corresponds to a control code. Each pixel in the converted grayscale image is mapped to a control code according to its grayscale level. Then, the control codes are compressed to form a compressed image file, such as a compressed image stream.
[0056] S300: Send the image compression file to the printing device so that the printing device can determine the inkjet printing parameters based on the image compression file and the correspondence between the control code and the inkjet parameters.
[0057] Image compression files contain control codes for converting grayscale images. Each control code value can be mapped to a set of preset inkjet control parameters (such as inkjet voltage, power-on time, and droplet volume), obtained through a lookup table or function. Specifically, if the inkjet control parameters are obtained through a lookup table, the row / index represents all possible control code values (e.g., 0 to 255 represents 256 levels of grayscale). Each column / content row corresponds to a control code value, containing a set of preset inkjet control parameters (voltage value V, power-on time T, target droplet volume D). When the inkjet control system needs to print a pixel with a specific control code, the system directly uses that control code value as an index to quickly locate the corresponding row in the lookup table (LUT), reads the predefined voltage (V), power-on time (T) (and sometimes volume D) stored in that row, and sends these read values directly to the printhead drive circuit for execution. If inkjet control parameters are obtained using functions, one or more mathematical functions can be defined (e.g., simple linear V = k*Code + b, polynomial V = a*Code^3 + b*Code^2 + c*Code + d). These functions take the control code value (denoted as Code) as input variables. Internally, the functions perform calculations and output the required inkjet control parameters (voltage V(Code), duration T(Code), volume D(Code)). When the inkjet control system needs to print a pixel with a specific control code, the system passes the control code value to a preset function. The function performs a series of mathematical calculations, and after the calculations are completed, it outputs the final voltage value (V), power-on duration (T), etc. These calculated values are sent to the inkjet head's drive circuit for execution. By obtaining inkjet control parameters through the above table lookup or function method, higher precision ink volume control and image restoration can be achieved, thereby meeting the needs of high-quality image printing. This invention does not limit the specific form of the control code and its correspondence with inkjet parameters. This control code is not only used for image compression representation but also directly mapped to inkjet printing parameters.
[0058] In one specific embodiment, each grayscale pixel (0 / 85 / 170 / 255 only) of the converted grayscale image is mapped to a 2-bit control code; every 4 control codes are merged into one byte and packaged into a compressed image stream; example: original pixel [0,85,170,255] → control code [00,01,10,11] → compressed byte 00011011 (0x1B); the entire image is compressed and sent to the print control module as a binary file or streaming data.
[0059] Optionally, the original grayscale image is converted into a converted grayscale image with M grayscale levels, including:
[0060] S101A: Divide the grayscale value range of the original grayscale image into M intervals, and convert the original grayscale image into a converted grayscale image with M grayscale levels according to the M intervals.
[0061] In one specific embodiment, the 256 gray levels of the original grayscale image are divided into four intervals, corresponding to the target gray levels 0, 85, 170, and 255, respectively. The conversion rules are as follows: original gray values g belonging to the interval [0, 63] are mapped to the target gray value 0; original gray values g belonging to the interval [64, 127] are mapped to the target gray value 85; original gray values g belonging to the interval [128, 191] are mapped to the target gray value 170; and original gray values g belonging to the interval [192, 255] are mapped to the target gray value 255. This method is simple to implement and has low computational overhead. Previously, mapping relationships needed to be defined for 256 gray levels; now, only mapping relationships need to be defined for four quantized gray levels, making it suitable for image processing tasks with high real-time requirements.
[0062] Optionally, the original grayscale image is converted into a converted grayscale image with M grayscale levels, including:
[0063] S101B: The original grayscale image is processed by M-value conversion according to the error diffusion jitter algorithm to obtain the converted grayscale image.
[0064] In one specific embodiment, to improve image visual quality, especially in areas with rich grayscale levels, this invention can introduce an error diffusion dithering algorithm (such as the Floyd-Steinberg algorithm) for quaternization processing. This method, during the quantization of each pixel, distributes and diffuses the quantization error between its original grayscale and the currently selected quaternion to adjacent pixels according to a certain weight, thereby preserving the overall brightness and detail of the image. This method is suitable for applications requiring high image visual fidelity.
[0065] Optionally, the original grayscale image is converted into a converted grayscale image with M grayscale levels, including:
[0066] S101C. Based on the gray value distribution of the original grayscale image, adaptively determine M-1 boundary thresholds to determine M intervals, and convert the original grayscale image into a converted grayscale image with M gray levels based on the M intervals.
[0067] In one specific embodiment, this invention adaptively sets three boundary thresholds based on the grayscale histogram distribution of an image, dividing the grayscale values into four intervals. This method can adjust the quantization threshold according to the image's brightness characteristics (too dark or too bright), resulting in a more uniform pixel distribution across each grayscale segment, thereby further optimizing the visual effect and compression efficiency of the quadratured image.
[0068] It should be noted that the above three grayscale conversion methods can be flexibly selected according to image characteristics, processing platform capabilities, or target printing accuracy. Furthermore, the present invention is not limited to the specific embodiments described above, and other N-value conversion strategies that can achieve similar grayscale dimensionality reduction effects can also be adopted.
[0069] Optionally, each pixel of the converted grayscale image is mapped to a control code, including:
[0070] S201. Convert the grayscale level of each pixel in the grayscale image into a binary number, and determine the control code based on the binary number.
[0071] In one specific embodiment, to convert any 8-bit grayscale value (0-255) into a control code of a set number of bits, the present invention proposes the following grayscale value encoding strategy:
[0072] Assuming the target control code is N bits (binary), then the number of gray levels that can be represented is L = 2. N Divide the continuous grayscale values from 0 to 255 into L intervals, and assign each grayscale value to the control code corresponding to its interval. For example:
[0073] For N=2 (L=4): the grayscale value ranges [0,63], [64,127], [128,191], and [192,255] correspond to control codes 00, 01, 10, and 11, respectively;
[0074] For N=3 (L=8): each grayscale interval has a width of 32, which are mapped to 000~111 respectively;
[0075] For N=4 (L=16): each interval has a width of 16, and is mapped sequentially to 0000~1111.
[0076] The control code for the grayscale value G can be calculated as follows:
[0077]
[0078] Encode this integer into N bits, which is the corresponding control code.
[0079] Optionally, the control code is compressed to form a compressed image file, including:
[0080] S202. Combine several control codes into one byte, and compress the several bytes to form an image compressed file.
[0081] One byte contains 8 binary control bits. If a control code contains 2 control bits, every 4 control codes are combined into one byte. Then, these multiple byte sequences are sent together to form a compressed image file. It should be noted that the number of control codes in one byte is determined by the number of bits in the control code.
[0082] Optionally, such as Figure 2 As shown, the inkjet parameters include inkjet voltage, nozzle opening time, and droplet volume. The correspondence between control codes and inkjet parameters is determined using the following method:
[0083] S301. Determine the inkjet voltage based on the minimum voltage, voltage step value, and control code value;
[0084] S302. Determine the nozzle opening time based on the minimum opening time, time step value, and control code value.
[0085] S303. Determine the ink droplet volume based on the minimum ink volume, ink volume step value, and control code value.
[0086] Specifically, each control code corresponds to an integer value (e.g., 00 = 0, 01 = 1, ...), which can be used as a parameter adjustment factor. The ink droplet ejection parameters can be designed in the following way:
[0087] Inkjet voltage (V) = V_min + ΔV × value of control code
[0088] Nozzle opening time (μs) = T_min + ΔT × control code value
[0089] Ink droplet volume (ng) = Q_min + ΔQ × control code value
[0090] Wherein, V_min, T_min, and Q_min are the minimum voltage, minimum turn-on time, and minimum ink volume, respectively, and ΔV, ΔT, and ΔQ are linear step values, determined based on the inkjet hardware performance.
[0091] This invention is not limited to the implementation of a 2-bit control code. For grayscale expansion or more complex inkjet printing requirements, flexible and high-precision printing control can be achieved through control code bit extension and parameter mapping mechanism design. This mapping method can be preset with a lookup table or calculated in real time, facilitating software and hardware system integration.
[0092] In one specific embodiment, the grayscale image conversion uses only the following four grayscale values, and the following mapping relationship is designed:
[0093]
[0094] By binding the control code with inkjet voltage, duration, and droplet volume, the print control unit can directly obtain inkjet control signals from the compressed bitstream without needing to look up tables or decode.
[0095] Optionally, the method further includes:
[0096] S001. Obtain the printed image, perform resolution calibration and color space conversion on the printed image to obtain the original grayscale image.
[0097] Resolution calibration: The input image is scaled according to the physical resolution of the target printing device (e.g., 600 dpi, 1200 dpi, etc.), and size adjustment is achieved using methods such as bilinear interpolation or cubic interpolation. Specific methods include:
[0098] Let the input image resolution be W. in *H in The target print size is W. target *H target The scaling factor is s w =W target / W in s h =H target / H in
[0099] Color space conversion: For color image input (such as RGB, CMYK format), convert it to a single-channel grayscale image. A weighted average grayscale algorithm can be used for this conversion.
[0100] Gray=0.299×R+0.587×G+0.114×B
[0101] For CMYK images, they can be converted to RGB first, and then the weighted conversion described above can be performed. For example:
[0102] R = 255 × (1 - C) × (1 - K)
[0103] G = 255 × (1 - M) × (1 - K)
[0104] B = 255 × (1 - Y) × (1 - K)
[0105] The resulting grayscale image is used for control code mapping and compression.
[0106] Implementing the embodiments of the present invention has the following beneficial effects: This embodiment acquires the original grayscale image, converts the original grayscale image into a converted grayscale image with N grayscale levels, where N is determined according to the number of bits in the control code, reducing data redundancy and reducing transmission and storage pressure. Each pixel of the converted grayscale image is mapped to a control code, and the control code is compressed to form an image compressed file. The image compressed file is sent to the printing device, so that the printing device determines the inkjet printing parameters according to the image compressed file and the correspondence between the control code and the inkjet parameters. The image grayscale is represented by the control code, which directly drives the printing device without intermediate decoding. Image compression and transmission to the printing control are integrated, reducing the control complexity of the printing system.
[0107] See Figure 3 This invention provides a compression system for finite grayscale images, comprising:
[0108] The first module is used to acquire the original grayscale image and convert it into a converted grayscale image with M grayscale levels; M is determined according to the number of bits in the control code.
[0109] The second module is used to map each pixel of the converted grayscale image to a control code, and compress the control code to form a compressed image file;
[0110] The third module is used to send the image compression file to the printing device so that the printing device can determine the inkjet printing parameters based on the image compression file and the correspondence between the control code and the inkjet parameters.
[0111] It is evident that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0112] See Figure 4 This invention provides a compression device for finite grayscale images, comprising:
[0113] At least one processor;
[0114] At least one memory for storing at least one program;
[0115] When at least one program is executed by at least one processor, the at least one processor performs the method described above.
[0116] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. The memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include remote memory located remotely relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0117] It is evident that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented in this device embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0118] Furthermore, this application also discloses a computer program product or computer program stored in a computer-readable storage medium. A processor of a computer device can read the computer program from the computer-readable storage medium, and the processor executes the computer program, causing the computer device to perform the described method. Similarly, the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0119] This invention also provides a computer-readable storage medium storing a processor-executable program that, when executed by a processor, implements the above-described method.
[0120] It is understood that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0121] This invention provides a printing device, including the compression system or the compression device described above.
[0122] Specifically, printing equipment also includes printing components, paper handling components, electronic and control components, and structural components. Printing components include printheads, ink cartridges, cleaning units, etc. Electronic and control components include motherboards, interfaces, memory, sensors, power supplies, etc. Structural components include housings, frames, covers, etc.
[0123] See Figure 5 This invention provides a printing system for limited grayscale images, including a printing device and a computer device connected to the printing device; wherein,
[0124] A printing device is used to receive image compression files and determine inkjet printing parameters based on the image compression files and the correspondence between control codes and inkjet parameters.
[0125] Computer equipment includes:
[0126] At least one processor;
[0127] At least one memory for storing at least one program;
[0128] When at least one program is executed by at least one processor, the at least one processor performs the method described above.
[0129] Specifically, the printing equipment includes inkjet printers, such as micro piezo inkjet printers and thermal inkjet printers; while the computer equipment can be different types of electronic devices, including but not limited to desktop computers, laptops, mobile phones or wearable devices.
[0130] See Figure 6 The compression module is used to perform the above image preprocessing to obtain the original grayscale image, and to compress the original grayscale image into an image compression file. The compression module is connected to the print control terminal and the embedded system through an interface.
[0131] The interface supports industrial fieldbus protocols (CAN has the highest priority) and automatically adapts to serial port baud rate / SPI clock synchronization. This invention supports multiple industrial field communication protocols, such as CAN, UART serial port, SPI, etc., and designs the following synchronization mechanism based on protocol characteristics:
[0132] CAN bus synchronization method: The frame ID of the CAN frame is used as the data category and priority identifier. The printer controller automatically identifies the frame type (such as start frame, data frame, end frame) based on the ID. The data length of each frame is fixed (e.g., 8 bytes), and the receiving end automatically synchronizes according to the CAN hardware, which has high robustness.
[0133] UART synchronization method: A specific frame header (such as 0xAA 0x55) is used to mark the start of a data frame; the structure of each frame is: [frame header][length][data][checksum]; if misalignment occurs, the byte alignment resynchronization mechanism can be implemented by continuously discarding invalid bytes until the frame header is re-identified; automatic baud rate detection is supported, and the baud rate is adaptive by sampling the start byte (Start Bit).
[0134] SPI synchronization method: Based on master-slave clock synchronization, the master device controls the SCLK clock line to ensure data edge alignment; the chip select signal (CS) is used as a frame synchronization flag, each time CS is pulled low, it indicates the transmission of one frame of data, and the receiver ends reception when CS is pulled high. Content boundary synchronization can be achieved by embedding a frame length field in the data header.
[0135] All protocols support CRC-8 or CRC-16 checksums to ensure data integrity. In the event of synchronization failure, the receiver can initiate a NACK response or automatically discard the frame, waiting for the next synchronization frame header to resynchronize, thus possessing strong anti-interference capabilities.
[0136] Embedded system adapter module: Provides Linux character device driver interface, realizes real-time task scheduling of RTOS, and integrates industrial EtherCAT / Profinet protocol stack.
[0137] See Figure 7 The printing control unit comprises several modules: a control code parsing module for parsing input control commands or codes; an inkjet parameter generator for generating inkjet control parameters (such as droplet size and frequency) based on the parsing results; a drive pulse controller for converting parameters into specific drive pulse signals; and a printhead array module for receiving pulse signals and performing physical inkjet operations. The printing control unit process is as follows: the MCU or FPGA receives the byte stream; decodes it into multiple sets of 2-bit control codes; and calls the hardware control function based on the control codes. For example, when the control code = 10, the output control voltage is 10.5V, the nozzle opening time is 6μs, and the inkjet volume is approximately 12ng. It should be noted that the printing system supports multi-channel concurrent parsing and real-time control, making it suitable for parallel printing arrays. The printing device also includes the printing medium, which is the carrier (paper, etc.) used to receive ink droplets and form the final pattern.
[0138] Application scenarios for printing systems based on the aforementioned limited grayscale images include, but are not limited to: QR code and barcode inkjet printing, industrial signage / label printing, black and white image output, electronic paper, thermal printers, and space / power-constrained embedded printing terminals.
[0139] It is evident that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0140] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0141] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0143] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. A method for compressing a finite grayscale image, characterized in that, include: Obtain the original grayscale image and convert the original grayscale image into a converted grayscale image with M grayscale levels; M is determined based on the number of bits in the control code; Each pixel of the converted grayscale image is mapped to a control code, and the control codes are compressed to form a compressed image file; The image compression file is sent to the printing device so that the printing device can determine the inkjet printing parameters based on the image compression file and the correspondence between the control code and the inkjet parameters.
2. The method according to claim 1, characterized in that, The step of converting the original grayscale image into a converted grayscale image with M grayscale levels includes: The original grayscale image is divided into M intervals, and the original grayscale image is converted into a converted grayscale image with M grayscale levels according to the M intervals.
3. The method according to claim 1, characterized in that, The step of converting the original grayscale image into a converted grayscale image with M grayscale levels includes: The original grayscale image is processed by M-value conversion using the error diffusion jitter algorithm to obtain the converted grayscale image.
4. The method according to claim 1, characterized in that, The step of converting the original grayscale image into a converted grayscale image with M grayscale levels includes: Based on the gray value distribution of the original grayscale image, M-1 boundary thresholds are adaptively determined to define M intervals. Based on the M intervals, the original grayscale image is converted into a converted grayscale image with M gray levels.
5. The method according to claim 1, characterized in that, The step of mapping each pixel of the converted grayscale image to a control code includes: The grayscale level of each pixel in the converted grayscale image is converted into a binary number, and a control code is determined based on the binary number.
6. The method according to claim 1, characterized in that, The step of compressing the control code to form an image compressed file includes: Several control codes are merged into one byte, and several bytes are compressed to form an image compressed file.
7. The method according to claim 1, characterized in that, The inkjet parameters include inkjet voltage, nozzle opening time, and droplet volume. The correspondence between the control code and the inkjet parameters is determined by the following method: The inkjet voltage is determined based on the minimum voltage, the voltage step value, and the value of the control code; The nozzle opening time is determined based on the minimum opening time, the time step value, and the value of the control code. The ink droplet volume is determined based on the minimum ink volume, the ink volume step value, and the value of the control code.
8. The method according to any one of claims 1-7, characterized in that, The method further includes: A printed image is acquired, and the printed image is subjected to resolution calibration and color space conversion to obtain the original grayscale image.
9. A compression system for finite grayscale images, characterized in that, include: The first module is used to acquire the original grayscale image and convert the original grayscale image into a converted grayscale image with M grayscale levels. M is determined based on the number of bits in the control code; The second module is used to map each pixel of the converted grayscale image to a control code, and compress the control code to form an image compressed file; The third module is used to send the image compression file to the printing device, so that the printing device can determine the inkjet printing parameters according to the image compression file and the correspondence between the control code and the inkjet parameters.
10. A compression device for finite grayscale images, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor performs the method as described in any one of claims 1-8.
11. A computer-readable storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to perform the method as described in any one of claims 1-8.
12. A printing device, characterized in that, Includes the compression system as described in claim 9 or the compression device as described in claim 10.
13. A printing system for finite grayscale images, characterized in that, Includes a printing device and a computer device connected to the printing device; wherein, The printing device is used to receive image compression files and determine inkjet printing parameters based on the image compression files and the correspondence between control codes and inkjet parameters. The computer device includes: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor performs the method as described in any one of claims 1-8.