A method and device for automatically detecting color difference of trademark paper

By automatically acquiring pixel color data of trademark paper samples and dividing them into areas, combined with color difference threshold judgment, the problem of low detection accuracy caused by manual positioning sampling is solved, and efficient and accurate color difference detection is achieved.

CN115829932BActive Publication Date: 2025-10-03CHINA TOBACCO GUANGDONG IND
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211318609.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-26
Publication Date
2025-10-03
Estimated Expiration
2042-10-26

AI Technical Summary

Technical Problem

In the prior art, color difference detection of cigarette outer packaging paper relies on manual positioning and sampling, resulting in low accuracy of detection results and unstable product quality.

Method used

The color data of all pixels of the trademark paper sample are obtained through an automated method, divided into the first area and the second area, and partial sampling and full sampling are performed at the same position in the test piece, and the qualification of the test piece is judged using the color difference threshold.

Benefits of technology

It improves the accuracy and efficiency of color difference detection, reduces human bias, ensures stable product quality, and saves sampling time and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115829932B_ABST
    Figure CN115829932B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of trademark paper material detection, and more specifically, to a method and device for automatically detecting color differences in trademark paper, wherein the method comprises obtaining color data of all pixels in a sample; dividing a first area and a second area based on the color data of the pixels, wherein the first area is a set of pixels whose number reaches a threshold value and whose color data are the same, and the second area is a set of the remaining pixels in the sample; obtaining color data of sampling points in the test piece, and obtaining color differences based on the color data of the corresponding sampling points in the sample, wherein the sampling points include all pixels in the second area and some sampling points in the first area. If the color difference is within a preset color difference threshold, the test piece is set as a qualified piece. The present invention can solve the problem of low accuracy of test results and unstable product quality caused by manual positioning sampling during color difference detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of trademark paper material detection, and more particularly to a method and device for automatically detecting color differences of trademark paper. Background Art

[0002] Cigarette outer packaging paper mainly includes cigarette carton label paper, small box label paper and cigarette tipping paper. Its appearance quality directly carries the external image and anti-counterfeiting function of cigarette products, determines the first impression of cigarette consumers on cigarette products, and to a certain extent affects consumers' choice of cigarette products.

[0003] During the printing process, color differences between cigarette outer wrappers and the original can occur due to factors such as printing materials and printing processes. Currently, colorimeter evaluation of cigarette outer wrappers primarily relies on colorimeter. Using a colorimeter requires manual positioning of color difference sampling points. Due to the small number of sampling points and their relatively uniform locations, significant deviations can occur, resulting in low test accuracy and unstable product quality. Summary of the Invention

[0004] In order to solve the problem that manual positioning and sampling during color difference detection leads to low detection accuracy and unstable product quality, the present application provides a method for automatic detection of color difference of trademark paper.

[0005] The present application provides a method for automatically detecting color difference of trademark paper, which specifically includes the following steps:

[0006] S1: Obtain the color data of all pixels in the sample to obtain the sample color data set;

[0007] S2: Pixel points with the same color data in the sample color data set are grouped into pixel groups, and the sample color data set is divided into multiple pixel groups;

[0008] S3: classifying the plurality of pixel groups into a first region and a second region respectively: wherein the pixel groups whose number of pixels exceeds a preset pixel number threshold are classified into the first region, and the remaining pixel groups are classified into the second region;

[0009] S4: Sampling is performed in the device under test, and color data corresponding to sampling points in the device under test are obtained to obtain a color data set of the device under test. The sampling rule is as follows: the sampling positions in the device under test are the same as the sampling positions in the sample, and the positions of the pixels in the first area of ​​the device under test corresponding to the sample are partially sampled, and the positions of the pixels in the second area of ​​the device under test corresponding to the sample are fully sampled.

[0010] S5: Compare the color data set of the test piece with the corresponding sample color data set to obtain a color difference; if the color difference is less than a preset color difference threshold, the test piece is qualified; if the color difference is greater than the preset color difference threshold, the test piece is unqualified.

[0011] By adopting the above technical solution, a sample is scanned to obtain color data of all pixels in the sample to obtain a sample color data set. Pixels of the same color in the color data set are classified and compared with a preset pixel number threshold according to the number of pixels of the same color. The portion with a large number of pixels of the same color is divided into a first region, and the remaining pixels are divided into a second region. When sampling the sample to be tested, color data of sampling points in the first region and sampling points in the second region of the sample to be tested is obtained. A sampling rule of partial sampling in the first region and full sampling in the second region is adopted for testing. This is in line with printing rules. During the printing process, portions with the same color are obtained by aggregating multiple pixels with the same color. Therefore, partial sampling of the first region can be used to infer whether the overall quality meets the requirements based on the sampling results. Since the number of pixels of the same color in the second region is less than the preset pixel number threshold, full testing of this portion can avoid missing pixels with different colors. The sampling results of the sample to be tested are then compared with the sample data to draw a judgment conclusion. The detection method of the present invention is obtained on the basis that the sampling position in the workpiece to be tested is the same as the sampling position in the sample, so as to ensure the validity of the color data comparison between the workpiece to be tested and the sample; the sampling method of the present invention can avoid all sampling, thereby saving sampling time and improving detection efficiency, and can minimize the deviation of the detection results caused by partial sampling. Compared with random sampling, the detection results are more accurate and can ensure stable product quality. Compared with manual detection, the judgment standards are unified, avoiding human subjective deviation, higher accuracy, more cost-saving, and higher efficiency.

[0012] Furthermore, before step S1, step Sa is also included: obtaining a signal indicating that the sample has reached the area to be tested. If it is detected that the sample has reached the area to be tested, step S1 is entered; if it is detected that the sample has not reached the area to be tested, step Sa is repeated.

[0013] Furthermore, in step S4, M1 is defined as the sum of the number of pixels in the first area, K is the number of pieces to be tested, and the number of sampling points P1 of the piece to be tested in the first area corresponding to the sample satisfies:

[0014] P1=M1 / K,

[0015] Define M2 as the sum of the number of pixels in the second area, then the number of sampling points P2 of the DUT in the second area of ​​the corresponding sample satisfies:

[0016] P2=M2,

[0017] The total number of sampling points P of the test piece satisfies:

[0018] P=P1+P2=M1 / K+M2.

[0019] Furthermore, the selection of pixels within the first area in step S4 specifically includes the following steps:

[0020] S41a: Randomly number all pixel points in the first area of ​​the sample;

[0021] S42a: sorting the random numbers;

[0022] S43a: Sample each piece to be tested in sequence. The sampling point of each piece to be tested in the first area is M1 / K. The pieces to be tested are sampled in sequence according to the corresponding positions of the sorted sample pixel points.

[0023] Furthermore, the random numbering rules in step S41a are as follows:

[0024] S411: Obtain a random four-digit number, where the random four-digit number is a random serial number corresponding to the Nth pixel, and N is a positive integer;

[0025] S412: Obtain the square value of the random four-digit number: if the square value is a seven-digit number, proceed to step S413; if the square value is an eight-digit number, proceed to step S414;

[0026] S413: padding a zero on the left side of the first digit of the seven-digit number to make the seven-digit number an eight-digit number;

[0027] S414: Select the middle four digits of the eight-digit number as a new random four-digit number, and set the new random four-digit number as the random sequence number corresponding to the N+1th pixel point.

[0028] Furthermore, in step S4, the sampling position in the test piece is made the same as the sampling position in the sample piece through the following specific steps:

[0029] S41b: Establishing a three-dimensional spatial coordinate system;

[0030] S42b: when obtaining the sample color data set, recording the placement position of the sample in the three-dimensional coordinate system;

[0031] S43b: Place the piece to be tested at the same position as the sample piece in the three-dimensional coordinate system.

[0032] Furthermore, the color difference in step S5 is a comprehensive color difference ΔE, which satisfies the following formula:

[0033] △E=(△L) 2 +(△a) 2 +(△b) 2 ,

[0034] Among them, △L is the lightness difference, △a is the first chromaticity difference, and △b is the second chromaticity difference. The larger the △E value, the greater the color difference.

[0035] Furthermore, the brightness difference ΔL satisfies the following formula:

[0036] △L=L-L1,

[0037] Wherein, L is the lightness index of the color data in the sample color data set, and L1 is the lightness index of the color data in the test piece color data set. When the lightness difference △L is a positive value, it means that the test piece is lighter in color and has higher lightness than the sample piece. When the lightness difference △L is a negative value, it means that the test piece is darker in color and has lower lightness than the sample piece.

[0038] Furthermore, the first chromaticity difference Δa and the second chromaticity Δb satisfy the following formula:

[0039] △a=a-a1

[0040] △b=b-b1,

[0041] Among them, the first chromaticity index of the color data in the sample color data set is a, the second chromaticity index of the color data in the sample color data set is b, the first chromaticity index of the color data in the color data set of the piece to be tested is a1, and the second chromaticity index of the color data in the color data set of the piece to be tested is b1. When the chromaticity difference △a is a positive value, it means that the piece to be tested is redder or less green than the sample; when the chromaticity difference △a is a negative value, it means that the piece to be tested is greener or less redder than the sample; when the chromaticity difference △b is a positive value, it means that the piece to be tested is yellower or less bluer than the sample; when the chromaticity difference △b is a negative value, it means that the piece to be tested is bluer or less yellower than the sample.

[0042] Furthermore, the method for determining whether the test piece is qualified is as follows, and the following steps can replace the step S5:

[0043] Sc1: Fitting the sample pixel color data curve according to the sample color data set;

[0044] Sc2: Fitting the color data curve of the pixel points of the test piece according to the color data set of the test piece;

[0045] Sc3: Compare the sample pixel color data curve with the test pixel color data curve. When the difference between the two curves is within a certain range, the test piece can be determined to be qualified. When the difference between the two curves exceeds a certain range, the test piece can be determined to be unqualified.

[0046] Furthermore, in step S3: when the number of pixel groups in the second area is 0, the following operations are performed:

[0047] S31: Calculate the ratio of the number of all pixels in the sample to the number of all test pieces. The ratio is the number of sampling points on each test piece:

[0048] N1=(M1+M2) / K

[0049] Wherein, M1 is the sum of the number of pixels in the first area, M2 is the sum of the number of pixels in the second area, K is the number of all the pieces to be tested, and N1 is the number of sampling points for each piece to be tested;

[0050] S32: Compare the number of sampling points N1 of each piece to be tested with the preset number of sampling points Q of each piece to be tested. If N1 ≥ Q, proceed to step S4; if N1 < Q, proceed to step S33;

[0051] S33: Divide the DUT into N2 sub-DUT sets, each of which contains N3 DUTs. The number of sampled pixels of a DUT in each sub-DUT set is P', and the following conditions are satisfied:

[0052] N2=(M1+M2) / Q,

[0053] N3=K / N2,

[0054] P'=(M1+M2) / N3;

[0055] S34: Enter step S4.

[0056] The present invention also provides a device for automatically detecting color difference of trademark paper, which is applied to the method for automatically detecting color difference of trademark paper as described above, comprising: an acquisition module, a processing module and a judgment module that are communicatively connected in sequence;

[0057] The acquisition module is used to acquire the color data of all pixels in the sample and the color data of the sampling points in the test piece;

[0058] The processing module is used to divide the pixel points into a first area and a second area according to the sample color data set, and compare the sample color data set obtained from the acquisition module with the sample color data set to obtain a color difference;

[0059] The judgment module is used to judge whether the color difference is within a preset color difference threshold range. If the color difference is less than the preset color difference threshold, the part to be tested is qualified; if the color difference is greater than the preset color difference threshold, the part to be tested is unqualified.

[0060] The present invention has the following beneficial technical effects:

[0061] By dividing all pixel points of the sample into different areas, and performing partial and full sampling on the corresponding positions of the test piece in the same area according to the characteristics of different areas to obtain the color data of the sampling points, the color data of the sample and the color data of the test piece are then compared for color difference to determine the test result; this automated color detection method is conducive to improving the accuracy of color difference detection and reducing the error caused by fixed-point sampling. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 This is a flow chart of a method for automatically detecting color differences of trademark paper according to an embodiment of the present application.

[0063] Figure 2 Schematic diagram of an automatic detection device for color difference of trademark paper according to an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to enable people skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0065] In the description of the embodiments of the present application, words such as "exemplary", "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present the relevant concepts in a concrete way. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of such features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0066] Example 1

[0067] like Figure 1The first embodiment of the method for automatically detecting color difference of trademark paper according to the present invention is shown, which specifically includes the following steps:

[0068] Sa: Obtain a signal indicating that the sample has reached the area to be tested. If it is detected that the sample has reached the area to be tested, proceed to step S1. If it is detected that the sample has not reached the area to be tested, repeat step Sa.

[0069] S1: Obtain the color data of all pixels in the sample to obtain a sample color dataset.

[0070] After obtaining the signal that the sample has reached the area to be tested, the sample is scanned and the color data of all pixels in the sample is obtained; this is conducive to the automation of color difference detection and is conducive to improving the efficiency of color difference detection.

[0071] Specifically, when automatically testing color differences on finished label paper, data from a sample of the label paper must first be collected. When the label paper sample arrives at the test area, the central control system detects the arrival of the label paper sample via a receiving sensor (in this embodiment, an infrared sensor). Subsequently, the central control system controls a dust removal device to remove dust from the surface of the label paper sample to prevent dust or fine particles from interfering with subsequent operations. Finally, a scanning device obtains color data corresponding to each pixel in the label paper sample, where the color data is evaluated in the Lab color space.

[0072] S2: Pixel points with the same color data in the sample color data set are grouped into pixel groups, and the sample color data set is divided into multiple pixel groups.

[0073] Each pixel group contains at least one pixel point. The pixel points in the sample color data set can be divided into multiple different pixel groups according to whether the color data are the same.

[0074] In one embodiment, there are a total of 10,000 pixels in the sample, of which 5,000 pixels have color data A, 3,150 pixels have color data B, 1,000 pixels have color data C, and the number of remaining pixels with the same color data does not exceed 100. In this case, A, B, C, etc. are divided into several pixel groups.

[0075] S3: Classifying the plurality of pixel groups into a first region and a second region respectively: wherein the pixel groups whose number of pixels exceeds a preset pixel number threshold are classified into the first region, and the remaining pixel groups are classified into the second region.

[0076] In the above example, the preset pixel number threshold is 2000. Then, the first area includes two pixel groups A and B. All pixel points with color data A and B in the two pixel groups are in the first area, and C and other remaining pixel points are divided into the second area.

[0077] S4: Sampling is performed in the piece to be tested, and color data of corresponding sampling points in the piece to be tested is obtained to obtain a color data set of the piece to be tested. The sampling rules are as follows: the position where sampling is performed in the piece to be tested is the same as the position where sampling is performed in the sample piece, and the position of the pixel point in the first area of ​​the piece to be tested corresponding to the sample piece is partial sampling, and the position of the pixel point in the second area of ​​the piece to be tested corresponding to the sample piece is full sampling.

[0078] Get the number of all pixels in the first area and define M1 as the sum of the number of pixels in the first area. Get the number of all pieces to be tested and define K as the number of pieces to be tested. Then the number of sampling points P1 of the piece to be tested in the first area of ​​the corresponding sample satisfies:

[0079] P1=M1 / K,

[0080] Determining the number of sampling points within the first area for each piece under test, so as to set multiple sampling points within the first area, which is beneficial for performing color difference detection on all sampling points within the first area and is beneficial for reducing errors in color difference detection;

[0081] Define M2 as the sum of the number of pixels in the second area, then the number of sampling points P2 of the DUT in the second area of ​​the corresponding sample satisfies:

[0082] P2=M2,

[0083] The total number of sampling points P of the test piece satisfies:

[0084] P=P1+P2=M1 / K+M2;

[0085] In one embodiment, the sum of the number of pixels in the first area of ​​the trademark paper sample, M1, is 8150, and the sum of the number of pixels in the second area, M2, is 1850. Therefore, the total number of pixels in the trademark paper sample is M1+M2=10,000. The number of test pieces K is 50. Therefore, the number of sampling points in the first area of ​​each test piece corresponding to the sample piece, P1=M1 / K=8150 / 50=163, the number of sampling points in the second area of ​​the test piece corresponding to the sample piece, P2=M2=1850, and the total number of sampling points of the test piece, P=P1+P2=M1 / K+M2=2013.

[0086] (1) Make the sampling position in the test piece the same as the sampling position in the sample piece by following the specific steps below:

[0087] S41b: Establishing a three-dimensional spatial coordinate system;

[0088] S42b: when obtaining the sample color data set, recording the placement position of the sample in the three-dimensional coordinate system;

[0089] S43b: Place the test piece at the same position as the sample piece in the three-dimensional coordinate system;

[0090] Specifically, the shape and size of the piece to be tested and the sample are the same, and the placement position of the sample when scanning the sample is the same as the placement position of the piece to be tested when scanning the piece to be tested. A positioning instrument can be used for corresponding positioning to ensure that the sampling point position when sampling the piece to be tested is the same as the position of the corresponding pixel point in the sample.

[0091] (2) Selecting pixels within the first area, specifically including the following steps:

[0092] S41a: Randomly number all pixel points in the first area of ​​the sample;

[0093] The random numbering rules are as follows:

[0094] S411: Obtain a first random four-digit number, where the first random four-digit number is a random serial number corresponding to the first pixel;

[0095] S412: Obtain the square value of the first random four-digit number: if the square value is a seven-digit number, proceed to step S413; if the square value is an eight-digit number, proceed to step S414;

[0096] S413: padding a zero to the left of the first digit of the seven-digit number to make the seven-digit number an eight-digit number;

[0097] S414: Select the middle four digits of the eight digits as a second random four-digit number, and set the second random four-digit number as the random sequence number corresponding to the second pixel point;

[0098] And so on, to obtain the random serial numbers of all pixels in the first area;

[0099] Specifically: after determining the number of pixels in the first area that need to be sampled in each piece to be tested, it is necessary to determine the position of the specific sampling pixels. In this embodiment, the pixel points corresponding to the random numbers are used to determine the positions of the sampled pixels. For example, the first random four-digit number corresponding to the first pixel is 2333, so its square value is 5442889. In order to obtain the second random four-digit number based on the first random four-digit number, it is necessary to fill a 0 on the left side of 5442889 to make the square value become an eight-digit number such as 05442889. Take out the middle four digits of the eight-digit number 05442889, that is, 4428 as the second random four-digit number. If the square value of the first random four-digit number corresponding to the first pixel is an eight-digit number, then directly take out the middle four digits of the eight-digit number as the second random four-digit number. In one embodiment, the first random four-digit number corresponding to the first pixel point is 4428, so the obtained square value 19607184 is an eight-digit number. At this time, the second random four-digit number corresponding to the second pixel point is 6071, that is, 6071 is the random serial number corresponding to the second pixel point.

[0100] S42a: sort the random numbers;

[0101] The random numbers corresponding to different pixel points are sorted according to size, a preset number of pixel points with the random numbers sorted first are set as multiple sampling points, and the positions of the multiple sampling points are determined according to the positions of the preset number of pixel points with the random numbers sorted first within the first area.

[0102] S43a: Sampling each piece to be tested in sequence, with the sampling point of each piece to be tested in the first area being M1 / K, and sampling the pieces to be tested in sequence according to the corresponding positions of the sorted sample pixel points;

[0103] In one embodiment, if the number P1 of sampling points in the first area of ​​the corresponding sample for each piece to be tested is 163, then the random serial numbers corresponding to the sampling points in the first area are sorted from small to large, and the sampling points corresponding to the random serial numbers sorted from 1 to 163 are selected from the first piece to be tested for sampling, and the sampling points corresponding to the random serial numbers sorted from 164 to 326 are selected from the second piece to be tested for sampling, so as to determine the positions of the sampling points in the first area of ​​different pieces to be tested, and so on.

[0104] All pixels within the first region are assigned different random numbers, sorted according to their numerical values, and the pixels corresponding to a fixed number of random numbers that are ranked first are set as multiple sampling points. Furthermore, the positions of the multiple sampling points are determined based on the positions of the fixed number of random numbers that are ranked first within the first region. Setting the sampling point positions corresponding to the random numbers facilitates random selection of sampling points, improves the randomness of color difference detection, and reduces the error of color difference detection.

[0105] By selecting random numbers, the serial numbers corresponding to different pixel points are set according to the random numbers. At the same time, the positions of the sampling points in the first area taken for different pieces to be tested are different during the testing process. The set of sampling points of all pieces to be tested in the first area corresponds to all the pixel points in the first area of ​​the sample, which is conducive to reducing errors in subsequent color difference detection.

[0106] S5: Compare the color data set of the test piece with the corresponding sample color data set to obtain a color difference; if the color difference is less than a preset color difference threshold, the test piece is qualified; if the color difference is greater than the preset color difference threshold, the test piece is unqualified.

[0107] The step of obtaining a color difference value according to color data of corresponding sampling points in the sample specifically includes:

[0108] Calculate the difference between the color data of the sampling point in the test piece and the color data of the corresponding sampling point in the sample piece to obtain the brightness difference and chromaticity difference;

[0109] The color difference calculation formula of the preset color space is used to obtain the color difference value according to the lightness difference, chromaticity difference and the color difference calculation formula of the color space.

[0110] Difference calculation is performed based on the color data of the corresponding sampling points in the sample to obtain the lightness difference and chromaticity difference of each sampling point. The color difference value is obtained based on the preset color difference calculation formula of the color space and the lightness difference and chromaticity difference of the sampling points. The total color difference of the test piece is obtained based on the lightness difference and chromaticity difference of different sampling points in the test piece and the corresponding sampling points in the sample. This is beneficial for comprehensive color difference detection of the test piece and is beneficial for improving the accuracy of color detection of the test piece.

[0111] The lightness difference △L satisfies the following formula:

[0112] △L=L-L1,

[0113] Wherein, L is the lightness index of the color data in the sample color data set, and L1 is the lightness index of the color data in the test piece color data set. When the lightness difference △L is a positive value, it means that the test piece is lighter in color and has higher lightness than the sample piece. When the lightness difference △L is a negative value, it means that the test piece is darker in color and has lower lightness than the sample piece.

[0114] The first chromaticity difference △a and the second chromaticity △b satisfy the following formula:

[0115] △a=a-a1

[0116] △b=b-b1,

[0117] Wherein, the first chromaticity index of the color data in the sample color data set is a, the second chromaticity index of the color data in the sample color data set is b, the first chromaticity index of the color data in the color data set of the test piece is a1, and the second chromaticity index of the color data in the color data set of the test piece is b1. When the chromaticity difference △a is a positive value, it means that the test piece is redder or less green than the sample piece; when the chromaticity difference △a is a negative value, it means that the test piece is greener or less redder than the sample piece; when the chromaticity difference △b is a positive value, it means that the test piece is yellower or less bluer than the sample piece; when the chromaticity difference △b is a negative value, it means that the test piece is bluer or less yellower than the sample piece;

[0118] The color difference is the comprehensive color difference △E, which satisfies the following formula

[0119] △E=(△L) 2 +(△a) 2 +(△b) 2 ,

[0120] Among them, △L is the lightness difference, △a is the first chromaticity difference, and △b is the second chromaticity difference. The larger the △E value, the greater the color difference.

[0121] If the color difference is within the preset color difference threshold range, the tested piece is set as a qualified piece.

[0122] Specifically, when ΔE is within a preset color difference threshold range, the part under test is considered qualified; otherwise, the part under test is considered unqualified. In one embodiment, when the preset color difference threshold range is 0-0.5, there is almost no color difference. At this time, the color difference of the part under test is 0.25, indicating that the part under test is qualified.

[0123] Example 2

[0124] The following is a second embodiment of a method for automatically detecting color differences in trademark paper according to the present invention. This embodiment is a special case of the first embodiment. The method in the first embodiment is for images with mostly consistent colors but a few areas with inconsistent colors. The method in this embodiment is for images with consistent colors throughout. In this case, the number of pixels in the second area is 0. The following operations are performed:

[0125] S31: Calculate the ratio of the number of all pixels in the sample to the number of all test pieces. The ratio is the number of sampling points on each test piece:

[0126] N1=(M1+M2) / K

[0127] Wherein, M1 is the sum of the number of pixels in the first area, M2 is the sum of the number of pixels in the second area, K is the number of all the pieces to be tested, and N1 is the number of sampling points for each piece to be tested;

[0128] S32: Compare the number of sampling points N1 of each piece to be tested with the preset number of sampling points Q of each piece to be tested. If N1 ≥ Q, proceed to step S4; if N1 < Q, proceed to step S33;

[0129] S33: Divide the DUT into N2 sub-DUT sets, each of which contains N3 DUTs. The number of sampled pixels of a DUT in each sub-DUT set is P', and the following conditions are satisfied:

[0130] N2=(M1+M2) / Q,

[0131] N3=K / N2,

[0132] P'=(M1+M2) / N3;

[0133] S34: Go to step S4.

[0134] For example, if the sample contains 10,000 pixels (i.e., M1 + M2 = 10,000), and there are 200 test pieces (i.e., K = 200), then the number of pixels sampled per test piece, N1, is 10,000 / 200 = 50. The preset sampling number, Q, for each test piece is 500, so 50 < 500. In this case, N2 = 10,000 / 50 = 200. The 200 test pieces need to be divided into 20 sub-sets (N3 = 200 / 20 = 10), each containing 10 test pieces. At this point, the number of pixels sampled per test piece, P', is 10,000 / 10 = 1,000. Each of these 10 test pieces undergoes color difference testing.

[0135] In this embodiment, the test pieces are divided into multiple sub-sets, each containing the same number of test pieces. By employing the above technical solution, when the number of sampling points per test piece is less than a preset number of sampling points, all test pieces are divided into multiple sub-sets containing the same number of test pieces, and the number of sampling points in each sub-set is determined based on the ratio of the total number of pixels in the sample to the number of sub-sets. Dividing all test pieces into multiple sub-sets helps increase the number of color difference detection points per test piece. This ensures a sufficient number of sampling points per test piece even when the number of test pieces is large, thus improving detection accuracy.

[0136] By adopting the above-mentioned technical solution, the method for sampling pixels in a test piece further includes determining the number of sampling points for each test piece based on the ratio of the number of pixels in the sample piece to the number of all test pieces. When the number of sampling points for each test piece exceeds a preset number of sampling points, the sampling point positions in different test pieces are set to different positions. The set of sampling point positions in all test pieces is the set of all pixels in the sample piece. By testing different sampling point positions in different test pieces and performing comparative testing on all pixels in the sample piece, the accuracy of color difference detection is improved.

[0137] Example 3

[0138] The following is a third embodiment of a method for automatically detecting color difference of trademark paper according to the present invention. This embodiment is similar to the second embodiment, except that the method for determining whether the test piece is qualified is as follows. Step S5 can be replaced by the following steps:

[0139] Sc1: Fitting the sample pixel color data curve according to the sample color data set;

[0140] Sc2: Fitting the color data curve of the pixel points of the test piece according to the color data set of the test piece;

[0141] Sc3: Compare the sample pixel color data curve with the test pixel color data curve. When the difference between the two curves is within a certain range, the test piece can be judged as qualified. When the difference between the two curves exceeds a certain range, the test piece can be judged as unqualified.

[0142] By comparing the sample pixel color data curve with the test piece pixel color data curve, you can more intuitively see the color data of the sample and the test piece. By comparing the two, you can get the color difference, which is more clear at a glance.

[0143] Example 4

[0144] like Figure 2 The present invention shows an embodiment of a device for automatically detecting color difference of trademark paper, which is applied to the above method for automatically detecting color difference of trademark paper, comprising: an acquisition module, a processing module and a judgment module that are communicatively connected in sequence;

[0145] The acquisition module is used to obtain the color data of all pixels in the sample and the color data of the sampling points in the test piece;

[0146] The processing module is used to divide the pixel points into a first area and a second area according to the sample color data set, and compare the sample color data set obtained from the acquisition module with the sample color data set to obtain a color difference;

[0147] By adopting the above technical solution, the acquisition module obtains the color data of all pixels in the sample, and divides the pixels into different areas according to the processing module to determine the sampling points in the test piece. The processing module divides the pixels into a first area and a second area, the first area is a set of pixels with the same color data, and the second area is a set of all pixels except the first area. The color data of the sampling points in the entire second area and the first area are collected, and the color difference of the sampling points of the test piece is obtained. The judgment module judges whether the color difference is within the preset color difference threshold range. If the color difference is within the preset color difference threshold range, it is determined that the test piece is a qualified piece. Performing color difference detection on the test piece by the acquisition module, the processing module and the judgment module is conducive to improving the accuracy of color difference detection and reducing the error existing in fixed-point sampling.

[0148] It should be noted that the above embodiments provide devices that implement their functions using only the division of the above functional modules as examples. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0149] The embodiments of this specific implementation method are all preferred embodiments of the present application and are not intended to limit the scope of protection of the present application. Therefore, any equivalent changes made based on the structure, shape, and principle of the present application should be included in the scope of protection of the present application.

Claims

1. A method for automatically detecting color difference of trademark paper, characterized in that: The specific steps include: S1: Obtain the color data of all pixels in the sample to obtain the sample color data set; S2: Pixel points with the same color data in the sample color data set are grouped into pixel groups, and the sample color data set is divided into a plurality of pixel groups; S3: classifying the plurality of pixel groups into a first region and a second region respectively: wherein the pixel groups whose number of pixels exceeds a preset pixel number threshold are classified into the first region, and the remaining pixel groups are classified into the second region; S4: Sampling is performed in the device under test, and color data corresponding to sampling points in the device under test are obtained to obtain a color data set of the device under test. The sampling rule is as follows: the sampling positions in the device under test are the same as the sampling positions in the sample, and the positions of the pixels in the first area of ​​the device under test corresponding to the sample are partially sampled, and the positions of the pixels in the second area of ​​the device under test corresponding to the sample are fully sampled. In step S4, the number of sampling points P1 of the test piece in the first area corresponding to the sample piece satisfies: P1=M1 / K Where M1 is the sum of the number of pixels in the first area, K is the number of all the test pieces, Then the number of sampling points P2 of the tested piece in the second area of ​​the corresponding sample satisfies: P2=M2 Wherein, M2 is the sum of the number of pixels in the second area, The number of sampling points P of the test piece satisfies: P=P1+P2=M1 / K+M2; S5: Compare the color data set of the test piece with the corresponding sample color data set to obtain a color difference; if the color difference is less than a preset color difference threshold, the test piece is qualified; if the color difference is greater than the preset color difference threshold, the test piece is unqualified.

2. The method for automatically detecting color difference of trademark paper according to claim 1, characterized in that: The selection of pixels within the first area in step S4 specifically includes the following steps: S41a: Randomly number all pixel points in the first area of ​​the sample; S42a: sorting the random numbers; S43a: Sample each piece to be tested in sequence. The sampling point of each piece to be tested in the first area is M1 / K. The pieces to be tested are sampled in sequence according to the corresponding positions of the sorted sample pixel points.

3. The method for automatically detecting color difference of trademark paper according to claim 2, characterized in that: The random numbering rules in step S41a are as follows: S411: Obtain a random four-digit number, where the random four-digit number is a random serial number corresponding to the Nth pixel, and N is a positive integer; S412: According to the random four-digit number, obtain its square value: if the square value is seven digits, proceed to step S413; if the square value is eight digits, proceed to step S414; S413: padding a zero on the left side of the first digit of the seven-digit number to make the seven-digit number an eight-digit number; S414: Select the middle four digits of the eight-digit number as a new random four-digit number, and set the new random four-digit number as the random sequence number corresponding to the N+1th pixel point.

4. The method for automatically detecting color difference of trademark paper according to any one of claims 1 to 3, characterized in that: In step S4, the sampling position in the test piece is made the same as the sampling position in the sample piece through the following specific steps: S41b: Establishing a three-dimensional spatial coordinate system; S42b: when obtaining the sample color data set, recording the placement position of the sample in the three-dimensional coordinate system; S43b: Place the piece to be tested at the same position as the sample piece in the three-dimensional coordinate system.

5. The method for automatically detecting color difference of trademark paper according to claim 1, characterized in that: The color difference in step S5 is a comprehensive color difference ΔE, which satisfies the following formula: , Where △L is the brightness difference, a is the first chromaticity difference, b is the second chromaticity difference, The larger the E value, the greater the color difference.

6. The method for automatically detecting color difference of trademark paper according to claim 5, characterized in that: The lightness difference ΔL satisfies the following formula: , Among them, L is the color data brightness index of the sample color data set, L1 is the color data brightness index of the test piece color data set, when the brightness difference When L is a positive value, it means that the color of the piece to be tested is lighter than that of the sample and the brightness is higher. When the brightness difference △L is a negative value, it means that the color of the piece to be tested is darker than that of the sample and the brightness is lower.

7. The method for automatically detecting color difference of trademark paper according to claim 6, characterized in that: First chromaticity difference a and secondary chromaticity b satisfies the following formula: , Among them, the first chromaticity index of the color data in the sample color data set is a, the second chromaticity index of the color data in the sample color data set is b, the first chromaticity index of the color data in the color data set of the test piece is a1, and the second chromaticity index of the color data in the color data set of the test piece is b1. When a is positive, it means that the tested piece is redder or less green than the sample. When a is a negative value, it means that the test piece is greener or less red than the sample. When b is positive, it means that the color of the test piece is yellower or less blue than the sample. When b is a negative value, it means that the test piece is bluer or less yellow than the sample.

8. The method for automatically detecting color difference of trademark paper according to claim 1, characterized in that: The method for determining whether the test piece is qualified is as follows. The following steps can replace step S5: Sc1: Fitting the sample pixel color data curve according to the sample color data set; Sc2: Fitting the color data curve of the pixel points of the test piece according to the color data set of the test piece; Sc3: Compare the sample pixel color data curve with the test pixel color data curve. When the difference between the two curves is within a certain preset range, the test piece can be determined to be qualified. When the difference between the two curves exceeds the preset range, the test piece can be determined to be unqualified.

9. The method for automatically detecting color difference of trademark paper according to claim 1, characterized in that: In step S3: when the number of pixel groups in the second area is 0, the following operations are performed: S31: Calculate the ratio of the number of all pixels in the sample to the number of all test pieces. The ratio is the number of sampling points on each test piece: N1=(M1+M2) / K Wherein, M1 is the sum of the number of pixels in the first area, M2 is the sum of the number of pixels in the second area, K is the number of all the pieces to be tested, and N1 is the number of sampling points for each piece to be tested; S32: Compare the number of sampling points N1 of each piece to be tested with the preset number of sampling points Q of each piece to be tested. If N1 ≥ Q, proceed to step S4; if N1 < Q, proceed to step S33; S33: Divide the DUT into N2 sub-DUT sets, each of which contains N3 DUTs. The number of sampled pixels of a DUT in each sub-DUT set is P', and the following conditions are satisfied: N2=(M1+M2) / Q, N3=K / N2, P'=(M1+M2) / N3; S34: Go to step S4.

10. An automatic detection device for color difference of trademark paper, characterized in that: The method for automatically detecting color difference of trademark paper according to any one of claims 1 to 9 comprises: an acquisition module, a processing module, and a judgment module that are communicatively connected in sequence; The acquisition module is used to acquire the color data of all pixels in the sample and the color data of the sampling points in the test piece; The processing module is used to divide the pixel points into a first area and a second area according to the sample color data set, and compare the sample color data set obtained from the acquisition module with the sample color data set to obtain a color difference; The judgment module is used to judge whether the color difference is within a preset color difference threshold range. If the color difference is less than the preset color difference threshold, the part to be tested is qualified; if the color difference is greater than the preset color difference threshold, the part to be tested is unqualified.

Citation Information

Patent Citations

  • Atmosphere light effective color obtaining method and device and display device

    CN106803948A

  • Color difference adaptive online detection method and device based on SLIC super pixel segmentation

    CN110108362A