A label printer-based positioning correction method, device, equipment and medium

By dynamically analyzing photoelectric sensor signals, identifying and filtering label feature segments, and calculating the face paper reference value and positioning threshold, the problem of inaccurate positioning in label printers is solved, achieving high-precision determination of the starting position of label consumables and improving printing quality.

CN121212176BActive Publication Date: 2026-02-17BEIJING SHUOFANG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511725661.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-02-17
Estimated Expiration
2045-11-24

AI Technical Summary

Technical Problem

Existing label printer positioning calibration methods rely on fixed thresholds, which cannot adapt to the diversity of label consumable materials and the complexity of the environment, resulting in inaccurate positioning and affecting print quality.

Method used

By dynamically analyzing the light intensity signal collected by the photoelectric sensor, the effective label feature segments are identified, filtered, and the face paper reference value is calculated. Combined with the preset offset, the final positioning threshold is generated to accurately locate the starting position of the label consumable.

Benefits of technology

It improves the positioning accuracy and reliability of label printers, enhances their adaptability to consumables of different materials, and ensures print quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121212176B_ABST
    Figure CN121212176B_ABST
Patent Text Reader

Abstract

A positioning correction method, apparatus, device, and medium based on a label printer are disclosed, relating to the field of label printing. In this method, light intensity signals are acquired to obtain an initial light intensity signal sequence; the initial light intensity signal sequence is analyzed to identify whether there are valid label feature segments that meet preset structural conditions; if valid label feature segments that meet the preset structural conditions are determined to exist, a face paper signal segment is extracted from the valid label feature segments and used as a calibration target signal; the calibration target signal is filtered to obtain a filtered signal, and a face paper reference value is calculated based on the filtered signal; a final positioning threshold is calculated based on the face paper reference value and a preset offset, and the starting position of the label consumable is determined based on the final positioning threshold. Implementing the technical solution provided in this application improves printing quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of label printing, specifically to a positioning correction method, apparatus, device, and medium based on a label printer. Background Technology

[0002] With the widespread use of label printers in logistics, retail, and other industries, accurate positioning of label consumables is crucial for ensuring print quality. Label consumables typically consist of a face sheet and a back sheet, separated by a gap. Photoelectric sensors determine the starting position of the label by detecting the gap position.

[0003] Currently, in label printer positioning calibration, existing positioning methods typically rely on fixed threshold values ​​to identify the starting position of the label liner. Specifically, photoelectric sensors collect light intensity signals during the movement of the label liner and use preset fixed threshold values ​​to distinguish between the face paper and gap signals, thereby determining the label's starting position.

[0004] However, due to the diversity of label consumable materials and the complexity of the usage environment (such as changes in optical properties or noise interference), the fixed threshold method is not adaptable enough to complex scenarios. It is prone to signal recognition errors due to unreasonable threshold settings or differences in consumable characteristics, which in turn leads to inaccurate positioning of the consumable starting position and a decline in print quality. Summary of the Invention

[0005] This application provides a positioning correction method, apparatus, device, and medium based on a label printer, which improves print quality.

[0006] A first aspect of this application provides a positioning calibration method based on a label printer. In this method, in response to a positioning calibration command, the consumable delivery device of the label printer is controlled to drive the label consumable to move, and a photoelectric sensor collects light intensity signals during the movement of the label consumable to obtain an initial light intensity signal sequence. The initial light intensity signal sequence is analyzed to identify whether there is a valid label feature segment that meets preset structural conditions. The valid label feature segment includes a face paper signal segment and a gap signal segment. If it is determined that there is a valid label feature segment that meets the preset structural conditions, the face paper signal segment is extracted from the valid label feature segment and used as a calibration target signal. The calibration target signal is filtered to obtain a filtered signal, and a face paper reference value is calculated based on the filtered signal. A final positioning threshold is calculated based on the face paper reference value and a preset offset, and the starting position of the label consumable is determined based on the final positioning threshold.

[0007] By employing the above technical solution, the consumable delivery device of the label printer is controlled to drive the movement of the label consumables. A photoelectric sensor collects the light intensity signal during the movement of the label consumables, obtaining an initial light intensity signal sequence. This initial light intensity signal sequence is then analyzed to identify valid label feature segments that meet preset structural conditions. These valid label feature segments include a face paper signal segment and a gap signal segment. The face paper signal segment is extracted from the valid label feature segments as a calibration target signal. This calibration target signal is filtered to obtain a filtered signal, and a face paper reference value is calculated based on the filtered signal. Finally, a final positioning threshold is calculated based on the face paper reference value and a preset offset, and the starting position of the label consumables is determined according to this final positioning threshold. This method automatically identifies valid label features on the label consumables, extracts a stable and reliable face paper signal as a calibration reference, and accurately determines the starting position of the label consumables through filtering and threshold offset processing. This method offers high positioning accuracy and effectively improves the intelligence level and print quality of the label printer.

[0008] Optionally, the initial light intensity signal sequence is analyzed to identify whether there are valid label feature segments that meet preset structural conditions. Specifically, this includes: performing ternary processing on the initial light intensity signal sequence to generate a ternary signal sequence, where each signal point in the ternary signal sequence is identified as a tissue signal point, a gap signal point, and a transition signal point; scanning the ternary signal sequence using a sliding window of preset length; if the sequence pattern of the current sliding window meets the preset structural conditions, then the original light intensity signal segment corresponding to the current window is determined as a candidate feature segment; determining the number of tissue signal points in the candidate feature segment; if the number of tissue signal points is greater than or equal to a preset number threshold, then the candidate feature segment is determined as the valid label feature segment.

[0009] By employing the above technical solution, the initial light intensity signal sequence is ternary-valued, identifying each signal point as a face paper signal point, gap signal point, or transition signal point, generating a ternary signal sequence. Then, a sliding window of preset length is used to scan the ternary signal sequence, determining whether the sequence pattern of the current window meets preset structural conditions. If it does, the corresponding original light intensity signal segment is selected as a candidate feature segment. Next, the number of face paper signal points in the candidate feature segment is determined; if the number is greater than or equal to a preset threshold, the candidate feature segment is identified as a valid label feature segment. Through ternary-valued processing and sliding window scanning, signal intervals matching label characteristics can be quickly selected based on prior knowledge of the label structure, and the validity of the candidate feature segments is further verified by judging the number of transition signal points. This method fully utilizes the structural characteristics of the label, improving the recognition efficiency and accuracy of valid label feature segments.

[0010] Optionally, the initial light intensity signal sequence is ternary processed to generate a ternary signal sequence, specifically including: determining the global maximum signal value and the global minimum signal value in the initial light intensity signal sequence; calculating the signal dynamic range based on the global maximum signal value and the global minimum signal value, and calculating and generating a gap identification threshold and a tissue identification threshold according to the signal dynamic range and a preset segmentation coefficient, wherein the gap identification threshold is greater than the tissue identification threshold; traversing each signal point in the initial light intensity signal sequence to obtain the current signal value of the current signal point; comparing the current signal value with the gap identification threshold; if the current signal value is greater than or equal to the gap identification threshold, then the current signal point is identified as a gap signal point; if the current signal value is less than the gap identification threshold, then the current signal value is compared with the tissue identification threshold; if the current signal value is less than or equal to the tissue identification threshold, then the current signal point is identified as a tissue signal point; if the current signal value is greater than the tissue identification threshold, then the current signal point is identified as a transition signal point.

[0011] By adopting the above technical solution, the global maximum and minimum signal values ​​of the initial light intensity signal sequence are first determined, and the signal dynamic range is calculated based on these values. Then, according to the signal dynamic range and preset segmentation coefficients, the paper identification threshold and gap identification threshold are calculated and generated. Next, each signal point in the initial light intensity signal sequence is traversed. By adaptively calculating the paper identification threshold and gap identification threshold, the paper, gap, and transition regions can be reasonably divided according to the actual signal dynamic range, improving the adaptability and robustness of the ternary processing. At the same time, by comparing and labeling each point, each signal point can be accurately classified into its corresponding category, providing a reliable basis for subsequent feature segment identification.

[0012] Optionally, the step of filtering the calibration target signal to obtain the filtered signal specifically includes: acquiring a sliding filter window with a preset length, and controlling the sliding filter window to slide point by point from the starting position corresponding to the calibration target signal to the ending position corresponding to the calibration target signal; for the signal subsequence covered by the sliding filter window at each position, identifying and removing the maximum and minimum signal values ​​of the signal subsequence to obtain a set of remaining signal points; calculating the arithmetic mean of all signal values ​​in the set of remaining signal points, and using the arithmetic mean as the new signal value corresponding to the center position of the sliding filter window to obtain the filtered signal.

[0013] By employing the above technical solution, a sliding filter window of preset length is used, sliding point by point from the beginning of the calibration target signal to the end. For the signal subsequence covered by the sliding filter window at each position, its maximum and minimum signal values ​​are identified and removed, resulting in a set of remaining signal points. Then, the arithmetic mean of all signal values ​​in the remaining signal point set is calculated, and this average is used as the new signal value corresponding to the center position of the sliding filter window, ultimately yielding the filtered signal. Using a sliding window approach effectively suppresses extreme noise and abnormal fluctuations in the calibration target signal while preserving local signal characteristics. The removal of maximum and minimum values ​​further improves the stability and robustness of the filtering result. Using the arithmetic mean as the new signal value smooths out local signal fluctuations, making the filtered signal more stable and reliable, providing high-quality input for subsequent calculations of the surface reference value.

[0014] Optionally, the step of calculating the reference value for the face paper based on the filtered signal specifically includes: counting the occurrence frequency of each signal value in the filtered signal, generating a signal value frequency distribution histogram representing the relationship between each signal value and its corresponding occurrence frequency; extending a signal value range of a preset width to both sides of the signal value with the highest occurrence frequency in the signal value frequency distribution histogram to obtain a peak interval; extracting target signal points from the filtered signal whose signal values ​​fall within the peak interval to form a core signal point set; calculating a weighted average based on the target signal values ​​of each target signal point in the core signal point set and the occurrence frequency of each target signal value in the signal value frequency distribution histogram, and determining the weighted average as the reference value for the face paper.

[0015] By adopting the above technical solution, the frequency of occurrence of each signal value in the filtered signal is first statistically analyzed to generate a frequency distribution histogram. Then, with the highest frequency signal value as the center, a signal value range of a preset width is extended to both sides to obtain the peak interval. Next, target signal points whose signal values ​​fall within the peak interval are extracted from the filtered signal to form a core signal point set. Finally, based on the signal values ​​of each target signal point in the core signal point set and its corresponding frequency of occurrence in the frequency distribution histogram, a weighted average is calculated, and this weighted average is determined as the surface reference value. The frequency distribution histogram can intuitively reflect the overall distribution characteristics of the filtered signal and automatically identify the main distribution intervals of the signal. Determining the peak interval with the highest frequency signal value as the center allows focus on the core stable region of the signal, eliminating interference from edge fluctuations and transition regions. Extracting target signal points within the peak interval to form the core signal point set further improves the relevance and representativeness of the surface reference value calculation. The weighted average method fully considers the frequency of occurrence of each signal value, giving higher-frequency stable signal values ​​a greater weight in the reference value calculation, thus improving the reliability and stability of the surface reference value.

[0016] Optionally, determining the final positioning threshold based on the paper reference value and the preset offset, and determining the starting position of the label consumable based on the final positioning threshold, specifically includes: subtracting the preset offset from the paper reference value to obtain the final positioning threshold; sequentially scanning the acquired light intensity signals to determine candidate starting points, wherein the candidate starting point is the first signal point determined during the scanning process whose signal value is greater than or equal to the final positioning threshold; determining a verification window with a preset length starting from the candidate starting point, and calculating the average signal value of all signal points within the verification window to obtain a window confirmation value; judging the relationship between the window confirmation value and the final positioning threshold; if the window confirmation value is greater than or equal to the final positioning threshold, then determining the candidate starting point as a valid label edge trigger point, and determining the physical position of the candidate starting point as the starting position of the label consumable.

[0017] By adopting the above technical solution, the final positioning threshold is first obtained by subtracting a preset offset from the reference value of the face paper. Then, the collected light intensity signals are sequentially scanned, and the first signal point with a signal value greater than or equal to the final positioning threshold is identified as a candidate starting point. Next, a verification window of a preset length is determined starting from the candidate starting point, and the average signal value of all signal points within the verification window is calculated to obtain the window confirmation value. Finally, the relationship between the window confirmation value and the final positioning threshold is compared. If the window confirmation value is greater than or equal to the final positioning threshold, the candidate starting point is determined as a valid tag edge trigger point, and its physical location is determined as the starting position of the tag consumable. By introducing a preset offset, the position of the final positioning threshold can be flexibly adjusted based on the face paper reference value to make it closer to the tag edge, improving the positioning accuracy. The sequential scanning and threshold comparison method can quickly lock the candidate position of the tag edge, avoiding the complexity of global search. The introduction of a verification window to confirm the candidate starting point, and the calculation of the relationship between the average signal value within the window and the threshold, further verifies the validity of the candidate starting point, improving the reliability of the tag starting position determination. Finally, based on the physical location of the candidate starting point, the starting position of the label consumable is accurately located, providing a reliable reference for subsequent label printing control.

[0018] Optionally, after determining the relationship between the window confirmation value and the final positioning threshold, the method further includes: if the window confirmation value is determined to be less than the final positioning threshold, then the candidate starting point is determined to be an invalid noise point; based on the comparison between the signal value of the invalid noise point and the final positioning threshold, a noise overshoot is calculated, and the noise overshoot is accumulated to obtain a cumulative noise energy value; the relationship between the cumulative noise energy value and a preset noise energy is determined; if the cumulative noise energy value is determined to be less than the preset noise energy, then a target starting point is determined from the next position of the candidate starting point, wherein the signal value of the target starting point is greater than or equal to the final positioning threshold; if the cumulative noise energy value is determined to be greater than or equal to the preset noise energy, then the current positioning process is terminated, and a recalibration process is triggered.

[0019] By adopting the above technical solution, when the confirmation value of the verification window is less than the final positioning threshold, the candidate starting point is determined as an invalid noise point. Then, based on the signal value of the invalid noise point and the final positioning threshold, the noise overshoot is calculated and accumulated to obtain the cumulative noise energy value. Next, the relationship between the cumulative noise energy value and the preset noise energy is compared. If the cumulative noise energy value is less than the preset noise energy, a new target starting point with a signal value greater than or equal to the final positioning threshold is determined from the next position after the candidate starting point. If the cumulative noise energy value is greater than or equal to the preset noise energy, the current positioning process is terminated, and a recalibration process is triggered. By introducing the concepts of noise overshoot and cumulative noise energy, the impact of invalid noise points on the positioning process can be quantitatively evaluated. When the cumulative noise energy is small, invalid noise points are skipped, and the search for the next potential tag starting position continues, improving the robustness and fault tolerance of the positioning. When the cumulative noise energy exceeds the preset threshold, the current positioning process is terminated in a timely manner to avoid positioning failure caused by noise interference, and the positioning parameters are adaptively adjusted by triggering the recalibration process, improving the system's self-repair capability. This method effectively enhances the stability and reliability of label start position determination and improves the system's adaptability to complex printing environments.

[0020] A second aspect of this application provides a positioning and calibration device based on a label printer. The device includes a light intensity signal acquisition module, a valid label analysis module, a calibration signal determination module, a paper reference value calculation module, and a starting position determination module. The light intensity signal acquisition module is used to respond to a positioning and calibration command, control the consumable delivery device of the label printer to drive the label consumable to move, and cause a photoelectric sensor to acquire light intensity signals during the movement of the label consumable to obtain an initial light intensity signal sequence. The valid label analysis module is used to analyze the initial light intensity signal sequence to identify whether there are valid label features that meet preset structural conditions. The effective label feature segment includes a face paper signal segment and a gap signal segment; the calibration signal determination module is used to extract the face paper signal segment from the effective label feature segment if it is determined that there is an effective label feature segment that meets the preset structural conditions, and use the face paper signal segment as the calibration target signal; the face paper reference value calculation module is used to filter the calibration target signal to obtain a filtered signal, and calculate the face paper reference value based on the filtered signal; the starting position determination module is used to determine the final positioning threshold according to the face paper reference value and a preset offset, and determine the starting position of the label consumable according to the final positioning threshold.

[0021] A third aspect of this application provides an electronic device including a processor, a memory, a user interface, and a network interface, wherein the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any of the foregoing.

[0022] A fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed, perform the method described in any of the preceding descriptions.

[0023] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages:

[0024] By dynamically analyzing the light intensity signal collected by the photoelectric sensor, effective label feature segments are accurately extracted. The extracted face paper signal segments are then filtered to eliminate noise interference, ensuring signal stability and reliability. Simultaneously, by calculating the face paper reference value and combining it with a preset offset to dynamically generate the final positioning threshold, adaptive processing for consumables of different materials is achieved. This ultimately and accurately determines the starting position of the label consumable, overcoming the shortcomings of the fixed threshold method in signal processing accuracy, anti-interference capability, and adaptability, effectively improving the positioning accuracy and reliability of label printing. Attached Figure Description

[0025] Figure 1 This is a flowchart illustrating a positioning correction method based on a label printer disclosed in an embodiment of this application;

[0026] Figure 2 This is another schematic flowchart of a positioning correction method based on a label printer disclosed in an embodiment of this application;

[0027] Figure 3 This is a schematic diagram of a positioning and correction device based on a label printer disclosed in an embodiment of this application;

[0028] Figure 4 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.

[0029] Explanation of reference numerals in the attached diagram: 301, Light intensity signal acquisition module; 302, Valid tag analysis module; 303, Calibration signal determination module; 304, Face paper reference value calculation module; 305, Starting position determination module; 400, Electronic device; 401, Processor; 402, Communication bus; 403, User interface; 404, Network interface; 405, Memory. Detailed Implementation

[0030] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0031] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0032] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0033] This application provides a positioning correction method based on a label printer, referring to... Figure 1 , Figure 1 This is a flowchart illustrating a positioning correction method based on a label printer, provided in an embodiment of this application. The method is applied to the controller of the label printer, which executes a positioning correction procedure based on the label printer. The method includes steps S101 to S105, as follows:

[0034] Step S101: In response to the positioning calibration command, control the consumable delivery device of the label printer to drive the label consumable to move, and make the photoelectric sensor collect the light intensity signal during the movement of the label consumable to obtain the initial light intensity signal sequence.

[0035] In step S101, the positioning calibration command refers to a specific command issued by the user through the printer operation panel, host computer software, or remote control terminal to initiate the printer to perform adaptive learning of the optical characteristics and initialize the positioning reference for the currently loaded label consumables. The label printer refers to a dedicated device capable of printing information on continuous or discontinuous label consumables using thermal or thermal transfer methods, and it integrates a consumables conveying device and a photoelectric sensor. The consumables conveying device is a mechanical module composed of components such as a stepper motor, drive wheel, and paper pressure shaft, used to precisely control the forward or backward movement of the label consumables. The photoelectric sensor includes a transmitter and a receiver. The transmitter is a light-emitting element such as a light-emitting diode or laser emitter, which emits light to detect the light transmittance of the consumables. It is generally securely mounted on one side of the consumables conveying path. The transmitter is elongated to ensure that the light can cover a certain width of the consumables area, and the material can be common semiconductor materials. The receiver, typically a photoresistor, photodiode, or phototransistor, is mounted on the other side of the consumable transport path, parallel to the transmitter's axis. This allows for precise reception of light emitted from the transmitter and transmitted through the consumable, converting the optical signal into an electrical signal. Its shape is generally flat for easy light reception. The transmitter and receiver are positioned relative to each other with parallel axes, ensuring that light effectively passes through the consumable and is captured by the receiver. The transmitter emits light, and the receiver receives the light transmitted through the consumable and converts it into an electrical signal. Together, they can acquire the light intensity signal at different locations on the consumable in real time, accurately distinguishing between gaps and the paper surface area. The light intensity signal refers to the raw electrical signal value output by the photoelectric sensor, quantifying the intensity of light transmission or reflection at the sensor detection point. The initial light intensity signal sequence is a one-dimensional digital array consisting of a series of light intensity signal values ​​continuously and at equal intervals collected and stored by the controller during a preset travel distance controlled by the controller. This sequence completely records the changes in optical characteristics over a physical length range on the consumable.

[0036] Specifically, when the label printer's controller receives a user-triggered positioning calibration command, the pre-installed positioning calibration program in its firmware is activated. First, the controller sends pulse signals to the stepper motor driver chip via its I / O port, precisely controlling the stepper motor in the consumable delivery device to rotate at a preset, stable speed. The motor's rotation drives the drive wheel, thereby pulling the label consumable (e.g., composed of a backing paper and an adhesive face paper attached to it) smoothly through the detection area of ​​the photoelectric sensor. During this process, the photoelectric sensor's emitting end continuously emits a beam of light of stable intensity, which penetrates vertically through the label consumable and is received by the receiving end. Because the face paper portion and the gap between the face paper portions of the label have different light transmittance, the intensity of the light received by the receiving end changes significantly as the consumable moves. The photoelectric sensor converts these continuously changing light intensities into analog voltage signals in real time and sends them to the controller. The analog-to-digital converter (ADC) integrated within the controller samples and quantizes this analog voltage signal at a preset sampling frequency (e.g., synchronized with each step of the stepper motor or at a fixed clock cycle), converting it into a series of digital values, i.e., light intensity signals. The controller sequentially stores these time-acquired values ​​into its internal RAM, forming a digital sequence, namely the initial light intensity signal sequence. The length of this sequence is determined by the calibration stroke in the firmware, which typically needs to cover at least one complete "gap + sheet + gap" structure to ensure sufficient data is acquired for analysis. Finally, the controller obtains the initial light intensity signal sequence in its own storage space.

[0037] Step S102: Analyze the initial light intensity signal sequence to identify whether there are valid label feature segments that meet the preset structural conditions. Valid label feature segments include face paper signal segments and gap signal segments.

[0038] In step S102, the preset structural condition refers to a standard signal pattern or template predefined by the controller to accurately capture a complete tag from a continuous signal stream. In this embodiment, the condition is specifically a gap-sheet-gap sequence pattern. This pattern is based on an abstraction of the physical structure of a standard tag unit: an opaque or low-transmittance tag (sheet) is always surrounded by two high-transmittance gap regions. Therefore, when the tag material passes through the photoelectric sensor at a constant speed, its light intensity signal will inevitably exhibit "high-low-high" electrical signal characteristics in the time (or displacement) dimension, corresponding to the "gap-sheet-gap" physical structure. For example, the controller will look for a signal segment whose initial part is high voltage (e.g., 1.9V-2.5V, representing a gap), the middle part turns to a continuous low voltage (e.g., 0.5V-2.0V, representing a sheet), and the last part rises back to high voltage (representing the next gap). Only signal segments that completely satisfy this ordered structural change are considered potentially valid.

[0039] Specifically, after obtaining the initial light intensity signal sequence in step S101, the controller begins to execute the analysis and recognition task of this step. The initial light intensity signal sequence is a one-dimensional array or data stream generated by continuous sampling by the photoelectric sensor during the movement of the consumable. Each data point is a voltage value, faithfully recording the light transmission intensity at a corresponding tiny location on the consumable. The controller traverses this sequence, and its core task is pattern matching, i.e., finding whether there exists a subsequence in the sequence whose overall shape conforms to a preset "gap-paper-gap" structural pattern.

[0040] To achieve this goal, the controller internally defines two basic components that constitute this pattern:

[0041] Gap signal segment: refers to a continuous range of data points in a signal sequence, where the voltage values ​​are all stable within a relatively high preset voltage range (e.g., between 1.9V and 2.5V). This indicates that the photoelectric sensor is aligned with the translucent backing paper between the labels (i.e., the gap).

[0042] The label faceplate signal segment refers to a continuous range of data points in the signal sequence, where the voltage values ​​are consistently within a low, preset voltage range, for example, between 0.5V and 2.0V. This indicates that the sensor is aligned with the opaque label faceplate.

[0043] The controller's analysis process doesn't simply involve searching for three alternating regions; it incorporates more stringent constraints. It searches for a gap signal segment, which must be immediately followed by a tissue signal segment, and this tissue signal segment must then be immediately followed by another gap signal segment. Crucially, to eliminate interference from signal noise or accidental stains or defects on the consumables, the controller also verifies the length of the identified tissue signal segments. For example, the controller will determine if the physical length corresponding to the low-voltage signal segment meets a minimum effective length, such as 10mm. Only when a high-low-high signal pattern is found, and the duration of the low-signal portion—the tissue signal segment—also meets the preset minimum length requirement, will the controller ultimately confirm this complete gap-tissue-gap subsequence as a valid tag feature segment. This identified valid tag feature segment represents a complete and reliable tag sample signal captured during the calibration process, which can be used for subsequent, more accurate baseline calculations.

[0044] In one possible implementation, please refer to Figure 2 This invention provides a method for analyzing an initial light intensity signal sequence to identify whether there are valid tag feature segments that meet preset structural conditions. Specifically, it includes steps S201 to S208, which are described below in conjunction with... Figure 2 Detailed explanation:

[0045] Step S201: Determine the global maximum signal value and the global minimum signal value in the initial light intensity signal sequence.

[0046] In step S201, the control module traverses the entire initial light intensity signal sequence, and by comparing the signal value of each signal point in the sequence, determines and stores the global maximum signal value and the global minimum signal value of the sequence. These two extreme values ​​represent the theoretical upper limit (usually corresponding to the label gap area) and lower limit (usually corresponding to the label face paper area) of the signal intensity that the photoelectric sensor can detect under the current consumable and printer status, respectively, providing a data basis for subsequent dynamic threshold calculation.

[0047] Step S202: Based on the global maximum signal value and the global minimum signal value, calculate the signal dynamic range, and according to the signal dynamic range and the preset segmentation coefficient, calculate and generate the gap recognition threshold and the tissue paper recognition threshold, wherein the gap recognition threshold is greater than the tissue paper recognition threshold.

[0048] In step S202, the control module performs threshold calculation. First, based on the global maximum signal value and global minimum signal value obtained in step S201, the signal dynamic range is calculated, i.e., global maximum signal value - global minimum signal value. Then, the control module calculates two core discrimination thresholds according to the preset gap segmentation coefficient and paper segmentation coefficient using the following formula:

[0049] Gap recognition threshold = Global minimum signal value + Signal dynamic range × Gap segmentation coefficient

[0050] Tissue recognition threshold = global minimum signal value + signal dynamic range × tissue segmentation coefficient

[0051] The gap segmentation coefficient and the face paper segmentation coefficient are parameters pre-stored in the storage unit, and the value of the gap segmentation coefficient is greater than the value of the face paper segmentation coefficient (for example, the gap segmentation coefficient can be 0.7 and the face paper segmentation coefficient can be 0.3). This setting ensures that the calculated gap recognition threshold is necessarily higher than the face paper recognition threshold, thereby correctly dividing the discrimination boundary between the high signal area (corresponding to the gap) and the low signal area (corresponding to the face paper) on the signal strength axis.

[0052] Step S203: Traverse each signal point in the initial light intensity signal sequence and obtain the current signal value of the current signal point.

[0053] In step S203, after generating a dynamic threshold that matches the current consumable characteristics, the control module initiates a traversal process, sequentially processing each signal point in the initial light intensity signal sequence. In each step of the loop, the control module reads the signal value of the currently processed signal point as the current signal value for subsequent classification and discrimination.

[0054] Step S204: Compare the current signal value with the gap identification threshold.

[0055] In step S204, the control module performs the first-level comparison of the ternary classification decision. The current signal value obtained in step S203 is compared with the gap identification threshold calculated in step S202, which serves as the boundary for high-level decision. The result of this comparison operation determines whether the current signal point belongs to a high-confidence gap region.

[0056] Step S205: If the current signal value is greater than or equal to the gap identification threshold, then the current signal point is identified as a gap signal point.

[0057] In step S205, if the comparison result of step S204 is true, that is, the current signal value is greater than or equal to the gap identification threshold, it indicates that the signal point has a sufficiently high signal strength and can be confidently determined to physically correspond to the gap area between the tags. The control module then classifies the signal point and assigns it a gap signal point identifier. After the identifier is completed, the processing flow for this signal point ends, and the traversal process will proceed to the next signal point.

[0058] Step S206: If the current signal value is less than the gap recognition threshold, then compare the current signal value with the paper recognition threshold.

[0059] In step S206, for all signal points that fail the high-level test in step S205 (i.e., whose signal values ​​are less than the gap identification threshold), the control module performs a second-level comparison. The purpose of this operation is to further distinguish between clearly low-level signals (face paper) and intermediate-level signals (transition) among the remaining non-gap signals. The control module compares the current signal value with the face paper identification threshold calculated in step S202, which serves as the low-level decision boundary.

[0060] Step S207: If the current signal value is less than or equal to the tissue identification threshold, then the current signal point is identified as a tissue signal point.

[0061] In step S207, if the comparison result of step S206 is true (i.e., the current signal value is lower than or equal to the label recognition threshold), it indicates that the signal point has a sufficiently low signal strength and can be confidently determined to physically correspond to an opaque label area. The control module then classifies the signal point and assigns it a label signal point identifier. After the identifier is completed, the processing flow for this signal point ends.

[0062] Step S208: If the current signal value is greater than the tissue paper recognition threshold, then the current signal point is marked as a transition signal point.

[0063] In step S208, this is the final branch of the ternary classification decision. For a signal point, if it is determined to be less than the gap recognition threshold in step S204, and greater than the face paper recognition threshold in the subsequent judgment in step S206, it means that the signal value of the signal point falls in the middle region between the two dynamic thresholds. These signal points physically correspond to the edge transition zone between the label face paper and the gap. The control module therefore classifies the signal point and assigns it the identifier of a transition signal point.

[0064] By performing the complete traversal of steps S203 to S208, the control module converts the original, continuous initial light intensity signal sequence into a discrete ternary signal sequence composed of three types of identifiers: gap signal points, face paper signal points, and transition signal points. This provides clear and reliable structured data for subsequent accurate identification of the start and end positions of the label.

[0065] Step S209: Scan the ternary signal sequence using a sliding window of a preset length;

[0066] In step S209, the sliding window refers to a data inspection window with a preset length for localized analysis. It slides across the entire ternary signal sequence in a step-by-step manner, thereby achieving segment-by-segment scanning of the sequence.

[0067] Specifically, after ternary processing of the initial light intensity signal sequence, the controller obtains a sequence composed of three identifiers: gaps, face sheets, and transitions. To identify target features with specific structures, the controller employs a sliding window method for scanning. The controller first reads a preset length value from its storage unit, designed to accommodate a complete tag feature, such as a typical "gap-face sheet-gap" structure. Then, the controller places this preset-length sliding window at the beginning of the ternary signal sequence and analyzes the local sequence segments within the window. After analysis, the controller moves the window forward one signal point along the sequence direction and analyzes the sequence segments within the new window again. This process is repeated until the end of the window reaches the end of the entire ternary signal sequence. In this way, the controller can check every continuous subsequence in the sequence that conforms to the preset length without omission, laying the foundation for subsequent pattern matching.

[0068] Step S210: If the sequence pattern of the current sliding window satisfies the preset structural conditions, then the original light intensity signal segment corresponding to the current window is determined as a candidate feature segment.

[0069] In step S210, the preset structural condition refers to a predefined typical sequence pattern used to characterize the features of an effective tag signal. In this embodiment, the condition is specifically manifested as a sequence structure that starts from the gap region, transitions to the face paper region in the middle, and ends at the gap region.

[0070] Specifically, during the scanning process in step S209, whenever the sliding window moves to a new position, the controller judges the sequence pattern covered by the current sliding window. The controller compares the ternary identifier sequence within the window with preset structural conditions stored internally. These preset structural conditions are the gap-paper-gap sequence pattern. This comparison process not only checks for the presence of these three signal points but, more importantly, verifies their correct arrangement order. For example, the controller checks whether the beginning of the window is mainly composed of gap identifiers, whether there is a continuous and significant paper identifier region following it, and whether the end of the window contains another gap identifier region. If the sequence pattern within the current sliding window matches these preset structural conditions, the controller determines that the original light intensity signal segment corresponding to the window possesses the basic morphological characteristics of a valid label and identifies it as a candidate feature segment for further quantization verification. Conversely, if the structural conditions are not met, the current sliding window content is ignored, and the scanning continues.

[0071] Step S211: Determine the number of face paper signal points in the candidate feature segment.

[0072] In step S211, the number of tissue signal points refers to the total number of points identified as tissue signal points within a sequence segment that has been identified as a candidate feature segment. This number is a key quantitative indicator for measuring the physical length or width of the tissue portion in the candidate feature segment.

[0073] Specifically, after the controller identifies a candidate feature segment in step S210, it needs to perform quantitative analysis to eliminate false features that are structurally similar but too small. The controller focuses on the ternary sequence portion corresponding to this candidate feature segment. Then, the controller starts a counting program to traverse each signal point identifier within the candidate feature segment. During this traversal, a counter inside the controller increments by one whenever an identifier assigned to a tissue signal point is encountered. After the traversal is complete, the final value of the counter is the number of tissue signal points contained in the candidate feature segment. For example, a candidate feature segment may contain a total of 120 signal points, and the controller finds through counting that 95 points are identified as tissues, then the number of tissue signal points is 95. This value will be used for the final decision in the next step.

[0074] Step S212: If the number of signal points on the face paper is greater than or equal to the preset number threshold, then the candidate feature segment is determined to be a valid label feature segment.

[0075] In step S212, a valid tag feature segment refers to a candidate feature segment that not only meets the preset structural conditions, but also whose internal face paper portion size meets the preset minimum standard. It represents a real and complete tag signal area that the controller finally confirms.

[0076] Specifically, this step is the final confirmation step in the label recognition process. The controller compares the number of face paper signal points of a specific candidate feature segment calculated in step S211 with a preset quantity threshold stored in non-volatile memory. This preset quantity threshold represents the minimum face paper width that a label must have to be considered a valid label, and its function is to filter out false label signals that are undersized due to material defects or detection noise. The controller performs a comparison judgment. If the number of face paper signal points is greater than or equal to this preset quantity threshold, for example, the calculated number is 95 and the preset quantity threshold is 80, then the candidate feature segment passes the final size verification. The controller then officially confirms it as a valid label feature segment. This confirmed segment is the final result of the entire recognition process, marking that the position of a physical label has been successfully and reliably located. If the number of face paper signal points is less than the preset quantity threshold, the candidate feature segment is judged to be invalid and discarded.

[0077] Step S103: If it is determined that there is a valid label feature segment that meets the preset structural conditions, then extract the face paper signal segment from the valid label feature segment and use the face paper signal segment as the calibration target signal.

[0078] In step S103, the face paper signal segment refers to the sequence that is precisely separated from a complete valid label feature segment and contains only the original light intensity signal data corresponding to the face paper area.

[0079] Specifically, the controller first determines whether its internal processing has successfully identified at least one valid label feature segment. If the determination is yes, confirming the existence of a signal segment that meets the preset structural conditions and size requirements, the controller initiates this step. Based on the position information recorded during the previous ternary processing, the controller precisely locates the start and end positions of the marker indicating the face paper signal point within the original light intensity signal sequence corresponding to the complete valid label feature segment. Subsequently, the controller performs an extraction operation, extracting all original light intensity signal values ​​from the start to the end position as an independent, continuous signal segment; this extracted segment is the face paper signal segment. Finally, the controller assigns this face paper signal segment a new functional role, designating it as the calibration target signal, and passes it to subsequent processing units to provide the system with a true and reliable reference.

[0080] Step S104: Filter the calibration target signal to obtain the filtered signal, and calculate the face paper reference value based on the filtered signal.

[0081] In step S104, the face paper reference value represents a single value that is calculated after filtering and can stably represent the optical characteristics of the face paper material. It serves as the core reference standard for subsequent signal discrimination.

[0082] Specifically, the controller receives the calibration target signal from the previous step, i.e., the original face paper signal segment. Since the original signal may contain random fluctuations caused by factors such as sensor noise, ambient light variations, or minor material inhomogeneities, the controller first performs filtering on the calibration target signal to obtain a more stable and representative value. For example, the controller can apply a digital low-pass filter, such as a moving average filtering algorithm, to smooth the signal by calculating the average value of data points within a small neighborhood, thereby effectively suppressing high-frequency noise and obtaining a filtered signal with less fluctuation. After obtaining this smoothed filtered signal, the controller calculates a single representative value from it. Typically, the controller calculates the arithmetic mean of all numerical points in the filtered signal sequence. This calculated average value, because it integrates the signal intensity of the entire face paper area and eliminates most noise interference, can very accurately reflect the light intensity response level of the face paper under the current operating conditions. Finally, the controller stores this calculated average value and formally establishes it as the face paper reference value, which can be used later in real-time detection as a threshold or reference level to distinguish the face paper from other areas.

[0083] In one possible implementation, the calibration target signal is filtered to obtain a filtered signal, specifically including steps S1041-S1043, as follows:

[0084] Step S1041: Obtain a sliding filter window with a preset length, and control the sliding filter window to slide point by point from the starting position corresponding to the calibration target signal to the ending position corresponding to the calibration target signal.

[0085] In step S1041, the sliding filter window refers to a virtual observation window of fixed size created and used in memory by the controller when executing the digital filtering algorithm. It moves across the signal data sequence using an index or pointer. The preset length is an integer (usually an odd number, such as 5, 7, or 9) pre-programmed in the controller firmware, representing the number of data points this window can simultaneously hold. The calibration target signal represents the original data sequence that needs to undergo this filtering process. "Sliding" refers to the controller systematically moving this window from the beginning of the signal sequence, one data point at a time, towards the end of the sequence. The purpose of this step is to establish a dynamic analysis framework for subsequent local signal processing (filtering).

[0086] Specifically, when the controller receives a calibration target signal that needs to be processed, it first initiates a filtering procedure. The first step of the procedure is to read a preset length value from its firmware or configuration parameters, for example, a value of 5. Next, the controller initializes a sliding filter window, which is typically implemented using a loop and several index variables. The controller controls the sliding filter window to slide point by point from the starting position corresponding to the calibration target signal to the ending position corresponding to the calibration target signal. For example, a typical implementation uses the loop variable `i` to represent the center position of the window, starting from the third point of the signal (assuming a window length of 5) and looping to the third-to-last point. In each iteration of `i`, the window covers 5 data points from `i-2` to `i+2`. When a loop ends, `i` is incremented by 1, and the window shifts to the right by one data point. This systematic scanning process ensures that every point in the original signal (except for the two ends of the sequence that cannot form a complete window) becomes the center point of the window and is processed by subsequent steps.

[0087] Step S1042: For the signal subsequence covered by the sliding filter window at each position, identify and remove the maximum and minimum signal values ​​of the signal subsequence to obtain the set of remaining signal points.

[0088] In step S1042, the signal subsequence refers to the small, continuous set of signal values ​​completely covered within the sliding filter window at each pause. The maximum and minimum signal values ​​represent the values ​​of the data points with the highest and lowest values ​​in this subsequence, respectively. Identifying and removing these extreme values ​​means actively ignoring them in subsequent calculations; this is the core difference between this filtering algorithm and ordinary mean filtering. The remaining signal point set represents the set of all data points remaining within the window after removing a maximum and a minimum value.

[0089] Specifically, within the loop established in step S1041, the controller performs this step for each signal subsequence covered by the sliding window at each position. Assume the current window length is 5, and the covered signal subsequence is [120, 122, 250, 121, 118]. The controller identifies the maximum signal value of this subsequence as 250 and the minimum signal value as 118 through a quick traversal or sorting. Then, the controller performs a "removal" operation, meaning these two values ​​will be ignored in subsequent calculations. After this operation, the controller obtains a set of remaining signal points, which in this example is {120, 122, 121}. The ingenuity of this step lies in its effective handling of "outliers" or "impulse noise" in the signal (such as the unusually high 250) by eliminating these extreme values ​​most likely representing noise before averaging, thus avoiding their disproportionately large impact on the filtering result.

[0090] Step S1043: Calculate the arithmetic mean of all signal values ​​in the set of remaining signal points, and use the arithmetic mean as the new signal value corresponding to the center position of the sliding filter window to obtain the filtered signal.

[0091] In step S1043, the arithmetic mean is the result of summing all the values ​​in a dataset and dividing by the number of data points; it is a basic statistic for measuring the central tendency of a dataset. For a window of odd length, the center position of the sliding filter window is the position of the middle data point in the sequence. The new signal value represents the output value obtained after the filtering algorithm is applied, which will replace the original signal value. The filtered signal refers to a completely new signal sequence of the same length as the original signal, composed of all these new signal values.

[0092] Specifically, after obtaining the set of remaining signal points in step S1042, the controller immediately executes this step. Continuing the example above, for the set {120, 122, 121}, the controller's arithmetic logic unit (ALU) calculates the arithmetic mean of all signal values ​​in the set of remaining signal points. The calculation process is (120 + 122 + 121) / 3, resulting in 121. This result 121 is the new signal value. Subsequently, the controller uses the arithmetic mean as the new signal value corresponding to the center position of the sliding filter window. In our example, the original signal subsequence is [120, 122, 250, 121, 118], and its center value is 250. Therefore, the controller writes the new value 121 in a newly allocated memory area (used to store the filtered signal) at the same position as 250. When the outer sliding loop (step S1041) ends, this new memory area completely constitutes the filtered signal. The resulting signal sequence has a smoother waveform than the original signal, and isolated noise spikes like 250 have been effectively suppressed and corrected.

[0093] In one possible implementation, the reference value of the face paper is calculated based on the filtered signal, specifically including steps S1044-S1047, as follows:

[0094] Step S1044: Statistically count the frequency of occurrence of each signal value in the filtered signal and generate a frequency distribution histogram of signal values ​​that represents the relationship between each signal value and its corresponding frequency of occurrence.

[0095] In step S1044, the signal value frequency distribution histogram is a data structure used to systematically record and display how many times each different signal value or signal value within a specific range appears in a signal sequence. The histogram is typically represented in the controller's memory as an array or hash table (associative array), where the index (or key) represents the signal value, and the corresponding value (or value) represents the frequency of that signal value. The frequency of occurrence indicates the total number of times a specific signal value appears in the entire filtered signal sequence. The purpose of this step is to transform the original one-dimensional time-series signal into a statistical view with signal values ​​as the dimension and frequency as the measure, thereby revealing the distribution pattern of signal values, especially the most concentrated numerical regions.

[0096] Specifically, after the controller obtains the filtered signal through steps S1041-S1043, it executes this step to analyze the numerical composition of the signal. The controller first creates a data structure in memory to store the histogram, such as an integer array `histogram

[1024] ` of size 1024 (assuming the signal value range is 0-1023), and initializes all its elements to 0. Then, the controller starts a loop that iterates through each signal point in the filtered signal. For each read signal value (e.g., 850), the controller increments the corresponding element in the `histogram` array by one, i.e., `histogram

[850] ++`, using that signal value as an index. The controller repeats this process until all filtered signal points have been traversed. When the loop ends, the `histogram` array has completely generated a frequency distribution histogram representing the relationship between each signal value and its corresponding frequency of occurrence. For example, the value of `histogram

[850] ` might be 200, indicating that the point with the value 850 appeared a total of 200 times in the entire filtered signal.

[0097] Step S1045: Using the signal value with the highest frequency in the signal value frequency distribution histogram as the center, extend the signal value range of a preset width to both sides to obtain the peak interval.

[0098] In step S1045, the most frequently occurring signal value refers to the signal value with the largest count in the frequency distribution histogram of signal values ​​generated in step S1044. This value represents the "mode" that appears most frequently in the entire signal sequence, typically corresponding to the level value of the most stable and longest-lasting plateau region in the signal waveform. The preset width is a parameter fixed in the firmware, defining a range extending outwards from the mode. The peak interval is a specific range of signal values ​​calculated at the end; it delineates the core region of the main peak in the histogram, containing the most frequently occurring signal value and its neighboring, equally frequently occurring signal values.

[0099] Specifically, after generating the histogram in step S1044, the controller iterates through this histogram array (e.g., histogram

[1024] ) to find the element with the maximum value. Assuming the controller finds that histogram

[855] has the largest value among all elements, then the most frequently occurring signal value is 855. Next, the controller reads a preset width value from its firmware, for example, 10. Then, the controller extends the signal value range of the preset width to both sides, centered on the most frequently occurring signal value in the signal value frequency distribution histogram (855). The calculation method is usually center value ± width, i.e., [855-10, 855+10]. Thus, the controller obtains a peak range of [845, 865]. The significance of this range is that it not only includes the most frequently occurring signal value 855, but also includes signal values ​​around it that are also likely to belong to the stable signal region of the face paper (such as 854, 856, etc.), thereby more robustly defining the core distribution area of ​​the face paper signal.

[0100] Step S1046: Extract target signal points whose signal values ​​fall within the peak range from the filtered signal to form a core signal point set.

[0101] In step S1046, target signal points refer to those original signal points whose signal values ​​fall exactly within the peak range determined in step S1045. The core signal point set is a temporary data set formed in memory, specifically containing all identified target signal points. This step is essentially a filtering and extraction operation, aiming to precisely separate the data points that best represent the stable state of the paper from the entire signal sequence, preparing for subsequent calculations of accurate baseline values.

[0102] Specifically, after determining the peak range (e.g., [845, 865]) in step S1045, the controller restarts a loop, traversing the complete filtered signal sequence from beginning to end. In the loop, for each signal point, the controller reads its signal value and determines whether the value falls within the peak range. For example, if the current signal point's value is 852, since 845 <= 852 <= 865, the condition is met, and the controller extracts this signal point, or at least its signal value 852, and adds it to a new list or array specifically used to store core signal points. If the current signal point's value is 840, because it is not within the range, the controller ignores it and continues processing the next point. After the controller has traversed the entire filtered signal sequence, this newly formed list constitutes the core signal point set. All data points in this set are high-confidence surface signal points, excluding signal interference from transition and gap regions.

[0103] Step S1047: Based on the target signal value of each target signal point in the core signal point set and the frequency of occurrence of each target signal value in the signal value frequency distribution histogram, calculate the weighted average value and determine the weighted average value as the reference value of the paper.

[0104] In step S1047, the weighted average refers to an average calculation method that assigns a specific weight to each value in the set during the summation process. This weight typically reflects the importance or frequency of occurrence of the value. In this embodiment, the weight is the frequency of occurrence of each target signal value in the signal value frequency distribution histogram. The face paper reference value is used to represent a high-precision reference value finally calculated in this embodiment. It is designed to most stably and accurately represent the light intensity signal characteristics of the current label consumable face paper portion.

[0105] Specifically, after the controller constructs the core signal point set through the preceding steps, this step is executed to calculate a benchmark value that can minimize the influence of random noise and reflect the true mode of the signal. The controller first prepares two accumulation registers in its internal arithmetic unit: one for accumulating the weighted sum of signal values, and the other for accumulating the total frequency of occurrence. Both are initially set to zero. Then, the controller begins to traverse each target signal point in the core signal point set. For any given target signal point, the controller first reads its corresponding target signal value, for example, a signal value of 852. Next, the controller uses the previously generated signal value frequency distribution histogram to query the frequency of occurrence corresponding to the signal value 852. Then, the controller performs a weighted accumulation operation, multiplying the target signal value by its corresponding frequency of occurrence and accumulating the result in the register recording the weighted sum of signal values; simultaneously, the frequency of occurrence is accumulated in the register recording the total frequency of occurrence. The controller repeats this process for all target signal points in the core signal point set until the traversal is complete. After all points have been processed, the controller records the final value in the register containing the sum of weighted signal values, divides it by the final value in the register containing the total frequency of occurrences, and calculates the weighted average. Compared to a simple arithmetic average, this result, by assigning greater determining power to signal values ​​that occur more frequently, can more accurately approximate the center of the signal distribution. Finally, the controller determines this weighted average as the baseline value and stores it as the core basis for accurate judgment in subsequent algorithm processes.

[0106] Step S105: Calculate the final positioning threshold based on the face paper reference value and the preset offset, and determine the starting position of the label consumable based on the final positioning threshold.

[0107] In step S105, the final positioning threshold refers to a dynamic judgment boundary obtained by performing mathematical operations on the face paper reference value and a preset offset. This boundary is specifically used to mark the precise transition point from non-face paper areas, such as gaps, into the face paper area in the original light intensity signal sequence.

[0108] Specifically, after the controller successfully calculates the high-precision face paper reference value, it performs this step to determine the precise position of the label's physical edge. The controller first reads a preset offset from its internal storage. This preset offset is an empirically pre-set value, designed to create a reasonable buffer zone between the stable face paper signal intensity and the gap signal intensity, effectively avoiding fluctuations in the signal transition area. Then, the controller performs a subtraction operation, subtracting this preset offset from the face paper reference value obtained in the previous step. The result is determined as the final positioning threshold. After obtaining this threshold, the controller uses it to scan the original light intensity signal corresponding to the previously determined valid label feature segment. Starting from the beginning of the feature segment, the controller compares the light intensity value of each signal point with the final positioning threshold along the direction of the signal sequence. When the controller detects the first signal point in the sequence whose light intensity value is greater than or equal to the final positioning threshold, it considers that point to be the physical leading edge of the label consumable. For example, if the reference value for the face paper is 850 and the preset offset is 100, the controller calculates a final positioning threshold of 750. When scanning the original light intensity signal, once the controller encounters the first signal point with an intensity of 750 or higher, it immediately records the position index of that signal point and determines that position as the starting position of the label consumable. This position information is the precise basis for subsequent printing or positioning operations.

[0109] In one possible implementation, a final positioning threshold is determined based on the paper reference value and a preset offset, and the starting position of the label consumable is determined based on the final positioning threshold. Specifically, this includes steps S1051-S1055, as follows:

[0110] Step S1051: Subtract the preset offset from the face paper reference value to obtain the final positioning threshold.

[0111] In step S1051, the final positioning threshold is a value obtained by subtracting a preset offset from the face paper reference value. This value is used as a preliminary criterion for determining whether a signal point may belong to the face paper area in subsequent signal scanning.

[0112] Specifically, the controller first retrieves the established face paper reference value and a preset offset from its internal storage unit. This preset offset is designed to adjust downwards from the stable signal strength of the face paper to a fault-tolerant boundary, avoiding misjudgments caused by normal fluctuations in the signal between the gap and the face paper. Subsequently, the controller performs a subtraction operation, subtracting the preset offset from the face paper reference value, and determines the difference as the final positioning threshold for use in subsequent steps.

[0113] Step S1052: Sequentially scan the acquired light intensity signals to determine candidate starting points. The candidate starting point is the first signal point whose signal value is greater than or equal to the final positioning threshold determined during the scanning process.

[0114] In step S1052, the candidate starting point refers to the first signal point whose signal value is greater than or equal to the final positioning threshold encountered during the sequential scanning of the collected light intensity signals. This point is initially marked as the possible actual starting position of the tag, but further verification is still needed.

[0115] Specifically, the controller initiates a scanning process that begins at the starting position of the acquired complete light intensity signal sequence and checks the signal value of each signal point sequentially, either chronologically or physically. During the scanning process, the controller compares the signal value of each point with the final positioning threshold determined in the previous step in real time. Once the controller detects the first signal point whose signal value is greater than or equal to the final positioning threshold, it immediately stops scanning and records the location index of that signal point as a candidate starting point, which is then passed to subsequent verification steps.

[0116] Step S1053: Determine a verification window with a preset length, starting from the candidate starting point, and calculate the average signal value of all signal points within the verification window to obtain the window confirmation value.

[0117] In step S1053, the window confirmation value is a comprehensive value obtained by calculating the arithmetic mean of all signal points within a verification window of a preset length starting from the candidate starting point. This value is used to evaluate the overall signal strength level of a region after the candidate starting point.

[0118] Specifically, based on the location of the candidate starting point determined in the previous step, the controller defines a continuous signal segment on the light intensity signal sequence; this segment is the verification window. The starting point of this verification window is the candidate starting point, and its length is a preset length determined according to tag characteristics and system accuracy requirements. Subsequently, the controller processes all signal points within the coverage area of ​​the verification window, summing the signal values ​​of all these points, and then dividing the sum by the preset length to calculate the signal mean. This calculated mean is determined as the window confirmation value, reflecting the average signal intensity within a small area immediately following the candidate starting point.

[0119] Step S1054: Determine the relationship between the window confirmation value and the final positioning threshold.

[0120] In step S1054, determining the relationship between the confirmation value of the window and the final positioning threshold means performing a numerical comparison operation to check whether the average signal strength of the area behind the candidate starting point has reached the minimum signal level that should be available as an effective face paper area.

[0121] Specifically, within its internal logic unit, the controller compares the window confirmation value calculated in the previous step with the final positioning threshold determined in step S1051. The purpose of this comparison is to verify whether the overall signal strength in a region following the initial trigger point is stably maintained at or above the set judgment boundary. The comparison result—whether the window confirmation value is greater than or equal to the final positioning threshold—will serve as a logical judgment result, directly determining the execution path of subsequent steps.

[0122] Step S1055: If the window confirmation value is greater than or equal to the final positioning threshold, the candidate starting point is determined as a valid tag edge trigger point, and the physical location of the candidate starting point is determined as the starting position of the tag consumable.

[0123] In step S1055, a valid tag edge trigger point refers to a candidate starting point that has passed window verification and has been confirmed as a real tag edge rather than noise interference; the tag consumable starting position is used to represent the precise starting coordinates on the physical medium corresponding to the valid trigger point, which is the final basis for all subsequent positioning-related operations of the system.

[0124] Specifically, the controller makes decisions based on the judgment results of the previous step. If the judgment result is that the window confirmation value is greater than or equal to the final positioning threshold, the controller determines that the candidate starting point has successfully passed the verification, proving that the area immediately following it is indeed a stable paper area, rather than an isolated noise pulse. In this case, the controller formally confirms the candidate starting point as a valid label edge trigger point, and determines its corresponding physical location information, such as the encoder count value or timestamp at the time the point was acquired, as the starting position of the label consumable, and stores this location information for subsequent printing control module or peeling control module to call. If the judgment result is negative, it means that the verification has failed, the controller will abandon the candidate starting point, and may choose to continue scanning the light intensity signal from the position after the point to find the next possible candidate starting point.

[0125] In one possible implementation, after determining the relationship between the window confirmation value and the final positioning threshold, the method further includes steps S1056-S10510, as follows:

[0126] Step S1056: If the confirmed value of the window is less than the final positioning threshold, then the candidate starting point is determined to be an invalid noise point.

[0127] In step S1056, an invalid noise point refers to a signal point whose signal value momentarily exceeds the final positioning threshold, but whose average signal strength in its immediate neighboring area fails to pass verification, and is therefore judged by the system as a signal point caused by random interference rather than the actual label edge.

[0128] Specifically, this step is executed based on the judgment result of step S1054. When the controller determines that the window confirmation value is less than the final positioning threshold, this result indicates that although the signal value of the candidate starting point itself reaches the trigger standard, the overall signal strength in the subsequent preset length region fails to be stably maintained above the threshold. Based on this, the controller infers that the candidate starting point is not the starting edge of the real label, but is more likely an isolated, transient high signal pulse caused by circuit noise or minor defects on the dielectric surface. Therefore, the controller marks or classifies the candidate starting point as an invalid noise point and prepares to initiate subsequent noise processing and re-search logic.

[0129] Step S1057: Based on the comparison between the signal value of the invalid noise point and the final positioning threshold, calculate the noise overshoot, and accumulate the noise overshoot to obtain the cumulative noise energy value.

[0130] In step S1057, the cumulative noise energy value is an additive index used to quantify the total intensity of noise interference encountered during the process of finding the starting position of the tag. It dynamically assesses the severity of the current signal environment by continuously accumulating the magnitude of each invalid noise point exceeding the positioning threshold.

[0131] Specifically, after identifying a candidate starting point as an invalid noise point, the controller performs a calculation to assess the severity of the false trigger. The controller first obtains the actual signal value of the invalid noise point and compares it with the final location threshold. The difference between the two is calculated, and this difference represents the noise overshoot, indicating how much the signal strength of the noise point exceeds the judgment benchmark. Subsequently, the controller accesses an internal register or variable specifically for recording the total noise level and adds the calculated noise overshoot to the existing value in that register, thus updating the cumulative noise energy value. This process is repeated whenever a new invalid noise point is identified, ensuring that the cumulative noise energy value reflects the total impact of all identified noise levels in real time.

[0132] Step S1058: Determine the relationship between the cumulative noise energy value and the preset noise energy.

[0133] In step S1058, the preset noise energy refers to a reference threshold preset in the controller, which defines the upper limit of the total cumulative noise that the system can tolerate during the positioning process.

[0134] Specifically, after updating the cumulative noise energy value, the controller immediately performs a comparison. The controller reads the preset noise energy value from its configuration parameter storage area. This value is typically preset by the device manufacturer based on sensor performance, algorithm robustness, and testing experience with different consumable characteristics. The controller compares the currently calculated cumulative noise energy value with this fixed preset noise energy value. The purpose of this step is to determine whether the noise level of the current signal environment has exceeded an acceptable range. The comparison result directly determines whether the system continues to attempt to find the tag edge or considers the signal quality too poor and must terminate the current task.

[0135] Step S1059: If the cumulative noise energy value is determined to be less than the preset noise energy, then the target starting point is determined from the next position of the candidate starting point. The signal value of the target starting point is greater than or equal to the final positioning threshold.

[0136] In step S1059, the target starting point refers to the next signal point found after the previous candidate starting point is identified as an invalid noise point, where the controller continues scanning from the next position of the invalid point and the signal value is greater than or equal to the final positioning threshold.

[0137] Specifically, if the judgment result of the previous step is that the cumulative noise energy value is less than the preset noise energy, the controller considers the current noise level to be within a controllable range, and the positioning process can continue. At this time, the controller will abandon the signal point previously marked as an invalid noise point and move the starting position of the search forward by one position, that is, move to the position of the signal point immediately following the invalid noise point. From this new position, the controller resumes the operation similar to step S1052, that is, sequentially scans the light intensity signal to find the first signal point whose signal value is greater than or equal to the final positioning threshold. When such a point is found, the controller determines it as the new target starting point. This target starting point is actually the candidate starting point for the new round of verification process, and will then enter step S1053 again for window verification.

[0138] Step S10510: If the cumulative noise energy value is determined to be greater than or equal to the preset noise energy, the current positioning process is terminated and a recalibration process is triggered.

[0139] In step S10510, the recalibration process refers to a high-level error recovery or system state reset procedure triggered when the system detects that the signal noise is abnormally severe, to the point that positioning accuracy cannot be guaranteed.

[0140] Specifically, if the judgment result of step S1058 is that the cumulative noise energy value is greater than or equal to the preset noise energy, the controller determines that the current signal environment is extremely poor, and the cumulative noise interference has exceeded the fault tolerance limit of the algorithm. Continuing the search will most likely lead to positioning failure or significant positional deviation. In this case, the controller will immediately execute a stop command to stop the current tag positioning process to prevent erroneous position information from being used by subsequent programs. At the same time, the controller will trigger a preset recalibration process. This process may include a series of operations, such as instructing the sensor to re-perform automatic gain and bias calibration, guiding the system to re-execute the complete medium characteristic learning process, or displaying error messages on the operation interface, requesting the user to check and confirm whether the tag consumables are installed correctly and whether there is dirt on the sensor surface. The ultimate goal of this process is to attempt to restore a stable and reliable signal acquisition environment to create conditions for the next successful positioning operation.

[0141] Reference Figure 3This application also provides a positioning correction device based on a label printer. This device is a controller, which includes a light intensity signal acquisition module 301, an effective label analysis module 302, a calibration signal determination module 303, a paper reference value calculation module 304, and a starting position determination module 305. Specifically: the light intensity signal acquisition module 301 is used to respond to positioning calibration commands, control the consumable delivery device of the label printer to drive the label consumables to move, and cause the photoelectric sensor to acquire light intensity signals during the movement of the label consumables to obtain an initial light intensity signal sequence; the effective label analysis module 302 is used to analyze the initial light intensity signal sequence to identify whether there is a full label. The effective label feature segments that meet the preset structural conditions include a face paper signal segment and a gap signal segment; the calibration signal determination module 303 is used to extract the face paper signal segment from the effective label feature segments if it is determined that there are effective label feature segments that meet the preset structural conditions, and use the face paper signal segment as the calibration target signal; the face paper reference value calculation module 304 is used to filter the calibration target signal to obtain a filtered signal, and calculate the face paper reference value based on the filtered signal; the starting position determination module 305 is used to determine the final positioning threshold according to the face paper reference value and the preset offset, and determine the starting position of the label consumable according to the final positioning threshold.

[0142] In one possible implementation, the effective label analysis module 302 analyzes the initial light intensity signal sequence to identify whether there are effective label feature segments that meet preset structural conditions. Specifically, the effective label analysis module 302 performs ternary processing on the initial light intensity signal sequence to generate a ternary signal sequence. Each signal point in the ternary signal sequence is identified as a face paper signal point, a gap signal point, and a transition signal point. The effective label analysis module 302 uses a sliding window of preset length to scan the ternary signal sequence. If the sequence pattern of the current sliding window meets the preset structural conditions, the effective label analysis module 302 determines the original light intensity signal segment corresponding to the current window as a candidate feature segment. The effective label analysis module 302 determines the number of face paper signal points in the candidate feature segment. If the number of face paper signal points is greater than or equal to a preset number threshold, the effective label analysis module 302 determines the candidate feature segment as a valid label feature segment.

[0143] In one possible implementation, the effective label analysis module 302 performs ternary processing on the initial light intensity signal sequence to generate a ternary signal sequence. Specifically, this includes: the effective label analysis module 302 determining the global maximum signal value and the global minimum signal value in the initial light intensity signal sequence; the effective label analysis module 302 calculating the signal dynamic range based on the global maximum signal value and the global minimum signal value, and calculating and generating a gap recognition threshold and a tissue recognition threshold according to the signal dynamic range and a preset segmentation coefficient, wherein the gap recognition threshold is greater than the tissue recognition threshold; and the effective label analysis module 302 traversing each signal point in the initial light intensity signal sequence to obtain the current... The effective label analysis module 302 compares the current signal value of the signal point with the gap identification threshold. If the current signal value is greater than or equal to the gap identification threshold, the effective label analysis module 302 identifies the current signal point as a gap signal point. If the current signal value is less than the gap identification threshold, the effective label analysis module 302 compares the current signal value with the tissue paper identification threshold. If the current signal value is less than or equal to the tissue paper identification threshold, the effective label analysis module 302 identifies the current signal point as a tissue paper signal point. If the current signal value is greater than the tissue paper identification threshold, the current signal point is identified as a transition signal point.

[0144] In one possible implementation, the paper reference value calculation module 304 filters the calibration target signal to obtain a filtered signal. Specifically, the paper reference value calculation module 304 acquires a sliding filter window with a preset length and controls the sliding filter window to slide point by point from the starting position corresponding to the calibration target signal to the ending position corresponding to the calibration target signal. For the signal subsequence covered by the sliding filter window at each position, the paper reference value calculation module 304 identifies and removes the maximum and minimum signal values ​​of the signal subsequence to obtain a set of remaining signal points. The paper reference value calculation module 304 calculates the arithmetic mean of all signal values ​​in the set of remaining signal points and uses the arithmetic mean as the new signal value corresponding to the center position of the sliding filter window to obtain the filtered signal.

[0145] In one possible implementation, the paper reference value calculation module 304 calculates the paper reference value based on the filtered signal, specifically including: the paper reference value calculation module 304 statistically analyzes the occurrence frequency of each signal value in the filtered signal and generates a signal value frequency distribution histogram representing the relationship between each signal value and its corresponding occurrence frequency; the paper reference value calculation module 304 extends a signal value range of a preset width to both sides of the signal value with the highest occurrence frequency in the signal value frequency distribution histogram to obtain a peak interval; the paper reference value calculation module 304 extracts target signal points whose signal values ​​fall within the peak interval from the filtered signal to form a core signal point set; the paper reference value calculation module 304 calculates a weighted average value based on the target signal value of each target signal point in the core signal point set and the occurrence frequency of each target signal value in the signal value frequency distribution histogram, and determines the weighted average value as the paper reference value.

[0146] In one possible implementation, the starting position determination module 305 determines a final positioning threshold based on the paper reference value and a preset offset, and determines the starting position of the tag consumable based on the final positioning threshold. Specifically, the starting position determination module 305 subtracts the preset offset from the paper reference value to obtain the final positioning threshold; the starting position determination module 305 sequentially scans the acquired light intensity signals to determine candidate starting points, where the candidate starting point is the first signal point whose signal value is greater than or equal to the final positioning threshold determined during the scanning process; the starting position determination module 305 determines a verification window with a preset length starting from the candidate starting point, and calculates the average signal value of all signal points within the verification window to obtain a window confirmation value; the starting position determination module 305 judges the relationship between the window confirmation value and the final positioning threshold; if the window confirmation value is greater than or equal to the final positioning threshold, the starting position determination module 305 determines the candidate starting point as a valid tag edge trigger point and determines the physical position of the candidate starting point as the starting position of the tag consumable.

[0147] In one possible implementation, after the starting position determination module 305 determines the relationship between the window confirmation value and the final positioning threshold, it further includes: if the starting position determination module 305 determines that the window confirmation value is less than the final positioning threshold, then it determines the candidate starting point as an invalid noise point; the starting position determination module 305 compares the signal value of the invalid noise point with the final positioning threshold, calculates the noise overshoot, and accumulates the noise overshoot to obtain a cumulative noise energy value; the starting position determination module 305 determines the relationship between the cumulative noise energy value and a preset noise energy; if the starting position determination module 305 determines that the cumulative noise energy value is less than the preset noise energy, then it determines a target starting point from the next position of the candidate starting point, where the signal value of the target starting point is greater than or equal to the final positioning threshold; if the starting position determination module 305 determines that the cumulative noise energy value is greater than or equal to the preset noise energy, then it terminates the current positioning process and triggers a recalibration process.

[0148] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0149] This application also provides an electronic device. (See reference...) Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 400 may include: at least one processor 401, at least one network interface 404, a user interface 403, a memory 405, and at least one communication bus 402.

[0150] The communication bus 402 is used to enable communication between these components.

[0151] The user interface 403 may include a display screen and a camera. Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.

[0152] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0153] The processor 401 may include one or more processing cores. The processor 401 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 405, and by calling data stored in memory 405. Optionally, the processor 401 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 401 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 401.

[0154] The memory 405 may include random access memory (RAM) or read-only memory. Optionally, the memory 405 may include a non-transitory computer-readable storage medium. The memory 405 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 405 may also be at least one storage device located remotely from the aforementioned processor 401. (Refer to...) Figure 4 The memory 405, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program based on a positioning correction method for a label printer.

[0155] exist Figure 4In the illustrated electronic device 400, the user interface 403 is mainly used to provide an input interface for the user and acquire user input data; while the processor 401 can be used to call an application program stored in the memory 405 for a positioning correction method based on a label printer. When executed by one or more processors 401, the electronic device 400 performs one or more of the methods described in the above embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simplicity, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0156] This application also provides a computer-readable storage medium storing instructions. When executed by one or more processors 401, these instructions cause the electronic device 400 to perform one or more of the methods described in the above embodiments.

[0157] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0158] In the various embodiments provided in this application, it should be understood that the disclosed apparatus 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 through some service interface; the indirect coupling or communication connection between apparatuses or units may be electrical or other forms.

[0159] 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, depending on actual needs.

[0160] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0161] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0162] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will be readily apparent to those skilled in the art upon consideration of the specification and the disclosure of practical truths.

[0163] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. A label printer-based positioning correction method, characterized by, The method includes: In response to the positioning calibration command, the consumable conveying device of the label printer is controlled to drive the label consumable to move, and the photoelectric sensor collects light intensity signals during the movement of the label consumable to obtain an initial light intensity signal sequence; The initial light intensity signal sequence is analyzed to identify whether there are valid label feature segments that meet the preset structural conditions. The valid label feature segments include face paper signal segments and gap signal segments. If it is determined that there is a valid label feature segment that meets the preset structural conditions, then the face paper signal segment is extracted from the valid label feature segment and the face paper signal segment is used as the calibration target signal; The calibration target signal is filtered to obtain a filtered signal, and the paper reference value is calculated based on the filtered signal. Based on the reference value of the face paper and the preset offset, the final positioning threshold is calculated, and the starting position of the label consumable is determined based on the final positioning threshold. The analysis of the initial light intensity signal sequence to identify whether there are valid label feature segments that meet the preset structural conditions specifically includes: The initial light intensity signal sequence is ternary processed to generate a ternary signal sequence. Each signal point in the ternary signal sequence is identified as a face paper signal point, a gap signal point, and a transition signal point. The ternary signal sequence is scanned using a sliding window of a preset length; If the sequence pattern of the current sliding window satisfies the preset structural conditions, then the original light intensity signal segment corresponding to the current sliding window is determined as a candidate feature segment; Determine the number of face paper signal points in the candidate feature segment; If the number of signal points on the face paper is greater than or equal to a preset threshold, then the candidate feature segment is determined to be the valid label feature segment.

2. The method of claim 1, wherein, The step of performing ternary processing on the initial light intensity signal sequence to generate a ternary signal sequence specifically includes: Determine the global maximum and global minimum signal values ​​in the initial light intensity signal sequence; Based on the global maximum signal value and the global minimum signal value, the signal dynamic range is calculated, and according to the signal dynamic range and the preset segmentation coefficient, the gap recognition threshold and the tissue paper recognition threshold are calculated and generated, wherein the gap recognition threshold is greater than the tissue paper recognition threshold; Traverse each signal point in the initial light intensity signal sequence and obtain the current signal value of the current signal point; Compare the current signal value with the gap identification threshold; If the current signal value is greater than or equal to the gap identification threshold, then the current signal point is identified as a gap signal point; If the current signal value is less than the gap recognition threshold, then the current signal value is compared with the tissue paper recognition threshold; If the current signal value is less than or equal to the tissue identification threshold, then the current signal point is identified as a tissue signal point; If the current signal value is greater than the tissue paper recognition threshold, then the current signal point is marked as a transition signal point.

3. The method of claim 1, wherein, The filtering process of the calibration target signal to obtain the filtered signal specifically includes: Obtain a sliding filter window with a preset length, and control the sliding filter window to slide point by point from the starting position corresponding to the calibration target signal to the ending position corresponding to the calibration target signal; For each signal subsequence covered by the sliding filter window at each position, the maximum and minimum signal values ​​of the signal subsequence are identified and removed to obtain the set of remaining signal points. Calculate the arithmetic mean of all signal values ​​in the set of remaining signal points, and use the arithmetic mean as the new signal value corresponding to the center position of the sliding filter window to obtain the filtered signal.

4. The method of claim 1, wherein, The calculation of the paper reference value based on the filtered signal specifically includes: The frequency of occurrence of each signal value in the filtered signal is counted, and a frequency distribution histogram of signal values ​​is generated to represent the relationship between each signal value and its corresponding frequency of occurrence. Using the signal value that appears most frequently in the frequency distribution histogram as the center, extend the signal value range of a preset width to both sides to obtain the peak interval; From the filtered signal, target signal points whose signal values ​​fall within the peak range are extracted to form a core signal point set; Based on the target signal value of each target signal point in the core signal point set and the occurrence frequency of each target signal value in the signal value frequency distribution histogram, a weighted average value is calculated, and the weighted average value is determined as the reference value of the paper.

5. The method of claim 1, wherein, The step of determining the final positioning threshold based on the paper reference value and the preset offset, and determining the starting position of the label consumable based on the final positioning threshold, specifically includes: Subtract the preset offset from the reference value of the face paper to obtain the final positioning threshold; The acquired light intensity signals are sequentially scanned to determine candidate starting points. The candidate starting point is the first signal point whose signal value is greater than or equal to the final positioning threshold determined during the scanning process. A verification window with a preset length and starting from the candidate starting point is determined, and the average signal value of all signal points within the verification window is calculated to obtain the window confirmation value. Determine the relationship between the window confirmation value and the final positioning threshold; If the window confirmation value is greater than or equal to the final positioning threshold, then the candidate starting point is determined as a valid tag edge trigger point, and the physical location of the candidate starting point is determined as the starting position of the tag consumable.

6. The method according to claim 5, characterized in that, After determining the relationship between the window confirmation value and the final positioning threshold, the method further includes: If the window confirmation value is determined to be less than the final positioning threshold, then the candidate starting point is determined to be an invalid noise point; Based on the comparison between the signal value of the invalid noise point and the final positioning threshold, the noise overshoot is calculated, and the noise overshoot is accumulated to obtain the cumulative noise energy value. Determine the relationship between the cumulative noise energy value and the preset noise energy; If the cumulative noise energy value is determined to be less than the preset noise energy, then a target starting point is determined from the next position of the candidate starting point, and the signal value of the target starting point is greater than or equal to the final positioning threshold. If the cumulative noise energy value is determined to be greater than or equal to the preset noise energy, the current positioning process is terminated and a recalibration process is triggered.

7. A positioning and correction device based on a label printer, characterized in that, The device is used to perform the method as described in any one of claims 1-6, the device comprising a light intensity signal acquisition module (301), an effective label analysis module (302), a calibration signal determination module (303), a paper reference value calculation module (304), and a starting position determination module (305), wherein: The light intensity signal acquisition module (301) is used to respond to the positioning calibration command, control the consumable conveying device of the label printer to drive the label consumable to move, and enable the photoelectric sensor to acquire the light intensity signal during the movement of the label consumable to obtain the initial light intensity signal sequence. The effective label analysis module (302) is used to analyze the initial light intensity signal sequence and identify whether there are effective label feature segments that meet the preset structural conditions. The effective label feature segments include face paper signal segments and gap signal segments. The calibration signal determination module (303) is used to extract the face paper signal segment from the valid label feature segment if it is determined that there is a valid label feature segment that meets the preset structural conditions, and to use the face paper signal segment as the calibration target signal. The paper reference value calculation module (304) is used to filter the calibration target signal to obtain a filtered signal, and calculate the paper reference value based on the filtered signal. The starting position determination module (305) is used to determine the final positioning threshold based on the face paper reference value and the preset offset, and to determine the starting position of the label consumable based on the final positioning threshold.

8. An electronic device, characterized in that, The device includes a processor (401), a memory (405), a user interface (403), and a network interface (404). The memory (405) is used to store instructions. The user interface (403) and the network interface (404) are used to communicate with other devices. The processor (401) is used to execute the instructions stored in the memory (405) to cause the electronic device (400) to perform the method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Label printer and operation method thereof

    CN113580784A

  • Label printer and sensor calibration method and system thereof

    CN116330854A