A method and system for cooperative control of a high-speed scanner and a thermal printer
By using printhead parameters to generate row-level output constraint information and thermal control mapping rules in the collaborative control of document scanners and thermal printers, binary bitmap row data matching the printhead is directly generated. The continuous connection between data processing and printing is achieved through sliding row windows and batch ready indicators, which solves the queue blocking problem in hospital window ticket printing and improves business continuity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN AIYIN TECHNOLOGY CO LTD
- Filing Date
- 2026-05-15
- Publication Date
- 2026-06-19
AI Technical Summary
In hospital window ticket printing scenarios, the coordinated control of document scanners and thermal printers suffers from queue congestion and printing delays caused by frequent reading and writing of temporary files generated from image data, affecting business continuity and patient experience.
By acquiring the printhead dot width, heating cycle parameters, and buffer status parameters of the thermal printer, an initial parameter set is formed, row-level output constraint information is generated, and the correspondence between pixel position and heating control is established. Binary bitmap row data matching the printhead heating behavior is directly generated, and the continuous connection between image acquisition, data processing, and printing is achieved by using a sliding row window and batch ready flag.
By reducing intermediate processing steps, lowering system scheduling overhead, avoiding data out-of-order issues, and achieving seamless integration of image acquisition, data processing, and printing execution, queue blocking phenomena are reduced.
Smart Images

Figure CN122240049A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method and system for the coordinated control of a document scanner and a thermal printer. Background Technology
[0002] In existing technologies, document scanners and thermal printers are typically controlled in series via a general-purpose computer or embedded terminal: the document scanner captures images of paper documents, transmits them to the host computer via a USB interface, the application software performs image processing (such as cropping, enhancement, and format conversion), and then calls the print driver to send the processing results to the thermal printer for output. Some systems achieve data connection between devices through intermediate cache files or memory queues, and rely on the operating system's device management and driver framework to achieve basic collaborative operation.
[0003] However, the above method has obvious drawbacks in hospital window ticket printing scenarios. For example, during peak hours, registration forms need to be collected and printed quickly, but because the image data needs to be generated into a temporary file before being read by the print driver, when the system processes multiple forms at the same time, frequent disk I / O (such as repeated reading and writing of each approximately 2MB image) can easily cause queue blockage, resulting in printing delays or even out-of-order printing, affecting the continuity of window services and the patient experience. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for the coordinated control of a document scanner and a thermal printer, aiming to solve the problems mentioned in the background art.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: A first aspect includes a method for coordinated control of a document scanner and a thermal printer, the method comprising: Obtain the printhead dot width, heating cycle parameters, and buffer status parameters of the thermal printer to form an initial parameter set; Based on the initial parameter set, the line data length is matched to the printhead dot matrix width to generate pixel quantity constraints; the continuous heating point limit is determined based on the heating cycle parameter to generate in-line heating density constraints; and the data output rhythm is determined based on the buffer state parameter to generate inter-line output constraints. Based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, row-level output constraint information is formed, and the correspondence between pixel position and heating control is established to generate thermal control mapping rules for controlling printhead heating behavior. Based on the row-level output constraint information, the high-speed scanner is controlled to perform image acquisition and the original image data is scanned line by line to generate grayscale image row data. The grayscale image row data is subjected to threshold conversion processing, and the energy distribution is adjusted according to the thermal control mapping rules to generate binary bitmap row data with the same width as the print head dot matrix. The binary bitmap row data is used to characterize whether the corresponding pixel has performed a printing operation. The binary bitmap row data is written to the corresponding storage location in the mapping buffer of the shared data channel according to the preset address mapping rules. During the writing process, the corresponding write location identifier is generated and updated, and the row sequence identifier and hot control identifier are attached. A sliding row window is constructed based on the row sequence identifier, and a batch ready identifier is generated and sent to the thermal printer via a trigger signal line. The thermal printer reads the data in the sliding row window from the mapping buffer based on the batch ready identifier, and drives the print head to complete the printing of multiple rows according to the thermal control identifier, generating a batch printing completion feedback signal. Based on the feedback signal indicating that the batch printing is complete, the document scanner is controlled to trigger the data acquisition and processing of the next sliding window. If there is unread data in the mapping buffer, the generation of new sliding window data is paused, and processing is resumed after the data is read.
[0006] Preferably, based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, row-level output constraint information is formed, and a correspondence between pixel positions and heating control is established to generate thermal control mapping rules for controlling the printhead heating behavior, including: Based on the pixel count constraint, length matching processing is performed on each row of image data to generate the corresponding pixel position sequence; Based on the inline heating density constraint, pixels with consecutive position indices in the pixel position sequence are grouped, and length detection is performed on each consecutive pixel group to generate a continuous pixel distribution result. Based on the continuous pixel distribution results, the pixels that exceed the continuous heating point limit are subjected to interval allocation processing to generate an adjusted pixel position sequence; Based on the inter-row output constraints, the adjusted pixel position sequence is associated with at least one row of generated pixel position sequence to generate cross-row heating distribution results; Based on the cross-row heating distribution results, corresponding heating control intensity information and heating timing information are generated, and the correspondence between pixel position and heating control signal is established accordingly to generate thermal control mapping rules.
[0007] Preferably, the grayscale image row data undergoes threshold conversion processing, and energy distribution is adjusted according to thermal control mapping rules to generate binary bitmap row data consistent with the printhead dot matrix width, including: Based on the grayscale image row data, each pixel is compared with a preset baseline threshold. Pixels that meet the comparison conditions are determined as printing state pixels, and pixels that do not meet the comparison conditions are determined as non-printing state pixels, generating initial binary pixel data. According to the thermal control mapping rules, the pixels in the printing state in the initial binary pixel data are reconstructed to generate corrected binary pixel data. Based on the corrected binary pixel data, region recognition processing is performed on continuous pixels in the printing state to generate continuous printing areas; Based on the continuous printing area and combined with the thermal control mapping rules, segmentation and interval control processing is performed on the continuous printing area to generate the adjusted pixel distribution result; Based on the adjusted pixel distribution, binary bitmap row data containing thermal control information is generated.
[0008] Preferably, the binary bitmap row data is written to the corresponding storage location in the mapping buffer corresponding to the shared data channel according to a preset address mapping rule, and a corresponding write location identifier is generated and updated during the writing process, while a row sequence identifier and a hot control identifier are attached, including: According to the preset address mapping rules, the binary bitmap row data is allocated to the target storage address in the mapping buffer to generate the address mapping result; Based on the address mapping results, the binary bitmap row data is written to the corresponding storage address, and row sequence identifiers and thermal control identifiers are attached during the writing process to generate structured storage data. Based on the structured storage data, generate and update the write position identifier in the mapping buffer, and generate the corresponding data write status information; Based on the data write status information, a data ready indication is generated for the thermal printer to read sequentially.
[0009] Preferably, constructing a sliding row window based on the row sequence identifier includes: Based on the row sequence identifier, the binary bitmap row data is sequentially arranged to generate an ordered data sequence; Based on the heating cycle parameters, select multiple consecutive rows of data from the ordered data sequence to generate a sliding row window; Based on the binary bitmap row data in the sliding window and the corresponding heat control identifier, the data of each row is jointly scheduled and processed to generate a cross-row heating control sequence. Based on the cross-line heating control sequence, a batch ready identifier is generated to control the thermal printer to perform corresponding multi-line printing. After completing the processing of the current sliding window, the window position of the ordered data sequence is updated according to the preset movement rules to generate a new sliding window.
[0010] Preferably, based on the cross-row heating distribution results, corresponding heating control intensity information and heating timing information are generated, and a correspondence between pixel positions and heating control signals is established accordingly to generate thermal control mapping rules, including: Based on the cross-row heating distribution results, the continuous printing length, adjacent pixel spacing, and cross-row heating distribution information of the corresponding pixels at each pixel position are comprehensively analyzed and processed to determine the heating load distribution at each pixel position. Based on the heating load distribution, hierarchical processing is performed on each pixel position to determine the corresponding heating control intensity information; Based on the heating control intensity information, the heating triggering order of each pixel position in the same row is adjusted, and combined with the distribution of heating control intensity information between adjacent rows, the heating triggering time of cross-row pixels is scheduled to generate corresponding heating timing information. Based on the heating control intensity information and heating timing information, the pixel position is mapped to the corresponding heating control signal to generate a thermal control mapping rule.
[0011] Preferably, according to the thermal control mapping rules, the pixels in the initial binary pixel data that are in the printing state are subjected to distribution reconstruction processing to generate corrected binary pixel data, including: Based on the printing status, pixel position, and distribution relationship of adjacent pixels in the initial binary pixel data, the pixels in the printing state are divided into continuous regions to generate the printing region distribution result. Based on the heating control intensity information corresponding to the thermal control mapping rules, the printing area distribution results are graded to determine the printing priority and distribution constraints of pixels in each area, and intensity control distribution results are generated. Based on the heating timing information corresponding to the thermal control mapping rules, timing adjustment processing is performed on the intensity control distribution results to generate timing constraint distribution results; Based on the temporal constraint distribution results, the pixels in the continuous printing area are subjected to interval insertion and pixel state redistribution processing to generate the adjusted pixel distribution results; Based on the adjusted pixel distribution, corrected binary pixel data is generated.
[0012] Secondly, a collaborative control system for a document scanner and a thermal printer, the system comprising: The parameter acquisition module is used to acquire the printhead dot width, heating cycle parameters, and buffer status parameters of the thermal printer to form an initial parameter set. The constraint generation module is used to match the line data length of the printhead dot matrix width according to the initial parameter set to generate pixel quantity constraints; determine the continuous heating point limit according to the heating cycle parameter to generate in-line heating density constraints; and determine the data output rhythm according to the buffer state parameter to generate inter-line output constraints. The mapping rule generation module is used to form row-level output constraint information based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, and to establish the correspondence between pixel positions and heating control, thereby generating thermal control mapping rules for controlling the heating behavior of the printhead. The image acquisition and processing module is used to control the high-speed document scanner to perform image acquisition based on the row-level output constraint information, and to perform row-by-row scanning processing on the original image data to generate grayscale image row data. The binary data generation module is used to perform threshold conversion processing on grayscale image row data and adjust the energy distribution according to thermal control mapping rules to generate binary bitmap row data consistent with the width of the print head dot matrix. The binary bitmap row data is used to characterize whether the corresponding pixel has performed a printing operation. The data writing module is used to write binary bitmap row data into the corresponding storage location in the mapping buffer of the shared data channel according to the preset address mapping rules, and generate and update the corresponding writing location identifier during the writing process, while attaching the row sequence identifier and the hot control identifier. The window construction and execution module is used to construct a sliding window based on the row sequence identifier and generate a batch ready identifier, which is sent to the thermal printer via a trigger signal line. The thermal printer reads the data in the sliding window from the mapping buffer based on the batch ready identifier and drives the print head to complete multi-line printing according to the thermal control identifier, generating a batch printing completion feedback signal. The feedback scheduling module is used to control the document scanner to trigger the data acquisition and processing of the next sliding window based on the batch printing completion feedback signal. It also pauses the generation of new sliding window data when there is unread data in the mapping buffer and resumes processing after reading is completed.
[0013] The above-described solution of the present invention has at least the following beneficial effects: First, by directly obtaining the printhead dot width, heating cycle parameters, and buffer status parameters, and forming row-level output constraint information before image processing, the image data is made consistent with the physical characteristics of the printhead during the generation stage. This avoids the traditional approach of generating a complete image first and then adapting it to the driver, thereby reducing intermediate processing steps.
[0014] Furthermore, by establishing a correspondence between pixel positions and heating control, thermal control mapping rules are generated to control the heating behavior of the print head. This allows the image data to synchronously contain printing control information during the generation process, avoiding reliance on operating system drivers for secondary parsing and helping to reduce system scheduling overhead.
[0015] Furthermore, by performing line-by-line scanning processing on the grayscale image row data and directly generating binary bitmap row data, and by combining energy distribution adjustment to optimize continuous areas, the data is continuously output in row-level form, reducing the entire image caching and temporary file generation process, thereby reducing the number of disk read / write operations and memory usage.
[0016] Furthermore, by writing the binary bitmap row data into the mapping buffer according to the address mapping rules and attaching row sequence identifiers and thermal control identifiers, the data has sequence information and control information during the storage stage. The thermal printer can directly read and execute printing in sequence, avoiding data out-of-order problems caused by intermediate files or driver scheduling.
[0017] Finally, by constructing a sliding window and organizing data output in batches, multiple lines of data can be processed continuously under unified scheduling. Combined with the printing completion feedback signal, subsequent data generation is triggered and controlled, so that image acquisition, data processing and printing execution are seamlessly connected, reducing queue blocking caused by multi-task concurrency. Attached Figure Description
[0018] Figure 1 This is a flowchart of a collaborative control method for a document scanner and a thermal printer provided in an embodiment of the present invention. Detailed Implementation
[0019] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0020] like Figure 1 As shown, an embodiment of the present invention proposes a method for coordinated control of a document scanner and a thermal printer, the method comprising: Obtain the printhead dot width, heating cycle parameters, and buffer status parameters of the thermal printer to form an initial parameter set; Based on the initial parameter set, the line data length is matched to the printhead dot matrix width to generate pixel quantity constraints; the continuous heating point limit is determined based on the heating cycle parameter to generate in-line heating density constraints; and the data output rhythm is determined based on the buffer state parameter to generate inter-line output constraints. Based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, row-level output constraint information is formed, and the correspondence between pixel position and heating control is established to generate thermal control mapping rules for controlling printhead heating behavior. Based on the row-level output constraint information, the high-speed scanner is controlled to perform image acquisition and the original image data is scanned line by line to generate grayscale image row data. The grayscale image row data is subjected to threshold conversion processing, and the energy distribution is adjusted according to the thermal control mapping rules to generate binary bitmap row data with the same width as the print head dot matrix. The binary bitmap row data is used to characterize whether the corresponding pixel has performed a printing operation. The binary bitmap row data is written to the corresponding storage location in the mapping buffer of the shared data channel according to the preset address mapping rules. During the writing process, the corresponding write location identifier is generated and updated, and the row sequence identifier and hot control identifier are attached. A sliding row window is constructed based on the row sequence identifier, and a batch ready identifier is generated and sent to the thermal printer via a trigger signal line. The thermal printer reads the data in the sliding row window from the mapping buffer based on the batch ready identifier, and drives the print head to complete the printing of multiple rows according to the thermal control identifier, generating a batch printing completion feedback signal. Based on the feedback signal indicating that the batch printing is complete, the document scanner is controlled to trigger the data acquisition and processing of the next sliding window. If there is unread data in the mapping buffer, the generation of new sliding window data is paused, and processing is resumed after the data is read.
[0021] In this embodiment of the invention, by uniformly acquiring the printhead dot width, heating cycle parameters, and buffer state parameters of the thermal printer and forming an initial parameter set, a constraint basis consistent with the physical characteristics of the printing device can be established at the beginning of data processing. This allows subsequent image data processing to directly address printing execution requirements. Generating pixel quantity constraints, in-line heating density constraints, and inter-line output constraints based on the initial parameter set helps to clarify data length, continuous heating point distribution, and output rhythm at the line level. This establishes a correspondence between image processing and printing control, avoiding mismatches between the data output stage and the physical capabilities of the printhead.
[0022] Based on this, by forming row-level output constraint information and establishing the correspondence between pixel positions and heating control, a thermal control mapping rule for controlling the printhead heating behavior is obtained. This allows each pixel position to correspond to a specific heating control method during the generation stage, thereby unifying the constraints between the image data processing and printing control processes. Using this mapping rule, threshold conversion and energy distribution adjustment are performed on the grayscale image row data, ensuring that the generated binary bitmap row data not only reflects the image content but also contains control information matching the printhead heating behavior. This helps reduce the concentration of continuous high-density heating areas and ensures that the data output format is consistent with the printing execution method.
[0023] During the data transmission and execution phase, by writing binary bitmap row data into the mapping buffer according to preset address mapping rules and generating write position identifiers and row sequence identifiers, a stable data storage and access order can be established, enabling the thermal printer to read data in a predetermined order. Furthermore, by constructing a sliding row window and generating batch ready identifiers, multiple rows of data are organized and output in a window format. Combined with print completion feedback signals to trigger subsequent data acquisition and processing, a continuous closed-loop scheduling relationship can be formed between data generation and print execution. This ensures data sequence consistency while coordinating the rhythm of image acquisition, data processing, and print execution.
[0024] The following explanation is based on specific scenarios: In document printing applications, the document scanner scans the document line by line to acquire grayscale image data and generates corresponding line-level output constraint information based on the printhead dot matrix width and heating cycle parameters. When generating binary bitmap line data, the thermal control mapping rules are used to control the interval of continuous character areas, so that the character strokes are distributed in a dispersed manner while maintaining recognizability. The processed data is written to the mapping buffer according to the address mapping rules and organized into multiple printing batches according to the sliding window. The thermal printer reads the data sequentially according to the batch ready flag and completes the printing of multiple lines. After each batch is completed, the execution status is fed back. The document scanner triggers the generation of the next batch of data based on the feedback result, thereby realizing the continuous coordination of image acquisition, data processing and printing execution.
[0025] In a preferred embodiment of the present invention, the printhead dot width, heating cycle parameters, and buffer state parameters of the thermal printer are obtained to form an initial parameter set, including: The device information register in the thermal printer control chip is read through the interface to obtain the printhead dot matrix width, for example, 384 dots or 576 dots. By reading the printer driver configuration or firmware parameters, the heating cycle parameters can be obtained, including the duration of a single heating cycle and the interval between adjacent heating triggers. For example, the duration of a single heating cycle is 0.8ms and the interval between adjacent triggers is 0.4ms. By accessing the printer cache management unit, cache status parameters can be obtained, including cache capacity and current available space, for example, cache capacity is 64KB and current available space is 32KB; The printhead dot width, heating cycle parameters, and buffer status parameters are combined according to a preset data structure to form an initial parameter set, wherein the preset data structure is defined according to the printer communication protocol.
[0026] In a preferred embodiment of the present invention, based on an initial parameter set, the printhead dot matrix width is matched with row data length to generate pixel quantity constraints; continuous heating point limits are determined based on heating cycle parameters to generate in-row heating density constraints; and data output rhythm is determined based on buffer state parameters to generate inter-row output constraints, including: The maximum number of pixels per row is determined based on the width of the printhead dot matrix. For example, when the dot matrix width is 384 dots, the image data of each row is uniformly processed into 384 pixels to generate a pixel count constraint. The number of consecutive heating points allowed per unit time is calculated based on the heating cycle parameters. For example, under the conditions of a single heating time of 0.8ms and a trigger interval of 0.4ms, the number of consecutive heating points is limited to no more than 8, and an inline heating density constraint is generated. The data output interval is determined based on the cache status parameters. For example, when the available cache space is 32KB and each line of data occupies 384 bytes, the output is limited to no more than 80 lines at a time, and the output interval is set to 10ms to generate inter-line output constraints. The pixel quantity constraint, in-row heating density constraint, and inter-row output constraint are combined to form a unified constraint control set for subsequent data processing.
[0027] In a preferred embodiment of the present invention, the document scanner is controlled to perform image acquisition based on row-level output constraint information, and the original image data is scanned line by line to generate grayscale image row data, including: Configure the high-speed document scanner's acquisition resolution and scanning width based on the row-level output constraint information. For example, set the acquisition resolution to 200 dpi and crop the image width to the scanning range corresponding to 384 pixels. The high-speed document scanner is triggered to perform image acquisition, and the acquired image data is decomposed into line by line to form a line-by-line data stream; Perform grayscale conversion on each row of data, for example, convert an RGB format image to 8-bit grayscale value using a weighted formula; Output grayscale image row data sequentially, while maintaining the same constraints on the length and number of pixels for each row during the output process.
[0028] In a preferred embodiment of the present invention, the thermal printer reads data from the sliding window in the mapping buffer according to the batch ready flag, and drives the print head to complete multi-line printing according to the thermal control flag, generating a batch printing completion feedback signal, including: After receiving the batch ready flag, the starting address and reading length of the sliding window are determined according to the preset address mapping rules. For example, the starting address is determined to be 0x2000 and the reading length is 384 bytes × 50 rows. Read the corresponding rows of data from the mapping buffer in sequence, parse the thermal control identifier in each row of data, and extract the corresponding heating control intensity information and heating timing information; The print head is driven to perform heating operations line by line according to the heating control information, for example, the heating trigger time and duration of each pixel are controlled according to a preset timing sequence. After printing all rows of data within the current sliding window, a batch printing completion feedback signal is sent to the upper control unit, for example, via a GPIO interrupt or a serial port return completion flag, to trigger subsequent data processing.
[0029] In a preferred embodiment of the present invention, row-level output constraint information is formed based on pixel number constraints, in-row heating density constraints, and inter-row output constraints, and a correspondence between pixel positions and heating control is established to generate thermal control mapping rules for controlling the heating behavior of the printhead, including: Based on the pixel count constraint, length matching processing is performed on each row of image data to generate the corresponding pixel position sequence; Based on the inline heating density constraint, pixels with consecutive position indices in the pixel position sequence are grouped, and length detection is performed on each consecutive pixel group to generate a continuous pixel distribution result. Based on the continuous pixel distribution results, the pixels that exceed the continuous heating point limit are subjected to interval allocation processing to generate an adjusted pixel position sequence; Based on the inter-row output constraints, the adjusted pixel position sequence is associated with at least one row of generated pixel position sequence to generate cross-row heating distribution results; Based on the cross-row heating distribution results, corresponding heating control intensity information and heating timing information are generated, and the correspondence between pixel position and heating control signal is established accordingly to generate thermal control mapping rules.
[0030] In this embodiment of the invention, by comprehensively processing pixel quantity constraints, intra-row heating density constraints, and inter-row output constraints, and forming row-level output constraint information based on these constraints, the spatial distribution and output rhythm of pixels can be uniformly limited before the image data has been binarized. Detecting consecutive pixels in the pixel position sequence and performing interval allocation processing on regions exceeding the consecutive heating point limit helps to pre-disperse potentially continuous heating regions during the data generation stage, thereby reducing the degree of concentrated heating in local areas. Furthermore, by associating the adjusted pixel position sequence with the generated pixel position sequence, the pixel distribution can be coordinated across rows, forming a continuous constraint on the heating distribution between adjacent rows. Based on this, heating control intensity information and heating timing information are generated, so that each pixel position not only has spatial distribution attributes but also corresponding time and intensity control attributes, thereby providing a complete basis for the establishment of subsequent thermal control mapping rules, ensuring consistency between image data and printhead heating behavior during the generation stage.
[0031] In a preferred embodiment of the present invention, length matching processing is performed on each row of image data according to the pixel number constraint to generate a corresponding pixel position sequence, including: Get the original number of pixels for each row of grayscale image data, for example, if the original data is 512 pixels; The target number of pixels is determined based on the pixel count constraint, for example, a constraint of 384 pixels; When the number of original pixels is greater than the number of target pixels, the original pixels are downsampled according to the equal interval sampling rule. For example, a sampling point is taken every 512 / 384≈1.33 pixels to generate 384 pixels. When the number of original pixels is less than the number of target pixels, the original pixels are padded according to the interpolation rules, for example, by using linear interpolation to padded to 384 pixels. Based on the processed pixel order, a corresponding position index is assigned to each pixel to generate a pixel position sequence, where the position index ranges from 1 to 384.
[0032] In a preferred embodiment of the present invention, according to the in-row heating density constraint, pixels with consecutive position indices in the pixel position sequence are grouped, and length detection processing is performed on each consecutive pixel group to generate a continuous pixel distribution result, including: Obtain the pixel position sequence, where each pixel corresponds to a unique position index, for example, the position index range is 1 to 384; Based on the position index order in the pixel position sequence, adjacent pixels are judged to be continuous. When the position index difference between two adjacent pixels is 1, they are judged to be positionally continuous pixels. Based on the continuity determination result, pixels with consecutive position indices are grouped to form multiple consecutive pixel groups. For example, when pixels with position indices from 10 to 17 are all consecutive, a consecutive pixel group containing 8 pixels is formed. The upper limit of the number of consecutive heating points is obtained based on the in-row heating density constraint. For example, the upper limit of the number of consecutive heating points is set to 8. This upper limit is calculated based on the printhead heating cycle parameters. Length detection processing is performed on each continuous pixel group, the number of pixels in each continuous pixel group is counted, and compared with the upper limit of the number of continuous heating points. For example, when the length of a continuous pixel group is 9, it is determined that the limit is exceeded. Record the start position index, end position index, and corresponding length information of each consecutive pixel group, and indicate whether the upper limit of the number of consecutive heating points has been exceeded. The position information and length detection results of all consecutive pixel groups are summarized to generate a continuous pixel distribution result, which is used for subsequent pixel interval adjustment processing.
[0033] In a preferred embodiment of the present invention, based on the continuous pixel distribution results, an interval allocation process is performed on pixels exceeding the continuous heating point limit to generate an adjusted pixel position sequence, including: Read the length information of each continuous region in the continuous pixel distribution result and compare it with the continuous heating point limit, for example, a limit of 8 pixels; When the length of a continuous region exceeds the limit, an interval allocation process is performed on the region. For example, for a region with a length of 9, an interval is inserted at the 5th pixel position, dividing the region into two sub-regions with lengths of 4 and 5 respectively. The interval allocation method is determined according to a preset distribution rule, which is to divide the continuous area into uniform intervals to ensure that the length of each segment does not exceed the limit of continuous heating points; The processed sub-regions are remapped back to the original pixel position sequence to generate the adjusted pixel position sequence.
[0034] In a preferred embodiment of the present invention, based on inter-row output constraints, the adjusted pixel position sequence is associated with at least one row of already generated pixel position sequences to generate a cross-row heating distribution result, including: The scope of association is determined based on the inter-line output constraints, for example, specifying that the current line must be associated with the previous line and the two lines before it; Obtain the adjusted pixel position sequence of the current row and the pixel position sequence of the at least one row that has already been generated; Statistical analysis is performed on the distribution of the same pixel position in different rows. For example, it is determined whether the 20th pixel is in a heated state in three consecutive rows. Generate cross-row distribution information based on statistical results, such as recording the number of times a certain position appears consecutively in multiple rows; The cross-row distribution information of each pixel position is summarized to form the cross-row heating distribution result, which is used to generate subsequent heating control information.
[0035] In a preferred embodiment of the present invention, threshold conversion processing is performed on the grayscale image row data, and energy distribution is adjusted according to thermal control mapping rules to generate binary bitmap row data consistent with the width of the printhead dot matrix, including: Based on the grayscale image row data, each pixel is compared with a preset baseline threshold. Pixels that meet the comparison conditions are determined as printing state pixels, and pixels that do not meet the comparison conditions are determined as non-printing state pixels, generating initial binary pixel data. According to the thermal control mapping rules, the pixels in the printing state in the initial binary pixel data are reconstructed to generate corrected binary pixel data. Based on the corrected binary pixel data, region recognition processing is performed on continuous pixels in the printing state to generate continuous printing areas; Based on the continuous printing area and combined with the thermal control mapping rules, segmentation and interval control processing is performed on the continuous printing area to generate the adjusted pixel distribution result; Based on the adjusted pixel distribution, binary bitmap row data containing thermal control information is generated.
[0036] In this embodiment of the invention, by performing a comparison process based on a preset benchmark threshold on the grayscale image row data, pixels are divided into printed state pixels and non-printed state pixels, achieving data discretization while maintaining the basic outline of the image. Furthermore, by combining thermal control mapping rules, the distribution of pixels in the printed state in the initial binary pixel data is reconstructed, allowing the pixel distribution obtained from the threshold conversion to be adjusted according to the heating characteristics of the print head, thereby avoiding continuous output based solely on the image grayscale results. By performing continuous region identification on the corrected binary pixel data and combining thermal control mapping rules to perform segmentation and interval control processing on the continuous printing region, long continuous regions can be finely segmented, resulting in a spatially dispersed structure for the output data. Based on this, binary bitmap row data containing thermal control information is generated, so that the data not only includes information on whether printing is enabled but also includes control content related to heating behavior, thus making the output data more adaptable to the heating distribution requirements in the thermal printing process without changing the overall image structure.
[0037] In a preferred embodiment of the present invention, the method for setting a preset benchmark threshold includes: Obtain the gray value distribution of all pixels in the row data of a grayscale image, and calculate its grayscale histogram, for example, the gray value range is 0 to 255; A baseline threshold is selected according to a preset threshold determination rule. The preset threshold determination rule can be determined by using a fixed threshold or by using the quantile value based on the grayscale distribution. The fixed threshold can be set to 128, or the median value can be taken as the baseline threshold after sorting the grayscale values. When there is a deviation in image brightness, the baseline threshold is corrected based on the average gray level. For example, when the average gray level is 160, the baseline threshold is adjusted to 140. The determined threshold is used as the preset baseline threshold for subsequent pixel comparison processing.
[0038] In a preferred embodiment of the present invention, based on the corrected binary pixel data, region identification processing is performed on consecutive pixels in the printing state to generate a continuous printing region, including: Traverse the corrected binary pixel data and mark the pixels whose state is to be printed. The pixels in the printing state are grouped according to their pixel positions. When adjacent pixels are in the same continuous position and both are in the printing state, they are divided into the same continuous region. For each continuous region, record the start position, end position, and region length. For example, the start position is the 15th pixel, the end position is the 22nd pixel, and the length is 8. The location and length information of all continuous regions are summarized to generate a set of continuous printable regions.
[0039] In a preferred embodiment of the present invention, based on the continuous printing area and in conjunction with thermal control mapping rules, segmentation and interval control processing is performed on the continuous printing area to generate an adjusted pixel distribution result, including: Obtain the length information of the continuous printing area and compare it with the continuous heating point limit in the thermal control mapping rule, such as a limit of 8 pixels; When the length of a continuous printing area exceeds the limit, the area is segmented, for example, the area with a length of 12 is divided into two sub-areas with lengths of 6 and 6. Interval pixels are inserted between adjacent sub-regions. The number of interval pixels is determined according to the heating timing information in the thermal control mapping rules. For example, one non-printing state pixel is inserted. The segmented sub-regions and interval pixels are recombined to generate an adjusted pixel distribution structure. Perform the above processing on all continuous printed areas to form the overall adjusted pixel distribution result.
[0040] In a preferred embodiment of the present invention, binary bitmap row data containing thermal control information is generated based on the adjusted pixel distribution results, including: Iterate through the adjusted pixel distribution results, determine the printing status of each pixel position, and encode the printing status as binary data, for example, the printing status is encoded as 1 and the non-printing status is encoded as 0. Based on the heating control intensity information in the thermal control mapping rules, a corresponding intensity identifier is attached to each printed state pixel, for example, the intensity level is encoded as a 2-bit control field. Based on the heating timing information in the thermal control mapping rules, a corresponding triggering sequence identifier is attached to each pixel, for example, using a time sequence number to represent the triggering sequence. The printing status data, heating control intensity information, and heating timing information are combined according to a preset data format to form a structured data unit; The structured data units are arranged in pixel order to generate the final binary bitmap row data for subsequent printing control.
[0041] In a preferred embodiment of the present invention, binary bitmap row data is written to the corresponding storage location in the mapping buffer corresponding to the shared data channel according to a preset address mapping rule, and a corresponding write location identifier is generated and updated during the writing process, while a row sequence identifier and a hot control identifier are attached, including: According to the preset address mapping rules, the binary bitmap row data is allocated to the target storage address in the mapping buffer to generate the address mapping result; Based on the address mapping results, the binary bitmap row data is written to the corresponding storage address, and row sequence identifiers and thermal control identifiers are attached during the writing process to generate structured storage data. Based on the structured storage data, generate and update the write position identifier in the mapping buffer, and generate the corresponding data write status information; Based on the data write status information, a data ready indication is generated for the thermal printer to read sequentially.
[0042] In this embodiment of the invention, by writing binary bitmap row data to the corresponding storage location in the mapping buffer according to a preset address mapping rule, a deterministic correspondence between data and storage space can be established during the data generation stage, thereby avoiding data order disorder during transmission and reading. By attaching row sequence identifiers and thermal control identifiers during the writing process, each row of data not only has storage location attributes but also sequence and control attributes, which helps with subsequent sequential reading and execution of print control. Furthermore, by generating and updating the write location identifier, the current data writing status in the mapping buffer can be reflected in real time, thereby providing a basis for data scheduling. Based on this, data write status information and data readiness indication information are generated, enabling the thermal printer to read sequentially according to the data status, thereby achieving a connection between data writing and data reading, and forming a consistent access mechanism at the storage level between the data organization process and the printing execution process.
[0043] In a preferred embodiment of the present invention, the method for setting preset address mapping rules includes: The storage length of each row of binary bitmap data is determined based on the width of the printhead dot matrix. For example, when the dot matrix width is 384 dots, each row of data occupies 384 bytes or 48 bytes (compressed to 1 byte for 8 pixels). The storage space is divided according to the total capacity of the mapped buffer. For example, when the buffer capacity is 64KB, it can be divided into contiguous address blocks to store multiple rows of data. Establish an address mapping relationship according to the sequential storage rules. For example, set the nth row of data to be stored at the starting address plus n × the row length, where the starting address is, for example, 0x2000. When using a circular buffer structure, the address wraparound rule is set according to the buffer capacity. For example, when the write address reaches 0x2000+64KB, it will return to the starting address 0x2000. The address allocation rules, sequential storage rules, and wraparound rules are combined to form preset address mapping rules, which are used to guide the data writing and reading process.
[0044] In a preferred embodiment of the present invention, constructing a sliding row window based on row sequence identifiers includes: Based on the row sequence identifier, the binary bitmap row data is sequentially arranged to generate an ordered data sequence; Based on the heating cycle parameters, select multiple consecutive rows of data from the ordered data sequence to generate a sliding row window; Based on the binary bitmap row data in the sliding window and the corresponding heat control identifier, the data of each row is jointly scheduled and processed to generate a cross-row heating control sequence. Based on the cross-line heating control sequence, a batch ready identifier is generated to control the thermal printer to perform corresponding multi-line printing. After completing the processing of the current sliding window, the window position of the ordered data sequence is updated according to the preset movement rules to generate a new sliding window.
[0045] In this embodiment of the invention, by arranging the binary bitmap row data sequentially according to the row sequence identifier to form an ordered data sequence, the consistency of the data order in subsequent processing can be guaranteed. Based on this, a sliding window is constructed by selecting multiple consecutive rows of data in conjunction with the heating cycle parameter, transforming the data organization method from single-row processing to multi-row collaborative processing, which helps to uniformly consider heating behavior across rows. By jointly scheduling the data within the sliding window, the heating relationship between multiple rows can be coordinated as a whole, enabling the printing process between adjacent rows to cooperate in time and space. The generated cross-row heating control sequence is further used to form a batch ready identifier, allowing printing execution to be triggered in batches, thereby reducing the control overhead caused by frequent triggering. After completing the processing of the current sliding window, a new sliding window is formed by updating the window position, allowing data processing and printing execution to continue continuously, thus achieving cyclic scheduling of multi-row data while ensuring data continuity.
[0046] In a preferred embodiment of the present invention, based on the binary bitmap row data within the sliding window and the corresponding heat control identifier, joint scheduling processing is performed on the data of each row to generate a cross-row heating control sequence, including: Retrieve multiple rows of binary bitmap data and their corresponding thermal control identifiers within a sliding window, for example, a window containing 50 consecutive rows of data; Align the thermal control markers of the same pixel position in different rows to form a cross-row pixel set, for example, summarizing the control information of the 20th column pixel in row 50. Based on the heating control intensity information of each pixel, the set of pixels across rows is sorted, and pixels with higher intensity are scheduled first. Based on the heating timing information, trigger times are assigned to each pixel in the cross-row pixel set, for example, adjacent pixels are triggered sequentially at a time interval of 0.4ms; The trigger time and corresponding position of each pixel are arranged in chronological order to generate a cross-line heating control sequence, which is used to drive the print head to perform multi-line printing.
[0047] In a preferred embodiment of the present invention, the method for setting preset movement rules includes: The movement step size of the sliding window is determined based on the heating cycle parameters. For example, when the heating cycle is 10ms and 50 rows of data are processed in each batch, the movement step size is set to 25 rows. The window update frequency is determined based on the cache status parameters. For example, when the remaining cache space allows for continued writing, the window is updated once after each batch of printing is completed. Set window overlap rules according to data continuity requirements, such as setting 20 rows of data to overlap between two adjacent sliding window to ensure cross-row scheduling continuity; perform deduplication control on the overlapping area and only print unprinted data; The movement step size, update frequency, and overlap rules are combined to form a preset movement rule; When the window is updated, the ordered data sequence is offset according to the preset movement rules to generate a new sliding window.
[0048] In a preferred embodiment of the present invention, based on the cross-row heating distribution results, corresponding heating control intensity information and heating timing information are generated, and a correspondence between pixel positions and heating control signals is established accordingly to generate thermal control mapping rules, including: Based on the cross-row heating distribution results, the continuous printing length, adjacent pixel spacing, and cross-row heating distribution information of the corresponding pixels at each pixel position are comprehensively analyzed and processed to determine the heating load distribution at each pixel position. Based on the heating load distribution, hierarchical processing is performed on each pixel position to determine the corresponding heating control intensity information; Based on the heating control intensity information, the heating triggering order of each pixel position in the same row is adjusted, and combined with the distribution of heating control intensity information between adjacent rows, the heating triggering time of cross-row pixels is scheduled to generate corresponding heating timing information. Based on the heating control intensity information and heating timing information, the pixel position is mapped to the corresponding heating control signal to generate a thermal control mapping rule.
[0049] In this embodiment of the invention, by comprehensively analyzing the cross-row heating distribution results and combining continuous print length, adjacent pixel spacing, and cross-row distribution information, the heating load of each pixel position can be uniformly evaluated. Based on this, pixel positions are graded and corresponding heating control intensity information is determined, enabling pixels at different positions to adopt different heating methods according to their distribution characteristics, thereby avoiding concentrated heating in local areas. Furthermore, the pixel triggering order within the same row is adjusted according to the heating control intensity information, and the cross-row triggering time is scheduled based on the heating control intensity distribution between adjacent rows, allowing the printhead's heating behavior to be distributed in a time dimension. By generating corresponding heating timing information and mapping the heating control intensity information and heating timing information together into a heating control signal, each pixel position has a clear control method during the execution phase, thus ensuring that the heating distribution during the printing process remains coordinated both spatially and temporally.
[0050] In a preferred embodiment of the present invention, based on the cross-row heating distribution results, the continuous printing length corresponding to each pixel position, the spacing between adjacent pixels, and the cross-row heating distribution information of the corresponding pixels are comprehensively analyzed and processed to determine the heating load distribution at each pixel position, including: To obtain the number of times each pixel position appears in multiple consecutive rows in the cross-row heating distribution results, for example, to count the number of times a certain pixel position is in the printing state in 3 consecutive rows; Calculate the continuous printing length for each pixel position. For example, when positions 30 to 37 are continuously printed, the continuous printing length is 8. Calculate the spacing between adjacent pixels. For example, if there is one non-printed pixel between position 30 and position 32, the spacing is 2. The heating load value is calculated according to the number of times the line breaks occur, the continuous printing length, and the pixel spacing, based on a preset weighting rule. For example, the weight is set as continuous length × 0.5 + number of line breaks × 0.3 + (1 / (spacing + 1)) × 0.2. When the continuous length is 8, the number of line breaks is 3, and the spacing is 2, the calculated load value is 8 × 0.5 + 3 × 0.3 + (1 / 2) × 0.2 = 4 + 0.9 + 0.1 = 5. The heating load values at each pixel location are summarized to form the heating load distribution.
[0051] In a preferred embodiment of the present invention, hierarchical processing is performed on each pixel position according to the heating load distribution to determine the corresponding heating control intensity information, including: The heating load value of each pixel position is obtained, and the level range is divided according to the preset grading rules. For example, the load value range is divided into level 1 (0 to 2), level 2 (2 to 4), and level 3 (4 to 6). Map the heating load value of each pixel location to the corresponding level. For example, a pixel with a load value of 5 is divided into three levels. The corresponding heating control intensity information is determined according to the level. For example, Level 1 corresponds to a heating time of 0.4ms, Level 2 corresponds to 0.6ms, and Level 3 corresponds to 0.8ms. The heating control intensity information at each pixel location is recorded to form intensity distribution data.
[0052] In a preferred embodiment of the present invention, the heating triggering order of pixels within the same row is adjusted based on the heating control intensity information, and the heating triggering time of pixels across rows is scheduled based on the distribution of heating control intensity information between adjacent rows to generate corresponding heating timing information, including: Obtain the heating control intensity information of each pixel position in the same row, and sort them from high to low intensity. Adjust the heating triggering order based on the sorting results, for example, prioritize triggering high-intensity pixels and set the triggering interval between adjacent pixels to 0.4ms; Obtain the heating control intensity information of corresponding pixel positions between adjacent rows, and perform time dispersion processing on cross-row pixels. For example, when the same position in three consecutive rows is high intensity, the trigger time is set to 0ms, 0.4ms, and 0.8ms respectively. The trigger times of the same row and across rows are sorted uniformly to generate a complete time series; The trigger time corresponding to each pixel position is recorded to form heating timing information.
[0053] In a preferred embodiment of the present invention, a heat control mapping rule is generated by mapping pixel positions to corresponding heat control signals based on heating control intensity information and heating timing information, including: The corresponding printhead heating point number is determined based on the pixel position. For example, the nth pixel corresponds to the nth printhead heating point number. The heating control intensity information is converted into control signal parameters, for example, the heating time of 0.8ms is encoded into a corresponding pulse width signal; The heating timing information is converted into a trigger time parameter, for example, the trigger time of 0.4ms is encoded into a delay control signal; The pixel position, heating control intensity parameters, and trigger time parameters are combined according to a preset signal format to generate a control command unit; All control command units are arranged in pixel order to form a complete thermal control mapping rule, which is used to drive the print head to perform heating operations.
[0054] In a preferred embodiment of the present invention, according to the thermal control mapping rules, the pixels in the initial binary pixel data that are in the printing state are subjected to distribution reconstruction processing to generate corrected binary pixel data, including: Based on the printing status, pixel position, and distribution relationship of adjacent pixels in the initial binary pixel data, the pixels in the printing state are divided into continuous regions to generate the printing region distribution result. Based on the heating control intensity information corresponding to the thermal control mapping rules, the printing area distribution results are graded to determine the printing priority and distribution constraints of pixels in each area, and intensity control distribution results are generated. Based on the heating timing information corresponding to the thermal control mapping rules, timing adjustment processing is performed on the intensity control distribution results to generate timing constraint distribution results; Based on the temporal constraint distribution results, the pixels in the continuous printing area are subjected to interval insertion and pixel state redistribution processing to generate the adjusted pixel distribution results; Based on the adjusted pixel distribution, corrected binary pixel data is generated.
[0055] In this embodiment of the invention, by dividing the pixels in the printing state in the initial binary pixel data into continuous regions, the scattered printing points can be summarized into printing areas with structural features, providing a basis for subsequent adjustments. Based on this, the printing areas are graded according to the heating control intensity information in the thermal control mapping rules, so that pixels in different areas obtain corresponding printing priorities and distribution constraints according to their distribution, thereby differentiating the data at the region level. Furthermore, the heating timing information in the thermal control mapping rules is combined to perform timing adjustments on the pixels within the regions, so that each region forms an orderly triggering relationship during the output process. Based on this, by performing interval insertion and pixel state redistribution processing on pixels within continuous printing areas, the original continuous structure can be refined, making the pixel distribution more balanced. The final corrected binary pixel data, while maintaining the basic image structure, can match the heating control method of the print head, thus ensuring that the data output format is consistent with the printing execution process.
[0056] In a preferred embodiment of the present invention, based on the printing state, pixel position, and distribution relationship of adjacent pixels in the initial binary pixel data, the pixels in the printing state are subjected to continuous region division processing to generate a printing region distribution result, including: Iterate through the initial binary pixel data, determine the printing state of each pixel, and mark the pixels with a value of 1 as the printing state pixels. The pixels in the printing state are grouped according to their pixel positions. When adjacent pixels are in the same continuous position and both are in the printing state, they are divided into the same continuous area. For each consecutive region, record the start position, end position, and region length. For example, if the 12th to 18th positions are continuously printed, then the length of the region is 7. The location and length information of all continuous regions are summarized to generate the printed region distribution result.
[0057] In a preferred embodiment of the present invention, the printing area distribution results are graded according to the heating control intensity information corresponding to the thermal control mapping rules, the printing priority and distribution constraints of pixels in each area are determined, and intensity control distribution results are generated, including: Obtain the heating control intensity information corresponding to each pixel position in the thermal control mapping rules, and extract the intensity value of each pixel in each printing area; The printed area is graded according to a preset grading rule. The grading rule is determined based on the average intensity of pixels in the area. For example, an average intensity in the range of 0.4ms to 0.6ms is classified as Level 1, and an average intensity in the range of 0.6ms to 0.8ms is classified as Level 2. Printing priority is determined based on the region level; for example, printing from a second-level region takes precedence over printing from a first-level region. Set distribution constraints based on region level, for example, limit the number of consecutive pixels in a secondary region to no more than 6; The priority and constraint information of each region is recorded to generate intensity control distribution results.
[0058] In a preferred embodiment of the present invention, based on the heating timing information corresponding to the thermal control mapping rules, a timing adjustment process is performed on the intensity control distribution results to generate timing constraint distribution results, including: The heating timing information corresponding to each pixel position is obtained and arranged in chronological order to form a timing sequence; The timing sequence is adjusted according to the region priority. For example, pixels in high-priority regions are triggered earlier, and the time interval is set to 0.4ms. Pixels within the same region are allocated according to timing information, for example, the trigger times of consecutive pixels are set sequentially to 0ms, 0.4ms, and 0.8ms; the trigger times are cyclically mapped within a single heating cycle. The triggering time of cross-region pixels is coordinated to avoid simultaneous triggering of adjacent regions, for example, by staggering the triggering time of adjacent regions by 0.4ms; The adjusted trigger time is associated with the corresponding pixel position to generate a temporal constraint distribution result.
[0059] In a preferred embodiment of the present invention, based on the temporal constraint distribution result, interval insertion and pixel state redistribution processing are performed on pixels within a continuous printing area to generate an adjusted pixel distribution result, including: Obtain the trigger time and distribution information of each printed area in the timing constraint distribution results; When the length of the continuous printing area exceeds the preset limit, non-printing pixels are inserted between adjacent pixels according to the time interval. For example, one non-printing pixel is inserted every four pixels in eight consecutive pixels. The pixel state is redistributed based on the insertion result, for example, the original continuous region is divided into multiple sub-regions; The sub-regions and interval pixels are rearranged according to their positional order to form a new pixel distribution structure; Summarize the processing results of all regions to generate the adjusted pixel distribution result; In this process, after performing interval insertion and redistribution, the total number of pixels is constrained and corrected so that the number of pixels in the final pixel distribution result is consistent with the pixel number constraint.
[0060] Embodiments of the present invention also provide a collaborative control system for a document scanner and a thermal printer, the system comprising: The parameter acquisition module is used to acquire the printhead dot width, heating cycle parameters, and buffer status parameters of the thermal printer to form an initial parameter set. The constraint generation module is used to match the line data length of the printhead dot matrix width according to the initial parameter set to generate pixel quantity constraints; determine the continuous heating point limit according to the heating cycle parameter to generate in-line heating density constraints; and determine the data output rhythm according to the buffer state parameter to generate inter-line output constraints. The mapping rule generation module is used to form row-level output constraint information based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, and to establish the correspondence between pixel positions and heating control, thereby generating thermal control mapping rules for controlling the heating behavior of the printhead. The image acquisition and processing module is used to control the high-speed document scanner to perform image acquisition based on the row-level output constraint information, and to perform row-by-row scanning processing on the original image data to generate grayscale image row data. The binary data generation module is used to perform threshold conversion processing on grayscale image row data and adjust the energy distribution according to thermal control mapping rules to generate binary bitmap row data consistent with the width of the print head dot matrix. The binary bitmap row data is used to characterize whether the corresponding pixel has performed a printing operation. The data writing module is used to write binary bitmap row data into the corresponding storage location in the mapping buffer of the shared data channel according to the preset address mapping rules, and generate and update the corresponding writing location identifier during the writing process, while attaching the row sequence identifier and the hot control identifier. The window construction and execution module is used to construct a sliding window based on the row sequence identifier and generate a batch ready identifier, which is sent to the thermal printer via a trigger signal line. The thermal printer reads the data in the sliding window from the mapping buffer based on the batch ready identifier and drives the print head to complete multi-line printing according to the thermal control identifier, generating a batch printing completion feedback signal. The feedback scheduling module is used to control the document scanner to trigger the data acquisition and processing of the next sliding window based on the batch printing completion feedback signal. It also pauses the generation of new sliding window data when there is unread data in the mapping buffer and resumes processing after reading is completed.
[0061] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0062] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0063] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0064] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for coordinated control of a document scanner and a thermal printer, characterized in that, The method includes: Obtain the printhead dot width, heating cycle parameters, and buffer status parameters of the thermal printer to form an initial parameter set; Based on the initial parameter set, the line data length is matched to the printhead dot matrix width to generate pixel quantity constraints; the continuous heating point limit is determined based on the heating cycle parameter to generate in-line heating density constraints; and the data output rhythm is determined based on the buffer state parameter to generate inter-line output constraints. Based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, row-level output constraint information is formed, and the correspondence between pixel position and heating control is established to generate thermal control mapping rules for controlling printhead heating behavior. Based on the row-level output constraint information, the high-speed scanner is controlled to perform image acquisition and the original image data is scanned line by line to generate grayscale image row data. The grayscale image row data is subjected to threshold conversion processing, and the energy distribution is adjusted according to the thermal control mapping rules to generate binary bitmap row data with the same width as the print head dot matrix. The binary bitmap row data is used to characterize whether the corresponding pixel has performed a printing operation. The binary bitmap row data is written to the corresponding storage location in the mapping buffer of the shared data channel according to the preset address mapping rules. During the writing process, the corresponding write location identifier is generated and updated, and the row sequence identifier and hot control identifier are attached. A sliding row window is constructed based on the row sequence identifier, and a batch ready identifier is generated and sent to the thermal printer via a trigger signal line. The thermal printer reads the data in the sliding row window from the mapping buffer based on the batch ready identifier, and drives the print head to complete the printing of multiple rows according to the thermal control identifier, generating a batch printing completion feedback signal. Based on the feedback signal indicating that the batch printing is complete, the document scanner is controlled to trigger the data acquisition and processing of the next sliding window. If there is unread data in the mapping buffer, the generation of new sliding window data is paused, and processing is resumed after the data is read.
2. The method for coordinated control of a document scanner and a thermal printer according to claim 1, characterized in that, Based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, row-level output constraint information is formed, and a correspondence between pixel positions and heating control is established. This generates thermal control mapping rules for controlling printhead heating behavior, including: Based on the pixel count constraint, length matching processing is performed on each row of image data to generate the corresponding pixel position sequence; Based on the inline heating density constraint, pixels with consecutive position indices in the pixel position sequence are grouped, and length detection is performed on each consecutive pixel group to generate a continuous pixel distribution result. Based on the continuous pixel distribution results, the pixels that exceed the continuous heating point limit are subjected to interval allocation processing to generate an adjusted pixel position sequence; Based on the inter-row output constraints, the adjusted pixel position sequence is associated with at least one row of generated pixel position sequence to generate cross-row heating distribution results; Based on the cross-row heating distribution results, corresponding heating control intensity information and heating timing information are generated, and the correspondence between pixel position and heating control signal is established accordingly to generate thermal control mapping rules.
3. The method for coordinated control of a document scanner and a thermal printer according to claim 1, characterized in that, The grayscale image row data undergoes threshold conversion, and energy distribution is adjusted according to thermal control mapping rules to generate binary bitmap row data consistent with the printhead dot matrix width, including: Based on the grayscale image row data, each pixel is compared with a preset baseline threshold. Pixels that meet the comparison conditions are determined as printing state pixels, and pixels that do not meet the comparison conditions are determined as non-printing state pixels, generating initial binary pixel data. According to the thermal control mapping rules, the pixels in the printing state in the initial binary pixel data are reconstructed to generate corrected binary pixel data. Based on the corrected binary pixel data, region recognition processing is performed on continuous pixels in the printing state to generate continuous printing areas; Based on the continuous printing area and combined with the thermal control mapping rules, segmentation and interval control processing is performed on the continuous printing area to generate the adjusted pixel distribution result; Based on the adjusted pixel distribution, binary bitmap row data containing thermal control information is generated.
4. The method for coordinated control of a document scanner and a thermal printer according to claim 1, characterized in that, The binary bitmap row data is written to the corresponding storage location in the mapping buffer of the shared data channel according to the preset address mapping rules. During the writing process, the corresponding write location identifier is generated and updated, and a row sequence identifier and a hot control identifier are attached, including: According to the preset address mapping rules, the binary bitmap row data is allocated to the target storage address in the mapping buffer to generate the address mapping result; Based on the address mapping results, the binary bitmap row data is written to the corresponding storage address, and row sequence identifiers and thermal control identifiers are attached during the writing process to generate structured storage data. Based on the structured storage data, generate and update the write position identifier in the mapping buffer, and generate the corresponding data write status information; Based on the data write status information, a data ready indication is generated for the thermal printer to read sequentially.
5. The method for coordinated control of a document scanner and a thermal printer according to claim 1, characterized in that, Construct a sliding row window based on the row sequence identifier, including: Based on the row sequence identifier, the binary bitmap row data is sequentially arranged to generate an ordered data sequence; Based on the heating cycle parameters, select multiple consecutive rows of data from the ordered data sequence to generate a sliding row window; Based on the binary bitmap row data in the sliding window and the corresponding heat control identifier, the data of each row is jointly scheduled and processed to generate a cross-row heating control sequence. Based on the cross-line heating control sequence, a batch ready identifier is generated to control the thermal printer to perform corresponding multi-line printing. After completing the processing of the current sliding window, the window position of the ordered data sequence is updated according to the preset movement rules to generate a new sliding window.
6. The method for coordinated control of a document scanner and a thermal printer according to claim 2, characterized in that, Based on the cross-row heating distribution results, corresponding heating control intensity information and heating timing information are generated, and a correspondence between pixel positions and heating control signals is established accordingly, generating thermal control mapping rules, including: Based on the cross-row heating distribution results, the continuous printing length, adjacent pixel spacing, and cross-row heating distribution information of the corresponding pixels at each pixel position are comprehensively analyzed and processed to determine the heating load distribution at each pixel position. Based on the heating load distribution, hierarchical processing is performed on each pixel position to determine the corresponding heating control intensity information; Based on the heating control intensity information, the heating triggering order of each pixel position in the same row is adjusted, and combined with the distribution of heating control intensity information between adjacent rows, the heating triggering time of cross-row pixels is scheduled to generate corresponding heating timing information. Based on the heating control intensity information and heating timing information, the pixel position is mapped to the corresponding heating control signal to generate a thermal control mapping rule.
7. The method for coordinated control of a document scanner and a thermal printer according to claim 3, characterized in that, According to the thermal control mapping rules, the pixels in the initial binary pixel data that are in the printing state are subjected to distribution reconstruction processing to generate corrected binary pixel data, including: Based on the printing status, pixel position, and distribution relationship of adjacent pixels in the initial binary pixel data, the pixels in the printing state are divided into continuous regions to generate the printing region distribution result. Based on the heating control intensity information corresponding to the thermal control mapping rules, the printing area distribution results are graded to determine the printing priority and distribution constraints of pixels in each area, and intensity control distribution results are generated. Based on the heating timing information corresponding to the thermal control mapping rules, timing adjustment processing is performed on the intensity control distribution results to generate timing constraint distribution results; Based on the temporal constraint distribution results, the pixels in the continuous printing area are subjected to interval insertion and pixel state redistribution processing to generate the adjusted pixel distribution results; Based on the adjusted pixel distribution, corrected binary pixel data is generated.
8. A collaborative control system for a document scanner and a thermal printer, characterized in that, The system, used in any one of claims 1 to 7, comprises: The parameter acquisition module is used to acquire the printhead dot width, heating cycle parameters, and buffer status parameters of the thermal printer to form an initial parameter set. The constraint generation module is used to match the line data length of the printhead dot matrix width according to the initial parameter set to generate pixel quantity constraints; determine the continuous heating point limit according to the heating cycle parameter to generate in-line heating density constraints; and determine the data output rhythm according to the buffer state parameter to generate inter-line output constraints. The mapping rule generation module is used to form row-level output constraint information based on pixel quantity constraints, in-row heating density constraints, and inter-row output constraints, and to establish the correspondence between pixel positions and heating control, thereby generating thermal control mapping rules for controlling the heating behavior of the printhead. The image acquisition and processing module is used to control the high-speed document scanner to perform image acquisition based on the row-level output constraint information, and to perform row-by-row scanning processing on the original image data to generate grayscale image row data. The binary data generation module is used to perform threshold conversion processing on grayscale image row data and adjust the energy distribution according to thermal control mapping rules to generate binary bitmap row data consistent with the width of the print head dot matrix. The binary bitmap row data is used to characterize whether the corresponding pixel has performed a printing operation. The data writing module is used to write binary bitmap row data into the corresponding storage location in the mapping buffer of the shared data channel according to the preset address mapping rules, and generate and update the corresponding writing location identifier during the writing process, while attaching the row sequence identifier and the hot control identifier. The window construction and execution module is used to construct a sliding window based on the row sequence identifier and generate a batch ready identifier, which is sent to the thermal printer via a trigger signal line. The thermal printer reads the data in the sliding window from the mapping buffer based on the batch ready identifier and drives the print head to complete multi-line printing according to the thermal control identifier, generating a batch printing completion feedback signal. The feedback scheduling module is used to control the document scanner to trigger the data acquisition and processing of the next sliding window based on the batch printing completion feedback signal. It also pauses the generation of new sliding window data when there is unread data in the mapping buffer and resumes processing after reading is completed.
9. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.