A Machine Vision-Based Method for Positioning Glass Labels and QR Codes During Printing
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-18
- Publication Date
- 2026-08-11
AI Technical Summary
[0005]鉴于此,本发明提出了一种基于机器视觉的玻璃商标及二维码打印定位方法,旨在解决现有技术中人工对位效率低、精度差,传统视觉对位法调整繁琐、缺乏动态修正能力,且二维码与商标协同定位困难、尺寸无法自适应调整的问题
[0016]与现有技术相比,本发明的有益效果在于:通过红色角标与红色方框的协同定位,实现商标与二维码的自动对位及二维码尺寸的自适应调整,无需人工干预,降低了人工成本,提升了生产效率;红色角标与红色方框提供明确基准,配合实时检测与动态修正机制,可消除玻璃微小偏移导致的位置偏差,同时确保二维码尺寸与红色方框匹配,提升了整体打印精度;实现商标与二维码的关联定位,避免两者位置错位,保障了产品视觉一致性;相机移动过程中实时显示图像,便于操作人员监控,降低了对专业技能的要求;通过红色角标与红色方框的灵活设置,可适配不同型号玻璃及多样的商标、二维码位置需求,无需重新设计识别逻辑,提升了设备通用性。
Smart Images

Figure CN122539780A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of glass processing technology, and more specifically, to a machine vision-based method for positioning glass trademarks and QR codes during printing. Background Technology
[0002] In glass production, the printing of trademarks and QR codes is a crucial step, as their positional accuracy and dimensional fit directly impact product quality and brand image. Currently, the industry commonly uses two main methods for trademark and QR code printing and positioning: Manual alignment method: Operators manually adjust the printhead position, and after printing, the position and size accuracy of the trademark and QR code are judged by manual measurement. This process is repeated until the result is satisfactory. This method relies on manual experience, is inefficient, and suffers from significant problems such as positional deviations and size mismatches, making it difficult to guarantee consistency in mass production.
[0003] Traditional visual alignment method: This method obtains positional information by capturing feature points around the glass using a vision system, and then locks the parameters after multiple adjustments for subsequent batches. However, this method lacks specificity for QR code positioning, does not consider the positional coordination between the QR code and the trademark, and lacks a size adaptive adjustment mechanism. When the glass shifts due to transmission vibrations, it can easily lead to misalignment or size discrepancies between the QR code and the trademark.
[0004] Therefore, it is necessary to design a machine vision-based method for printing and positioning glass trademarks and QR codes to achieve automated, high-precision, and high-efficiency printing and positioning of glass trademarks and QR codes, while meeting the requirements for positional coordination and size adaptation between QR codes and trademarks. Summary of the Invention
[0005] In view of this, the present invention proposes a machine vision-based glass trademark and QR code printing positioning method, which aims to solve the problems of low efficiency and poor accuracy of manual alignment in the prior art, cumbersome adjustment and lack of dynamic correction capability of traditional visual alignment method, and difficulty in co-positioning QR codes and trademarks and the inability to adaptively adjust their size.
[0006] This invention proposes a machine vision-based method for positioning glass trademarks and QR codes during printing, comprising: Based on glass images acquired by industrial cameras, the detection areas with red corner marks for trademark positioning and red squares for QR code positioning were identified; The detection area is subjected to image correction processing; and the actual position coordinates of the red corner mark of the trademark positioning are extracted using image processing technology, as well as the actual position coordinates and size parameters of the red square of the QR code positioning. The trademark nozzle displacement parameters are calculated based on the deviation between the actual position coordinates of the red corner mark of the trademark positioning and the design position coordinates of the trademark; the QR code scaling ratio is determined based on the actual size parameters of the red square of the QR code positioning, and the QR code nozzle displacement parameters are calculated based on the deviation between the actual position coordinates of the red square of the QR code positioning and the design position coordinates of the QR code. The trademark printhead is driven to print the trademark at the designed position according to the trademark printhead displacement parameters; the QR code is scaled proportionally according to the QR code scaling ratio, and the QR code printhead is driven to print the QR code at the designed position according to the QR code printhead displacement parameters. During the printing process, the actual printing position of the trademark, as well as the actual printing position and size of the QR code, are monitored in real time. When a deviation is detected, correction parameters are calculated and the corresponding printhead position is dynamically compensated.
[0007] Furthermore, when confirming the detection area with the red corner mark for trademark positioning and the red square for QR code positioning, it includes: Based on the HSV color space, red features are extracted from the acquired glass images to identify image areas whose RGB values conform to the preset red threshold range; Noise interference is eliminated based on morphological processing, and candidate regions with subscript and box features are preserved; Geometric shape analysis was used to distinguish between the red corner mark for trademark positioning and the red square for QR code positioning. The red corner mark for trademark positioning has a right-angle feature, while the red square for QR code positioning has a rectangular feature. Based on the relative positions of the candidate areas, the detection areas with red corner markers for trademark positioning and red squares for QR code positioning are determined.
[0008] Furthermore, when performing image correction processing on the detection area, it includes: The camera distortion parameters were obtained using the checkerboard calibration method, and the influence of lens distortion was eliminated based on radial distortion correction. Based on the right-angle features of the red corner mark for trademark positioning and the rectangular features of the red square for QR code positioning, the image rotation angle is calculated; the image rotation is corrected using a bilinear interpolation algorithm so that the angle deviation between the corrected image and the design file is less than a preset angle threshold. The image after rotation correction is subjected to contrast enhancement processing.
[0009] Furthermore, when extracting the actual position coordinates of the red corner mark for trademark positioning, and the actual position coordinates and size parameters of the red square for QR code positioning, the following steps are taken: The edge features of the red corner mark for trademark positioning are extracted based on the sub-pixel edge detection algorithm, and the center point of the corner mark is calculated as the actual position coordinates of the red corner mark for trademark positioning. The four sides of the red square in the QR code are detected by Hough transform, and the intersection of the four sides is calculated as the four vertices of the square. The actual position coordinates and size parameters of the red square in the QR code are determined based on the coordinates of the four vertices.
[0010] Furthermore, when calculating the trademark nozzle displacement parameters based on the deviation between the actual coordinates of the red corner mark and the designed coordinates of the trademark, the following is included: Determine the X-axis and Y-axis deviation values between the actual position coordinates of the red corner mark of the trademark and the design position coordinates of the trademark; convert the X-axis and Y-axis deviation values into the number of pulses of the stepper motor to obtain the trademark nozzle displacement parameters; the trademark nozzle displacement parameters include the trademark nozzle displacement direction and the trademark nozzle displacement amount.
[0011] Furthermore, when determining the QR code scaling ratio based on the actual size parameters of the red square positioning the QR code, and calculating the QR code printhead displacement parameters based on the deviation between the actual position coordinates of the red square positioning the QR code and the designed position coordinates of the QR code, the following steps are taken: Compare the actual dimensions of the QR code within the red box with the design dimensions to calculate the scaling ratio in the length and width directions; keep the aspect ratio of the QR code unchanged, and scale the QR code proportionally according to the scaling ratio. Calculate the X-axis and Y-axis deviations between the actual position coordinates of the red square for QR code positioning and the designed position coordinates of the QR code; convert the X-axis and Y-axis deviations into the number of pulses of the stepper motor to obtain the QR code printhead displacement parameters; the QR code printhead displacement parameters include the QR code printhead displacement direction and the QR code printhead displacement amount.
[0012] Furthermore, when driving the trademark printhead to print the trademark at the designed position based on the trademark printhead displacement parameters, this includes: The trademark nozzle motion trajectory data is generated based on the displacement parameters of the trademark nozzle, and the trademark nozzle motion trajectory data includes the movement path, speed parameters and acceleration / deceleration curve of the trademark nozzle; The motion trajectory data of the trademark nozzle is converted into control signals, driving the trademark nozzle to move along the X and Y axes to the trademark design position.
[0013] Furthermore, when driving the QR code printhead to print the QR code at the designed position based on the QR code printhead displacement parameters, this includes: Based on the displacement parameters of the QR code printhead, QR code printhead motion trajectory data is generated, which includes the movement path, speed parameters, and acceleration / deceleration curves of the QR code printhead. The motion trajectory data of the QR code printhead is converted into control signals, driving the QR code printhead to move along the X and Y axes to the designed QR code position.
[0014] Furthermore, when calculating the correction parameters and dynamically compensating for the corresponding nozzle positions, the following steps are included: During the printing of trademarks and QR codes, real-time images of the printing area are captured at preset time intervals; the deviation between the actual printing position and the design position of the trademark and the actual printing position and the design position of the QR code are detected according to the template matching algorithm; the difference between the actual printing size and the design size of the QR code is measured by the edge detection algorithm. When a deviation is detected to exceed a preset threshold, compensation parameters are calculated in real time to adjust the nozzle position for subsequent printing.
[0015] Furthermore, when a deviation is detected to exceed a preset threshold, compensation parameters are calculated in real time, and the printhead position is adjusted for subsequent printing, including: When the deviation between the actual printing position and the design position of the trademark exceeds the first preset deviation threshold, the displacement parameters of the trademark printhead are adjusted. When the deviation between the actual printed position of the QR code and the designed position exceeds the second preset deviation threshold, the displacement parameters of the QR code printhead are adjusted. When the difference between the actual printed size and the design size of the QR code exceeds the third preset difference threshold, the scaling parameter of the QR code is adjusted.
[0016] Compared with existing technologies, the advantages of this invention are as follows: Through the coordinated positioning of the red corner mark and the red square, automatic alignment of the trademark and QR code, as well as adaptive adjustment of the QR code size, are achieved without manual intervention, reducing labor costs and improving production efficiency. The red corner mark and the red square provide a clear benchmark, and with real-time detection and dynamic correction mechanisms, positional deviations caused by minor glass offsets can be eliminated, while ensuring that the QR code size matches the red square, thus improving overall printing accuracy. The associated positioning of the trademark and QR code is achieved, avoiding misalignment and ensuring visual consistency of the product. Real-time image display during camera movement facilitates operator monitoring and reduces the requirement for specialized skills. The flexible setting of the red corner mark and the red square can adapt to different glass models and diverse trademark and QR code position requirements without redesigning the recognition logic, thus improving the equipment's versatility. Attached Figure Description
[0017] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart illustrating a machine vision-based glass trademark and QR code printing and positioning method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the printing graphic positioning of a machine vision-based glass trademark and QR code printing positioning method provided in an embodiment of the present invention. Detailed Implementation
[0018] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the disclosure to those skilled in the art. It should be noted that, unless otherwise specified, embodiments and features in the embodiments of the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0019] For this, please refer to Figure 1-2 As shown, this application proposes a machine vision-based method for positioning glass trademarks and QR code printing, including: S100: Based on glass images acquired by an industrial camera, it identifies the detection areas with red corner marks for trademark positioning and red squares for QR code positioning; S200: Perform image correction processing on the detection area; and extract the actual position coordinates of the red corner mark for trademark positioning, as well as the actual position coordinates and size parameters of the red square for QR code positioning through image processing technology; S300: Calculate the trademark nozzle displacement parameters based on the deviation between the actual position coordinates of the red corner mark of the trademark positioning and the design position coordinates of the trademark; determine the QR code scaling ratio based on the actual size parameters of the red square of the QR code positioning, and calculate the QR code nozzle displacement parameters based on the deviation between the actual position coordinates of the red square of the QR code positioning and the design position coordinates of the QR code. S400: Drives the trademark printhead to print the trademark at the designed position according to the trademark printhead displacement parameters; scales the QR code according to the QR code scaling ratio, and drives the QR code printhead to print the QR code at the designed position according to the QR code printhead displacement parameters. S500: During the printing process, the actual printing position of the trademark, the actual printing position and the actual printing size of the QR code are monitored in real time. When a deviation is detected, the correction parameters are calculated and the corresponding printhead position is dynamically compensated.
[0020] Specifically, this application utilizes a high-precision machine vision system to identify positioning marks, accurately calculate printing deviations, and perform real-time compensation, ensuring high-precision trademark and QR code printing positioning on high-speed production lines. First, an industrial camera captures glass images to identify detection areas with red corner marks for trademark positioning and red squares for QR code positioning. Then, image correction processing is performed on the detection areas, and the actual position coordinates and size parameters of the positioning marks are extracted. Next, based on the extracted positioning information, the printhead displacement parameters for the trademark and QR code, as well as the QR code scaling ratio, are calculated. Then, the corresponding printheads are driven to print the trademark and QR code in the designed positions. Finally, the printing quality is monitored in real-time during the printing process, and dynamic compensation is performed when deviations are detected. The entire method achieves full automation from image acquisition and positioning analysis to precise printing, requiring no manual intervention.
[0021] The hardware system includes: a digital printer (with X-axis and Y-axis motion mechanisms, supporting multi-head or single-head time-sharing control), an industrial camera (equipped with a telephoto lens, with a resolution of no less than 5 million pixels), a computer system (installed with image processing software and motion control software, supporting size adaptive algorithms), a monitor, and connecting cables.
[0022] The working process and principle involve using specialized graphics processing software to convert the printed graphics on the glass (including red corner marks and red squares) into a computer-recognizable format (such as DXF, PNG, TIF, PDF, etc.). After importing, the system automatically extracts: the preset coordinate information of the red corner marks (establishing a coordinate system with the specified position on the glass); the preset coordinate information and preset size parameters of the red squares. An industrial camera captures images of the glass products on the conveyor belt. Based on the preset coordinates of the red corner marks and red squares, the camera is driven along the guide rail to the corresponding area via a motion control card or servo driver. The movement speed can be set via software (recommended initial speed is 50-200 mm / s, decreasing to 10-50 mm / s when approaching the target area). During movement, the camera captures images in real time and transmits them to the monitor, with an image frame rate of no less than 30 fps to ensure clear observation by the operator. The system confirms the presence of preset trademark positioning red corner marks and QR code positioning red squares on the glass surface. These positioning marks are printed with special red ink, whose spectral characteristics are significantly different from ordinary printing inks, facilitating accurate identification in complex backgrounds. Once the camera reaches the designated area, the correction process automatically initiates, eliminating lens distortion through a built-in distortion correction algorithm. Angle correction is performed based on the shape characteristics of the red corner marker (e.g., right angle, specific size) and the rectangular characteristics of the red box, ensuring the angular deviation between the captured image and the preset graphic is less than 0.1°. Red features are highlighted through color space conversion (from RGB to HSV), and adaptive threshold segmentation technology is applied to extract potential red areas. Morphological processing and contour analysis are then used to confirm whether these are valid positioning markers. After confirming the valid detection area, image correction processing is performed to eliminate image distortion caused by camera angle, curved glass surfaces, or conveyor belt vibration. A sub-pixel-level edge detection algorithm accurately extracts the position and size parameters of the red corner marker for trademark positioning and the red box for QR code positioning. The extracted actual position coordinates are compared with the preset design coordinates to calculate the displacement parameters of the trademark and QR code printheads. Simultaneously, the scaling ratio of the QR code is determined based on the actual size of the red box for QR code positioning. Based on the calculation results, the center coordinates of the red corner mark are extracted (accuracy up to 0.01mm), compared with the preset coordinates to calculate the deviation value, and converted into motor pulse count based on the motion accuracy of the digital printer's X and Y axes (0.005mm / step), driving the label printhead to move to the target position; at the same time, the actual size parameters (length and width, accuracy up to 0.01mm) of the red square are extracted, and the length and width of the QR code are automatically adjusted through a size adaptive algorithm (keeping the QR code ratio unchanged), and the center coordinates of the red square are extracted, compared with the preset coordinates to calculate the deviation value, converted into motor pulse count, driving the QR code printhead (or the same printhead switching mode) to move to the target position.During the printing process, the camera captures an image of the printing area every 0.5 seconds. The template matching algorithm detects the following: the deviation between the actual position of the trademark and the position of the red corner mark (threshold ≤ 0.05mm); the deviation between the actual position of the QR code and the position of the red box (threshold ≤ 0.05mm); and the matching degree between the actual size and the size of the red box (deviation threshold ≤ 0.05mm). If any deviation exceeds the threshold, the system immediately recalculates the coordinates and size parameters and drives the printhead to make corrections. The correction response time is less than 0.1 seconds.
[0023] Understandably, the high-precision positioning mark recognition and real-time compensation mechanism improves the printing accuracy of trademarks and QR codes on glass products, solving the problems of low efficiency of manual alignment, cumbersome traditional visual alignment adjustment, difficulty in coordinating the positioning of QR codes and trademarks, and inability to adapt to size in existing technologies. It features high automation, high positioning accuracy, strong coordination, convenient operation, and strong adaptability, and is suitable for batch and accurate printing of glass trademarks and QR codes.
[0024] This application further proposes that when confirming the detection area with the red corner mark for trademark positioning and the red square for QR code positioning, it includes: Based on the HSV color space, red features are extracted from the acquired glass images to identify image areas whose RGB values conform to the preset red threshold range; Noise interference is eliminated based on morphological processing, and candidate regions with subscript and box features are preserved; Geometric shape analysis was used to distinguish between the red corner mark for trademark positioning and the red square for QR code positioning. The red corner mark for trademark positioning has a right-angle feature, while the red square for QR code positioning has a rectangular feature. Based on the relative positions of the candidate areas, the detection areas with red corner markers for trademark positioning and red squares for QR code positioning are determined.
[0025] Specifically, red features are extracted from the acquired glass images based on the HSV color space. The process involves converting the RGB image to the HSV color space, setting a precise threshold range for the red channel (H: 0-10 and 165-180, S: 120-255, V: 80-255), and extracting potential red regions through threshold segmentation. Then, morphological opening operations (3×3 pixel structuring elements) are applied to eliminate small-area noise, followed by closing operations (5×5 pixel structuring elements) to connect broken edges. Connected region analysis is used to calculate the area, perimeter, aspect ratio, rectangularity, and roundness of each connected region. Area thresholding (3-5mm for trademark corner marks) is then applied for further filtering. 2 QR code frame 50-70mm 2Based on the analysis of sub-indicator features and shape features, candidate regions with sub-indicator features (close to right triangles, rectangularity > 0.85) and box features (close to squares, aspect ratio 0.95-1.05) are retained. Finally, the effective detection area is determined according to the preset relative positional relationship (e.g., the distance between the sub-indicator and the box should be within the range of 100-150mm).
[0026] Understandably, the method of extracting red features using the HSV color space overcomes the problems of glass reflection and background interference, thus improving the accuracy of positioning marker recognition.
[0027] This application further proposes image correction processing for the detection region, including: The camera distortion parameters were obtained using the checkerboard calibration method, and the influence of lens distortion was eliminated based on radial distortion correction. Based on the right-angle features of the red corner mark for trademark positioning and the rectangular features of the red square for QR code positioning, the image rotation angle is calculated; the image rotation is corrected using a bilinear interpolation algorithm so that the angle deviation between the corrected image and the design file is less than a preset angle threshold. The image after rotation correction is subjected to contrast enhancement processing.
[0028] Specifically, a checkerboard calibration method was used to obtain camera distortion parameters. Using a 9×6 checkerboard calibration board, 20-30 images were captured at different positions and angles within the camera's field of view. The camera intrinsic parameter matrix and distortion coefficients were calculated. Radial and tangential distortion corrections were performed to eliminate barrel or pincushion distortion. Based on the right-angled features of the red corner mark in the trademark positioning, two vertical edges were detected using Canny edge detection and Hough transform. The deviation of their included angle from 90° was calculated as the image rotation angle. Simultaneously, based on the rectangular features of the red box in the QR code positioning, four edges were detected and their intersections were calculated to evaluate the rectangularity of the box. Image rotation correction was performed using affine transformation. Finally, the corrected images underwent contrast enhancement processing. Adaptive histogram equalization (CLAHE) was applied to enhance image contrast, with parameters set to an 8×8 grid size and a contrast limit of 0.02 to ensure a clear distinction between the red mark and the background.
[0029] Understandably, the method of using checkerboard calibration to obtain camera distortion parameters and perform image correction eliminates lens distortion and angular deviation, and reduces angular error.
[0030] This application further proposes methods for extracting the actual position coordinates of the red corner mark for trademark positioning, and the actual position coordinates and size parameters for extracting the red square for QR code positioning, including: The edge features of the red corner mark for trademark positioning are extracted based on the sub-pixel edge detection algorithm, and the center point of the corner mark is calculated as the actual position coordinates of the red corner mark for trademark positioning. The four sides of the red square in the QR code are detected by Hough transform, and the intersection of the four sides is calculated as the four vertices of the square. The actual position coordinates and size parameters of the red square in the QR code are determined based on the coordinates of the four vertices.
[0031] Specifically, the Sobel operator is applied to the red corner mark area for edge detection to obtain gradient magnitude and direction; Zernike moment subpixel edge localization technology is used to improve edge localization accuracy; the two right-angled sides of the corner mark are detected by Hough transform, and their intersection coordinates are calculated as the center point of the corner mark, which is the actual position coordinate of the red corner mark for trademark positioning; to improve accuracy, the measurement results of five consecutive frames are weighted and averaged to eliminate random errors. For the red square for QR code positioning, the outline of the square is obtained by Canny edge detection, and the quadrilateral outline is extracted by applying a polygon fitting algorithm (such as the Douglas-Peucker algorithm); the four sides are detected by Hough transform, and the equation of each side is calculated; the intersection of the equations of adjacent sides is used as the four vertices of the square; based on the coordinates of the four vertices, the center point of the square is calculated as the actual position coordinate, and the distance between the midpoints of opposite sides is calculated as the width and height of the square, thereby determining the size parameters of the red square for QR code positioning.
[0032] Understandably, the subpixel edge detection algorithm extracts the coordinates and size parameters of the positioning markers, improving positioning accuracy and ensuring the precise printing position and size of the trademarks and QR codes.
[0033] This application further proposes that when calculating the nozzle displacement parameters of the trademark based on the deviation between the actual position coordinates of the red corner mark of the trademark and the position coordinates of the trademark design, the following should be included: Determine the X-axis and Y-axis deviations between the actual position coordinates of the red corner mark of the trademark and the design position coordinates of the trademark; convert the X-axis and Y-axis deviations into the number of pulses of the stepper motor to obtain the trademark nozzle displacement parameters; the trademark nozzle displacement parameters include the direction and amount of trademark nozzle displacement.
[0034] Specifically, the actual coordinates of the red corner mark of the trademark are compared with the coordinates of the trademark design position, and the deviations Δx and Δy in the X-axis and Y-axis directions are calculated. Considering the mechanical characteristics of the digital printer, the physical deviations are converted into the number of pulses of the stepper motor. The calculation formula is: X-axis displacement pulse count of the trademark printhead = Δx / X-axis resolution, Y-axis displacement pulse count of the trademark printhead = Δy / Y-axis resolution, where the X-axis and Y-axis resolutions are usually 0.005mm / pulse. Based on the calculation results, the trademark printhead displacement parameters are generated, including the displacement direction (positive / negative) and displacement amount (number of pulses). These parameters are used to drive the trademark printhead to move accurately to the target position.
[0035] Understandably, the method of calculating the nozzle displacement parameters based on the deviation between the actual position coordinates of the positioning mark and the design position coordinates achieves a seamless connection from measurement to execution, transforming measurement errors into precise motion control and improving printing position accuracy.
[0036] This application further proposes methods for determining the QR code scaling ratio based on the actual size parameters of the red square positioning the QR code, and for calculating the QR code printhead displacement parameters based on the deviation between the actual position coordinates of the red square positioning the QR code and the designed position coordinates of the QR code, including: Compare the actual dimensions of the QR code within the red box with the design dimensions to calculate the scaling ratio in the length and width directions; keep the aspect ratio of the QR code unchanged, and scale the QR code proportionally according to the scaling ratio. Calculate the X-axis and Y-axis deviations between the actual position coordinates of the red square for QR code positioning and the designed position coordinates of the QR code; convert the X-axis and Y-axis deviations into the number of pulses for the stepper motor to obtain the QR code printhead displacement parameters; the QR code printhead displacement parameters include the QR code printhead displacement direction and the QR code printhead displacement amount.
[0037] Specifically, the actual width Wa and actual height Ha of the red square for positioning the QR code are measured and compared with the designed width Wd and designed height Hd. The scaling ratios kw = Wa / Wd and kh = Ha / H_d in the length and width directions are calculated. To maintain the aspect ratio of the QR code, the average scaling ratio k = (kw + kh) / 2 is taken as the final scaling ratio. For QR code printing, the original QR code data is scaled proportionally according to the scaling ratio k, and the scaling algorithm uses bilinear interpolation to ensure image quality. At the same time, the X-axis deviation Δx = xa - xd and the Y-axis deviation Δy = ya - yd of the actual center coordinates (xa, ya) of the red square for positioning the QR code and the designed center coordinates (xd, yd) are calculated. These deviations are converted into the number of pulses of the stepper motor. The calculation formula is: number of X-axis displacement pulses of the QR code printhead = Δx / X-axis resolution, number of Y-axis displacement pulses of the QR code printhead = Δy / Y-axis resolution. Finally, QR code printhead displacement parameters containing displacement direction and displacement amount are generated to accurately control the QR code printing position and size.
[0038] Understandably, the method of determining the scaling ratio based on the actual size parameters of the red square in the QR code location solves the problem of QR code scaling distortion caused by slight changes in glass size, ensuring the readability of the QR code and the success rate of scanning.
[0039] This application further proposes a method for printing a trademark at the designed trademark position by driving the trademark printhead according to the printhead displacement parameters, including: The trademark nozzle motion trajectory data is generated based on the nozzle displacement parameters. The trademark nozzle motion trajectory data includes the nozzle's movement path, speed parameters, and acceleration / deceleration curves. The motion trajectory data of the trademark nozzle is converted into control signals, which drive the trademark nozzle to move along the X and Y axes to the trademark design position.
[0040] Specifically, the displacement parameters of the trademark nozzle are converted into commands recognizable by the motion controller, including target position coordinates, moving speed, and acceleration. An S-shaped velocity planning algorithm is applied to generate a smooth motion trajectory, avoiding mechanical vibrations caused by sudden velocity changes. For example, the velocity curve parameters can be set as follows: acceleration time 0.05 seconds, constant speed time 0.1 seconds, and deceleration time 0.05 seconds. The physical limitations of the nozzle (maximum speed 300 mm / s, maximum acceleration 1000 mm / s) are taken into account. 2 To ensure the safety and reliability of the printing process, a closed-loop control system is used to monitor the printhead position in real time during the printing process. When the printhead reaches the target position, the system controls the printhead to print the trademark in the designed position according to the preset printing parameters (ink volume, frequency, etc.). During the printing process, the printhead status and ink flow are monitored in real time to ensure stable printing quality.
[0041] Understandably, by using S-shaped speed planning and closed-loop control, smooth and precise printhead movement is achieved, avoiding ink splashing and print quality degradation.
[0042] This application further proposes a method for driving a QR code printhead to print a QR code at the designed QR code position based on the QR code printhead displacement parameters, including: Based on the displacement parameters of the QR code printhead, the motion trajectory data of the QR code printhead is generated. The motion trajectory data of the QR code printhead includes the movement path, speed parameters and acceleration and deceleration curves of the QR code printhead. The motion trajectory data of the QR code printhead is converted into control signals, which drive the QR code printhead to move along the X and Y axes to the designed position of the QR code.
[0043] Specifically, the original QR code data is scaled proportionally according to the scaling ratio to ensure that the scaled QR code size matches the red box; the QR code printhead displacement parameters are converted into motion controller commands to generate a motion trajectory containing the target position, speed, and acceleration; for the special requirements of QR code printing (high precision, high resolution), the speed parameters are set more strictly, for example, a maximum speed of 200 mm / s and an acceleration time of 0.08 seconds; during the printhead movement, the printhead position is monitored in real time and compared with the target trajectory, and the motion parameters are adjusted through a PID controller; a multi-resolution printing strategy is adopted, using higher resolution printing for key feature areas of the QR code (such as positioning patterns) to ensure scanning recognition rate; when the printhead reaches the target position, the printhead is controlled to print the scaled QR code according to the adjusted resolution.
[0044] Understandably, motion parameters and resolution strategies were optimized to meet the specific printing requirements of QR codes, ensuring a high scanning and recognition rate.
[0045] This application further proposes methods for calculating correction parameters and dynamically compensating for the corresponding nozzle positions, including: During the printing of trademarks and QR codes, real-time images of the printing area are captured at preset time intervals; the deviation between the actual printing position and the design position of the trademark and the actual printing position and the design position of the QR code are detected according to the template matching algorithm; the difference between the actual printing size and the design size of the QR code is measured by the edge detection algorithm. When a deviation is detected to exceed a preset threshold, compensation parameters are calculated in real time to adjust the nozzle position for subsequent printing.
[0046] Specifically, an auxiliary industrial camera is installed at an appropriate position behind the printhead to work in conjunction with the main camera; the image acquisition frequency is set to 2 frames / second (one frame every 0.5 seconds) to ensure timely capture of changes during the printing process; for trademark printing, a normalized cross-correlation (NCC) template matching algorithm is applied to compare the actual printed trademark with the design template to detect deviations between the actual printed position and the design position; for QR code printing, an edge detection algorithm is used to extract the QR code boundary, calculate its actual position coordinates and size parameters, and then compare them with the design values; when a deviation is detected that exceeds a preset threshold (trademark position deviation > 0.05mm, QR code position deviation > 0.05mm, QR code size deviation > 0.05mm), a compensation mechanism is immediately activated; an incremental compensation strategy is adopted, dividing the compensation amount into multiple small steps and implementing them step by step to avoid printing quality problems caused by sudden adjustments; the compensation parameters are updated in real time through a motion controller, and the correction response time is controlled within 0.1 seconds; the entire dynamic compensation process does not affect the production line speed and can achieve accuracy correction without stopping the machine.
[0047] Understandably, a complete closed-loop control system was built, which can promptly detect and correct deviations in the printing process, thus improving system stability.
[0048] This application further proposes that when a deviation is detected to exceed a preset threshold, compensation parameters are calculated in real time to adjust the printhead position for subsequent printing, including: When the deviation between the actual printing position and the design position of the trademark exceeds the first preset deviation threshold, the displacement parameters of the trademark printhead are adjusted. When the deviation between the actual printed position of the QR code and the designed position exceeds the second preset deviation threshold, the displacement parameters of the QR code printhead are adjusted. When the difference between the actual printed size and the design size of the QR code exceeds the third preset difference threshold, the scaling parameter of the QR code is adjusted.
[0049] Specifically, the compensation amounts in the X and Y axes are calculated, and these compensation amounts are equal to the detected deviation values. An exponential decay strategy is adopted to proportionally distribute the compensation amounts across the subsequent N printing cycles, avoiding quality issues caused by sudden adjustments. The N value is dynamically adjusted according to the magnitude of the deviation; the larger the deviation, the smaller the N value, and the faster the response. When the deviation between the actual printed position of the QR code and the designed position exceeds the second preset deviation threshold (usually 0.05mm), new QR code printhead displacement parameters are calculated, including compensation amounts in the X and Y axes. Simultaneously, the trend of the deviation is analyzed (e.g., whether it exhibits periodic or linear growth), predicting future deviations and compensating in advance. When the difference between the actual printed size of the QR code and the designed size exceeds the third preset difference threshold (usually 0.05mm), the QR code scaling ratio is recalculated using the formula: new scaling ratio = old scaling ratio × (1 - size deviation / design size). All compensation data is recorded to analyze system drift and periodic errors during production, providing data support for long-term stability. For persistent deviations, maintenance reminders are automatically triggered, prompting inspection of mechanical components or calibration of the system.
[0050] Understandably, setting different preset thresholds for different types of deviations and adopting targeted compensation strategies can intelligently distinguish and handle various printing deviations, improving the targeting and effectiveness of compensation.
[0051] like Figure 2 As shown, the red corner mark is the positioning reference for the trademark, and its center position corresponds to the preset printing center of the trademark; the red square is the positioning and size reference for the QR code, and its area corresponds to the preset printing area of the QR code, and its size determines the adaptive size of the QR code.
[0052] In summary, the coordinated positioning of the red corner mark and red box enables automatic alignment of the trademark and QR code, as well as adaptive adjustment of the QR code size, without manual intervention, reducing labor costs and improving production efficiency. The red corner mark and red box provide a clear benchmark, and combined with real-time detection and dynamic correction mechanisms, they can eliminate positional deviations caused by minor glass offsets, while ensuring the QR code size matches the red box, improving overall printing accuracy. The associated positioning of the trademark and QR code avoids misalignment, ensuring visual consistency of the product. Real-time image display during camera movement facilitates operator monitoring and reduces the need for specialized skills. The flexible setting of the red corner mark and red box allows adaptation to different glass models and diverse trademark and QR code position requirements without redesigning the recognition logic, improving the equipment's versatility.
[0053] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A machine vision-based glass trademark and two-dimensional code printing and positioning method, characterized in that, include: Based on glass images acquired by industrial cameras, the detection areas with red corner marks for trademark positioning and red squares for QR code positioning were identified; Image correction processing is performed on the detection area; The actual position coordinates of the red corner mark of the trademark and the actual position coordinates and size parameters of the red square of the QR code are extracted using image processing technology. The trademark nozzle displacement parameters are calculated based on the deviation between the actual position coordinates of the red corner mark of the trademark positioning and the design position coordinates of the trademark; the QR code scaling ratio is determined based on the actual size parameters of the red square of the QR code positioning, and the QR code nozzle displacement parameters are calculated based on the deviation between the actual position coordinates of the red square of the QR code positioning and the design position coordinates of the QR code. The trademark printhead is driven to print the trademark at the designed position according to the trademark printhead displacement parameters; the QR code is scaled proportionally according to the QR code scaling ratio, and the QR code printhead is driven to print the QR code at the designed position according to the QR code printhead displacement parameters. During the printing process, the actual printing position of the trademark, as well as the actual printing position and size of the QR code, are monitored in real time. When a deviation is detected, correction parameters are calculated and the corresponding printhead position is dynamically compensated. 2.The method of claim 1, wherein When confirming the detection area with the red corner mark for trademark positioning and the red square for QR code positioning, it includes: Based on the HSV color space, red features are extracted from the acquired glass images to identify image areas whose RGB values conform to the preset red threshold range; Noise interference is eliminated based on morphological processing, and candidate regions with subscript and box features are preserved; Geometric shape analysis was used to distinguish between the red corner mark for trademark positioning and the red square for QR code positioning. The red corner mark for trademark positioning has right-angle features, while the red square for QR code positioning has rectangular features. Based on the relative positions of the candidate areas, the detection areas with red corner markers for trademark positioning and red squares for QR code positioning are determined. 3.The method of claim 2, wherein, Image correction processing of the detection area includes: The camera distortion parameters were obtained using the checkerboard calibration method, and the influence of lens distortion was eliminated based on radial distortion correction. Based on the right-angle features of the red corner mark for trademark positioning and the rectangular features of the red square for QR code positioning, the image rotation angle is calculated; the image rotation is corrected using a bilinear interpolation algorithm so that the angle deviation between the corrected image and the design file is less than a preset angle threshold. The image after rotation correction is subjected to contrast enhancement processing.
4. The machine vision-based glass trademark and QR code printing positioning method according to claim 3, characterized in that, When extracting the actual position coordinates of the red corner mark for trademark positioning, and the actual position coordinates and size parameters of the red square for QR code positioning, the following should be included: The edge features of the red corner mark for trademark positioning are extracted based on the sub-pixel edge detection algorithm, and the center point of the corner mark is calculated as the actual position coordinates of the red corner mark for trademark positioning. The four sides of the red square in the QR code are detected by Hough transform, and the intersection of the four sides is calculated as the four vertices of the square. The actual position coordinates and size parameters of the red square in the QR code are determined based on the coordinates of the four vertices. 5.The method of claim 4, wherein, When calculating the nozzle displacement parameters of the trademark based on the deviation between the actual coordinates of the red corner mark and the designed coordinates of the trademark, the following should be included: Determine the X-axis and Y-axis deviation values between the actual position coordinates of the red corner mark of the trademark and the design position coordinates of the trademark; convert the X-axis and Y-axis deviation values into the number of pulses of the stepper motor to obtain the trademark nozzle displacement parameters; the trademark nozzle displacement parameters include the trademark nozzle displacement direction and the trademark nozzle displacement amount. 6.The method of claim 5, wherein, When determining the QR code scaling ratio based on the actual size parameters of the red square positioning the QR code, and calculating the QR code printhead displacement parameters based on the deviation between the actual position coordinates of the red square positioning the QR code and the designed position coordinates of the QR code, the following steps are included: Compare the actual dimensions of the QR code within the red box with the design dimensions to calculate the scaling ratio in the length and width directions; keep the aspect ratio of the QR code unchanged, and scale the QR code proportionally according to the scaling ratio. Calculate the X-axis and Y-axis deviations between the actual position coordinates of the red square for QR code positioning and the designed position coordinates of the QR code; convert the X-axis and Y-axis deviations into the number of pulses of the stepper motor to obtain the QR code printhead displacement parameters; the QR code printhead displacement parameters include the QR code printhead displacement direction and the QR code printhead displacement amount. 7.The method of claim 6, wherein, When the trademark printhead is driven to print the trademark at the designed position according to the printhead displacement parameters, this includes: The trademark nozzle motion trajectory data is generated based on the displacement parameters of the trademark nozzle, and the trademark nozzle motion trajectory data includes the movement path, speed parameters and acceleration / deceleration curve of the trademark nozzle; The motion trajectory data of the trademark nozzle is converted into control signals, driving the trademark nozzle to move along the X and Y axes to the trademark design position. 8.The method of claim 7, wherein, When driving the QR code printhead to print the QR code at the designed position based on the QR code printhead displacement parameters, this includes: Based on the displacement parameters of the QR code printhead, QR code printhead motion trajectory data is generated, which includes the movement path, speed parameters, and acceleration / deceleration curves of the QR code printhead. The motion trajectory data of the QR code printhead is converted into control signals, driving the QR code printhead to move along the X and Y axes to the designed QR code position. 9.The method of claim 8, wherein, When calculating correction parameters and dynamically compensating for the corresponding nozzle positions, the following steps are included: During the printing of trademarks and QR codes, real-time images of the printing area are captured at preset time intervals; the deviation between the actual printing position and the design position of the trademark and the actual printing position and the design position of the QR code are detected according to the template matching algorithm; the difference between the actual printing size and the design size of the QR code is measured by the edge detection algorithm. When a deviation is detected to exceed a preset threshold, compensation parameters are calculated in real time to adjust the nozzle position for subsequent printing. 10.The method of claim 9, wherein, When a deviation is detected to exceed a preset threshold, compensation parameters are calculated in real time, and the printhead position is adjusted for subsequent printing, including: When the deviation between the actual printing position and the design position of the trademark exceeds the first preset deviation threshold, the displacement parameters of the trademark printhead are adjusted. When the deviation between the actual printed position of the QR code and the designed position exceeds the second preset deviation threshold, the displacement parameters of the QR code printhead are adjusted. When it is detected that the difference between the actual printed size and the designed size of the two-dimensional code exceeds a third preset difference threshold, the scaling parameter of the two-dimensional code is adjusted.