Industrial vision-based hot stamping finished product quality online visual inspection method and system
By employing multi-level image processing and edge detection algorithms, the challenge of inspecting heat transfer finished products against complex backgrounds has been solved, achieving highly accurate and real-time quality inspection and improving the automation level of the heat transfer production line.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGGUAN HONGXING HEAT TRANSFER MATERIALS CO LTD
- Filing Date
- 2026-06-02
- Publication Date
- 2026-07-28
AI Technical Summary
Existing technologies struggle to effectively distinguish patterns from backgrounds in complex environments during the quality inspection of heat transfer printed products, leading to misjudgments and omissions. This is especially true for dark fabrics, intricate textures, or color gradients, where traditional methods fail to accurately extract the complete boundaries of the pattern and separate the main subject area, impacting inspection accuracy and the automation level of the production line.
A multi-level image processing strategy is adopted. Gaussian filtering is triggered by brightness variance analysis to denoise the image. Combined with color difference distribution and local entropy analysis, the Sobel edge detection algorithm is used to extract gradient change features. The mask boundary is expanded by morphological dilation operation and the boundary is refined by watershed algorithm to detect pattern breaks and edge blurring points.
It significantly improves the accuracy of pattern main area extraction, reduces the false judgment rate, and achieves accurate separation and defect identification in complex backgrounds, meeting the real-time detection needs of large-scale industrial production lines and reducing the workload of manual re-inspection.
Smart Images

Figure CN122473151A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of visual inspection technology, specifically an online visual inspection method and system for heat transfer printing finished product quality based on industrial vision. Background Technology
[0002] Finished product quality inspection is a crucial step in ensuring product quality in the industrial manufacturing sector. In the production of clothing, bags, and various decorative items, heat transfer printing is a common pattern transfer process that uses heat to fix patterns onto the fabric surface. Its quality directly affects the product's aesthetics, durability, and market competitiveness.
[0003] With the increasing demand for personalized customization from consumers, heat transfer patterns are widely used on fabrics of various materials, colors, and textures, which poses higher requirements and challenges for the quality inspection of finished heat transfer products.
[0004] Industrial visual inspection technology, as a core means to achieve production automation and quality standardization, has seen rapid development in the industrial manufacturing field in recent years. This technology acquires product surface information through digital image acquisition equipment and utilizes image processing and analysis algorithms to automatically identify and determine product defects. It can effectively replace traditional manual visual inspection methods, improving inspection efficiency and consistency. Visual inspection of heat transfer printing products aims to determine the integrity, clarity, and positional accuracy of the heat transfer pattern by extracting and analyzing its features, thereby achieving online monitoring of the heat transfer process quality.
[0005] In existing technologies, visual inspection methods for heat transfer printed products mainly rely on simple image processing techniques, such as threshold-based image segmentation and basic edge detection algorithms. However, these methods face many limitations in practical applications: heat transfer patterns are transferred onto fabric surfaces with diverse colors and textures. The complexity and diversity of the fabric background significantly reduce the distinguishability between the pattern and the background, especially on dark fabrics, complex textures, or color gradients. Background noise can easily confuse the heat transfer pattern, leading to misjudgments and missed judgments. Furthermore, under different lighting conditions, the edges of the heat transfer pattern may be affected by shadows, reflections, or fabric textures, presenting blurred or discontinuous contour features. Traditional methods struggle to accurately extract the complete boundary of the pattern and separate the main body area. This technical bottleneck not only restricts the accuracy and stability of online inspection systems but also limits the further improvement of the automation level of heat transfer production lines. Summary of the Invention
[0006] The purpose of this invention is to address the aforementioned shortcomings in the prior art by providing an online visual inspection method and system for heat transfer printing product quality based on industrial vision.
[0007] The objective of this invention is achieved through the following technical solution: an online visual inspection method for the quality of heat transfer printing products based on industrial vision, comprising the following steps: S1. Acquire the original image of the heat transfer finished product using a digital camera, obtain pixel data containing the pattern and background from the fabric surface, and obtain the initial image matrix; S2. Calculate the variance of pixel brightness distribution based on the initial image matrix. If the variance exceeds a preset variance threshold, apply Gaussian filtering to remove noise caused by illumination changes and obtain a denoised image. S3. The denoised image is processed using an edge detection algorithm to extract gradient change features at the pattern boundary and determine the outline of the potential subject region. S4. Analyze the color difference distribution through the outline of the potential main body region, and mark the pixels with higher color differences inside the outline than outside the outline as pixels inside the pattern to obtain the preliminary separated pattern mask. S5. Obtain the local entropy value of the edge blur risk region in the initially separated pattern mask. If the local entropy value is lower than the preset entropy threshold, expand the mask boundary to encompass the blurry edge and obtain the optimized pattern mask. S6. Based on the optimized pattern mask superimposed on the denoised image, the main region pixels are separated, and it is determined whether the proportion of the separated main region pixels reaches a preset ratio to obtain the complete pattern region. S7. Perform boundary refinement processing on the complete pattern area, extract defect features from the complete pattern area, and determine the quality inspection result based on the number of defect features.
[0008] The present invention is further configured such that, in step S1, the digital camera is an area array industrial camera or a line array industrial camera, the pixel specifications of the digital camera are adapted to industrial inspection requirements, the focal length of the digital camera lens is matched and designed according to a preset working distance, the digital camera works at the preset working distance, the digital camera's acquisition angle covers the entire area of the heat transfer finished product to be inspected, and a diffuse reflection light source is set between the digital camera and the finished product to be inspected, the color temperature of the diffuse reflection light source is within a preset color temperature range.
[0009] The present invention is further configured such that, in step S2, the variance of the pixel brightness distribution is calculated within a neighborhood window of a preset size; the Gaussian filter uses a Gaussian convolution kernel of an adapted size, and the parameters of the Gaussian convolution kernel are determined according to a preset standard deviation; the preset variance threshold is determined according to the mean variance under normal lighting conditions in the historical sample library.
[0010] The present invention is further configured such that, in step S3, the edge detection algorithm uses the Sobel operator or the Cannibal operator to calculate the gradient components of each pixel in the horizontal and vertical directions in the denoised image, determine the gradient magnitude, and mark the pixels with gradient magnitudes exceeding a preset magnitude threshold as edge candidate points, and remove nonlocal maximum edge points through nonmaximum suppression processing.
[0011] The present invention is further configured such that in the color difference distribution analysis in step S4, the difference between the average color value of all pixels within each potential contour and the average color value of pixels in the adjacent area outside the contour is calculated. When the difference is greater than the preset color difference threshold, the pixels within the corresponding contour are marked as internal pixels of the pattern.
[0012] The present invention is further configured such that in step S5, the local entropy value calculation is based on the Shannon information entropy principle, and the uncertainty of the gray-scale distribution is statistically analyzed within a pixel neighborhood of a preset size; the mask boundary expansion adopts a morphological dilation operation, and the dilation structural element is a circular structural element with a preset radius. The expanded mask boundary is smoothed by Gaussian smoothing.
[0013] The present invention is further configured such that in step S6, if the proportion of pixels in the main body area is lower than the preset proportion, then return to step S5 for secondary mask expansion.
[0014] The present invention is further configured such that in step S7, the boundary refinement adopts a watershed algorithm; the defect features include pattern break points and edge blur points. The pattern break points are detected by the Hough transform, and the edge blur points are detected by the Laplacian operator. The quality inspection result determination criterion is as follows: It is determined as unqualified when the number of pattern break points exceeds the preset number or the number of edge blur points exceeds the preset number; It is determined that manual re-inspection is required when the number of pattern break points and the number of edge blur points are within the preset number range; It is determined as qualified when the number of pattern break points is zero and the number of edge blur points is zero.
[0015] The present invention is further configured to further include step S8: output the quality inspection result to the production line management system in the form of structured data. The output data includes the number of the heat transfer finished product, the detection timestamp, the pixel coordinates of the pattern area, the quality determination level, and the list of defect types.
[0016] An on-line visual inspection system for the quality of heat transfer finished products based on industrial vision, comprising: An initial image matrix acquisition module: collecting the original image of the heat transfer finished product through a digital camera, obtaining pixel data including the pattern and the background from the fabric surface, and obtaining an initial image matrix; A denoising processing module: calculating the variance of the pixel brightness distribution according to the initial image matrix. If the variance exceeds the preset variance threshold, Gaussian filtering is applied to remove the noise caused by the illumination change, and a denoised image is obtained; A main body area contour extraction module: processing the denoised image by using an edge detection algorithm, extracting the gradient change features at the pattern boundary, and determining the potential main body area contour; Preliminary pattern mask generation module: By analyzing the color difference distribution of the potential subject region contour, pixels with higher color differences within the contour than outside the contour are marked as pixels inside the pattern, thus obtaining a preliminary separated pattern mask; Pattern mask optimization module: Obtain the local entropy value of the edge blur risk region in the initially separated pattern mask. If the local entropy value is lower than the preset entropy threshold, expand the mask boundary to encompass the blurry edge to obtain an optimized pattern mask. Complete pattern region separation module: Based on the optimized pattern mask superimposed on the denoised image, the main region pixels are separated, and it is determined whether the proportion of the separated main region pixels reaches a preset ratio to obtain the complete pattern region. Quality inspection and judgment module: refines the boundaries of the complete pattern area, extracts defect features from the complete pattern area, and determines the quality inspection result based on the number of defect features.
[0017] The beneficial effects of this invention are as follows: First, it adopts a multi-level image processing strategy, triggering Gaussian filtering for noise reduction through brightness variance analysis, effectively eliminating image noise interference caused by changes in illumination; second, through a dual verification mechanism combining color difference distribution analysis and local entropy analysis, it can adapt to various fabric color and texture features, effectively solving the problem of separating heat transfer patterns on complex backgrounds such as dark fabrics, complex textures, and color gradients, and significantly improving the accuracy of extracting the main area of the pattern.
[0018] Secondly, by extracting gradient change features through the Sobel edge detection algorithm and combining morphological dilation operation to expand the mask boundary to encompass blurred edges, it effectively addresses the edge features of blurred or discontinuous pattern outlines under different lighting conditions. The boundary recognition accuracy reaches the preset accuracy level, solving the technical problem that traditional methods are difficult to accurately extract the complete boundary of a pattern.
[0019] Third, through the dual verification mechanism of color difference distribution analysis and local entropy value analysis, the pattern separation accuracy is significantly improved, and the misjudgment rate is controlled within the preset low level range; the whole process is automated, and the time consumption for single heat transfer finished product inspection meets the real-time requirements, meeting the real-time inspection needs of large-scale industrial production lines and significantly reducing the workload of manual re-inspection.
[0020] Fourth, the watershed algorithm is used to refine boundary details, and the Hough transform is used to detect break points and the Laplacian operator is used to evaluate ambiguity. This enables accurate identification of various defect types such as pattern breakage, edge blurring, and pattern missingness. The defect detection rate reaches the preset detection rate requirement, providing reliable technical support for the quality control of heat transfer printing products. Attached Figure Description
[0021] The invention will be further illustrated with reference to the accompanying drawings, but the embodiments in the drawings do not constitute any limitation on the invention. For those skilled in the art, other drawings can be obtained based on the following drawings without any creative effort.
[0022] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0023] The present invention will be further described in conjunction with the following embodiments.
[0024] Example 1, by Figure 1 As can be seen, the online visual inspection method for heat transfer printing quality based on industrial vision described in this embodiment; in step S1, an initial image matrix is acquired; specifically, the original image of the heat transfer printing product is acquired by an area array industrial camera; the pixel specifications of the area array industrial camera are adapted and selected according to industrial inspection requirements, typically using an industrial-grade sensor in the range of 1296×966 to 2448×2048 pixels; the lens focal length is matched and designed according to the preset working distance to ensure that when the camera works at the predetermined acquisition distance, the acquisition angle can completely cover the entire area of the heat transfer printing product to be inspected; the camera and the product to be inspected... Diffuse light sources are placed between the fabric elements, with the color temperature of the diffuse light sources within a preset range, typically between 5000K and 6500K, a neutral daylight color temperature range, to effectively eliminate the impact of specular reflection on image acquisition. During image acquisition, the digital camera obtains pixel data containing patterns and backgrounds from the fabric surface. The pixel data is stored and transmitted in the form of a two-dimensional array, forming an initial image matrix. The dimension of this initial image matrix matches the resolution of the camera sensor, and each pixel location stores the corresponding color channel value, typically represented using an RGB three-channel color space or a grayscale space.
[0025] In step S2, denoising is performed based on the initial image matrix. First, the variance of the pixel brightness distribution is calculated within a neighborhood window of a preset size. The size of the neighborhood window is adapted to the image resolution, typically a square neighborhood window ranging from 3×3 to 7×7 pixels. Let the pixel brightness value within the neighborhood window be... The number of pixels in the neighborhood window is The average pixel brightness within the neighborhood window is Then the formula for calculating variance is: The neighborhood window for variance calculation uses a preset size, and the preset threshold is determined based on the mean variance under normal lighting conditions in the historical sample database. If the calculated variance exceeds the preset threshold, it indicates that the current image is affected by noise interference caused by changes in lighting, requiring denoising processing. Denoising is performed using Gaussian filtering, employing a Gaussian convolution kernel of an adapted size. The kernel parameters are determined based on the preset standard deviation. The standard deviation typically ranges from 0.5 to 2.0 pixels, and the kernel size and standard deviation satisfy a certain relationship. The relationship is as follows: Gaussian filtering performs convolution operations on the image, replacing the value of each pixel with the weighted average of the values of pixels in its neighborhood. The weights are determined by the spatial distance of the Gaussian function, thereby effectively eliminating noise caused by changes in illumination and obtaining a denoised image.
[0026] In step S3, an edge detection algorithm is used to process the denoised image, extracting gradient change features at the pattern boundaries to determine the contours of potential subject regions. The edge detection algorithm employs a Sobel operator-based edge detection method. The Sobel operator contains two 3×3 convolutional templates in the horizontal and vertical directions, respectively used to calculate the gradient components of the image in the horizontal and vertical directions. For each pixel in the denoised image... Horizontal gradient The vertical gradient is obtained by performing a convolution operation between the horizontal convolution template and the pixel neighborhood. It is obtained by performing a convolution operation between a vertical convolution template and the pixel neighborhood. The formula for calculating the gradient magnitude is: ;in The gradient is in the horizontal direction. The gradient is in the vertical direction; for each pixel, its gradient magnitude is calculated. When the gradient magnitude exceeds a preset magnitude threshold, the pixel is marked as an edge candidate point. The preset magnitude threshold is adaptively adjusted according to the image contrast and noise level, and is usually set to a certain quantile of the gradient magnitude statistical distribution. After the edge candidate points are marked, non-local maximum edge points are removed by non-maximum suppression to ensure the accuracy of edge localization. The principle of non-maximum suppression is to interpolate and compare the gradient magnitude in the gradient direction, and only retain the pixel with the local maximum gradient magnitude as the final edge point, thereby achieving edge refinement.
[0027] In step S4, a preliminary pattern mask is generated by analyzing the color difference distribution of the potential subject region contours; the color difference distribution analysis is performed for each potential contour; for a given potential contour, the average color value of all pixels within the contour and the average color value of pixels in the adjacent region outside the contour are calculated respectively; let the average color value of the pixels within the contour be... The average color value of the pixels in the immediate vicinity outside the outline is Color difference value Calculated using the following formula: When color difference value When the color difference exceeds a preset threshold, the pixels within the corresponding outline are marked as internal pixels of the pattern. The preset color difference threshold needs to take into account the color contrast difference between the heat transfer material and the fabric material, and is usually determined based on the statistical distribution of color differences between the pattern area and the background area in the historical sample library. For outlines that meet the color difference conditions, all pixels inside them are marked as internal pixels of the pattern, thus forming a preliminary separated pattern mask. This pattern mask is represented in the form of a binary image, with internal pixels of the pattern marked as white or with a value of 1, and background pixels marked as black or with a value of 0.
[0028] In step S5, the local entropy value of the edge blurring risk region in the initially separated pattern mask is obtained. If the local entropy value is lower than a preset threshold, the mask boundary is expanded to encompass the blurred edges, resulting in an optimized pattern mask. The calculation of the local entropy value is based on the Shannon information entropy principle. The uncertainty of gray-level distribution is statistically analyzed within a pixel neighborhood of a preset size, typically a square neighborhood ranging from 5×5 to 11×11 pixels. It is assumed that the number of gray levels of pixels within the neighborhood is... species, first The probability of a gray level appearing is Then the local entropy value The calculation formula is: The number of gray levels in the neighborhood is determined based on the image bit depth. For an 8-bit grayscale image, the number of gray levels is 256. The identification criterion for edge blur risk areas is that the local entropy value is lower than a preset entropy threshold. When an edge blur risk area is detected, it indicates that there may be blurred edges or discontinuous edges in the area, and the mask boundary needs to be expanded. The specific method for expanding the mask boundary is as follows: for pixel positions where the local entropy value is lower than the preset entropy threshold, the mask boundary is expanded outward from this position as the center. The expansion range is set to a preset number of pixels, usually 2 to 5 pixel units. Morphological dilation is used during the expansion process. The dilation structuring element is a circular structuring element with a preset radius. The radius of the circular structuring element is set according to the required expansion range. The expanded mask boundary is smoothed by Gaussian smoothing. The Gaussian smoothing kernel uses a preset size, usually matching the expansion range, to eliminate the edge jaggedness effect and ensure a natural transition of the edges.
[0029] In step S6, the main body region pixels are separated based on the optimized pattern mask superimposed on the denoised image. It is then determined whether the proportion of separated main body region pixels reaches a preset ratio to obtain the complete pattern region. The calculation method for the proportion of main body region pixels is as follows: count the number of pixels marked as inside the pattern in the optimized pattern mask, and calculate the ratio of this number to the total number of pixels in the denoised image to obtain the proportion of main body region pixels. Let the number of pixels inside the pattern be... The total number of pixels in the denoised image is Pixel ratio of the main area The calculation formula is: When the proportion is not lower than the preset ratio, it is determined that a complete pattern area has been obtained. The value of the preset ratio is determined based on the statistical distribution of the pattern area proportion of the finished heat transfer product, and is usually set between 5% and 30%. When the proportion is lower than the preset ratio, return to step 5 for secondary mask expansion, that is, continue to expand the mask boundary outward on the basis of the original expansion, recalculate the local entropy value and perform morphological dilation processing until the pixel proportion of the main area meets the preset ratio requirement, or reaches the preset maximum number of expansion iterations.
[0030] In step S7, an image segmentation algorithm is used to refine the boundary details of the complete pattern region. Defect features such as breaks or blurry points are extracted from the complete pattern region, and the number of defect features is determined to confirm the quality detection result. The image segmentation algorithm uses the watershed algorithm to refine the boundary of the complete pattern region to eliminate the jagged edge effect. The basic principle of the watershed algorithm is to treat the image as a terrain surface, with gray values corresponding to altitude. The watershed boundary is determined by simulating the immersion process, thus achieving accurate segmentation of the overlapping area. During the boundary refinement process, the watershed algorithm can identify and eliminate boundary burrs caused by noise or edge detection errors, resulting in a smooth and accurate pattern region boundary. The pattern break point detection uses Hough transform to detect pattern edges. The continuity of straight line segments at the edge is determined by the Hough transform, which maps straight lines in the image space to the parameter space and performs voting statistics to detect the endpoint positions of straight line segments at the edge of the pattern. When the endpoints of the detected straight line segments deviate significantly from the expected continuous edge, they are identified as pattern breakpoints. When the number of breakpoints exceeds a preset number, it indicates that there is a significant break defect in the pattern. The preset number is usually set to 1 to 3, and can be adjusted according to the complexity of the pattern and quality requirements. Edge blur point detection uses the Laplacian operator to calculate the edge blur of the pattern region. The Laplacian operator is a second-derivative operator. For regions with smooth gray-level changes, the Laplacian operator response is close to zero. For edge regions with drastic gray-level changes, the Laplacian operator response is absolute. The value is relatively large; by calculating the statistical distribution of the Laplacian operator response within the pattern area, when the standard deviation of the response value is lower than the preset fuzziness threshold, the area is determined to be an edge fuzzy point; when the number of edge fuzzy points exceeds the preset number, it indicates that there is a fuzzy defect at the edge of the pattern; the criteria for judging the number of defect features are as follows: when the number of break points exceeds the preset number or the number of edge fuzzy points exceeds the preset number, the quality inspection result is judged to be unqualified; when the number of break points and the number of fuzzy points are within the preset number range, the quality inspection result is judged to require manual re-inspection; when the number of pattern break points is zero and the number of edge fuzzy points is zero, the quality inspection result is judged to be qualified; the inspection result output module outputs the quality inspection result in the form of structured data to the production line. Production line management system; output data includes heat transfer finished product number, inspection timestamp, pattern area pixel coordinates, quality judgment level, and defect type list; the heat transfer finished product number is used to uniquely identify the inspected heat transfer finished product and is associated with the workpiece flow information on the production line; the inspection timestamp records the execution time of this inspection, accurate to the millisecond level; the pattern area pixel coordinates record the position information of the complete pattern area in the initial image matrix, represented in the form of the upper left and lower right corner pixel coordinates; the quality judgment level adopts a preset grading standard, usually divided into three levels: qualified, unqualified, and requiring manual re-inspection; the defect type list records various defect characteristics detected, including the location coordinates of the break point and the area range of the blurred point;The data transmission protocol employs a real-time database write protocol, with the transmission frequency adapted to preset real-time requirements, typically set to a write frequency of 10 to 100 times per second to meet the real-time detection needs of large-scale industrial production lines.
[0031] The method of the present invention will be further explained below with reference to specific application examples.
[0032] On the heat transfer printing inspection production line of a garment manufacturing company, the finished heat transfer prints to be inspected are cotton T-shirts printed with cartoon patterns. The pattern color is light blue, and the fabric background is dark gray with obvious woven texture characteristics. The production line is equipped with an online inspection system including an area array industrial camera, a diffuse light source, and an image processing industrial control computer. The area array industrial camera has a 1.3-megapixel sensor, a 1 / 2-inch sensor size, a 12mm lens focal length, and a working distance of 500mm. The acquisition angle covers the chest pattern area of the T-shirt to be inspected, and the diffuse light source color temperature is set to 5600K. After the inspection process starts, the area array industrial camera acquires images of the finished heat transfer print under the action of a preset trigger signal. During the image acquisition process, the diffuse light source provides uniform illumination to the surface of the T-shirt, eliminating the influence of specular reflection on image quality. The camera transmits the acquired raw image to the image processing industrial control computer in RGB three-channel color space, with each color channel having a pixel value range of 0 to 255. The original image has a resolution of 1280×960 pixels and is stored in the industrial control computer's memory as a two-dimensional array, forming an initial image matrix. In the denoising stage, the image processing industrial control computer calculates the variance of the brightness channel in the initial image matrix. The neighborhood window size for variance calculation is set to 5×5 pixels, and the brightness variance within the neighborhood window is calculated for each pixel position in the image. The system determines a preset variance threshold of 150 based on a historical sample database. When the variance calculation result of a pixel's neighborhood window exceeds 150, it is determined that the area is affected by lighting changes and requires Gaussian filtering for denoising. The standard deviation of the Gaussian filter is set to 1.2 pixels, and the convolution kernel size is 7×7 pixels. Through Gaussian filtering, noise interference caused by shadow changes due to uneven fabric surfaces and fluctuations in light source brightness is effectively eliminated, resulting in a denoised image. The edge detection stage uses an edge detection method based on the Sobel operator. For each pixel in the denoised image, its gradient components in the horizontal and vertical directions are calculated. and Then calculate the gradient magnitude. The preset amplitude threshold, set to 80, takes into account the edge contrast between the cartoon pattern and the dark gray fabric. Pixels with a gradient amplitude greater than 80 are marked as edge candidates. Non-maximum suppression (NMS) is then performed to refine these candidate edges, retaining only pixels with local maximum gradient values as the final edge points. After edge detection, the system identifies the outline of the cartoon pattern and the edge features generated by the fabric weave texture. The continuity of the cartoon pattern's outline edge is significantly better than that of the fabric texture edge. The color difference distribution analysis stage calculates the average RGB color value of the pixels within the cartoon pattern outline, resulting in a light blue hue. Calculate the average RGB color value of the pixels in the immediate vicinity of the outline; the resulting average color value is a dark gray tone. The color difference value is 90, which is much greater than the preset color difference threshold of 50. Therefore, the pixels inside this contour are marked as internal pattern pixels. For edge contours generated by fabric textures, since the difference between their internal and external colors is small, they are judged as non-pattern contours and excluded. Through color difference distribution analysis, the system forms a preliminary pattern mask, accurately identifying the location distribution of cartoon patterns in the image. The local entropy calculation stage analyzes each region in the preliminary pattern mask. In detailed areas such as the eyes and mouth of the cartoon pattern, due to the uniform color and concentrated grayscale distribution, the local entropy value is low, below the preset entropy threshold of 2.0, indicating that these areas belong to the edge blurring risk areas and require expansion of the mask boundary to encompass possible blurred edges. The system expands the mask boundary outward from these low-entropy areas, with an expansion range set to 3 pixels. The expansion process uses a morphological dilation operation, with the radius of the circular structuring element set to 3 pixels. The expanded mask boundary is smoothed using Gaussian smoothing, with the Gaussian smoothing kernel size set to 5×5 pixels. After mask boundary expansion, the optimized pattern mask can fully encompass all details of the cartoon pattern, including color gradient areas and blurred edge areas. In the main area pixel percentage calculation stage, the number of pixels marked as inside the pattern in the optimized pattern mask is counted, resulting in 45,678 pixels inside the pattern. The total number of pixels in the denoised image is 1280×960, equal to 1,228,800, and the calculated main area pixel percentage is 3.72%. The preset percentage is 3.0%, and since 3.72% is greater than 3.0%, it is determined to be a complete pattern area. The complete pattern area is obtained by superimposing the optimized pattern mask and the denoised image, effectively distinguishing the pattern area pixels from the background area pixels. In the quality detection stage, the watershed algorithm is used to refine the boundary of the complete pattern area. The watershed algorithm identifies the watershed boundary between the cartoon pattern area and the background area and refines the boundary to a single pixel width, effectively eliminating the jagged edge effect. The breakpoint detection uses Hough transform to analyze the continuity of straight line segments along the cartoon pattern's edge. A breakpoint was detected in the left ear area of the pattern, causing discontinuity in the straight line segments. The edge blur point detection uses the Laplacian operator to calculate the edge blur of the pattern area. The standard deviation of the Laplacian operator response in the lower right corner of the pattern is lower than the preset blur threshold of 0.15, thus this area is identified as an edge blur point. Based on the defect feature quantity judgment criteria, the number of breakpoints and edge blur points is 1, both within the preset range of 0 to 1. Therefore, the quality inspection result is determined to require manual re-inspection. The system outputs the inspection results to the production line management system in structured data format, including the finished heat transfer product number, inspection timestamp, pixel coordinates of the pattern area, quality judgment level, and a list of defect types. The data is transmitted to the production line management system via a real-time database write protocol, with a write frequency set to 50 times per second.In another application example, the to-be-inspected heat transfer printing finished product is a sportswear made of chemical fiber fabric with a brand logo printed on it. The pattern color is white, the fabric background is black and the surface is smooth. The configuration of the detection system is the same as that in the previous example, but the color temperature of the diffuse reflection light source is adjusted to 6000K to better adapt to the characteristics of the black fabric. During the image acquisition process, due to the smooth and dark color of the fabric surface, the risk of specular reflection is relatively high. The configuration of the diffuse reflection light source effectively eliminates the interference of specular reflection on image acquisition. In the denoising processing stage, the image variance is detected to be 120, which is lower than the preset variance threshold of 150. It is determined that the image noise level is within the acceptable range, and the Gaussian filtering process is skipped and directly enters the edge detection stage. In the edge detection stage, due to the strong contrast between the white pattern and the black background, the calculation result of the gradient magnitude is significant, and the Sobel operator successfully identifies a clear pattern contour. In the color difference distribution analysis stage, the color difference value between the white pattern area and the black background area reaches 240, which is much larger than the preset color difference threshold, and the pattern mask is generated accurately. In the local entropy value calculation stage, the gray level distribution in the white pattern area is relatively concentrated, and the overall local entropy value is low. The system automatically performs mask boundary expansion processing to accommodate edge details. The calculation result of the pixel proportion of the main area is 2.8%, which is lower than the preset proportion of 3.0%. The system returns to the local entropy value calculation stage for secondary mask expansion. After the secondary expansion, the proportion reaches 3.2%, meeting the preset proportion requirement. In the quality inspection determination stage, no pattern break points and edge blur points are detected, and it is determined that the quality inspection result is qualified. The detection result is successfully output to the production line management system for guiding subsequent finished product sorting and packaging processes.
[0033] Example 2: To provide a more comprehensive explanation of the technical solution of the present invention, an alternative technical solution is described below. In the image acquisition stage of step 1, the alternative technical solution uses a line-scan industrial camera instead of an area-scan industrial camera for image acquisition. The working principle of a line-scan industrial camera is to acquire images by scanning line by line using a linear sensor, which is suitable for continuous motion production line scenarios. The sensor resolution of a line-scan camera is typically 2048 to 8192 pixels, and the number of scan lines is dynamically adjusted according to the movement speed and exposure time. In the application of heat transfer printing product inspection, the heat transfer printing products to be inspected are conveyed forward at a constant speed via a conveyor belt. The line-scan camera is installed above the conveyor belt and scans the surface of the heat transfer printing product line by line. The line frequency of the line-scan camera is set to 1000 to 5000 lines per second, and the acquisition angle is focused through the optical lens of the line-scan camera to ensure that the entire area of the heat transfer printing product can be completely covered during the movement of the conveyor belt. The image data acquired by the line-scan camera is buffered and processed in line units, ultimately forming an initial image matrix equivalent to an area-scan image. The advantages of the line-scan camera solution are fast scanning speed and high image resolution, making it suitable for high-speed motion production line scenarios. In step 3, the edge detection process uses an alternative approach based on the Cannibal operator to replace the Sobel operator-based edge detection method. The Cannibal operator's edge detection process includes four steps: Gaussian smoothing filtering for noise reduction, gradient magnitude and direction calculation, non-maximum suppression, and dual-threshold edge connection. The Gaussian smoothing filter uses a Gaussian convolution kernel with a standard deviation of 1.0 and a kernel size of 5×5 pixels, effectively suppressing image noise. The dual-threshold processing sets a high threshold of 100 and a low threshold of 50. Pixels with gradient magnitudes higher than the high threshold are directly identified as strong edge pixels, while pixels with gradient magnitudes between the high and low thresholds are identified as weak edge pixels. When a weak edge pixel is connected to a strong edge pixel, the weak edge pixel is retained; otherwise, it is discarded. Through dual-threshold edge connection processing, the Cannibal operator can effectively detect complete pattern contours while suppressing false edges generated by fabric textures. In step 5, the mask optimization process uses a region growing method to replace the local entropy-based mask expansion method. Region growing methods start from the boundary pixels of the initial pattern mask and expand outwards to surrounding pixels according to preset growth criteria. These criteria include two aspects: color similarity and spatial continuity. The color similarity criterion requires that the difference between the color value of the pixel to be grown and the average color value of the grown region is less than a preset color similarity threshold, typically set to 15 to 30 color units. The spatial continuity criterion requires that there be a spatial adjacency between the pixel to be grown and the grown region, usually using 4-neighborhood or 8-neighborhood connections. The region growing process iterates until no pixel meets the growth criteria. Region growing methods can adaptively expand the mask according to the color distribution characteristics of the pattern, without requiring preset criteria for identifying areas with blurred edges.In step 7, the defect detection stage, an alternative technical solution employs a deep learning-based defect detection method instead of the traditional method based on Hough transform and Laplacian operator. The deep learning defect detection method uses a convolutional neural network (CNN) to extract features and classify defects in the pattern region. The CNN consists of two parts: a feature extraction network and a classification network. The feature extraction network uses multi-layer convolutional and pooling structures to progressively extract local and global features of the pattern region. The classification network determines the defect type based on the extracted features and outputs a probability distribution of the defect category. Before deployment, the CNN requires extensive training with labeled samples, including both qualified samples and unqualified samples containing various defects. Through supervised learning training, the CNN can learn the feature representations of different defect types in the image, thereby achieving automatic identification of various defect types such as breaks, blurring, and missing parts. The defect detection rate of deep learning methods is generally higher than that of traditional methods, but it has high requirements for the quantity and quality of training samples.
[0034] Example 3: This example provides an online visual inspection system for heat transfer printing finished product quality based on industrial vision, including: Initial image matrix acquisition module: Acquires the original image of the heat transfer finished product through a digital camera, obtains pixel data containing the pattern and background from the fabric surface, and obtains the initial image matrix; Denoising module: Calculates the variance of pixel brightness distribution based on the initial image matrix. If the variance exceeds a preset variance threshold, Gaussian filtering is applied to remove noise caused by illumination changes, resulting in a denoised image. Main body region contour extraction module: The denoised image is processed using an edge detection algorithm to extract gradient change features at the pattern boundary and determine the potential main body region contour; Preliminary pattern mask generation module: By analyzing the color difference distribution of the potential subject region contour, pixels with higher color differences within the contour than outside the contour are marked as pixels inside the pattern, thus obtaining a preliminary separated pattern mask; Pattern mask optimization module: Obtain the local entropy value of the edge blur risk region in the initially separated pattern mask. If the local entropy value is lower than the preset entropy threshold, expand the mask boundary to encompass the blurry edge to obtain an optimized pattern mask. Complete pattern region separation module: Based on the optimized pattern mask superimposed on the denoised image, the main region pixels are separated, and it is determined whether the proportion of the separated main region pixels reaches a preset ratio to obtain the complete pattern region. Quality inspection and judgment module: refines the boundaries of the complete pattern area, extracts defect features from the complete pattern area, and determines the quality inspection result based on the number of defect features.
[0035] Finally, 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 the scope of protection of the present invention. 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 essence and scope of the technical solutions of the present invention.
Claims
1. An online visual inspection method for heat transfer printing finished product quality based on industrial vision, characterized in that: Includes the following steps: S1. Acquire the original image of the heat transfer finished product using a digital camera, obtain pixel data containing the pattern and background from the fabric surface, and obtain the initial image matrix; S2. Calculate the variance of pixel brightness distribution based on the initial image matrix. If the variance exceeds a preset variance threshold, apply Gaussian filtering to remove noise caused by illumination changes and obtain a denoised image. S3. The denoised image is processed using an edge detection algorithm to extract gradient change features at the pattern boundary and determine the outline of the potential subject region. S4. Analyze the color difference distribution through the outline of the potential main body region, and mark the pixels with higher color differences inside the outline than outside the outline as pixels inside the pattern to obtain the preliminary separated pattern mask. S5. Obtain the local entropy value of the edge blur risk region in the initially separated pattern mask. If the local entropy value is lower than the preset entropy threshold, expand the mask boundary to encompass the blurry edge and obtain the optimized pattern mask. S6. Based on the optimized pattern mask superimposed on the denoised image, the main region pixels are separated, and it is determined whether the proportion of the separated main region pixels reaches a preset ratio to obtain the complete pattern region. S7. Perform boundary refinement processing on the complete pattern area, extract defect features from the complete pattern area, and determine the quality inspection result based on the number of defect features.
2. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: In step S1, the digital camera is either an area scan industrial camera or a line scan industrial camera. The pixel specifications of the digital camera are adapted to the industrial inspection requirements. The focal length of the digital camera lens is designed to match the preset working distance. The digital camera works at the preset working distance. The digital camera's field of view covers the entire area of the heat transfer printing product to be inspected. A diffuse reflection light source is set between the digital camera and the product to be inspected. The color temperature of the diffuse reflection light source is within the preset color temperature range.
3. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: In step S2, the variance of pixel brightness distribution is calculated within a neighborhood window of a preset size; Gaussian filtering uses a Gaussian convolution kernel of an adapted size, and the parameters of the Gaussian convolution kernel are determined according to the preset standard deviation; the preset variance threshold is determined according to the mean variance under normal lighting conditions in the historical sample library.
4. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: In step S3, the edge detection algorithm uses the Sobel operator or the Cannibal operator to calculate the gradient components of each pixel in the horizontal and vertical directions in the denoised image, determine the gradient magnitude, and mark the pixels with gradient magnitudes exceeding the preset magnitude threshold as edge candidate points. Non-local maxima edge points are removed through non-maximum suppression processing.
5. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: In step S4, color difference distribution analysis involves calculating the difference between the average color value of all pixels within each potential contour and the average color value of pixels in the adjacent region outside the contour. When the difference is greater than a preset color difference threshold, the corresponding pixel within the contour is marked as a pixel inside the pattern.
6. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: In step S5, the local entropy calculation is based on the Shannon information entropy principle, which statistically analyzes the uncertainty of grayscale distribution within a pixel neighborhood of a preset size. The mask boundary expansion adopts a morphological dilation operation, with the dilation structuring element being a circular structuring element of a preset radius. The expanded mask boundary is then smoothed using Gaussian smoothing.
7. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: If the pixel ratio of the main area is lower than the preset ratio in step S6, return to step S5 for secondary mask expansion.
8. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: In step S7, the boundary refinement adopts the watershed algorithm; the defect features include pattern break points and edge blur points. The pattern break points are detected by the Hough transform, and the edge blur points are detected by the Laplacian operator; The quality inspection result judgment criterion is as follows: When the number of pattern break points exceeds the preset number or the number of edge blur points exceeds the preset number, it is judged as unqualified; When the number of pattern break points and the number of edge blur points are within the preset number range, it is judged that manual re-inspection is required; When the number of pattern break points is zero and the number of edge blur points is zero, it is judged as qualified.
9. The online visual inspection method for heat transfer printing finished product quality based on industrial vision according to claim 1, characterized in that: It further includes step S8: output the quality inspection result to the production line management system in the form of structured data. The output data includes the heat transfer finished product number, the detection timestamp, the pixel coordinates of the pattern area, the quality judgment level, and the list of defect types.
10. An online visual inspection system for heat transfer printing finished product quality based on industrial vision, characterized in that: It includes: Initial image matrix acquisition module: Collect the original image of the heat transfer finished product through a digital camera, obtain the pixel data including the pattern and the background from the fabric surface, and get the initial image matrix; Denoising processing module: Calculate the variance of the pixel brightness distribution according to the initial image matrix. If the variance exceeds the preset variance threshold, apply Gaussian filtering to remove the noise caused by the illumination change and obtain the denoised image; Main body area contour extraction module: Process the denoised image by using an edge detection algorithm, extract the gradient change features at the pattern boundary, and determine the potential main body area contour; Preliminary pattern mask generation module: Analyze the color difference distribution through the potential main body area contour, mark the pixels with higher color difference inside the contour than outside as the internal pixels of the pattern, and obtain the preliminarily separated pattern mask; Pattern mask optimization module: Obtain the local entropy value of the edge blur risk area in the preliminarily separated pattern mask. If the local entropy value is lower than the preset entropy threshold, expand the mask boundary to include the blurred edge and obtain the optimized pattern mask; Complete pattern area separation module: Separate the main body area pixels according to the optimized pattern mask superimposed on the denoised image, and judge whether the proportion of the separated main body area pixels reaches the preset proportion to obtain the complete pattern area; Quality inspection judgment module: Perform boundary refinement processing on the complete pattern area, extract defect features from the complete pattern area, and determine the quality inspection result according to the number of the defect features.