A thermal paper coating quality image recognition method, system, device and medium
By using image recognition technology to obtain the light transmittance image of thermal paper and convert it into a grayscale image, the distribution range of pixels and function errors are determined, which solves the problems of low efficiency and inaccurate pass rate of thermal paper coating quality identification, and realizes efficient and accurate coating quality detection.
Patent Information
- Application Number
- CN202510480096.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-04-17
AI Technical Summary
Existing thermal paper coating quality identification technologies are inefficient and have inaccurate pass rates. The use of dynamic color-generating instruments and thermal printers for detection results in low identification efficiency and inaccurate overall pass rates.
By establishing an image acquisition scene, the light transmittance image of the thermal paper is obtained and converted into a grayscale image. The grayscale value distribution range of the pixels is determined, and grayscale processing methods and function error methods are used to determine whether there is a central area depression in the thermal paper, thereby improving detection efficiency and accuracy.
It enables real-time detection of thermal paper coating quality, improves detection efficiency and overall pass rate, and avoids misjudgment caused by central depression in traditional methods.
Smart Images

Figure CN120471831B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of thermal paper coating quality identification, in particular to a thermal paper coating quality image identification method, system, device and medium. BACKGROUND
[0002] Thermal paper is applied in retail, logistics, catering and banking industries. Thermal paper can print characters on the paper without using ink because the surface of the paper is coated with a layer of thermal material. The quality of the thermal paper coating determines the clarity of the printed characters on the thermal paper. Therefore, thermal paper coating quality identification is a key step in producing thermal paper.
[0003] The existing thermal paper coating quality identification technology usually uses dynamic color developing instruments to test the saturated luminous density in the production process, which has a long test period and is not conducive to rapid production and adjustment of the coating machine. The existing technology also directly uses a thermal printer to print thermal paper samples to observe the sample quality. The thermal paper samples detected using this method cannot be used again, and the overall thermal paper pass rate obtained is not accurate because all thermal papers cannot be detected. For example, in the patent application with the authorization announcement number CN112504984B, a simple test method for the saturated color light density of low basis weight thermal paper is disclosed. This scheme proposes using a thermal printer to print thermal paper samples to observe the sample quality. After detection, the samples cannot be used, and the overall thermal paper pass rate obtained is not accurate. The existing thermal paper coating quality identification technology uses dynamic color developing instruments and thermal printers to detect the coating quality, resulting in low identification efficiency and inaccurate overall thermal paper coating pass rate. SUMMARY
[0004] The present application aims to at least solve one of the technical problems in the prior art, obtain a detection grayscale image, determine whether the distribution range of the grayscale values of all pixel points in the detection grayscale image is abnormal, and determine whether the to-be-detected thermal paper corresponding to the initial abnormal grayscale image is a middle area with a depression. This solves the problem of the existing thermal paper coating quality identification technology using dynamic color developing instruments and thermal printers to detect the coating quality, resulting in low identification efficiency and inaccurate overall thermal paper coating pass rate.
[0005] To achieve the above-mentioned purpose, in a first aspect, the present application provides a thermal paper coating quality image identification method, comprising the following steps:
[0006] An image acquisition scene is established, and a light transmission image of the to-be-detected thermal paper is obtained based on the image acquisition scene and is marked as a thermal paper light transmission image;
[0007] The thermal paper light transmission image is converted into a grayscale image using a grayscale processing method, and the grayscale image is marked as a detection grayscale image;
[0008] determining whether the distribution range of the gray scale values of all pixel points in the detection gray scale image is abnormal, and if so, marking the detection gray scale image as an initial abnormal gray scale image;
[0009] determining whether the to-be-detected thermal paper corresponding to the initial abnormal gray scale image is a middle region with a depression, and if not, issuing a coating abnormality signal of the to-be-detected thermal paper.
[0010] Further, the image acquisition scene includes the following sub-steps:
[0011] The end of the coating machine is provided with two parallel rollers for conveying the thermal paper, a plane region formed by the two parallel rollers is acquired, a vertical line passing through the midpoint of the plane region and perpendicular to the plane region is marked as a region vertical line, a light source is installed on one side of the plane region and on the region vertical line, and a camera is installed on the other side of the plane region and on the region vertical line.
[0012] Further, the gray scale processing method includes:
[0013] The RGB value of each pixel point in the light transmission image of the thermal paper is acquired.
[0014] The RGB value is converted into a gray scale value by using a gray scale conversion formula, and the gray scale conversion formula is:
[0015] RMH = 1 / 3*R + 1 / 3*G + 1 / 3*B; wherein RMH is the gray scale value, and R, G and B are three values in the RGB value.
[0016] Further, the determination of whether the distribution range of the gray scale values of all pixel points in the detection gray scale image is abnormal includes the following sub-steps:
[0017] The gray scale value of each pixel point in the detection gray scale image is counted and marked as a detection gray scale value.
[0018] Pmin and Pmax are acquired.
[0019] The number of detection gray scale values not in the range [Pmin, Pmax] is counted and marked as Jsn.
[0020] The total number of detection gray scale values is acquired and marked as Jsz.
[0021] The detection proportion is calculated as: Jsh = Jsn / Jsz; wherein Jsh is the detection proportion.
[0022] The light transmission image obtained by the first number of unqualified thermal papers passing through the image acquisition scene is acquired and marked as an unqualified light transmission image, the unqualified light transmission image is converted into a gray scale image by using the gray scale processing method, and the gray scale image is marked as an unqualified gray scale image, the gray scale value of each pixel point in the unqualified gray scale image is acquired and marked as an unqualified gray scale value.
[0023] Obtain the total number of unqualified gray scale values in any unqualified gray scale image, marked as Jlz;
[0024] Count the number of unqualified gray scale values in the range of [Pmin, Pmax], marked as Jln;
[0025] Calculate the unqualified proportion as: Jlh=Jln / Jlz; wherein Jlh is the unqualified proportion;
[0026] Obtain the unqualified proportion of each unqualified transmittance image, and obtain the minimum value of the unqualified proportion, marked as Jlm;
[0027] Determine whether Jsh is less than Jlm, if not, mark the detection gray scale image as an initial abnormal gray scale image.
[0028] Further, obtaining Pmin and Pmax includes the following sub-steps:
[0029] Obtain the transmittance image of the second number of coated qualified heat-sensitive paper obtained by the image acquisition scene, marked as a qualified transmittance image;
[0030] Convert the qualified transmittance image into a gray scale image using a gray scale processing method, marked as a qualified gray scale image;
[0031] Statistically obtain the gray scale value of each pixel point in the qualified gray scale image, marked as a qualified gray scale value;
[0032] Divide the qualified gray scale values of 0-255 into n equal intervals on average;
[0033] Statistically obtain the frequency of the qualified gray scale value of each equal interval, marked as interval frequency;
[0034] Draw a histogram with the qualified gray scale value as the X-axis and the interval frequency as the Y-axis, marked as a qualified gray scale histogram;
[0035] Calculate the sum of the interval frequencies, marked as P z ;
[0036] Mark each interval frequency as P i ;
[0037] Calculate the frequency proportion of each interval frequency as: Pb i =P i / P z ; wherein Pb i is the frequency proportion of each interval frequency, and i ranges from 1 to n;
[0038] Determine whether each Pb i is less than the excessively small proportion threshold value, if so, delete the interval frequency corresponding to Pbi in the qualified gray scale histogram, and mark it as a modified gray scale histogram;
[0039] Obtaining the minimum and maximum values of the interval frequency in the X-axis data in the modified gray histogram, and marking them as Pmin and Pmax respectively.
[0040] Further, judging whether the initial abnormal gray image contains a concave middle region in the to-be-detected thermal paper includes the following sub-steps:
[0041] Obtaining the function error of the initial abnormal gray image by using the function error obtaining method, and marking it as a detection value;
[0042] The function error obtaining method includes:
[0043] Marking the edge of the initial abnormal gray image parallel to the parallel roller as a starting edge;
[0044] Dividing the initial abnormal gray image into m equal regions by m-1 straight lines parallel to a starting edge, and marking them as equal regions;
[0045] Calculating the mean value of the gray values of the pixel points in each equal region, and marking it as a regional gray mean value;
[0046] Starting from a starting edge, corresponding each regional gray mean value to a sequence number along the direction edge, and the sequence number is a positive integer starting from 1;
[0047] Marking the regional gray mean value with a sequence number of 1 as a starting gray mean value;
[0048] According to the sequence number from small to large, calculating the absolute value of the difference between the regional gray mean value and the starting gray mean value in turn, and marking it as a sequential difference value;
[0049] According to the order of calculating the sequential difference value, sequentially labeling the sequential difference value, and marking it as a sequence number, which is an integer starting from 1;
[0050] Establishing a plane rectangular coordinate system with the sequence number as the X-axis and the sequential difference value as the Y-axis, marking it as a difference value coordinate system, and drawing the sequence number and the corresponding sequential difference value into the difference value coordinate system to obtain a scatter plot, marking it as a difference value scatter plot;
[0051] Setting a preset fitting function as: Y=a*X 2 +b*X+c; wherein a, b and c are parameters of the preset fitting function; X is the sequence number, and Y is the sequential difference value;
[0052] Fitting the difference value scatter plot with the preset fitting function to obtain the specific values of a, b and c, and substituting the specific values of a, b and c into the preset fitting function to obtain a fitting function, marking it as a difference value fitting function;
[0053] Substituting the sequence number into the difference value fitting function to obtain Y value, marking it as Cy j ;
[0054] The sequence difference value is marked as Cs j ;
[0055] The Cy j is calculated, and the mean square error of Cs j is marked as a function error, and the calculation formula is:
[0056] ;
[0057] Wherein, Cz is the function error, Cy j is the Y value obtained by bringing the jth sequence number into the difference fitting function, Cs j is the sequence difference value corresponding to the jth sequence number, and k is the number of sequence numbers.
[0058] Further, the judgment of whether the to-be-detected thermal paper corresponding to the initial abnormal gray image is a middle area with a depression includes the following sub-steps:
[0059] A third number of middle non-depressed and unqualified coated thermal papers pass through the image acquisition scene to obtain a light transmission image, which is marked as an abnormal light transmission image, and the abnormal light transmission image is converted into a gray image by using a gray processing method, which is marked as an abnormal gray image;
[0060] The function error of each abnormal gray image is obtained by using the function error acquisition method, which is marked as an abnormal value;
[0061] The minimum value of the abnormal value is obtained, which is marked as an abnormal threshold value;
[0062] It is judged whether the detection value is less than the abnormal threshold value, and if greater, an abnormal coating signal of the to-be-detected thermal paper is issued.
[0063] In a second aspect, the application provides a thermal paper coating quality image recognition system, which comprises an image acquisition module, a gray processing module, an initial judgment module, and a final judgment module;
[0064] The image acquisition module is used to establish an image acquisition scene, and based on the image acquisition scene, a light transmission image of a to-be-detected thermal paper is obtained, which is marked as a thermal paper light transmission image;
[0065] The gray processing module is used to convert the thermal paper light transmission image into a gray image by using a gray processing method, which is marked as a detection gray image;
[0066] The initial judgment module is used to judge whether the distribution range of the gray values of all pixel points in the detection gray image is abnormal, and if so, the detection gray image is marked as an initial abnormal gray image;
[0067] The final judgment module is used to judge whether the to-be-detected thermal paper corresponding to the initial abnormal gray image is a middle area with a depression, and if not, an abnormal coating signal of the to-be-detected thermal paper is issued.
[0068] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer readable instructions, and when the computer readable instructions are executed by the processor, the steps in the above method are executed.
[0069] In a fourth aspect, the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above method are executed.
[0070] The present application has the following advantages: the present application judges whether the distribution range of the gray value of all pixel points in the detection gray image is abnormal, judges whether the to-be-detected thermal paper corresponding to the initial abnormal gray image is concave in the middle region, and has the advantages that whether the coated thermal paper is qualified is observed by light transmission, and compared with the traditional detection method, the detection efficiency is improved by real-time detection, sampling detection is not needed, and the accuracy of the overall thermal paper coating qualification rate is improved.
[0071] The present application judges whether the distribution range of the gray value of all pixel points in the detection gray image is abnormal, and has the advantages that in the thermal paper transmission process, the thermal paper may be concave in the middle between the two conveying shafts due to the thermal paper material, the light intensity is different due to the different distances from the light source of the concave part and the non-concave part, and the qualified thermal paper is judged as unqualified, so that the accuracy of the thermal paper coating quality judgment can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0072] Figure 1 It is a principle block diagram of the system of the present application;
[0073] Figure 2 It is a schematic diagram of the qualified gray histogram of the present application;
[0074] Figure 3 It is a schematic diagram of the difference coordinate system of the present application;
[0075] Figure 4 It is a step flow chart of the method of the present application. DETAILED DESCRIPTION
[0076] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0077] Embodiment 1, please refer to Figure 1As shown, the present application provides a thermal paper coating quality image recognition system, comprising an image acquisition module, a gray processing module, an initial judgment module and a final judgment module;
[0078] The image acquisition module is used to establish an image acquisition scene, and based on the image acquisition scene, a light transmission image of the thermal paper to be detected is acquired, which is marked as a thermal paper light transmission image;
[0079] The image acquisition module is configured with a scene establishment strategy, which comprises:
[0080] The end of the coating machine is provided with two parallel rollers for conveying the thermal paper, a plane area formed by the two parallel rollers is acquired, a vertical line passing through the midpoint of the plane area and perpendicular to the plane area is marked as a region vertical line, a light source is installed on one side of the plane area and on the region vertical line, and a camera is installed on the other side of the plane area and on the region vertical line;
[0081] In actual application, if the two parallel rollers are on the same horizontal plane, the camera is installed above the plane area, and the light source is installed below the plane area, and the light source can uniformly irradiate the part of the thermal paper that can be shot by the camera.
[0082] The gray processing module is used to convert the thermal paper light transmission image into a gray image by using a gray processing method, which is marked as a detection gray image;
[0083] The gray processing module is configured with a gray processing strategy, which comprises:
[0084] The RGB value of each pixel point in the thermal paper light transmission image is acquired;
[0085] The RGB value is converted into a gray value by using a gray conversion formula, and the gray conversion formula is:
[0086] RMH=1 / 3*R+1 / 3*G+1 / 3*B; wherein RMH is the gray value, R, G and B are three values in the RGB value; here, because the thermal paper is white, the light transmission image of the thermal paper is between black and white, therefore, the R, G and B of the light transmission image pixel point are equal, and therefore, the average weighted method is more appropriate;
[0087] The initial judgment module is used to judge whether the distribution range of the gray value of all pixel points in the detection gray image is abnormal, and if it is abnormal, the detection gray image is marked as an initial abnormal gray image;
[0088] The initial judgment module is configured with an initial judgment strategy, which comprises:
[0089] The gray value of each pixel point in the detection gray image is counted, which is marked as a detection gray value;
[0090] Pmin and Pmax are acquired;
[0091] The number of detection gray values not in the range [Pmin, Pmax] is counted and marked as Jsn;
[0092] The total number of detection gray values is obtained and marked as Jsz;
[0093] The detection proportion is calculated as Jsh=Jsn / Jsz; wherein Jsh is the detection proportion;
[0094] The light transmission diagram obtained by the first number of unqualified coated thermal paper passing through the image acquisition scene is obtained and marked as an unqualified light transmission diagram; the unqualified light transmission diagram is converted into a gray scale diagram using a gray scale processing method, and marked as an unqualified gray scale diagram; the gray scale value of each pixel point in the unqualified gray scale diagram is obtained and marked as an unqualified gray scale value;
[0095] The total number of unqualified gray scale values in any one unqualified gray scale diagram is obtained and marked as Jlz;
[0096] The number of unqualified gray scale values in the range [Pmin, Pmax] is counted and marked as Jln;
[0097] The unqualified proportion is calculated as Jlh=Jln / Jlz; wherein Jlh is the unqualified proportion;
[0098] The unqualified proportion of each unqualified light transmission diagram is obtained, and the minimum value of the unqualified proportion is obtained and marked as Jlm;
[0099] It is judged whether Jsh is less than Jlm, if not, the detection gray scale diagram is marked as an initial abnormal gray scale diagram;
[0100] In actual application, the number of detection gray values not in the range [95, 191] is counted as Jsn=600,000, the total number of detection gray values is obtained as Jsz=2,070,000; the detection proportion is calculated as Jsh=Jsn / Jsz=0.290, the detection proportion result is retained to three decimal places, and the unqualified proportion of each unqualified light transmission diagram is calculated as 0.832, 0.691, 0.59 and 0.232, etc., the minimum value of the unqualified proportion is obtained as Jlm=0.232; Jsh=0.290>Jlm=0.232, the detection gray scale diagram is marked as an initial abnormal gray scale diagram.
[0101] The initial judgment module is configured with a Pmin and Pmax acquisition strategy, and the Pmin and Pmax acquisition strategy comprises:
[0102] The light transmission diagram obtained by the second number of coated qualified thermal paper passing through the image acquisition scene is obtained and marked as a qualified light transmission diagram;
[0103] The qualified light transmission diagram is converted into a gray scale diagram using a gray scale processing method, and marked as a qualified gray scale diagram;
[0104] Calculate the grayscale value of each pixel in the qualified grayscale image and mark it as a qualified grayscale value;
[0105] The acceptable grayscale value of 0-255 is divided into n equal intervals; the larger the value of n, the more accurate the data obtained later.
[0106] Count the frequency of qualified gray values in each equally divided interval and mark it as the interval frequency;
[0107] Plot a histogram with the qualified grayscale value on the X-axis and the interval frequency on the Y-axis, and mark it as the qualified grayscale histogram;
[0108] Calculate the sum of the interval frequencies and label it as P. z ;
[0109] Label the frequency of each interval as P. i ;
[0110] The frequency percentage of each interval is calculated as: Pb i =P i / P z Pb i The frequency percentage for each interval is given by i, which ranges from [1, n].
[0111] Determine each Pb i If the value is less than the threshold for the excessively small proportion, delete the interval frequency corresponding to Pbi in the qualified grayscale histogram and mark it as needing modification. The threshold for the excessively small proportion is set to find the range of grayscale values with a low frequency distribution. The specific value depends on the setting of n. The value of Pbi in the qualified grayscale histogram will be... i If the frequency of an interval is less than the threshold for the proportion of too small intervals, it is marked as an interval that is too small.
[0112] Obtain the minimum and maximum values of the interval frequency in the X-axis data of the modified grayscale histogram, and label them as Pmin and Pmax respectively. Since the grayscale values of the projection image of qualified coated thermal paper will be similar, obtain Pmin and Pmax within a certain grayscale value range, which is the range of grayscale values of qualified coated thermal paper.
[0113] In practical applications, the acceptable grayscale values from 0 to 255 are divided into 8 equal intervals to create an acceptable grayscale histogram. Please refer to [link / reference needed]. Figure 2 As shown, since n=8, the threshold for the proportion of excessively small values is set to 1 / 8 / 2=0.0625. After deleting excessively small intervals, the grayscale histogram is modified to obtain Pmin=95 and Pmax=191.
[0114] The final judgment module is used for judging whether the to-be-detected thermal paper corresponding to the initial abnormal gray image is caused by the middle area of the to-be-detected thermal paper being concave, and if not, an abnormal coating signal of the to-be-detected thermal paper is sent out; in the process of transmitting the thermal paper, due to the material of the thermal paper, the thermal paper between the two transmission shafts may be concave in the middle, the concave part and the non-concave part are different from the distance to the light source, resulting in different light intensities, and causing the qualified thermal paper to be judged as unqualified;
[0115] The final judgment module is configured with a function error method strategy, and the function error method strategy includes:
[0116] The function error method is used to obtain the function error of the initial abnormal gray image, which is marked as a detection value.
[0117] The function error method includes:
[0118] The edge of the initial abnormal gray image parallel to the parallel roller is marked as a starting edge.
[0119] The initial abnormal gray image is divided into m equal areas by m-1 straight lines parallel to a starting edge, which are marked as equal areas; if the thermal paper is concave in the middle, the gray value of the equal area in the middle of the thermal paper and the equal area at the edge of the thermal paper will appear a difference; the greater the setting of m, the more accurate the subsequent obtained data, but the calculation amount is greatly increased, so the setting of m is not to affect the subsequent results while reducing the calculation amount, for example, m is set to 10.
[0120] The average value of the gray value of each pixel in each equal area is calculated, which is marked as the area gray average value.
[0121] Each area gray average value is corresponded to a sequence number along the direction edge starting from a starting edge, and the sequence number is a positive integer starting from 1.
[0122] The area gray average value with a sequence number of 1 is marked as a starting gray average value.
[0123] The absolute value of the difference between the area gray average value and the starting gray average value is calculated in order from small to large according to the sequence number, which is marked as the order difference; the difference between the area gray average values of each equal area is calculated, which can more prominently highlight the difference between the area gray average values.
[0124] The order difference is sequentially labeled according to the order of the calculated order difference, which is marked as the order number, and the order number is an integer starting from 1.
[0125] A plane rectangular coordinate system is established with the order number as the X-axis and the order difference as the Y-axis, which is marked as the difference value coordinate system, and the order number and the corresponding order difference are drawn into the difference value coordinate system to obtain a scatter plot, which is marked as the difference value scatter plot; the coordinate points of the order number and the corresponding order difference are marked as the order difference coordinate points.
[0126] The preset fitting function is set as: Y=a*X 2 +b*X+c; wherein a, b and c are parameters of the preset fitting function; X is the sequence number, and Y is the sequence difference value; because the recess trend of the thermal paper is similar to a quadratic equation curve, the recess of the thermal paper causes the light distance to be similar to a quadratic equation curve, and further causes the light intensity on the thermal paper to be similar to a quadratic equation curve, and further causes the average gray value of each equal area to be similar to a quadratic equation curve, so the sequence difference value can be fitted into a quadratic equation curve; therefore, the recess degree of different thermal papers, and the specific data of a, b and c of the difference fitting function are different;
[0127] The difference scatter plot is fitted with the preset fitting function to obtain the specific values of a, b and c, the specific values of a, b and c are substituted into the preset fitting function to obtain the fitting function, which is marked as the difference fitting function;
[0128] The sequence number is substituted into the difference fitting function to obtain the Y value, which is marked as Cy j ;
[0129] The sequence difference value is marked as Cs j ;
[0130] The mean square error of Cy j and Cs j is calculated, which is marked as the function error, and the calculation formula is:
[0131] ;
[0132] Wherein Cz is the function error, Cy j is the Y value obtained by substituting the jth sequence number into the difference fitting function, Cs j is the sequence difference value corresponding to the jth sequence number, and k is the number of sequence numbers; the mean square error is used to represent the accuracy of the equation fitted by setting the preset fitting function as: Y=a*X 2 +b*X+c;
[0133] In actual application, m is set to 10, so the sequence number is an integer from 1 to 10, and the sequence difference value coordinate point is plotted in the difference coordinate system, please refer to Figure 3 , by fitting the specific values of a, b and c-0.75, 7.5 and 6.75, the difference fitting is: Y=-0.75*X 2 +7.5*X+6.75, the sequence number is substituted into the difference fitting function to obtain Cy j , and then the function error Cz=2.34 is calculated, that is, the detection value is 2.34.
[0134] The final judgment module is configured with a final judgment strategy, and the final judgment strategy includes:
[0135] The light transmission diagram of the third number of intermediate non-falling and coating unqualified thermal paper obtained through the image acquisition scene is marked as an abnormal light transmission diagram, the abnormal light transmission diagram is converted into a gray diagram by using a gray processing method, and the abnormal gray diagram is marked.
[0136] The function error of each abnormal gray diagram is obtained by using an acquisition function error method, and is marked as an abnormal value; because the scatter plot of the serial number and the serial difference value of the intermediate non-falling and coating unqualified thermal paper does not appear to be similar to a one-dimensional quadratic equation curve, the function error obtained by using Y=a*X 2 +b*X+c fitting is very large;
[0137] The minimum value of the abnormal value is marked as an abnormal threshold value; the minimum value of the abnormal value is the minimum value of the function error of the intermediate non-falling and coating unqualified thermal paper, and if the abnormal threshold value is greater than
[0138] It is judged whether the detection value is less than the abnormal threshold value, and if greater than, a coating abnormal signal of the thermal paper to be detected is issued;
[0139] In actual application, 100 abnormal light transmission diagrams of intermediate non-falling and coating unqualified thermal paper obtained through the image acquisition scene are converted into gray diagrams by using a gray processing method, and are marked as abnormal gray diagrams, the abnormal values of each abnormal gray diagram are 12, 32, 21, 43 and 89, and the minimum value of the abnormal value is the abnormal threshold value=12, it is judged that the detection value 2.34 is less than the abnormal threshold value 12, and no coating abnormal signal of the thermal paper to be detected is issued.
[0140] Embodiment 2, please refer to Figure 4 The second aspect, the application provides a kind of thermal paper coating quality image recognition method, comprising the following steps:
[0141] Step S1, establish image acquisition scene, based on the light transmission diagram of the thermal paper to be detected obtained in image acquisition scene, marked as thermal paper light transmission diagram;Step S1 includes the following sub-steps:
[0142] Step S101, the end of coating machine is equipped with two parallel rollers for conveying thermal paper, obtain the plane area formed by two parallel rollers, draw a vertical line through the midpoint of the plane area and perpendicular to the plane area, mark as area vertical line, install light source on one side of the plane area and on the area vertical line, install camera on the other side of the plane area and on the area vertical line.
[0143] Step S2, the thermal paper light transmission diagram is converted into a gray diagram by using a gray processing method, and the detection gray diagram is marked;Step S2 includes the following sub-steps:
[0144] Step S201, obtaining the RGB value of each pixel point in the light transmission diagram of the thermal paper;
[0145] Step S202, converting the RGB value into a gray value by using a gray scale conversion formula, the gray scale conversion formula being: RMH=1 / 3*R+1 / 3*G+1 / 3*B; wherein RMH is the gray value, and R, G and B are three values in the RGB value.
[0146] Step S3, judging whether the distribution range of the gray value of all pixel points in the detection gray diagram is abnormal, if so, marking the detection gray diagram as an initial abnormal gray diagram; step S3 includes the following sub-steps:
[0147] Step S301, counting the gray value of each pixel point in the detection gray diagram, and marking the gray value as a detection gray value;
[0148] Step S302, obtaining Pmin and Pmax; step S302 includes the following sub-steps:
[0149] Step S30201, obtaining the light transmission diagram of the second number of coated qualified thermal papers passing through the image acquisition scene, and marking the light transmission diagram as a qualified light transmission diagram;
[0150] Step S30202, converting the qualified light transmission diagram into a gray diagram by using a gray processing method, and marking the gray diagram as a qualified gray diagram; counting the gray value of each pixel point in the qualified gray diagram, and marking the gray value as a qualified gray value;
[0151] Step S30203, dividing the qualified gray value of 0-255 into n equal intervals on average; counting the frequency of the qualified gray value in each equal interval, and marking the frequency as an interval frequency;
[0152] Step S30204, drawing a histogram with the qualified gray value as the X axis and the interval frequency as the Y axis, and marking the histogram as a qualified gray histogram;
[0153] Step S30205, calculating the sum of the interval frequencies, and marking the sum as P z ;
[0154] Step S30206, marking each interval frequency as P i ;
[0155] Step S30207, calculating the frequency ratio of each interval frequency as: Pb i =P i / P z ; wherein Pb i is the frequency ratio of each interval frequency, and i ranges from 1 to n;
[0156] Step S30208, judging whether each Pb iIf yes, the interval frequency corresponding to Pbi in the qualified gray scale histogram is deleted, and marked as a modified gray scale histogram.
[0157] In step S30209, the minimum and maximum values of the interval frequency in the X-axis data of the modified gray scale histogram are obtained, and marked as Pmin and Pmax respectively.
[0158] In step S303, the number of detection gray scale values not in the range of [Pmin, Pmax] is counted and marked as Jsn, and the total number of detection gray scale values is obtained and marked as Jsz.
[0159] In step S304, the detection proportion is calculated as Jsh=Jsn / Jsz, wherein Jsh is the detection proportion.
[0160] In step S305, the light transmission diagram of the first number of unqualified thermal paper passing through the image acquisition scene is obtained and marked as an unqualified light transmission diagram, the unqualified light transmission diagram is converted into a gray scale diagram using a gray scale processing method, and marked as an unqualified gray scale diagram, and the gray scale value of each pixel point in the unqualified gray scale diagram is obtained and marked as an unqualified gray scale value.
[0161] In step S306, the total number of unqualified gray scale values in any one unqualified gray scale diagram is obtained and marked as Jlz, and the number of unqualified gray scale values in the range of [Pmin, Pmax] is counted and marked as Jln.
[0162] In step S307, the unqualified proportion is calculated as Jlh=Jln / Jlz, wherein Jlh is the unqualified proportion.
[0163] In step S308, the unqualified proportion of each unqualified light transmission diagram is obtained, and the minimum value of the unqualified proportion is obtained and marked as Jlm.
[0164] In step S309, it is judged whether Jsh is less than Jlm, if not, the detection gray scale diagram is marked as an initial abnormal gray scale diagram.
[0165] In step S4, it is judged whether the initial abnormal gray scale diagram corresponds to the middle area of the thermal paper to be detected, if not, an abnormal signal of the thermal paper to be detected is sent out, and step S4 includes the following sub-steps:
[0166] In step S401, the light transmission diagram of the third number of middle non-depressed and unqualified thermal paper passing through the image acquisition scene is obtained and marked as an abnormal light transmission diagram, and the abnormal light transmission diagram is converted into a gray scale diagram using a gray scale processing method and marked as an abnormal gray scale diagram.
[0167] In step S402, the function error of each abnormal gray scale diagram is obtained using a function error obtaining method and marked as an abnormal value.
[0168] Step S403, the minimum value of the abnormal value is obtained, which is marked as an abnormal threshold value;
[0169] Step S404, it is judged whether the detection value is less than the abnormal threshold value, if greater, a signal of abnormality of the detection of the thermal paper coating is sent out.
[0170] Embodiment 3, a structural schematic diagram of an electronic device, which can include a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus. The memory stores computer readable instructions, and the processor can call the instructions in the memory, when the computer readable instructions are executed by the processor, the steps in a kind of thermal paper coating quality image recognition method are run, to realize the following functions: establish image acquisition scene, based on image acquisition scene, obtain the light transmission diagram of the thermal paper to be detected, which is marked as thermal paper light transmission diagram;Thermal paper light transmission diagram is converted into gray scale diagram using gray scale processing method, which is marked as detection gray scale diagram;It is judged whether the distribution range of the gray scale value of all pixel points in detection gray scale diagram is abnormal, if abnormal, detection gray scale diagram is marked as initial abnormal gray scale diagram;It is judged whether the thermal paper to be detected corresponding to initial abnormal gray scale diagram is recessed in middle area, if not, the signal of abnormality of the detection of the thermal paper coating is sent out.
[0171] In addition, the logic instructions in the memory described above can be realized in the form of software functional units and sold or used as independent products, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and various program code storage media.
[0172] In embodiment 4, the application further provides a computer program product, which comprises a computer program stored on a computer readable storage medium, and the computer program comprises program instructions, when the program instructions are executed by a computer, the computer can execute a thermal paper coating quality image recognition method provided by each method, and the method comprises the following steps: establishing an image acquisition scene, acquiring a light transmission image of a thermal paper to be detected based on the image acquisition scene, and marking the light transmission image as a thermal paper light transmission image; converting the thermal paper light transmission image into a gray scale image by using a gray scale processing method, marking the gray scale image as a detection gray scale image; judging whether the distribution range of the gray scale values of all pixel points in the detection gray scale image is abnormal, if yes, marking the detection gray scale image as an initial abnormal gray scale image; and judging whether the thermal paper to be detected corresponding to the initial abnormal gray scale image is a middle area with a depression, if not, issuing a thermal paper coating abnormal signal.
[0173] In embodiment 5, the application further provides a computer readable storage medium, and the application provides a storage medium, which stores a computer program, when the computer program is executed by a processor, the steps in the above thermal paper coating quality image recognition method are run to realize the following functions: establishing an image acquisition scene, acquiring a light transmission image of a thermal paper to be detected based on the image acquisition scene, and marking the light transmission image as a thermal paper light transmission image; converting the thermal paper light transmission image into a gray scale image by using a gray scale processing method, marking the gray scale image as a detection gray scale image; judging whether the distribution range of the gray scale values of all pixel points in the detection gray scale image is abnormal, if yes, marking the detection gray scale image as an initial abnormal gray scale image; and judging whether the thermal paper to be detected corresponding to the initial abnormal gray scale image is a middle area with a depression, if not, issuing a thermal paper coating abnormal signal.
[0174] Through the description of the above embodiments, the embodiments of the application can be provided as a method, a system or a computer program product. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the method described in each embodiment or some parts of the embodiment.
[0175] In the embodiments of the present application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are only illustrative, for example, the division of modules or units is only a logical function division, and other division manners can be used in actual implementation, for example, a plurality of modules or units can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be through some communication interface, the indirect coupling or communication connection between the system, the module and the unit can be electrical, mechanical or other forms.
[0176] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of identifying a thermal paper coating quality image, characterized by, The method comprises the following steps: An image acquisition scene is established, and a light transmission image of the to-be-detected thermal paper is acquired based on the image acquisition scene, and is marked as a thermal paper light transmission image; The thermal paper light transmission image is converted into a gray scale image by using a gray scale processing method, and is marked as a detection gray scale image; It is judged whether the distribution range of the gray scale values of all pixel points in the detection gray scale image is abnormal, and if so, the detection gray scale image is marked as an initial abnormal gray scale image; It is judged whether the to-be-detected thermal paper corresponding to the initial abnormal gray scale image is recessed in the middle region, and if not, an abnormal coating signal of the to-be-detected thermal paper is sent out; The judgment whether the to-be-detected thermal paper corresponding to the initial abnormal gray scale image is recessed in the middle region comprises the following sub-steps: A function error of the initial abnormal gray scale image is obtained by using an acquisition function error method, and is marked as a detection value; The acquisition function error method comprises: An edge of the initial abnormal gray scale image parallel to the parallel roller is marked as a starting edge; The initial abnormal gray scale image is divided into m equal regions by m-1 straight lines parallel to one starting edge, and is marked as equal regions; The average value of the gray scale values of the pixel points in each equal region is calculated, and is marked as a regional gray scale average value; Each regional gray scale average value is sequentially numbered along the direction edge starting from one starting edge, and the sequence number is a positive integer starting from 1; The regional gray scale average value with the sequence number of 1 is marked as a starting gray scale average value; The absolute value of the difference between the regional gray scale average value and the starting gray scale average value is sequentially calculated according to the sequence number from small to large, and is marked as a sequential difference value; The sequential difference value is sequentially labeled according to the order of the calculation of the sequential difference value, and is marked as a sequence number, which is an integer starting from 1; A plane rectangular coordinate system is established with the sequence number as the X-axis and the sequential difference value as the Y-axis, and is marked as a difference value coordinate system, and the sequence number and the corresponding sequential difference value are drawn into the difference value coordinate system to obtain a scatter plot, which is marked as a difference value scatter plot; The preset fitting function is set as: Y = a*X 2 +b*X+c; wherein a, b and c are parameters of the preset fitting function; X is the sequence number, and Y is the sequence difference value. The difference value scatter plot is fitted by using a preset fitting function to obtain the specific values of a, b and c, the fitting function is obtained by substituting the specific values of a, b and c into the preset fitting function, and is marked as a difference value fitting function; Substitute the sequence number into the difference fitting function to obtain the Y value, marked as Cy j ; The sequential difference is marked as Cs j ; Cy is calculated j The mean square error of Cy with Cs j is calculated, denoted as the function error, and the formula is: ; wherein Cz is the functional error, Cy j Y is the value obtained by bringing the difference fitting function into the jth order number, Cs j is the sequence difference corresponding to the jth order number, and k is the number of order numbers. The judgment whether the to-be-detected thermal paper corresponding to the initial abnormal gray scale image is recessed in the middle region further comprises the following sub-steps: A light transmission image of a third number of thermal papers which are not recessed in the middle region and are not qualified in coating and pass through the image acquisition scene is obtained, and is marked as an abnormal light transmission image, and the abnormal light transmission image is converted into a gray scale image by using a gray scale processing method, and is marked as an abnormal gray scale image; The function error of each abnormal gray scale image is obtained by using the acquisition function error method, and is marked as an abnormal value; The minimum value of the abnormal value is obtained, and is marked as an abnormal threshold value; It is judged whether the detection value is less than the abnormal threshold value, and if greater, an abnormal coating signal of the to-be-detected thermal paper is sent out.
2. The method of claim 1, wherein the method is characterized by: The establishment of the image acquisition scene comprises the following sub-steps: Two parallel rollers for conveying the thermal paper are installed at the end of the coating machine, a plane region formed by the two parallel rollers is obtained, a vertical line passing through the midpoint of the plane region and perpendicular to the plane region is drawn, and is marked as a region vertical line, a light source is installed on one side of the plane region and on the region vertical line, and a camera is installed on the other side of the plane region and on the region vertical line.
3. The method of claim 2, wherein the method is characterized by: The gray scale processing method comprises: The RGB value of each pixel point in the thermal paper light transmission image is obtained; The RGB value is converted into a gray value by using a gray conversion formula, and the gray conversion formula is: RMH=1 / 3*R+1 / 3*G+1 / 3*B; wherein RMH is the gray value, and R, G and B are three values in the RGB value.
4. The method of claim 3, wherein the method is characterized by: The distribution range of the gray value of all pixel points in the detection gray image is determined, including the following sub-steps: The gray value of each pixel point in the detection gray image is counted and marked as a detection gray value; Pmin and Pmax are obtained; The number of detection gray values not in the range of [Pmin, Pmax] is counted and marked as Jsn; The total number of detection gray values is obtained and marked as Jsz; The detection ratio is calculated as: Jsh=Jsn / Jsz; wherein Jsh is the detection ratio; The first number of unqualified coated thermal paper is obtained, and the light transmission diagram obtained by the image acquisition scene is marked as an unqualified light transmission diagram, the unqualified light transmission diagram is converted into a gray diagram by using a gray processing method, and the gray diagram is marked as an unqualified gray diagram, and the gray value of each pixel point in the unqualified gray diagram is obtained and marked as an unqualified gray value; The total number of unqualified gray values in any one unqualified gray diagram is obtained and marked as Jlz; The number of unqualified gray values in the range of [Pmin, Pmax] is counted and marked as Jln; The unqualified ratio is calculated as: Jlh=Jln / Jlz; Wherein Jlh is the unqualified ratio; The unqualified ratio of each unqualified light transmission diagram is obtained, and the minimum value of the unqualified ratio is obtained and marked as Jlm; If Jsh is not less than Jlm, the detection gray diagram is marked as an initial abnormal gray diagram.
5. The method of claim 4, wherein the method is characterized by: Pmin and Pmax are obtained, including the following sub-steps: The second number of qualified coated thermal paper is obtained, and the light transmission diagram obtained by the image acquisition scene is marked as a qualified light transmission diagram; The qualified light transmission diagram is converted into a gray diagram by using a gray processing method, and the gray diagram is marked as a qualified gray diagram; The gray value of each pixel point in the qualified gray diagram is counted and marked as a qualified gray value; The qualified gray value of 0-255 is evenly divided into n equal intervals; The frequency of each equal interval qualified gray value is counted and marked as interval frequency; A histogram is drawn with the qualified gray value as the X-axis and the interval frequency as the Y-axis, and the histogram is marked as the qualified gray histogram; The sum of the interval frequencies is calculated and labeled P z ; Mark each interval frequency as P i ; The frequency proportion of each interval frequency is calculated as: Pb i = P i / P z ; wherein Pb i is the frequency proportion of each interval frequency, and i ranges from [1, n]. determining whether each Pb i is less than the too-small proportion threshold value, and if so, deleting the interval frequency corresponding to Pbi in the qualified gray level histogram and marking it as a modified gray level histogram; The minimum and maximum values of the interval frequency in the X-axis data of the modified gray histogram are obtained and marked as Pmin and Pmax, respectively.
6. A system for identifying thermal paper coating quality image, which is suitable for the method for identifying thermal paper coating quality image according to any one of claims 1-5, characterized in that, An image acquisition module, a gray processing module, an initial judgment module and a final judgment module are included. The image acquisition module is used to establish an image acquisition scene, and the light transmission diagram of the thermal paper to be detected is obtained based on the image acquisition scene, and is marked as a thermal paper light transmission diagram; The gray processing module is used to convert the thermal paper light transmission diagram into a gray diagram by using a gray processing method, and the gray diagram is marked as a detection gray diagram; The initial judgment module is used to determine whether the distribution range of the gray value of all pixel points in the detection gray diagram is abnormal, and if it is abnormal, the detection gray diagram is marked as an initial abnormal gray diagram; The final judgment module is used to determine whether the initial abnormal gray diagram corresponds to the thermal paper to be detected, and if not, an unqualified thermal paper coating signal is sent.
7. An electronic device, comprising: A computer program product comprising a processor and a memory storing computer readable instructions which, when executed by the processor, perform the steps of the method of any of claims 1-5.
8. A storage medium having stored thereon a computer program, characterized in that The computer program, when executed by a processor, performs the steps of the method of any of claims 1-5.
Citation Information
Patent Citations
A simple test method for the saturated chromatic optical density of low basis weight thermal paper
CN112504984B
Coated printing quality detection system and method based on ultraviolet spectrum
CN108593581A
Irregular metal button forming detection method based on machine vision
CN117197140A