A method for detecting the printing quality of a package printed matter
Patent Information
- Application Number
- CN202211200852.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-29
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2042-09-29
AI Technical Summary
[0006]本发明提供一种包装印刷品印刷质量检测方法,以解决现有多阈值分割时多次重复检测,检测效率低的问题
Smart Images

Figure CN115272343B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data recognition technology, and more specifically to a method for detecting the printing quality of packaging printed materials. Background Technology
[0002] Packaging serves to protect products, prevent counterfeiting, decorate and beautify products, and promote products. A good product is inseparable from packaging, which mainly includes elements such as trademarks or brands, shapes, colors, and patterns. These elements are all for the purpose of promoting the packaged goods. Therefore, it is necessary to inspect the trademarks or brands, shapes, colors, and patterns printed on the packaging to avoid affecting the promotion of the product.
[0003] Because various defects may occur on printed materials during the packaging printing process due to problems with the process or printing paperboard, such as ink spots, color differences, scratches, bubbles, and misalignment, there are many types of defects. The traditional quality inspection method, which mainly relies on manual sampling, has seriously restricted the improvement of enterprise competitiveness. Replacing manual labor with automated quality inspection equipment is an inevitable trend.
[0004] Existing artificial intelligence detection technologies mainly use threshold segmentation to detect and identify defects on printed materials. However, the types of defects in the current printing production process are complex, so the defect identification algorithm needs to set multiple thresholds. When using multi-threshold segmentation, it is necessary to predict the types of defects in advance. For printed materials, there are many processing procedures in the printing process, so many random defects will be generated in the production process. As a result, it is impossible to predict unknown defects, and therefore it is impossible to accurately detect defects, which makes it difficult to accurately identify the printing quality of printed materials.
[0005] Therefore, there is a need to provide a method for testing the printing quality of packaging printed materials to solve the above problems. Summary of the Invention
[0006] This invention provides a method for detecting the printing quality of packaging printed materials, in order to solve the problem of low detection efficiency caused by repeated detections in existing multi-threshold segmentation methods.
[0007] The present invention provides a method for detecting the printing quality of packaging printed materials, which adopts the following technical solution: Obtain the image to be inspected, the template image, and the corresponding grayscale image of the printed material; Obtain all connected components of the grayscale image corresponding to the image to be detected / template image. Use the centroid of the connected component in the grayscale image corresponding to the template image as the seed pixel projection point, and perform region growing on each connected component corresponding to the image to be detected / template image respectively. Obtain the coverage area and region growth time of each connected component when the growth of the stopped region is completed; obtain the area ratio of the coverage area of the connected components corresponding to the grayscale images of the image to be detected and the template image; obtain the time ratio of the region growth time of the connected components corresponding to the grayscale images of the image to be detected and the template image. The region growth result of the corresponding connected region is determined based on the area ratio, time ratio, preset area ratio threshold, and time ratio threshold of the connected region of the grayscale image to be detected. If the area growth result is no growth, the printed matter has a printing misalignment defect; if the area growth result is normal growth, the printed matter is acceptable; if the area growth result is overgrowth, the printed matter has a mutation defect. If the region growth result is premature cessation, the hole region on the grayscale image of the image to be detected is obtained. The difference value between the hole region and the corresponding connected region is obtained based on the grayscale value of the pixel in each hole region and the grayscale value of the pixel in the corresponding connected region of the hole region. The similarity between the hole region and its corresponding connected region is calculated based on the difference value and the grayscale variance of the pixel in the corresponding connected region in the grayscale image of the image to be detected. The hole region is judged as a mutation defect based on the number of connected regions connected by the hole region, the similarity, and the preset similarity threshold.
[0008] Preferably, the step of performing region growing on each connected component corresponding to the image to be detected / template image includes: The average gray value within each connected component of the image to be detected / template image is used as the gray value of the seed pixel when growing the region of the corresponding connected component. Obtain the position coordinates of each seed pixel in the template image; Based on the position coordinates of multiple seed pixels on the template pattern, seed pixels are projected at the same coordinate positions on the image to be detected. The gray level difference between the seed pixel and its neighboring pixels is obtained based on the seed pixel and its gray level value. Whether to perform region growing is determined based on the gray level difference and the preset threshold.
[0009] Preferably, the ratio of the coverage area of the connected components corresponding to the grayscale image of the image to be detected to the coverage area of the connected components corresponding to the grayscale image of the template image is used as the area ratio.
[0010] Preferably, the ratio of the region growth time of the connected component corresponding to the grayscale image of the image to be detected to the region growth time of the connected component corresponding to the grayscale image of the template image is used as the time ratio.
[0011] Preferably, the step of determining the region growing result of the corresponding connected component based on the area ratio, time ratio, preset area ratio threshold, and time ratio threshold of the connected component of the grayscale image to be detected includes: Set a first area ratio threshold, a second area ratio threshold, a first time ratio threshold, and a second time ratio threshold; When the area ratio is greater than the second area ratio threshold or the time ratio is greater than the second time ratio threshold, the region growth result of the connected component is overgrown. When the area ratio is equal to the second area ratio threshold or the time ratio is equal to the second time ratio threshold, the region growth result of the connected component is normal growth. When the area ratio is less than the second area ratio threshold and greater than the first area ratio threshold, or when the area ratio is less than the second time ratio threshold and greater than the first time ratio threshold, the region growth result of the connected component is to stop growing prematurely. When the area ratio is equal to the first area ratio threshold or the time ratio is equal to the first time ratio threshold, the region growth result of the connected component is no growth.
[0012] Preferably, the step of obtaining the difference between the hole region and its corresponding connected region based on the gray value of a pixel within each hole region and the gray value of a pixel within the connected region corresponding to the hole region includes: Obtain the average grayscale value of the remaining pixels in the connected component corresponding to the hole region, excluding the pixels within the hole region. The grayscale difference is obtained by subtracting the grayscale value of each pixel in the hole region from the mean grayscale value of the other pixels in its corresponding connected region. The target value is obtained by summing the squares of all grayscale differences. The difference between the hollow region and the corresponding connected region is obtained by averaging the target value.
[0013] Preferably, the step of calculating the similarity between the hole region and its corresponding connected region based on the difference value and the gray-level variance of the pixels in the corresponding connected region in the gray-level image of the image to be detected includes: Calculate the absolute value of the difference between the difference value and the gray-level variance of the corresponding pixels in the connected component of the gray-level image of the image to be detected; The similarity between the void region and its corresponding connected region is obtained by rounding down the absolute value of the difference and normalizing it.
[0014] Preferably, the step of determining whether a void region is a mutation defect based on the number and similarity of the connected components connected to the void region and a preset similarity threshold includes: Get the number of connected components connected to each hole region; If the number of connected components is greater than or equal to 2, then the void region is an abrupt defect; If the number of connected components is equal to 1, a similarity threshold is set. If the similarity between the hollow region and its corresponding connected component is greater than the similarity threshold, the hollow region is determined to be a normal region. If the similarity between the hollow region and its corresponding connected component is less than the similarity threshold, the hollow region is determined to be a mutation defect.
[0015] The beneficial effects of the packaging printing quality inspection method of the present invention are: 1. Since threshold segmentation segments defects based on grayscale, it cannot identify offset defects in printed materials. Therefore, this invention uses the centroid of the connected components on the template image as the projection point of the sub-pixel. Seed pixels are projected at corresponding positions in the template image and the image to be detected to perform region growth. Based on the coverage area and growth time during the region growth process, the growth result of the connected components of the image to be detected is determined. Based on the growth result, the printed materials are classified into normal printed materials, printed materials with printing offset defects, and printed materials with abrupt defects. This process does not require precise analysis of the type of each defect, thus achieving accurate identification of printed material quality.
[0016] 2. Further identification of printed materials with potential abrupt defects involves analyzing the differences in grayscale and structure between connected regions that prematurely cease growth and the void regions within them. This determines the similarity between the connected regions and the void regions, allowing for precise differentiation of void regions caused by subtle color differences within the connected regions. Consequently, void regions with abrupt defects within the void regions are accurately identified, improving the accuracy of defect identification and thus enhancing the accuracy of printed material quality inspection. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. 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.
[0018] Figure 1 This is a schematic diagram of an embodiment of a method for detecting the printing quality of packaging printed materials according to the present invention; Figure 2 This is a schematic diagram of the connected regions in a grayscale image, representing an embodiment of a method for detecting the printing quality of packaging printed materials according to the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] This invention provides an embodiment of a method for inspecting the printing quality of packaging printed materials. The application scenario of this embodiment is a product to be inspected with a relatively rich variety of defect types. Due to the richness of defect types, if not all defect types are obtained, it is difficult to accurately and reasonably set thresholds using traditional threshold segmentation methods. Therefore, the threshold segmentation results are also inaccurate. Specifically, for the packaging printed materials in this embodiment, the defects on the printed surface are quite complex, including scratches, dark and light inks, and printing misalignment. While these defects can be identified individually using threshold detection, the detection difficulty increases significantly when multiple defects such as scratches, ink, and bubbles coexist. This may even require multiple algorithms and thresholds for repeated detection, which undoubtedly greatly reduces the efficiency of intelligent inspection of printing quality. Therefore, this embodiment provides a method for... Figure 1 The method for inspecting the printing quality of printed materials shown includes the following steps: S1. Obtain the image to be inspected, the template image, and the corresponding grayscale image of the printed material.
[0021] Since printed products undergo different printing processes in different printing units, in this embodiment, an image acquisition device is set at the last printing unit of the gravure or flexographic printing machine. Specifically, this embodiment uses a high-speed line scan camera, an auxiliary light source, and an image acquisition and processing module to form an image acquisition device. When each printed product passes through the image acquisition device, the image to be inspected is acquired and grayscale processing is performed. Grayscale processing is to reduce the interference of redundant image information and facilitate the running speed of subsequent defect identification and analysis algorithms. At the same time, the template image of normal printed products is obtained from historical printing data, and the template image of the image to be inspected is grayscale processed, finally obtaining the grayscale images corresponding to the image to be inspected and the template image.
[0022] S2. Obtain all connected components of the grayscale image corresponding to the image to be detected / template image. Using the centroid of the connected component in the grayscale image corresponding to the template image as the seed pixel point, perform region growing on each connected component corresponding to the image to be detected / template image.
[0023] Since the template image for the same printed product is fixed, with only minor positional shifts, we first segment each independent connected region on the template image. An independent connected region is a unique shape on the template image that exists independently and has a uniform grayscale value. These can be easily segmented through manual labeling. For example, consider a type of printed product such as... Figure 2 As shown, it has N independent connected components, including the pure background region, which is also considered an independent connected component, so N=5.
[0024] Specifically, the steps for performing region growing on each connected component of the image to be detected / template image include: using the average gray value within each connected component of the image to be detected / template image as the gray value of the seed pixel during region growing; obtaining the position coordinates of each seed pixel on the template image; projecting seed pixels at the same coordinate positions on the image to be detected based on the position coordinates of multiple seed pixels on the template pattern; obtaining the gray level difference between the seed pixel and its neighboring pixels based on the gray value of the seed pixel; and determining whether to perform region growing based on the gray level difference and a preset threshold.
[0025] The region growing algorithm is an existing technology. Specifically, in this embodiment, the average gray value within each connected region is used as the gray value of the seed pixel for region growing. The centroid of the connected region of the template image is used as the projection point of the seed pixel of the corresponding connected region in the image to be detected and the template image. That is, multiple seed pixels obtained on the template pattern are projected onto the same coordinate position on the image to be detected. Thus, there are N seed pixels for N connected regions. Therefore, when performing region growing, the growth rule is set as follows: each seed pixel is compared with its 8 neighboring pixels. The preset threshold for the gray level difference is set to 10. When the gray value of the neighboring pixel is within 10 gray levels of the gray value of the seed pixel, the neighboring pixel is considered to be of the same type. The same type of pixel grows outward continuously according to the growth rule. Conversely, if the gray level difference is greater than 10, the growth stops. The region growing process is an existing technology and will not be described in detail in this embodiment.
[0026] S3. Obtain the coverage area and region growth time of each connected component when the region growth stops; obtain the area ratio of the coverage area of the connected components corresponding to the grayscale images of the image to be detected and the template image, and obtain the time ratio of the region growth time of the connected components corresponding to the grayscale images of the image to be detected and the template image; determine the region growth result of the corresponding connected component based on the area ratio, time ratio, preset area ratio threshold, and time ratio threshold of the connected components of the grayscale image to be detected. Given the shape and area of each connected region on the template image, theoretically, for a normal printed product without misalignment or defects, the coverage area of the seed pixel at the end of region growth should be infinitely close to the area of the connected region. Furthermore, the seed pixel is placed at the centroid of each connected region on the template image. Therefore, the region growth time of the seed pixel on each connected region on the template image can be recorded. Since region growth occurs simultaneously from the seed pixel to its 8-neighborhood, the centroid is theoretically the optimal placement point, meaning that the time required for the seed pixel to grow from this centroid to completion is the shortest.
[0027] After obtaining the region growth time and coverage area of each connected region in the template image, each seed pixel is placed into the image to be detected to obtain the region growth time and coverage area of each connected region in the image to be detected. If the coverage area can cover the entire image when the region growth of each connected region ends, then the image to be detected is an image without defective regions. If there are defective regions, several empty regions will be left, that is, the empty regions do not conform to any seed pixel growth rules.
[0028] Therefore, when the defect is unknown, it is necessary to determine the defect type. Defects, encompassing all types, can be categorized into displacement defects and abrupt defects. The former includes misalignment and omissions, while the latter includes ink spots, scratches, bubbles, etc. The former cannot be determined using thresholds, but the latter can. Therefore, an analysis-guided module is needed to use different detection methods for different printed materials. The steps for determining the region growing result of the corresponding connected components based on the area ratio, time ratio, preset area ratio threshold, and time ratio threshold of the connected components of the grayscale image to be detected include: The area ratio is defined as the ratio of the area covered by the connected components corresponding to the grayscale image of the target image to the area covered by the connected components corresponding to the grayscale image of the template image. The formula for calculating the area ratio is as follows: In the formula, Representing the The area that a seed pixel can cover on the image to be detected from its placement location to the end of the region growth process; Representing the The area covered by a seed pixel on the template image from its placement position to the end of the region growth is the area of the connected region corresponding to that seed pixel. Indicates the first The area ratio is the ratio of the area covered by each seed pixel in the image to be detected and the template image from the point of deployment to the end of the region growth. It should be noted that the coverage area reflects the difference between the coverage area of each connected component in the image to be detected and the coverage area of each connected component in the template image; specifically, a first area ratio threshold and a second area ratio threshold are set, wherein, in this embodiment, the first area ratio threshold is set to... The second area ratio threshold is 1, and the region growth results include four types: normal growth, no growth, overgrowth, and premature cessation of growth. Therefore, when the area ratio equals the second area ratio threshold, it indicates that the connected component of the image to be detected has the same area coverage as the connected component of the corresponding template image, which means there is no abnormality in the image to be detected. Thus, the region growth result of the connected component corresponding to the image to be detected is normal growth. When the area ratio is greater than the second area ratio threshold, it indicates that the area coverage of the connected component of the image to be detected during region growth is greater than the area coverage of the corresponding connected component during region growth in the template image. Thus, it is determined that the region growth result of the connected component of the image to be detected is overgrowth. When the area ratio is less than the second area ratio threshold but greater than the first area ratio threshold, the region growth result of the connected component is premature cessation of growth. When the area ratio is less than the first area ratio threshold or the time ratio is less than the first time ratio threshold, the region growth result of the connected component is no growth.
[0029] The ratio of the region growing time of the connected component corresponding to the grayscale image of the target image to the region growing time of the connected component corresponding to the grayscale image of the template image is used as the time ratio. The formula for calculating the time ratio is: In the formula, Representing the The region growth time of each seed pixel on the image to be detected, from the start of the projection position to the end of the region growth; Representing the The region growth time of each seed pixel on the template image from the start of the placement position to the end of the region growth; Indicates the first The ratio of the time taken for each seed pixel in the image to be detected and the template image from the start of the projection position to the end of the region growth, i.e., the time ratio; It should be noted that the time ratio reflects the growth rate. In this embodiment, the first time ratio threshold is set to... The second time ratio threshold is 1. When the time ratio equals the second time ratio threshold, it means that the growth rate of the connected component in the image to be detected is the same as that in the connected component of the corresponding template image. This indicates that there is no abnormality in the image to be detected, and the region growth result of the connected component corresponding to the image to be detected is normal growth. When the time ratio is greater than the second time ratio threshold, it means that the region growth time of the connected component in the image to be detected is greater than the region growth time of the corresponding connected component in the template image. This means that the seed pixel was not placed at the centroid of the connected component in the image to be detected when it was placed. This indicates that the printing pattern of the seed pixel placed here has a printing deviation defect, or the seed pixel has overgrown. Therefore, in this embodiment, this situation is defined as the region growth result of the connected component in the image to be detected being overgrown. When the time ratio is less than the second time ratio threshold but greater than the first time ratio threshold, the region growth result of the connected component is premature cessation of growth. When the time ratio is less than the first time ratio threshold or less than the first time ratio threshold, the region growth result of the connected component is no growth.
[0030] S4. If the area growth result is no growth, the printed matter has a printing misalignment defect; if the area growth result is normal growth, the printed matter is qualified; if the area growth result is overgrowth, the printed matter has a mutation defect. Since the region growing rule is idealized, but there are actually slight color differences within connected regions, these slight color differences can lead to empty regions. Therefore, when the region growing result indicates premature cessation of growth, it is necessary to analyze the empty regions to rule out the possibility that the empty regions caused by slight color differences within the connected regions are identified as abrupt defects. Thus, the empty regions on the grayscale image of the image to be detected are first obtained. The difference between the empty region and the corresponding connected region is obtained based on the grayscale value of the pixel in each empty region and the grayscale value of the pixel in the corresponding connected region of the empty region. The similarity between the empty region and its corresponding connected region is calculated based on the difference value and the grayscale variance of the pixel in the corresponding connected region in the grayscale image of the image to be detected. The number of connected regions connected to the empty region, the similarity, and the preset similarity threshold are used to determine whether the empty region is an abrupt defect.
[0031] Specifically, the steps for obtaining the difference between a hole region and its corresponding connected region based on the grayscale value of a pixel within each hole region and the grayscale value of a pixel within the connected region corresponding to the hole region include: obtaining the average grayscale value of the remaining pixels in the connected region corresponding to the hole region, excluding the pixels within the hole region; subtracting the grayscale value of each pixel within the hole region from the average grayscale value of the remaining pixels in its corresponding connected region to obtain the grayscale difference value; squaring all grayscale differences and summing them to obtain the target value; and averaging the target value to obtain the difference between the hole region and its corresponding connected region.
[0032] Specifically, the steps for calculating the similarity between a hole region and its corresponding connected region based on the difference value and the gray-level variance of pixels in the corresponding connected region of the gray-level image to be detected include: calculating the absolute value of the difference between the difference value and the gray-level variance of pixels in the corresponding connected region of the gray-level image to be detected; rounding down the absolute value of the difference and normalizing it to obtain the similarity between the hole region and its corresponding connected region, wherein the similarity calculation formula is: In the formula, Indicates the first The similarity between a hollow region and its corresponding connected region; This represents the difference between the void region and its corresponding connected component; Indicates the first The first connected component The total number of pixels in each hole region; Indicates the first The first connected component The first in the hollow region The grayscale value of each pixel; Indicates the first The average gray value of all pixels in a connected component, excluding pixels in the hole region of that connected component. Indicates the first The grayscale variance of pixels in a connected component; This represents an exponential function with base e; specifically, its purpose is to... The value ranges from 0 to 1; It should be noted that, The value of represents the pixel in the hole region and the th pixel. The difference in grayscale between pixels on a connected domain Further determining the relationship between pixels in the hole region and the first [unclear] at the structural level The smaller the difference between pixels in a connected region, the better. The closer the value is to 1.
[0033] Since the result of region growing is to surround the void region, and the void region is ultimately connected by several connected domains, in this embodiment, the number of connected domains connecting the void region is recorded. When the number of connected domains connecting the void region is greater than 1, it means that the void region is connected to at least two connected domains, and the void region is determined to be a mutation defect region. When the number of connected domains connecting the void region is 1, it means that the void region is only inside the connected domain. This indicates that the void region may be caused by a slight color difference inside the connected domain, or it may be caused by a defect. Therefore, it is necessary to judge based on the similarity between the void region and its corresponding connected domain and the similarity threshold.
[0034] Specifically, the steps in this embodiment for determining whether a hollow region is a mutation defect based on the number and similarity of the connected components connected to the hollow region and a preset similarity threshold include: obtaining the number of connected components connected to each hollow region; if the number of connected components is greater than or equal to 2, the hollow region is a mutation defect; if the number of connected components is equal to 1, a similarity threshold is set. In this embodiment, the similarity threshold is set to 0.95. When the similarity between the hollow region and its corresponding connected component is greater than the similarity threshold, the hollow region is determined to be a normal region. If the similarity between the hollow region and its corresponding connected component is less than the similarity threshold, the hollow region is determined to be a mutation defect.
[0035] This invention provides a method for inspecting the printing quality of packaging printed materials. Since threshold segmentation segments defects based on grayscale, it cannot identify offset defects in printed materials. Therefore, this invention uses the centroid of the connected components in the template image as the placement point for seed pixels. Seed pixels are placed at corresponding positions in the template image and the image to be inspected for region growth. Based on the coverage area and growth time during the region growth process, the growth result of the connected components in the image to be inspected is determined. Based on the growth result, the printed materials are classified into normal printed materials, printed materials with printing offset defects, and printed materials with abrupt defects. This process does not require precise analysis of each defect type, thus achieving high accuracy in identifying the printing quality. Further identification is then performed on printed materials that may have abrupt defects. This involves analyzing the differences in grayscale and structure between connected components whose region growth has stopped prematurely and the empty regions within them to determine the similarity between the connected components and the empty regions. Based on this similarity, the method accurately distinguishes empty regions caused by slight color differences within the connected components, and further accurately identifies empty regions with abrupt defects within the empty regions. This improves the defect identification accuracy and, consequently, the accuracy of printed material quality inspection.
[0036] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for inspecting the printing quality of packaging printed materials, characterized in that, The method includes: Obtain the image to be inspected, the template image, and the corresponding grayscale image of the printed material; Obtain all connected components of the grayscale image corresponding to the image to be detected / template image. Use the centroid of the connected component in the grayscale image corresponding to the template image as the seed pixel projection point, and perform region growing on each connected component corresponding to the image to be detected / template image respectively. Obtain the coverage area and region growth time of each connected component when the region growth stops; obtain the area ratio of the coverage area of the connected components corresponding to the grayscale images of the image to be detected and the template image; obtain the time ratio of the region growth time of the connected components corresponding to the grayscale images of the image to be detected and the template image. The region growth result of the corresponding connected region is determined based on the area ratio, time ratio, preset area ratio threshold, and time ratio threshold of the connected region of the grayscale image to be detected. If the area growth result is no growth, the printed matter has a printing misalignment defect; if the area growth result is normal growth, the printed matter is acceptable; if the area growth result is overgrowth, the printed matter has a mutation defect. If the region growth result is premature cessation, the hole region on the grayscale image of the image to be detected is obtained. The difference value between the hole region and the corresponding connected region is obtained based on the grayscale value of the pixel in each hole region and the grayscale value of the pixel in the corresponding connected region of the hole region. The similarity between the hole region and its corresponding connected region is calculated based on the difference value and the grayscale variance of the pixel in the corresponding connected region in the grayscale image of the image to be detected. The hole region is judged as a mutation defect based on the number of connected regions connected by the hole region, the similarity, and the preset similarity threshold.
2. The method for detecting the printing quality of packaging printed materials according to claim 1, characterized in that, The steps for performing region growing on each connected component corresponding to the image to be detected / template image include: The average gray value within each connected component of the image to be detected / template image is used as the gray value of the seed pixel when growing the region of the corresponding connected component. Obtain the position coordinates of each seed pixel in the template image; Based on the position coordinates of multiple seed pixels on the template pattern, seed pixels are projected at the same coordinate positions on the image to be detected. The gray level difference between the seed pixel and its neighboring pixels is obtained based on the seed pixel and its gray level value. Whether to perform region growing is determined based on the gray level difference and the preset threshold.
3. The method for detecting the printing quality of packaging printed materials according to claim 1, characterized in that, The ratio of the area covered by the connected components corresponding to the grayscale image of the image to be detected to the area covered by the connected components corresponding to the grayscale image of the template image is used as the area ratio.
4. The method for detecting the printing quality of packaging printed materials according to claim 1, characterized in that, The ratio of the region growth time of the connected component corresponding to the grayscale image of the image to be detected to the region growth time of the connected component corresponding to the grayscale image of the template image is used as the time ratio.
5. The method for detecting the printing quality of packaging printed materials according to claim 1, characterized in that, The steps for determining the region growing result of the corresponding connected components based on the area ratio, time ratio, preset area ratio threshold, and time ratio threshold of the connected components of the grayscale image to be detected include: Set a first area ratio threshold, a second area ratio threshold, a first time ratio threshold, and a second time ratio threshold; When the area ratio is greater than the second area ratio threshold or the time ratio is greater than the second time ratio threshold, the region growth result of the connected component is overgrown. When the area ratio is equal to the second area ratio threshold or the time ratio is equal to the second time ratio threshold, the region growth result of the connected component is normal growth. When the area ratio is less than the second area ratio threshold and greater than the first area ratio threshold, or when the area ratio is less than the second time ratio threshold and greater than the first time ratio threshold, the region growth result of the connected component is to stop growing prematurely. When the area ratio is equal to the first area ratio threshold or the time ratio is equal to the first time ratio threshold, the region growth result of the connected component is no growth.
6. The method for detecting the printing quality of packaging printed materials according to claim 1, characterized in that, The steps for obtaining the difference between a hole region and its corresponding connected region based on the grayscale value of a pixel within each hole region and the grayscale value of a pixel within the corresponding connected region of the hole region include: Obtain the average grayscale value of the remaining pixels in the connected region corresponding to the hole region, excluding the pixels within the hole region. The grayscale difference is obtained by subtracting the grayscale value of each pixel in the hole region from the mean grayscale value of the other pixels in its corresponding connected region. The target value is obtained by summing the squares of all grayscale differences. The difference between the hollow region and the corresponding connected region is obtained by averaging the target value.
7. The method for detecting the printing quality of packaging printed materials according to claim 1, characterized in that, The steps for calculating the similarity between a hole region and its corresponding connected region based on the difference value and the gray-level variance of pixels in the corresponding connected region of the gray-level image to be detected include: Calculate the absolute value of the difference between the difference value and the gray-level variance of the corresponding pixels in the connected component of the gray-level image of the image to be detected; The similarity between the hollow region and its corresponding connected region is obtained by rounding down the absolute value of the difference and normalizing it.
8. The method for detecting the printing quality of packaging printed materials according to claim 1, characterized in that, The steps for determining whether a void region is a mutation defect based on the number and similarity of connected components connected to the void region and a preset similarity threshold include: Get the number of connected components connected to each hole region; If the number of connected components is greater than or equal to 2, then the void region is an abrupt defect; If the number of connected components is equal to 1, a similarity threshold is set. If the similarity between the hollow region and its corresponding connected component is greater than the similarity threshold, the hollow region is determined to be a normal region. If the similarity between the hollow region and its corresponding connected component is less than the similarity threshold, the hollow region is determined to be a mutation defect.
Citation Information
Patent Citations
Method for identifying package printing quality in cosmetic production field and artificial intelligence system
CN114494265A