A method and system for detecting color difference of printed patterns on corrugated cardboard boxes
Through image segmentation and feature matching technology, combined with adaptive sampling and unsupervised learning, the problems of low chromatic aberration detection efficiency and high cost in corrugated carton printing are solved, and efficient and accurate chromatic aberration detection and printing parameter optimization are achieved.
Patent Information
- Application Number
- CN202411074310.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2044-08-07
AI Technical Summary
Color aberration problems often occur during the printing process of corrugated cartons. The existing technology relies on color aberration meters for testing, which is inefficient and costly, and is not suitable for large-scale promotion.
Image segmentation technology is used to classify the corrugated carton printing patterns through SVM algorithm, and large-area color blocks and complex patterns are processed respectively. The color difference detection is performed using an adaptive sampling density algorithm and SIFT feature matching algorithm, and the printing parameters are adaptively adjusted through an unsupervised algorithm.
It improves the efficiency and accuracy of color difference detection of corrugated carton printing patterns, reduces the detection cost, and is suitable for large-scale promotion.
Smart Images

Figure CN119048441B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image detection, and particularly to a method and system for detecting color difference of printed patterns on corrugated cartons. Background Art
[0002] During the printing process of corrugated cartons, color difference problems usually occur. This is because the absorbency, texture, and thickness of the paper itself may be uneven, which may lead to inconsistent ink distribution and thus cause color difference. In addition, printing pressure, ink volume control, printing speed, and environmental factors can all cause color difference. In order to ensure the printing quality of corrugated cartons, currently, a color difference meter is usually used to detect the color difference of printed products. A color difference meter is a precision instrument based on the CIE color space theory, which can accurately measure the color of printed products and quantify the difference from the standard color sample, usually represented by the ΔE value. However, this unified detection method is not only inefficient but also has a high equipment cost and is not suitable for large-scale promotion. Summary of the Invention
[0003] In order to solve at least one of the above-mentioned technical problems, the present invention provides a method and system for detecting color difference of printed patterns on corrugated cartons.
[0004] In a first aspect, the present invention provides a method for detecting color difference of printed patterns on corrugated cartons, the method comprising:
[0005] Performing image segmentation on the printed pattern of the corrugated carton to be measured, classifying the segmented images through the SVM algorithm to obtain a first image to be measured and a second image to be measured;
[0006] When detecting the color difference of the first image to be measured, obtaining the color uniformity of the first image to be measured and determining whether the color uniformity meets a preset condition;
[0007] If so, selecting a preset number of first sampling points on the first image to be measured and determining the pattern color difference according to the first sampling points and the standard template;
[0008] If not, partitioning and sampling on the first image to be measured according to the adaptive sampling density algorithm to obtain second sampling points, and determining the pattern color difference according to the second sampling points and the standard template;
[0009] When detecting the color difference of the second image to be measured, extracting SIFT features from the second image to be measured, and performing feature matching on the SIFT features and the standard template by using a feature point matching algorithm to determine the pattern color difference.
[0010] Preferably, the method further comprises:
[0011] Calculate the color difference abnormality rate of the printed pattern of the corrugated cardboard box to be measured at the same detection position according to the color difference detection results of the first image to be measured and the second image to be measured, and determine whether the color difference abnormality rate is greater than a preset threshold;
[0012] When it is determined that the color difference abnormality rate is greater than the preset threshold, use an unsupervised algorithm to learn the current printing parameters and the corresponding color difference detection results, adaptively adjust the current printing parameters, and use the updated printing parameters for the next printing process.
[0013] Preferably, the classification of the segmented images by the SVM algorithm includes:
[0014] Preprocess the segmented images, including format unification and median filtering;
[0015] Convert the color space of the preprocessed images, including converting to the HSV color space and the Lab color space respectively;
[0016] Separate the channels of the HSV color space, calculate the local brightness ratio based on the separated single-channel images, and segment the single-channel images according to the size of the local brightness ratio;
[0017] Based on the segmented single-channel images and the Lab color space, extract features respectively, and classify the extracted features using the SVM algorithm.
[0018] Preferably, the method further includes: identifying the color uniformity of the first image to be measured using a trained convolutional neural network model.
[0019] Preferably, the selection of a preset number of first sampling points on the first image to be measured and the determination of the pattern color difference according to the first sampling points and the standard template include:
[0020] In the first image to be measured, take the vertices and the center point of the four corners of the image as the first sampling points;
[0021] Calculate the first target color difference of each first sampling point in the Lab color space and the standard template in the Lab color space, and calculate the average value of the first target color differences as the color difference of the first image to be measured.
[0022] Preferably, the partition sampling on the first image to be measured according to the adaptive sampling density algorithm to obtain the second sampling points and the determination of the pattern color difference according to the second sampling points and the standard template include:
[0023] Identify the color uniform area and the color non-uniform area of the first image to be measured, and use the adaptive sampling density algorithm to collect sampling points with different densities in the color uniform area and the color non-uniform area respectively as the second sampling points;
[0024] Calculate the second target color difference between each second sampling point in the Lab color space and the standard template in the Lab color space, and calculate the root mean square error of the second target color difference as the color difference of the first image to be measured.
[0025] Preferably, the feature point matching algorithm is used to perform feature matching between the SIFT features and the standard template to determine the pattern color difference, including:
[0026] Use the FLANN algorithm to match the feature descriptors of the SIFT features with the feature descriptors of the standard template, remove the outliers, and obtain the matching pairs;
[0027] Calculate the Euclidean distance between the matching pairs, and filter out the matching pairs with the Euclidean distance less than the confidence threshold as the target matching pairs;
[0028] Based on the target matching pairs, extract the corresponding image regions from the second image to be measured and the standard template respectively, convert the image regions to the Lab color space, and generate the matching regions;
[0029] Calculate the color difference of each matching region, and calculate the corresponding average color difference according to the color difference of each matching region as the color difference of the second image to be measured.
[0030] In a second aspect, the present invention also provides a corrugated cardboard printing pattern color difference detection system, the system includes:
[0031] An image segmentation unit for performing image segmentation on the corrugated cardboard printing pattern to be measured, classifying the segmented images through the SVM algorithm to obtain a first image to be measured and a second image to be measured;
[0032] A first image color difference detection unit for obtaining the color uniformity of the first image to be measured and judging whether the color uniformity meets the preset conditions when detecting the color difference of the first image to be measured;
[0033] If so, select a preset number of first sampling points on the first image to be measured, and determine the pattern color difference according to the first sampling points and the standard template;
[0034] If not, sample the first image to be measured by region according to the adaptive sampling density algorithm to obtain second sampling points, and determine the pattern color difference according to the second sampling points and the standard template;
[0035] A second image color difference detection unit for performing feature extraction on the second image to be measured to obtain SIFT features, and using the feature point matching algorithm to perform feature matching between the SIFT features and the standard template to determine the pattern color difference.
[0036] In a third aspect, the present invention further provides an electronic device, comprising: a processor and a memory, the memory being configured to store computer program code, the computer program code including computer instructions, and when the processor executes the computer instructions, the electronic device executes the method according to the first aspect and any possible implementation manner thereof as described above.
[0037] In a fourth aspect, the present invention further provides a computer-readable storage medium, in which a computer program is stored, the computer program including program instructions, and when the program instructions are executed by a processor of an electronic device, the processor is caused to execute the method according to the first aspect and any possible implementation manner thereof as described above.
[0038] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0039] 1) The present invention provides a method for detecting color difference of printed patterns on corrugated cartons. First, image segmentation is performed on the printed patterns of the corrugated cartons to be measured, and a plurality of segmented images are classified by an SVM algorithm to obtain a first image to be measured and a second image to be measured. By classifying the images, first, the background base color with large-area colors close to each other can be distinguished from the complex patterns, so as to adopt different detection methods, avoiding problems such as waste of resources and poor detection effect caused by only using one detection method.
[0040] 2) When detecting the color difference of the first image to be measured, the color uniformity of the first image to be measured is obtained, and it is determined whether the color uniformity meets a preset condition; if so, a preset number of first sampling points are selected on the first image to be measured, and the pattern color difference is determined according to the first sampling points and a standard template; if not, area sampling is performed on the first image to be measured according to an adaptive sampling density algorithm to obtain second sampling points, and the pattern color difference is determined according to the second sampling points and the standard template. The first image to be measured is usually the background base color with large-area colors close to each other in visual perception, and the texture features are simple. However, in order to ensure the detection accuracy, the present invention distinguishes the first image to be measured by first detecting the uniformity, so as to determine the sampling method and sampling density, which can greatly improve the detection efficiency.
[0041] 3) When detecting the color difference of the second image to be measured, SIFT features are extracted from the second image to be measured, and the SIFT features are feature-matched with a standard template by using a feature point matching algorithm to determine the pattern color difference. Since the second image to be measured is usually a printed pattern with relatively complex texture features, when detecting the second image to be measured, SIFT features are mainly extracted, and the pattern color difference is detected by feature matching, so as to improve the accuracy of color difference detection in the case of relatively complex texture features. Compared with the prior art that only adopts a unified detection method without considering the situation of the detection object, the present invention reduces the detection cost while improving the detection efficiency and detection accuracy.
[0042] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background art, the drawings required for use in the embodiments of the present invention or the background art will be described below.
[0044] The drawings herein are incorporated into the specification and constitute a part of this specification. These drawings show embodiments consistent with the present disclosure and, together with the specification, are used to illustrate the technical solutions of the present disclosure.
[0045] Figure 1 A schematic flowchart of a method for detecting color difference of printed patterns on corrugated cardboard boxes provided by an embodiment of the present invention;
[0046] Figure 2 A schematic flowchart of a method for detecting color difference of printed patterns on corrugated cardboard boxes provided by another embodiment of the present invention;
[0047] Figure 3 A schematic structural diagram of a system for detecting color difference of printed patterns on corrugated cardboard boxes provided by an embodiment of the present invention;
[0048] Figure 4 A schematic structural diagram of a system for detecting color difference of printed patterns on corrugated cardboard boxes provided by another embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0049] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0050] The terms "first", "second", etc. in the specification and claims of the present invention and the above drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0051] As used herein, the term "and / or" is merely a description of the associated relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" as used herein means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set composed of A, B, and C.
[0052] Reference to "embodiment" in this specification means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present invention. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0053] In addition, for a better illustration of the present invention, numerous specific details are given in the following detailed description. Those skilled in the art should understand that the present invention can still be implemented without some of these specific details. In some instances, methods, means, elements, and circuits well known to those skilled in the art are not described in detail so as to highlight the gist of the present invention.
[0054] Currently, for the color difference detection of the printed patterns on corrugated cartons, a unified detection method, namely a color difference meter, is usually adopted. This method is not only costly but also inefficient. Therefore, the present invention aims to provide a method for detecting the color difference of the printed patterns on corrugated cartons, which can distinguish different detection images and match suitable detection methods, thereby reducing costs while improving the detection quality and efficiency.
[0055] Please refer to Figure 1 , Figure 1 which is a schematic flow chart of a method for detecting the color difference of the printed patterns on corrugated cartons provided by an embodiment of the present invention. As Figure 1 shown, a method for detecting the color difference of the printed patterns on corrugated cartons includes the following steps:
[0056] S10. Perform image segmentation on the printed pattern of the corrugated carton to be measured, and classify the segmented images through the SVM algorithm to obtain a first image to be measured and a second image to be measured.
[0057] The printed patterns on corrugated cartons are relatively rich and diverse, usually including text information such as brand logos, manufacturer information, usage instructions, etc.; large-area color blocks, such as background filling, using one or more colors to form a unified or gradient visual effect and increase the overall aesthetics of the packaging; complex patterns and textures, such as pattern texture effects, gloss effects, decorative graphics to beautify the packaging, etc. If the types of printed patterns are not distinguished and only a unified color difference detection method is used, it usually leads to the inability to guarantee the detection accuracy because different types of printed patterns have different sensitivities to color differences. Large-area uniform backgrounds are very sensitive to color uniformity and color differences, while complex pattern or texture areas may pay more attention to the color hierarchy and contrast. Using a single color difference detection standard cannot meet the requirements of these two situations simultaneously, resulting in inaccurate detection results.
[0058] In this embodiment, first, image segmentation is performed on the printed patterns of the corrugated carton, which can reduce the pattern area for one-time detection, enabling the color difference detection process of patterns in different regions to be processed in parallel and accelerating the efficiency. After segmentation, several segmented images are classified through the SVM algorithm to obtain the first image to be measured and the second image to be measured; among them, the first image to be measured is mainly the background color of the large-area color block type, and the second image to be measured is mainly complex patterns and textures. By pre-training the support vector machine (SVM) algorithm, the several segmented images are subjected to binary classification operations to obtain the first image to be measured and the second image to be measured, thereby enabling different types of printed patterns to be distinguished to provide a targeted color difference detection method.
[0059] S20. When detecting the color difference of the first image to be measured, obtain the color uniformity of the first image to be measured and determine whether the color uniformity meets the preset conditions;
[0060] S201. If so, select a preset number of first sampling points on the first image to be measured, and determine the pattern color difference according to the first sampling points and the standard template;
[0061] S202. If not, sample the first image to be measured in zones according to the adaptive sampling density algorithm to obtain second sampling points, and determine the pattern color difference according to the second sampling points and the standard template.
[0062] In this embodiment, when detecting the color difference of the first image to be measured, the color uniformity of the first image to be measured is first determined to judge whether the color uniformity meets the preset conditions. If the preset conditions are met, only a preset number of sampling points may be collected to calculate the pattern color difference. If the preset conditions are not met, it indicates that the uniformity of the first image to be measured cannot meet the requirements. At this time, to ensure the accuracy of color difference detection, it is necessary to sample the first image to be measured in zones according to the adaptive sampling density algorithm. Before zoning, the overall color uniformity is poor, but after zoning, positions with relatively uniform and non-uniform colors can be obtained. In this way, different-density sampling points can be selected for collection in different zones through the adaptive sampling density algorithm to calculate the pattern color difference.
[0063] In a preferred embodiment, a trained convolutional neural network model is used to identify the color uniformity of the first image to be measured.
[0064] When training the convolutional neural network model, a large number of images containing uniform and non-uniform colors need to be collected as the training set, and then each image is labeled with a category. The sample diversity of the training set is increased by performing operations such as rotation, scaling, and flipping on the images to improve the generalization ability of the model. Then, a CNN infrastructure constructed using the ResNet module is adopted to train the model with the training set, a loss function is constructed using cross-entropy loss, and through multiple rounds of iterative training, the classification accuracy and recall rate metrics of the model are evaluated, so as to optimize the model network structure, and finally a trained convolutional neural network model is obtained. When identifying the color uniformity of an image, it only needs to be output to this convolutional neural network model, and the identification result of the uniformity can be quickly output.
[0065] S30. When detecting the color difference of the second image to be measured, SIFT features are extracted from the second image to be measured, and the SIFT features are feature-matched with a standard template using a feature point matching algorithm to determine the pattern color difference.
[0066] The first image to be measured is mainly a large-area background color, so the method of collecting sampling points in the above manner is adopted to detect the color difference. In this step, the second image to be measured is mainly complex pattern textures. To ensure the detection efficiency and accuracy, SIFT features are extracted from the second image to be measured.
[0067] Specifically, when extracting SIFT features, first, scale extreme value space detection is performed. The Difference-of-Gaussian (DoG) pyramid is applied to identify potential points of interest with scale and orientation invariance. Local extreme points at different scales in the image are extracted through the DoG, and these extreme points serve as the key points of the SIFT algorithm. Then, direction assignment is carried out. For each key point, its gradient direction is calculated and assigned to the gradient direction histogram where it is located. Finally, the key point descriptor is obtained. In the neighborhood around each key point, the local gradient is measured at the selected scale. These gradients are transformed into a representation. With the key point as the center, a 4×4 window is constructed, and the gradient magnitude and direction of each pixel point within the window are calculated and assigned to the statistical histogram. Ultimately, a 128-dimensional SIFT feature vector of this key point is obtained. After obtaining the SIFT features, the feature point matching algorithm is used to match the SIFT features with the standard template, and the pattern color difference of the second image to be measured can be determined.
[0068] Therefore, in the color difference detection method provided in this embodiment, by performing image segmentation on the printed pattern of the corrugated cardboard box to be measured, and classifying the segmented images through the SVM algorithm, the first image to be measured and the second image to be measured are obtained. By classifying the images, first, the background base color with a large area of similar colors can be distinguished from the complex pattern, so as to adopt different detection methods, avoiding problems such as resource waste and poor detection effect caused by only using one detection method.
[0069] In addition, when detecting the color difference of the first image to be measured, the image type is distinguished based on the color uniformity index. If the color uniformity meets the preset conditions, a preset number of first sampling points are selected on the first image to be measured, and the pattern color difference is determined according to the first sampling points and the standard template; otherwise, sampling is performed on the first image to be measured according to the adaptive sampling density algorithm to obtain second sampling points, and the pattern color difference is determined according to the second sampling points and the standard template. By distinguishing the first image to be measured through color uniformity, thereby determining the sampling method and sampling density, the detection efficiency can be greatly improved. When detecting the color difference of the second image to be measured, the feature point matching algorithm is used to match the extracted SIFT features with the standard template to determine the pattern color difference. In this way, the accuracy of color difference detection in the case of relatively complex texture features can be improved. Compared with the existing method that only uses a unified detection method, the detection method of this embodiment can reduce the detection cost while improving the detection efficiency and detection accuracy.
[0070] See Figure 2 , in some embodiments, the method further includes:
[0071] S40. According to the color difference detection results of the first image to be measured and the second image to be measured, calculate the color difference abnormality rate of the printed pattern of the corrugated cardboard box to be measured at the same detection position, and determine whether the color difference abnormality rate is greater than a preset threshold;
[0072] S50. When it is determined that the color difference abnormality rate is greater than the preset threshold, use an unsupervised algorithm to learn the current printing parameters and the corresponding color difference detection results, adaptively adjust the current printing parameters, and use the updated printing parameters for the next printing process.
[0073] It should be noted that the scenario targeted in this embodiment is mainly to detect the color difference of the printed patterns of a batch of corrugated cartons after the printing of the batch is completed. Assume that a batch of corrugated cartons contains n. The color difference of the n cartons is detected by the detection method of the above embodiment, and the color difference abnormality rate of the printed patterns of the corrugated cartons to be measured at the same detection position can be calculated according to the detection results.
[0074] For example, for n cartons, the image of each carton is divided into m blocks, marked as N1-1, N1-2,..., N1-m,..., N2-1, N2-2,..., N2-m,..., Nn-1, Nn-2,..., Nn-m; where Ni-j represents the j-th block image of the i-th carton, the value range of i is [1, n], and the value range of j is [1, m].
[0075] When calculating the color difference abnormality rate, taking N1-1 as an example, the image at the same position of the second carton is N2-1, the image at the same position of the third carton is N3-1, and so on, and the image at the same position of the n-th carton is obtained as Nn-1. At this time, only the number of color difference abnormalities in these n pictures needs to be obtained. Assume that n is 30 and there are 3 color difference abnormalities, then it can be shown that the color difference abnormality rate of the images at the same position is 3 / 30 = 10%.
[0076] Furthermore, judge whether the color difference abnormality rate is greater than the preset threshold. If not, it means that the color difference problem is within the tolerance range and does not require special treatment. Only the problematic cartons need to be removed. If so, it means that the color difference problem is relatively serious, and it may be caused by improper printing parameters. At this time, in order to ensure the reduction of color difference problems in the next printing process, this embodiment will use an unsupervised algorithm to learn the current printing parameters and the corresponding color difference detection results, adaptively adjust the current printing parameters, and use the updated printing parameters for the next printing process.
[0077] Specifically, the printing parameters include, but are not limited to, ink concentration, printing speed, printing pressure, drying temperature, etc. When learning, in order to reduce the computational complexity, 2 or more parameters can be selected for learning, such as printing speed and pressure. Unsupervised learning can use clustering algorithms such as K-means and DBSCAN to analyze historical data, attempt to discover color difference patterns under different printing parameter configurations, cluster similar printing results into one category, then identify the optimal printing parameter cluster, and based on this, predict or recommend new printing parameter settings. Apply the printing parameters optimized through the above model to the next round of printing, perform color difference detection again, then collect new data and feedback it into the model, continuously iterate and optimize to form a closed-loop control, making the printing process gradually approach the ideal state and the quality of printed products getting better and better.
[0078] After detecting the color difference problem of a batch of corrugated carton printing patterns in this embodiment, by statistically analyzing the color difference abnormality rate and then comparing it with a preset threshold to determine whether to feedback and adjust the printing parameters. When it is determined that adjustment is needed, adaptively adjust the printing parameters through unsupervised learning, and use the updated printing parameters for the next printing process, which can greatly reduce the color difference problem in the next printing, thereby improving the quality of finished products of the entire production line.
[0079] In some embodiments, the classification of the several segmented images by the SVM algorithm includes:
[0080] 1) Preprocess the several segmented images, including performing format unification and median filtering;
[0081] 2) Perform color space conversion on the preprocessed several images, including converting them to the HSV color space and the Lab color space respectively;
[0082] 3) Separate the channels of the HSV color space, calculate the local brightness ratio based on the separated single-channel images, and segment the single-channel images according to the size of the local brightness ratio;
[0083] 4) Based on the segmented single-channel images and the Lab color space, perform feature extraction respectively, and use the SVM algorithm to classify the extracted features.
[0084] The HSV color space describes colors using hue H, saturation S, and value V. Compared with the RGB space, the three components of the HSV color space are not correlated, and the HSV color space has great advantages in segmenting specific color regions. The Lab color space is established based on the international standard for measuring colors. Different from other color spaces, this color space is device-independent, and the colors in it are richer than RGB colors. It can not only express all the colors in the RGB space, but also represent the colors of other models, and the color distribution is uniform. In this embodiment, the color characteristics in the HSV color space and the Lab color space are considered, combined into a feature vector, and then feature recognition and classification are performed.
[0085] Further, when separating the channels of the HSV color space, the local brightness ratio is calculated based on the separated single-channel image, and the single-channel image is segmented according to the magnitude of the local brightness ratio. To improve the robustness of the algorithm, a threshold segmentation process can be performed on each separated single-channel image, and several threshold images can be obtained, such as 3. Then, the threshold image with the largest local brightness ratio can be selected from the obtained 3 threshold images to complete the segmentation. Among them, the calculation formula of the local brightness ratio is:
[0086]
[0087] In the formula, s represents the local brightness ratio, are the pixel means of the foreground region and the background region respectively.
[0088] Based on the segmented single-channel image and the Lab color space, feature extraction is performed respectively, that is, the average color differences ΔH, ΔS, and ΔV between the upper foreground and the background regions are extracted from the threshold image of the HSV color space after segmentation, and the color difference values ΔL, Δa, and Δb are extracted from the Lab color space. Then, based on these 6 feature values, the SVM algorithm is used for feature classification, and the first test image and the second test image can be obtained.
[0089] Therefore, in this embodiment, by considering the HSV color space and the Lab color space, threshold segmentation is performed based on the local brightness ratio, and then features are extracted on the two color spaces respectively, greatly increasing the accuracy of the classification result.
[0090] In some embodiments, selecting a preset number of first sampling points on the first test image and determining the pattern color difference according to the first sampling points and the standard template includes:
[0091] In the first test image, the vertices and the center point of the four corners of the image are used as the first sampling points;
[0092] Calculate the first target color difference between each first sampling point in the Lab color space and the standard template in the Lab color space, and calculate the average value of the first target color differences as the color difference of the first image to be measured.
[0093] In this embodiment, since the color uniformity of the first image to be measured is good at this time, it is not necessary to detect all pixels on the image. Only the vertices and the center point at the four corners of the image are used as the first sampling points, and the first target color differences between these 5 points and the corresponding positions of the standard target in the Lab color space are calculated respectively. Finally, calculating the average value can characterize the color difference of the first image to be measured. In this way, the detection efficiency can be greatly improved while ensuring the detection accuracy.
[0094] In some embodiments, the partitioning sampling on the first image to be measured according to the adaptive sampling density algorithm to obtain the second sampling points, and determining the pattern color difference according to the second sampling points and the standard template includes:
[0095] Identify the color-uniform regions and color-non-uniform regions of the first image to be measured, and use the adaptive sampling density algorithm to collect sampling points with different densities in the color-uniform regions and color-non-uniform regions as the second sampling points;
[0096] Calculate the second target color difference between each second sampling point in the Lab color space and the standard template in the Lab color space, and calculate the root mean square error of the second target color differences as the color difference of the first image to be measured.
[0097] When the uniformity of the first image to be measured does not meet the preset conditions, in order to improve the detection efficiency, this embodiment will perform partitioning sampling, that is, identify the color-uniform regions and color-non-uniform regions of the first image to be measured, and use the adaptive sampling density algorithm to collect sampling points with different densities in the color-uniform regions and color-non-uniform regions. For example, only 2 - 3 pixel points need to be collected in the color-uniform sub-regions, while a dozen or more need to be collected in the non-uniform regions, which mainly depends on algorithm learning and the size of the partitioning range. Preferably, an adaptive oversampling algorithm of the probability density function can be used, and probability density functions such as the Rayleigh distribution are used to guide the oversampling process. The samples are divided into safe, boundary, and noise samples, and new samples are generated adaptively according to their distribution densities and characteristics to achieve the purpose of dataset balance. After the second sampling points are determined, calculate the second target color difference between each second sampling point in the Lab color space and the standard template in the Lab color space, and calculate the root mean square error of the second target color differences as the color difference of the first image to be measured. Compared with the case where the average value is used when the color uniformity of the first image to be measured is good, in the case of uneven colors here, through partitioning sampling, there are more sampling points, and the root mean square error can better express the color difference volatility to improve the detection accuracy.
[0098] In some embodiments, the feature matching algorithm is used to match the SIFT features with the standard template to determine the pattern color difference, including:
[0099] The FLANN algorithm is used to match the feature descriptors of the SIFT features with those of the standard template, remove the outliers, and obtain the matching pairs;
[0100] Calculate the Euclidean distance between the matching pairs, and filter out the matching pairs with the Euclidean distance less than the confidence threshold as the target matching pairs;
[0101] Based on the target matching pairs, extract the corresponding image regions from the second image to be measured and the standard template respectively, convert the image regions to the Lab color space, and generate the matching regions;
[0102] Calculate the color difference of each matching region, and calculate the corresponding average color difference according to the color difference of each matching region as the color difference of the second image to be measured.
[0103] In this embodiment, when using the FLANN algorithm for descriptor matching, first, an efficient index structure is constructed based on these descriptors, and then each SIFT feature descriptor in the image to be detected is used as a query item. First, remove the outliers, and then perform an approximate nearest neighbor search for each query descriptor to find the most similar feature descriptor in the standard template. By setting a confidence threshold, filter out the matching pairs with too large distances to reduce mis-matching, and screen out the matching pairs with the Euclidean distance less than the confidence threshold as the target matching pairs. Further, based on the target matching pairs, extract the corresponding image regions from the second image to be measured and the standard template respectively, convert the image regions to the Lab color space, and generate the matching regions; finally, calculate the color difference of each matching region, and calculate the corresponding average color difference according to the color difference of each matching region as the color difference of the second image to be measured. Among them, when calculating the color difference of the matching region, the color difference detection method of the first image to be measured can be referred to, which will not be elaborated here.
[0104] Therefore, in this embodiment, when detecting the second image to be measured, the SIFT features are mainly extracted, and the pattern color difference is detected through feature matching, so as to improve the accuracy of color difference detection in the case of relatively complex texture features. Compared with the existing unified detection method, the present invention first classifies the image into the first image to be measured and the second image to be measured through SVM classification, and then provides appropriate color difference detection methods for different images and different situations, realizing the reduction of detection cost while greatly improving the detection efficiency and detection accuracy.
[0105] See Figure 3 , in some embodiments, the present invention also provides a corrugated cardboard printing pattern color difference detection system, and the system includes:
[0106] An image segmentation unit 100 is configured to perform image segmentation on the printed pattern of the corrugated cardboard box to be measured, classify several segmented images through an SVM algorithm, and obtain a first image to be measured and a second image to be measured;
[0107] A first image color difference detection unit 200 is configured to, when detecting the color difference of the first image to be measured, obtain the color uniformity of the first image to be measured and determine whether the color uniformity meets a preset condition;
[0108] If so, a preset number of first sampling points are selected on the first image to be measured, and the pattern color difference is determined according to the first sampling points and a standard template;
[0109] If not, region sampling is performed on the first image to be measured according to an adaptive sampling density algorithm to obtain second sampling points, and the pattern color difference is determined according to the second sampling points and the standard template;
[0110] A second image color difference detection unit 300 is configured to, when detecting the color difference of the second image to be measured, extract SIFT features from the second image to be measured, and perform feature matching between the SIFT features and a standard template by using a feature point matching algorithm to determine the pattern color difference.
[0111] See Figure 4 , in some embodiments, a color difference detection system for a printed pattern of a corrugated cardboard box further includes a parameter update unit 400, configured to:
[0112] Calculate the color difference abnormality rate of the printed pattern of the corrugated cardboard box to be measured at the same detection position according to the color difference detection results of the first image to be measured and the second image to be measured, and determine whether the color difference abnormality rate is greater than a preset threshold;
[0113] When it is determined that the color difference abnormality rate is greater than the preset threshold, use an unsupervised algorithm to learn the current printing parameters and the corresponding color difference detection results, adaptively adjust the current printing parameters, and use the updated printing parameters for the next printing process.
[0114] It can be understood that the functions or modules included in the system provided in this embodiment can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0115] The present invention further provides an electronic device, including: a processor and a memory. The memory is configured to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes the methods in any of the above possible implementation manners.
[0116] The present invention also provides a computer-readable storage medium, in which a computer program is stored. The computer program includes program instructions, and when the program instructions are executed by a processor of an electronic device, the processor is caused to execute the method according to any of the above possible implementation manners.
[0117] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0118] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein. Those skilled in the art can also clearly understand that each embodiment of the present invention has its own emphasis. For the convenience and simplicity of description, the same or similar parts may not be elaborated in different embodiments. Therefore, the parts not described or not detailedly described in a certain embodiment can be referred to the descriptions of other embodiments.
[0119] In several embodiments provided by the present invention, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of devices or units can be in an electrical, mechanical, or other forms.
[0120] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0121] In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0123] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware with a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The foregoing storage medium includes various media that can store program codes, such as read-only memory (ROM) or random access memory (RAM), magnetic disks, or optical discs.
Claims
1. A method for detecting color difference of printed patterns on corrugated paper boxes, characterized in that: The method comprises: Perform image segmentation on the printed pattern of the corrugated box to be tested, and classify the segmented images by using the SVM algorithm to obtain a first image to be tested and a second image to be tested; The method of classifying the segmented images by using the SVM algorithm includes: Preprocessing the segmented images, including format unification and median filtering; Perform color space conversion on several preprocessed images, including conversion into HSV color space and Lab color space respectively; Separate the channels of the HSV color space, calculate the local brightness ratio based on the separated single-channel image, and segment the single-channel image according to the size of the local brightness ratio; Based on the segmented single-channel image and Lab color space, feature extraction is performed respectively, and the extracted features are classified using the SVM algorithm; Among them, the calculation formula of local brightness ratio is: Where s represents the local brightness ratio, are the pixel means of the foreground area and the background area respectively; When detecting the color difference of the first image to be tested, obtaining the color uniformity of the first image to be tested, and determining whether the color uniformity meets a preset condition; If yes, select a preset number of first sampling points on the first image to be tested, and determine the pattern color difference according to the first sampling points and the standard template; If not, sampling is performed on the first image to be tested according to an adaptive sampling density algorithm to obtain second sampling points, and the pattern color difference is determined according to the second sampling points and the standard template; When detecting the color difference of the second image to be tested, feature extraction is performed on the second image to be tested to obtain SIFT features, and feature matching is performed between the SIFT features and the standard template using a feature point matching algorithm to determine the pattern color difference.
2. The method for detecting color difference of printed patterns on corrugated paper boxes according to claim 1, characterized in that: The method further comprises: According to the color difference detection results of the first image to be tested and the second image to be tested, the color difference abnormality of the printed pattern of the corrugated box to be tested at the same detection position is calculated, and it is determined whether the color difference abnormality is greater than a preset threshold; When it is determined that the color difference anomaly rate is greater than a preset threshold, an unsupervised algorithm is used to learn the current printing parameters and the corresponding color difference detection results, the current printing parameters are adaptively adjusted, and the updated printing parameters are used for the next printing process.
3. The method for detecting color difference of printed patterns on corrugated paper boxes according to claim 1, characterized in that: The method also includes: using a trained convolutional neural network model to identify the color uniformity of the first image to be tested.
4. The method for detecting color difference of printed patterns on corrugated paper boxes according to claim 1, characterized in that: The step of selecting a preset number of first sampling points on the first image to be tested and determining the pattern color difference according to the first sampling points and the standard template includes: In the first image to be tested, the vertices and the center point of the four corners of the image are used as the first sampling points; The first target color difference between each first sampling point in the Lab color space and the standard template in the Lab color space is calculated, and the average value of the first target color differences is calculated as the color difference of the first image to be tested.
5. The method for detecting color difference of printed patterns on corrugated paper boxes according to claim 1, characterized in that: The method of sampling the first image to be tested in a partitioned manner according to the adaptive sampling density algorithm to obtain a second sampling point, and determining the pattern color difference according to the second sampling point and the standard template includes: Identify a color uniform region and a color non-uniform region of the first image to be tested, and use an adaptive sampling density algorithm to collect sampling points with different densities in the color uniform region and the color non-uniform region as second sampling points; The second target color difference between each second sampling point in the Lab color space and the standard template in the Lab color space is calculated, and the root mean square error of the second target color difference is calculated as the color difference of the first image to be measured.
6. The method for detecting color difference of printed patterns on corrugated paper boxes according to claim 1, characterized in that: The method of using a feature point matching algorithm to perform feature matching on the SIFT feature and the standard template to determine the pattern color difference includes: The FLANN algorithm is used to match the feature descriptor of SIFT features with the feature descriptor of the standard template, and outliers are removed to obtain matching pairs; Calculate the Euclidean distance between matching pairs, and select matching pairs whose Euclidean distance is less than the confidence threshold as target matching pairs; Extracting corresponding image regions from the second image to be tested and the standard template respectively based on the target matching pair, converting the image regions into Lab color space, and generating matching regions; The color difference of each matching area is calculated, and the corresponding color difference average value is calculated according to the color difference of each matching area as the color difference of the second image to be tested.
7. A corrugated box printing pattern color difference detection system, characterized in that: The system comprises: An image segmentation unit is used to perform image segmentation on the printed pattern of the corrugated box to be tested, and classify the segmented images by using a SVM algorithm to obtain a first image to be tested and a second image to be tested; The method of classifying the segmented images by using the SVM algorithm includes: Preprocessing the segmented images, including format unification and median filtering; Perform color space conversion on several preprocessed images, including conversion into HSV color space and Lab color space respectively; Separate the channels of the HSV color space, calculate the local brightness ratio based on the separated single-channel image, and segment the single-channel image according to the size of the local brightness ratio; Based on the segmented single-channel image and Lab color space, feature extraction is performed respectively, and the extracted features are classified using the SVM algorithm; Among them, the calculation formula of local brightness ratio is: Where s represents the local brightness ratio, are the pixel means of the foreground area and the background area respectively; A first image color difference detection unit is used to obtain the color uniformity of the first image to be tested when detecting the color difference of the first image to be tested, and to determine whether the color uniformity meets a preset condition; If yes, select a preset number of first sampling points on the first image to be tested, and determine the pattern color difference according to the first sampling points and the standard template; If not, sampling is performed on the first image to be tested according to an adaptive sampling density algorithm to obtain second sampling points, and the pattern color difference is determined according to the second sampling points and the standard template; The second image color difference detection unit is used to extract features from the second image to be tested to obtain SIFT features when detecting the color difference of the second image to be tested, and to perform feature matching between the SIFT features and the standard template using a feature point matching algorithm to determine the pattern color difference.
8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and when the processor executes the computer instructions, the electronic device executes the method for detecting color difference of a printed pattern of a corrugated box as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the method for detecting color difference of a printed pattern of a corrugated cardboard box according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for compensating chroma of images
CN101771825A
Method and device for automatically detecting color difference of label paper
CN115829932A
Ceramic tile color difference detection method and device, electronic equipment and storage medium
CN116580110A
Methods for evaluating and improving print quality
WO2007071826A1