A method and system for detecting surface defects of a printed product

By incorporating adaptive threshold segmentation and frequency-domain shifting in the surface defect detection method for printed materials, and combining the recursive update of the structural response map and the reference structural field, the problems of background residue and lack of long-term stable feature modeling in the existing technology are solved, thereby achieving high-precision defect detection and improved accuracy.

CN122175933APending Publication Date: 2026-06-09MIANYANG HUANGCHENG GUJIAN COLOR TILE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
MIANYANG HUANGCHENG GUJIAN COLOR TILE CO LTD
Filing Date
2026-03-10
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing methods for detecting defects in printed materials are unable to effectively eliminate fractional-period carrier components in printed background patterns and dot structures, resulting in significant background residue. Furthermore, they lack a modeling mechanism for the long-term stable characteristics of printed structures, making it difficult to distinguish between genuine defects and background structure changes caused by fluctuations in operating conditions, paper variations, or equipment vibrations.

Method used

By collecting visible light and supplementary camera images, adaptive thresholding and connected component analysis are performed to extract the printed mask. Two-dimensional fast Fourier transform and frequency domain shift processing are then performed. Combined with the recursive update of the structural response map and the reference structural field, the mean difference across channels and the aspect ratio are calculated to achieve accurate defect detection.

Benefits of technology

It achieves high-precision suppression of periodic background patterns and fractional periodic carrier textures in printed materials, reduces the interference of complex backgrounds on detection results, improves the accuracy and stability of defect identification, and can effectively distinguish between real defects and background texture fluctuations, reducing the false anomaly misjudgment rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122175933A_ABST
    Figure CN122175933A_ABST
Patent Text Reader

Abstract

The application discloses a kind of printed matter surface defect detection method and system, it is related to industrial machine vision technical field, including the candidate area is projected as candidate binary graph and is carried out connected domain label, calculate cross-channel difference mean in combination with standardization supplementary image and standardization visible light image, screen confirms defect set and calculates length-width ratio, and obtain defect detection label by threshold comparison;Through two-stage frequency domain frequency shift fine processing, realize the high-precision suppression of printed matter periodic underprint and fractional period carrier texture, reduce the interference of complex background to defect detection result, realize the adaptive modeling to printed structure stable feature by constructing and dynamically updating structure reference field, effectively distinguish real defect and background texture fluctuation changing with time, improve the accuracy of defect identification and reduce false abnormal misjudgment rate by area structured analysis and cross-channel consistency discrimination.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial machine vision technology, and in particular to a method and system for detecting surface defects in printed materials. Background Technology

[0002] Existing technologies for detecting surface defects in printed materials rely on industrial cameras to acquire visible light images and combine them with methods such as threshold segmentation, edge detection, texture analysis, or frequency domain analysis to identify defects such as dirt, missing prints, scratches, and ink smears. Multi-channel imaging methods, such as polarization imaging, near-infrared imaging, or ultraviolet imaging, are introduced to enhance the ability to distinguish between reflections, material differences, or ink coverage differences. In addition, frequency domain analysis of the images is performed through two-dimensional fast Fourier transform to suppress periodic backgrounds and highlight abnormal areas.

[0003] However, existing technologies still have shortcomings. Current methods for detecting defects in printed materials use a single two-dimensional fast Fourier transform to suppress periodic backgrounds. They can only shift integer frequency components, making it difficult to effectively eliminate fractional periodic carrier components commonly found in printed patterns and halftone structures. This results in noticeable background residue. Existing technologies rely on single-frame images or local statistical features for defect judgment, lacking a modeling mechanism for the long-term stable characteristics of printed structures. This makes it difficult to distinguish between real defects and background structure changes caused by fluctuations in operating conditions, paper variations, or equipment vibrations. Summary of the Invention

[0004] In view of the aforementioned existing problems, the present invention is proposed.

[0005] Therefore, this invention provides a method and system for detecting surface defects in printed materials, which solves the problem that existing methods for detecting defects in printed materials use a single two-dimensional fast Fourier transform to suppress periodic backgrounds. These methods can only shift integer frequency components, making it difficult to effectively eliminate fractional periodic carrier components commonly found in printed patterns and halftone structures, resulting in obvious background residue. Existing technologies rely on single-frame images or local statistical features for defect judgment, lacking a modeling mechanism for the long-term stable characteristics of printed structures, making it difficult to distinguish between real defects and background structure changes caused by operating condition fluctuations, paper variations, or equipment vibrations.

[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:

[0007] In a first aspect, the present invention provides a method for detecting surface defects in printed matter, comprising the following steps:

[0008] Collect the output image of the visible light camera and the supplementary camera image. Resample the supplementary camera image to the pixel coordinate system of the output image of the visible light camera to obtain the aligned image. Perform adaptive threshold segmentation and connected component analysis based on the aligned image. Select the connected region with the largest area as the printing mask. Crop the output image of the visible light camera and the aligned image to obtain the standardized visible light image and the standardized supplementary image.

[0009] The minimum bounding rectangle of the printed mask is extracted and divided into square grids. Square grids that intersect with the printed mask are selected as valid blocks. The standardized visible light image is cropped according to the valid blocks and subjected to a two-dimensional fast Fourier transform to obtain coarse suppression blocks. The coarse suppression blocks are filtered and amplified to obtain fine suppression blocks. The fine suppression blocks are stitched together and cropped using the printed mask to obtain the structure response map. The current reference structure field is recursively updated by combining the previous frame reference structure field. The deviation response map between the structure response map and the reference structure field is calculated to extract the candidate region set.

[0010] The candidate regions are projected into candidate binary images and connected components are labeled. The mean difference across channels is calculated by combining the standardized supplementary image and the standardized visible light image. The defect set is screened and confirmed and the aspect ratio is calculated. The defect detection label is obtained by threshold comparison.

[0011] As a preferred embodiment of the method for detecting surface defects in printed matter according to the present invention, the step of splicing the fine suppression blocks and cutting them using a printed matter mask to obtain a structural response map, and recursively updating the current reference structural field in conjunction with the previous frame reference structural field, includes:

[0012] Extract the minimum bounding rectangle of the printed mask and divide it into square grids. Filter the valid blocks and crop the standardized visible light image using the grid coordinates of the valid blocks to obtain the visible light block image.

[0013] A two-dimensional fast Fourier transform is performed on the visible light block image to obtain the spectral complex matrix. The amplitude map of the spectral complex matrix is ​​calculated using the amplitude formula. The amplitude of each pixel in the amplitude map is sorted in descending order. The coordinates of the pixel corresponding to the largest amplitude are selected and set as the frequency peak coordinates. The frequency peak coordinates are used as the translation amount to perform an integer-point translation on the spectral complex matrix. A two-dimensional inverse fast Fourier transform is performed on the translated spectral complex matrix to obtain the coarse suppression block.

[0014] The coarse suppression block is filtered using a Gaussian low-pass filter to obtain a filtered block. An amplification factor is set based on empirical rules, and the filtered block is amplified using the amplification factor to obtain an amplified block. The spectral complex matrix and frequency peak coordinates are extracted from the amplified block. The x and y coordinates of the frequency peak coordinates are divided by the amplification factor to obtain the refined frequency shift coordinates. The refined frequency shift coordinates are used as the translation amount to perform a non-integer translation on the spectral complex matrix. The translated spectral complex matrix is ​​then subjected to a two-dimensional inverse fast Fourier transform to obtain the refined suppression block.

[0015] The fine suppression blocks are stitched together according to the grid positions of the effective blocks and cropped using a printed mask to obtain the fine suppression full image. Gradient response is extracted from the fine suppression image to generate the structure response map. The reference structure field is initialized as the structure response map, and the reference structure field is calculated.

[0016] In a preferred embodiment of the method for detecting surface defects in printed matter according to the present invention, the method for calculating the deviation response map from the reference structural field and extracting a candidate region set includes:

[0017] The deviation response map is obtained by subtracting the reference structure field from the structure response map. Adaptive threshold segmentation is performed on the deviation response map to obtain a binary candidate map. Morphological opening operation is performed on the binary candidate map to remove isolated noise points, and connected component analysis is performed to obtain a set of candidate regions.

[0018] As a preferred embodiment of the method for detecting surface defects in printed matter according to the present invention, the step of calculating the mean cross-channel difference by combining standardized supplementary images and standardized visible light images, screening and confirming the defect set, and calculating the aspect ratio includes:

[0019] Initialize a candidate binary map of the same size as the printed mask, extract the pixel coordinate set of the candidate regions from the candidate region set, fill in the candidate binary map and crop it using the printed mask to obtain a cropped binary map, and perform connected component labeling on the cropped binary map to obtain a label matrix;

[0020] The absolute value of the pixel-by-pixel subtraction between the normalized visible light image and the normalized supplementary image is used to obtain the cross-channel difference map;

[0021] Extract the set of pixel coordinates from the label matrix, count the number of all pixel coordinates in the set, obtain the area of ​​the region, calculate the average cross-channel difference by combining the cross-channel difference map, screen and confirm the defect set and calculate the aspect ratio.

[0022] In a preferred embodiment of the method for detecting surface defects in printed matter according to the present invention, the step of obtaining the defect detection label through threshold comparison includes:

[0023] Based on the enterprise's quality specifications or acceptance standards, an aspect ratio threshold range is set. If the aspect ratio is greater than or equal to the maximum value of the aspect ratio threshold, the label is a linear defect. If the aspect ratio is less than the maximum value of the aspect ratio threshold but greater than or equal to the minimum value of the aspect ratio threshold range, the label is a strip defect. If the aspect ratio is less than the minimum value of the aspect ratio threshold range, the label is a block defect, thus obtaining a defect detection label.

[0024] As a preferred embodiment of the method for detecting surface defects in printed materials according to the present invention, the step of resampling the supplementary camera image to the pixel coordinate system of the visible light camera output image to obtain an aligned image includes:

[0025] When the production line controller receives the clock trigger edge, it uses the trigger edge counter as the frame index and obtains the visible light camera output image, supplementary camera image and timestamp of the frame index through the API interface.

[0026] Read the extrinsic calibration matrices of the visible light camera and the supplementary camera, resample the supplementary camera image to the pixel coordinate system of the visible light camera output image, and obtain the aligned image.

[0027] As a preferred embodiment of the method for detecting surface defects in printed materials according to the present invention, the step of cropping the visible light camera output image and the aligned image to obtain a standardized visible light image and a standardized supplementary image includes:

[0028] Based on the aligned image, an adaptive thresholding method is used to convert it into a binary image. All connected regions in the image are extracted through connected component analysis. The connected regions corresponding to the largest areas are selected. A printed mask is set, and the aligned image and the visible light camera output image are cropped using the printed mask to obtain a standardized visible light image and a standardized supplementary image.

[0029] Secondly, the present invention provides a system for detecting surface defects in printed matter, comprising:

[0030] The synchronous acquisition module is used to generate a frame index when the production line controller receives the cycle trigger edge, acquire visible light images and supplementary images, read the timestamp and the number of pulses of the conveyor encoder, calculate the conveyor displacement, and complete the external parameter resampling and alignment of the multi-channel images.

[0031] The mask normalization module is used to perform adaptive threshold segmentation and morphological closing operations on the aligned image to extract the largest connected region as a print mask, and to perform white balance and edge preservation and noise reduction on the cropped image to obtain a normalized visible light image and a normalized supplementary image.

[0032] The frequency shift suppression module is used to divide the printed mask area into grids and select effective blocks according to the block side length and pixel number. It performs coarse suppression of the frequency shift by integer translation of the spectrum on the standardized visible light block image and fine correction of the non-integer frequency shift after Gaussian filtering and amplification, and stitches them together to obtain a finely suppressed full image.

[0033] The structural analysis module is used to extract gradient responses from the finely suppressed whole image to generate a structural response map, and to recursively update the reference structural field based on the frame index to obtain the structural baseline of the current frame.

[0034] The defect determination module is used to generate a deviation response map by pixel-by-pixel difference between the structural response map and the reference structural field, extract candidate regions, calculate the cross-channel difference mean and region morphology parameters for the candidate regions, screen and confirm defects, and determine the defect type based on the aspect ratio.

[0035] Thirdly, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, wherein when the computer program is executed by the processor, it implements any step of the method for detecting surface defects of printed matter as described in the first aspect of the present invention.

[0036] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the method for detecting surface defects of printed matter as described in the first aspect of the present invention.

[0037] The beneficial effects of this invention are as follows: This invention projects candidate regions into candidate binary images and labels connected components, calculates the mean cross-channel difference by combining standardized supplementary images and standardized visible light images, screens and confirms the defect set and calculates the aspect ratio, and obtains defect detection labels through threshold comparison; through two-level frequency domain frequency shift refinement processing, it achieves high-precision suppression of periodic background patterns and fractional periodic carrier textures of printed materials, reducing the interference of complex backgrounds on defect detection results; by constructing and dynamically updating a structural reference field, it achieves adaptive modeling of stable features of printed structures, effectively distinguishing real defects from background texture fluctuations that change over time; and through regional structured analysis and cross-channel consistency discrimination, it improves the accuracy of defect identification and reduces the false anomaly misjudgment rate. Attached Figure Description

[0038] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1This is a flowchart illustrating the operation of the method for detecting surface defects in printed materials in Example 1.

[0040] Figure 2 This is a schematic diagram of the structure of the printing surface defect detection system in Example 2. Detailed Implementation

[0041] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0042] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0043] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.

[0044] Example 1, referring to Figure 1 This is the first embodiment of the present invention, which provides a method for detecting surface defects in printed matter, including the following steps:

[0045] S1. Collect the output image of the visible light camera and the supplementary camera image. Resample the supplementary camera image to the pixel coordinate system of the output image of the visible light camera to obtain the aligned image. Perform adaptive threshold segmentation and connected component analysis based on the aligned image. Select the connected region with the largest area as the printing mask. Crop the output image of the visible light camera and the aligned image to obtain the standardized visible light image and the standardized supplementary image.

[0046] Specifically, the supplementary camera image is resampled to the pixel coordinate system of the visible light camera output image to obtain an aligned image, including:

[0047] When the production line controller receives a cycle trigger edge, the trigger edge counter is used as the frame index, denoted as... (Obtained by incrementing the counter by 1 each time triggered by the controller), the frame index is obtained through the API interface. The visible light camera output image, supplementary camera (e.g., polarized or near-infrared or ultraviolet) image and timestamp are used to read the cumulative pulse count and pulse count per unit length of the transport encoder. The transport displacement is obtained by dividing the cumulative pulse count by the pulse count per unit length.

[0048] Read the extrinsic calibration matrices of the visible light camera and the supplementary camera, resample the supplementary camera image to the pixel coordinate system of the visible light camera output image, and obtain the aligned image.

[0049] By synchronously acquiring image information from a visible light camera and a supplementary camera under production line cycle trigger conditions, and uniformly binding the acquisition process with the displacement of the conveyor encoder, while resampling the supplementary camera image to the pixel coordinate system of the visible light camera using external parameter calibration relationships, this invention establishes a strict correspondence between multi-channel images in three dimensions: time, space, and conveying direction. This technical solution effectively overcomes the problems of time asynchrony, spatial coordinate inconsistency, and difficulty in corresponding physical positions in existing multi-camera imaging technologies. It enables the information acquired by different imaging channels to accurately reflect the true state of the same printing position, thereby providing a reliable data foundation for subsequent defect analysis based on multi-channel consistency and structural differences, and significantly improving the accuracy and stability of the detection results.

[0050] Furthermore, the visible light camera output image and the aligned image are cropped to obtain a standardized visible light image and a standardized supplementary image, including:

[0051] Based on the aligned image, an adaptive threshold segmentation method is used to convert it into a binary image. Morphological closing operation is used to fill the boundary breaks in the binary image, and all connected regions (regions with the same adjacent pixel value and interconnected) are extracted through connected component analysis. The area of ​​all connected regions is calculated and sorted in descending order. The connected region with the largest area is selected as the initial print mask.

[0052] Subtract the reference displacement (frame index) from the transport displacement. =0 transport displacement), obtain the relative displacement, multiply the relative displacement by the pixel resolution (set based on experimental calibration method) and multiply by the cosine value of the camera mounting angle to obtain the mask pixel offset, translate the initial printed mask along the transport direction by the mask pixel offset to obtain the printed mask;

[0053] The aligned image and the visible light camera output image are cropped using a printed mask. The cropped image is then white-balanced and denoised (e.g., with bilateral filtering) to obtain a normalized visible light image and a normalized supplementary image.

[0054] By automatically extracting the printed area using a combination of adaptive threshold segmentation and morphological processing, and further introducing a mask dynamic translation correction mechanism based on transport displacement, this invention achieves precise positioning of the printed mask during continuous transport. Compared with existing methods that rely on fixed cropping windows or single-frame static masks, this technical solution can effectively adapt to the positional offset and posture changes of the printed material during transport, avoiding background areas from entering the detection range. At the same time, through joint processing of white balance and edge-preserving noise reduction, the consistency of image quality is improved, and the printing structure details are preserved to the greatest extent while suppressing noise interference, providing stable and high-quality input data for subsequent refined analysis.

[0055] S2. Extract the minimum bounding rectangle of the printed mask and divide it into square grids. Select the square grids that intersect with the printed mask as valid blocks. Crop the standardized visible light image according to the valid blocks and perform a two-dimensional fast Fourier transform to obtain coarse suppression blocks. Filter and amplify the coarse suppression blocks to obtain fine suppression blocks. Stitch the fine suppression blocks and crop them using the printed mask to obtain the structure response map. Recursively update the current reference structure field by combining it with the previous frame reference structure field. Calculate the deviation response map between the structure response map and the reference structure field and extract the candidate region set.

[0056] Specifically, the fine suppression blocks are stitched together and cropped using a printed mask to obtain the structural response map. The current reference structural field is then recursively updated by combining the previous frame's reference structural field, including:

[0057] By reading the pixel count of the block side length through the API interface, the outer boundary of all regions with a pixel value of 1 in the printed mask is extracted to obtain the minimum bounding rectangle. The pixel count of the block side length is then set as the side length. Divide the smallest bounding rectangle into two parts in the horizontal and vertical directions. The side length is Furthermore, for non-overlapping square grids, select square grids with a pixel value greater than 1 and mark them as valid blocks;

[0058] The standardized visible light image is cropped using the raster coordinates of the effective blocks to obtain a visible light patch image;

[0059] Performing a two-dimensional fast Fourier transform on the visible light patch image yields the spectral complex matrix. ;

[0060] Calculate the complex spectrum matrix using the amplitude formula. The amplitude map is processed by sorting the amplitude values ​​of each pixel in descending order and selecting the coordinates of the pixel with the largest amplitude value, which are then set as the frequency peak coordinates. ;

[0061] frequency peak coordinates As a translation quantity, for the spectral complex matrix Perform an integer-point translation on the resulting complex spectrum matrix. Perform a two-dimensional inverse fast Fourier transform to obtain a coarse suppression block;

[0062] The coarse suppression block is filtered using a Gaussian low-pass filter to obtain the filtered block;

[0063] The amplification factor is set based on empirical rules. The amplification factor is used to amplify the filter block (multiplication operation) to obtain the amplified block. The spectral complex matrix is ​​then extracted from the amplified block. and frequency peak coordinates (Same as the steps above);

[0064] frequency peak coordinates Divide the x-coordinate and y-coordinate by the magnification factor to obtain the fine-tuned frequency shift coordinates;

[0065] Using the refined frequency shift coordinates as the translation amount, the complex spectrum matrix is... Perform a non-integer translation (frequency domain interpolation translation, such as cubic spline interpolation) on the translated spectral complex matrix. Perform a two-dimensional inverse fast Fourier transform to obtain the fine suppression block.

[0066] The fine-suppression blocks are stitched together according to the grid positions of the effective blocks and then cropped using a printed mask to obtain the fine-suppression full image;

[0067] Gradient response extraction (e.g., using Sobel and Scharr operators) is performed on the fine suppression map to generate a structure response map;

[0068] Filter Frame Index Then initialize the reference structure field Filter the frame index for the structural response graph. Then extract the frame index. Reference structure field Calculate the reference structure field The formula is:

[0069] ,

[0070] in, For reference structural field , For frame index, To update the coefficients, a statistical analysis method was used. To The first result obtained by performing fixed resampling alignment The reference structure field after frame size alignment. This is a structural response diagram.

[0071] By dividing the printed area into fixed-size effective blocks and introducing frequency domain analysis and multi-level frequency shift suppression mechanisms at the block level, this invention can perform high-precision suppression of periodic backgrounds such as printing patterns and dot structures. Compared with existing methods that only use single-pass frequency domain processing, this technical solution first performs coarse-grained background suppression and then combines filtering and amplification mechanisms to achieve fine frequency shift correction, effectively solving the problem of fractional-period background residue. By splicing the finely suppressed blocks back into the whole image according to their spatial positions, the continuity of the overall structure is ensured, making real defects stand out more in complex backgrounds, and significantly improving the robustness and sensitivity of defect detection in complex printing scenarios.

[0072] Furthermore, the deviation response map between the structural response map and the reference structural field is calculated, and a candidate region set is extracted, including:

[0073] The reference structure field is subtracted from the structure response map (pixel by pixel) to obtain the deviation response map. Adaptive thresholding is then applied to the deviation response map to obtain a binary candidate map.

[0074] Morphological opening operations are performed on the binary candidate image to remove isolated noise points, and connected component analysis is performed to obtain a set of candidate regions.

[0075] By extracting structural responses based on the fine suppression map and introducing a reference structural field that is updated recursively across frames, this invention achieves adaptive modeling of stable structural features of printed materials. Compared with existing methods that rely solely on information from the current frame, this technical solution can effectively distinguish between normal structural fluctuations caused by equipment vibration, changes in paper texture, or light perturbations and abnormal structural changes caused by defects. This allows the detection results to focus more on the continuous and consistent structural damage characteristics, thereby significantly reducing the probability of false detections and improving the stability and reliability of the system under long-term continuous operation conditions.

[0076] S3. Project the candidate region into a candidate binary image and label the connected components. Combine the standardized supplementary image and the standardized visible light image to calculate the mean cross-channel difference. Screen and confirm the defect set and calculate the aspect ratio. Obtain the defect detection label by threshold comparison.

[0077] Specifically, by combining the standardized supplementary image and the standardized visible light image, the mean cross-channel difference is calculated to screen and confirm the defect set and calculate the aspect ratio, including:

[0078] Initialize a candidate binary image of the same size as the printed mask (initial pixel count is 0);

[0079] Extract the set of pixel coordinates of the candidate regions from the candidate region set. On the candidate binary map, set the position corresponding to the set of pixel coordinates to 1, otherwise set it to 0 to obtain the filled binary map. Use a printed mask to crop the filled binary map to obtain the cropped binary map.

[0080] Perform connected component labeling on the clipped binary graph to obtain a label matrix (representing integer labels for each connected region with displacement) and a maximum label number (obtained by sorting the integer labels in descending order and filtering for the maximum integer label).

[0081] The absolute value of the pixel-by-pixel subtraction between the normalized visible light image and the normalized supplementary image is used to obtain the cross-channel difference map;

[0082] For each label in the label matrix (being processed), iterate through each pixel position in the label matrix, filter the pixel positions whose label values ​​are equal to the label value (being processed), arrange them horizontally, and obtain the set of pixel coordinates;

[0083] The area of ​​a region is obtained by counting the number of all pixel coordinates in the pixel coordinate set and then calculating the mean cross-channel difference using the cross-channel difference map. The formula is as follows:

[0084] ,

[0085] in, This represents the mean of cross-channel differences. For the area, A set of pixel coordinates This is a cross-channel difference chart. These are the x and y coordinates of the pixels. For tag indexing,

[0086] Based on the fixed threshold method, a cross-channel difference threshold is set. If the mean cross-channel difference is less than or equal to the cross-channel difference threshold, the cross-channel difference in this area is judged to be insignificant, indicating that the consistency of the printed structure is destroyed. The connected region is added to the confirmed defect set. Otherwise, the area is judged to be a pseudo-anomaly caused by reflection, material difference or channel response difference, and is not added to the confirmed defect set.

[0087] Based on the confirmed defect set, the aspect ratio is calculated using the following formula:

[0088] ,

[0089] in, The maximum value of the x-axis or y-axis. To find the minimum value of the x-coordinate or y-coordinate, it is obtained by iterating through the x-coordinate or y-coordinate of all pixels in the pixel coordinate set. The aspect ratio is obtained by dividing the width of the region bounding box by the height of the region bounding box.

[0090] By combining visible light images and supplementary images at the regional scale to calculate cross-channel differences and using this to determine the consistency of candidate regions, this invention can effectively distinguish between genuine printing defects and false anomalies caused by reflection, material differences, or inconsistent channel responses. Compared with existing methods that rely on a single channel or empirical weights for discrimination, this technical solution achieves reliable screening of defect authenticity without introducing complex model parameters. By statistically analyzing the geometric features of confirmed defect regions, it provides a stable basis for subsequent defect classification, making the detection results more engineering interpretable and reproducible.

[0091] Furthermore, defect detection labels are obtained through threshold comparison, including:

[0092] Based on the enterprise's quality specifications or acceptance standards, an aspect ratio threshold range is set. If the aspect ratio is greater than or equal to the maximum value of the aspect ratio threshold, the label is a linear defect (scratches or ink smears). If the aspect ratio is less than the maximum value of the aspect ratio threshold but greater than or equal to the minimum value of the aspect ratio threshold range, the label is a stripe defect (creases, indentations, or stripes). If the aspect ratio is less than the minimum value of the aspect ratio threshold range, the label is a block defect (dirt or missing print), thus obtaining a defect detection label.

[0093] By combining the geometric features of the defect area with enterprise quality specifications or acceptance standards to complete the defect type labeling, this invention realizes an engineered closed loop from defect detection to defect classification. Compared with existing methods that only output defect presence or simple alarm information, this technical solution can provide clear classification results for different types of defects, enabling the detection output to directly serve actual production needs such as sorting control, quality statistics, and process adjustment. This significantly improves the practical value and decision support capability of the printed surface defect detection system in industrial applications.

[0094] Example 2, refer to Figure 2 As a second embodiment of the present invention, a system for detecting surface defects in printed matter includes:

[0095] The synchronous acquisition module is used to generate a frame index when the production line controller receives the cycle trigger edge, acquire visible light images and supplementary images, read the timestamp and the number of pulses of the conveyor encoder, calculate the conveyor displacement, and complete the external parameter resampling and alignment of the multi-channel images.

[0096] The mask normalization module is used to perform adaptive threshold segmentation and morphological closing operations on the aligned image to extract the largest connected region as a print mask, and to perform white balance and edge preservation and noise reduction on the cropped image to obtain a normalized visible light image and a normalized supplementary image.

[0097] The frequency shift suppression module is used to divide the printed mask area into grids and select effective blocks according to the block side length and pixel number. It performs coarse suppression of the frequency shift by integer translation of the spectrum on the standardized visible light block image and fine correction of the non-integer frequency shift after Gaussian filtering and amplification, and stitches them together to obtain a finely suppressed full image.

[0098] The structural analysis module is used to extract gradient responses from the finely suppressed whole image to generate a structural response map, and to recursively update the reference structural field based on the frame index to obtain the structural baseline of the current frame.

[0099] The defect determination module is used to generate a deviation response map by pixel-by-pixel difference between the structural response map and the reference structural field, extract candidate regions, calculate the cross-channel difference mean and region morphology parameters for the candidate regions, screen and confirm defects, and determine the defect type based on the aspect ratio.

[0100] This embodiment also provides a computer device applicable to a method for detecting surface defects in printed materials, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the method for detecting surface defects in printed materials as proposed in the above embodiment.

[0101] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0102] This embodiment also provides a storage medium storing a computer program, which, when executed by a processor, implements the method for detecting surface defects of printed materials as proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0103] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for detecting surface defects in printed matter, characterized in that: Includes the following steps: Collect the output image of the visible light camera and the supplementary camera image. Resample the supplementary camera image to the pixel coordinate system of the output image of the visible light camera to obtain the aligned image. Perform adaptive threshold segmentation and connected component analysis based on the aligned image. Select the connected region with the largest area as the printing mask. Crop the output image of the visible light camera and the aligned image to obtain the standardized visible light image and the standardized supplementary image. The minimum bounding rectangle of the printed mask is extracted and divided into square grids. Square grids that intersect with the printed mask are selected as valid blocks. The standardized visible light image is cropped according to the valid blocks and subjected to a two-dimensional fast Fourier transform to obtain coarse suppression blocks. The coarse suppression blocks are filtered and amplified to obtain fine suppression blocks. The fine suppression blocks are stitched together and cropped using the printed mask to obtain the structure response map. The current reference structure field is recursively updated by combining the previous frame reference structure field. The deviation response map between the structure response map and the reference structure field is calculated to extract the candidate region set. The candidate regions are projected into candidate binary images and connected components are labeled. The mean difference across channels is calculated by combining the standardized supplementary image and the standardized visible light image. The defect set is screened and confirmed and the aspect ratio is calculated. The defect detection label is obtained by threshold comparison.

2. The method for detecting surface defects of printed matter as described in claim 1, characterized in that: The process of stitching together the fine suppression blocks and cropping them using a printed mask to obtain a structural response map, and then recursively updating the current reference structural field in conjunction with the previous frame reference structural field, includes: Extract the minimum bounding rectangle of the printed mask and divide it into square grids. Filter the valid blocks and crop the standardized visible light image using the grid coordinates of the valid blocks to obtain the visible light block image. A two-dimensional fast Fourier transform is performed on the visible light block image to obtain the spectral complex matrix. The amplitude map of the spectral complex matrix is ​​calculated using the amplitude formula. The amplitude of each pixel in the amplitude map is sorted in descending order. The coordinates of the pixel corresponding to the largest amplitude are selected and set as the frequency peak coordinates. The frequency peak coordinates are used as the translation amount to perform an integer-point translation on the spectral complex matrix. A two-dimensional inverse fast Fourier transform is performed on the translated spectral complex matrix to obtain the coarse suppression block. The coarse suppression block is filtered using a Gaussian low-pass filter to obtain a filtered block. An amplification factor is set based on empirical rules, and the filtered block is amplified using the amplification factor to obtain an amplified block. The spectral complex matrix and frequency peak coordinates are extracted from the amplified block. The x and y coordinates of the frequency peak coordinates are divided by the amplification factor to obtain the refined frequency shift coordinates. The refined frequency shift coordinates are used as the translation amount to perform a non-integer translation on the spectral complex matrix. The translated spectral complex matrix is ​​then subjected to a two-dimensional inverse fast Fourier transform to obtain the refined suppression block. The fine suppression blocks are stitched together according to the grid positions of the effective blocks and cropped using a printed mask to obtain the fine suppression full image. Gradient response is extracted from the fine suppression image to generate the structure response map. The reference structure field is initialized as the structure response map, and the reference structure field is calculated.

3. The method for detecting surface defects of printed matter as described in claim 2, characterized in that: The deviation response map between the calculated structural response map and the reference structural field is used to extract a candidate region set, including: The deviation response map is obtained by subtracting the reference structure field from the structure response map. Adaptive threshold segmentation is performed on the deviation response map to obtain a binary candidate map. Morphological opening operation is performed on the binary candidate map to remove isolated noise points, and connected component analysis is performed to obtain a set of candidate regions.

4. The method for detecting surface defects of printed matter as described in claim 3, characterized in that: The process of combining standardized supplementary images and standardized visible light images to calculate the mean cross-channel difference, screening and confirming the defect set, and calculating the aspect ratio includes: Initialize a candidate binary map of the same size as the printed mask, extract the pixel coordinate set of the candidate regions from the candidate region set, fill in the candidate binary map and crop it using the printed mask to obtain a cropped binary map, and perform connected component labeling on the cropped binary map to obtain a label matrix; The absolute value of the pixel-by-pixel subtraction between the normalized visible light image and the normalized supplementary image is used to obtain the cross-channel difference map; Extract the set of pixel coordinates from the label matrix, count the number of all pixel coordinates in the set, obtain the area of ​​the region, calculate the average cross-channel difference by combining the cross-channel difference map, screen and confirm the defect set and calculate the aspect ratio.

5. The method for detecting surface defects of printed matter as described in claim 4, characterized in that: The process of obtaining defect detection labels through threshold comparison includes: Based on the enterprise's quality specifications or acceptance standards, an aspect ratio threshold range is set. If the aspect ratio is greater than or equal to the maximum value of the aspect ratio threshold, the label is a linear defect. If the aspect ratio is less than the maximum value of the aspect ratio threshold but greater than or equal to the minimum value of the aspect ratio threshold range, the label is a strip defect. If the aspect ratio is less than the minimum value of the aspect ratio threshold range, the label is a block defect, thus obtaining a defect detection label.

6. The method for detecting surface defects of printed matter as described in claim 5, characterized in that: The step of resampling the supplementary camera image to the pixel coordinate system of the visible light camera output image to obtain the aligned image includes: When the production line controller receives the clock trigger edge, it uses the trigger edge counter as the frame index and obtains the visible light camera output image, supplementary camera image and timestamp of the frame index through the API interface. Read the extrinsic calibration matrices of the visible light camera and the supplementary camera, resample the supplementary camera image to the pixel coordinate system of the visible light camera output image, and obtain the aligned image.

7. The method for detecting surface defects of printed matter as described in claim 6, characterized in that: The process of cropping the visible light camera output image and the aligned image to obtain a standardized visible light image and a standardized supplementary image includes: Based on the aligned image, an adaptive thresholding method is used to convert it into a binary image. All connected regions in the image are extracted through connected component analysis. The connected regions corresponding to the largest areas are selected. A printed mask is set, and the aligned image and the visible light camera output image are cropped using the printed mask to obtain a standardized visible light image and a standardized supplementary image.

8. A system for detecting surface defects in printed matter, used to implement the method for detecting surface defects in printed matter according to any one of claims 1 to 7, characterized in that: include: The synchronous acquisition module is used to generate a frame index when the production line controller receives the cycle trigger edge, acquire visible light images and supplementary images, read the timestamp and the number of pulses of the conveyor encoder, calculate the conveyor displacement, and complete the external parameter resampling and alignment of the multi-channel images. The mask normalization module is used to perform adaptive threshold segmentation and morphological closing operations on the aligned image to extract the largest connected region as a print mask, and to perform white balance and edge preservation and noise reduction on the cropped image to obtain a normalized visible light image and a normalized supplementary image. The frequency shift suppression module is used to divide the printed mask area into grids and select effective blocks according to the block side length and pixel number. It performs coarse suppression of the frequency shift by integer translation of the spectrum on the standardized visible light block image and fine correction of the non-integer frequency shift after Gaussian filtering and amplification, and stitches them together to obtain a finely suppressed full image. The structural analysis module is used to extract gradient responses from the finely suppressed whole image to generate a structural response map, and to recursively update the reference structural field based on the frame index to obtain the structural baseline of the current frame. The defect determination module is used to generate a deviation response map by pixel-by-pixel difference between the structural response map and the reference structural field, extract candidate regions, calculate the cross-channel difference mean and region morphology parameters for the candidate regions, screen and confirm defects, and determine the defect type based on the aspect ratio.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the method for detecting surface defects of printed matter as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the method for detecting surface defects of printed matter as described in any one of claims 1 to 7.