Thermal-sensitive paper coating quality image recognition method, system and equipment and medium
The light transmission diagram of thermal paper is obtained through image recognition technology and converted into grayscale diagrams to judge the grayscale value distribution and function error, solving the problems of low coating quality recognition efficiency and inaccurate pass rate in the prior art, and achieving efficient and accurate coating quality detection.
Patent Information
- Application Number
- CN202510480096.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2045-04-17
AI Technical Summary
The existing thermal paper coating quality recognition technology uses dynamic chromogenic instruments and thermal printers to detect coating quality, resulting in low recognition efficiency and inaccurate overall pass rate.
By establishing an image acquisition scene, obtaining the light-transmitting image of the thermal paper and converting it into a grayscale image, determining the distribution range of the grayscale value of the pixel point, using grayscale processing and function error methods to determine whether the intermediate area is sunken, and sending out a coating abnormal signal.
Real-time detection is achieved, the detection efficiency and the accuracy of the overall coating pass rate are improved, and misjudgment caused by intermediate depressions in traditional methods is avoided.
Smart Images

Figure CN120471831A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of thermal paper coating quality recognition, and in particular to a thermal paper coating quality image recognition method, system, equipment and medium. Background Art
[0002] Thermal paper is used in industries such as retail, logistics, catering, and banking. Fonts can be printed on thermal paper without the use of ink because the surface of the paper is coated with a layer of heat-sensitive material. The quality of the thermal paper coating determines the clarity of the printed fonts. Therefore, thermal paper coating quality identification is a key step in the production of thermal paper. The existing thermal paper coating quality identification technology usually requires the use of a dynamic colorimetric instrument to test the saturated luminous density during the production process. The test cycle is long, which is not conducive to the 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 tested using this method cannot be used again. At the same time, because all thermal papers cannot be tested, the determination of the overall thermal paper qualification rate is not accurate. For example, the patent application with the authorization announcement number CN112504984B discloses a simple test method for the saturated luminous density of low-quantity thermal paper. The scheme proposes to use a thermal printer to print thermal paper samples to observe the sample quality. After the test, the sample cannot be used and the obtained overall thermal paper qualification rate is not accurate. The existing thermal paper coating quality identification technology uses a dynamic colorimetric instrument and a thermal printer to detect the coating quality, resulting in low recognition efficiency and inaccurate overall thermal paper coating qualification rate. Summary of the Invention
[0003] The present invention aims to solve, at least to a certain extent, 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 pixels in the detection grayscale image is abnormal, and determine whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a depression in the middle area, so as to solve the problem that the existing thermal paper coating quality identification technology uses a dynamic colorimeter and a thermal printer to detect the coating quality, resulting in low identification efficiency and inaccurate overall thermal paper coating qualification rate.
[0004] To achieve the above objectives, in a first aspect, the present application provides a method for identifying thermal paper coating quality images, comprising the following steps: Establish an image acquisition scene, and acquire a light transmittance image of the thermal paper to be detected based on the image acquisition scene, and mark it as a light transmittance image of the thermal paper; The thermal paper transmittance image is converted into a grayscale image using a grayscale processing method and marked as a detection grayscale image; Determine whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal. If abnormal, mark the detection grayscale image as the initial abnormal grayscale image; It is determined whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a concave middle area. If not, a coating abnormality signal of the thermal paper to be detected is issued.
[0005] Furthermore, establishing the image acquisition scenario includes the following sub-steps: Two parallel rollers for transporting thermal paper are installed at the end of the coating machine. The plane area formed by the two parallel rollers is obtained, and a vertical line passing through the midpoint of the plane area and perpendicular to the plane area is drawn, marked as the vertical line in the area. A light source is installed on one side of the plane area and on the vertical line in the area, and a camera is installed on the other side of the plane area and on the vertical line in the area.
[0006] Furthermore, the grayscale processing method includes: Get the RGB value of each pixel in the thermal paper transmittance image; Use the grayscale conversion formula to convert the RGB value into a grayscale value. The grayscale conversion formula is: RMH=1 / 3*R+1 / 3*G+1 / 3*B; RMH is the grayscale value, and R, G, and B are three values in the RGB value.
[0007] Furthermore, determining whether the distribution range of the grayscale values of all pixels in the grayscale image is abnormal includes the following sub-steps: Statistically detect the grayscale value of each pixel in the grayscale image and mark it as the detected grayscale value; Get Pmin and Pmax; Count the number of grayscale values that are not in the range of [Pmin, Pmax], marked as Jsn; Get the total number of detected grayscale values, marked as Jsz; The detection ratio is calculated as: Jsh=Jsn / Jsz; where Jsh is the detection ratio; Obtaining a first quantity of transmittance images of unqualified thermal papers through an image acquisition scene, marking the images as unqualified transmittance images, converting the unqualified transmittance images into grayscale images using a grayscale processing method, marking the images as unqualified grayscale images, obtaining a grayscale value for each pixel in the unqualified grayscale images, and marking the pixels as unqualified grayscale values; Get the total number of unqualified grayscale values in any unqualified grayscale image, marked as Jlz; Count the number of unqualified grayscale values in the range [Pmin, Pmax], marked as Jln; The unqualified ratio is calculated as: Jlh=Jln / Jlz; where Jlh is the unqualified ratio; Get the unqualified ratio of each unqualified light transmittance image, and mark the minimum value of the unqualified ratio as Jlm; Determine whether Jsh is less than Jlm. If not, mark the detected grayscale image as the initial abnormal grayscale image.
[0008] Furthermore, obtaining Pmin and Pmax includes the following sub-steps: Obtaining a second number of light transmittance images of thermal papers with qualified coating obtained through the image acquisition scene, and marking them as qualified light transmittance images; The qualified light transmittance image is converted into a grayscale image using a grayscale processing method and marked as a qualified grayscale image; Count the grayscale value of each pixel in the qualified grayscale image and mark it as a qualified grayscale value; Divide the qualified grayscale values 0-255 into n equal intervals; Count the frequency of qualified grayscale values in each equally divided interval respectively, and mark it as interval frequency; Draw a histogram with the qualified grayscale value as the X-axis and the interval frequency as the Y-axis, and mark it as the qualified grayscale histogram; Calculate the sum of the interval frequencies and mark it as P z ; Mark the frequency of each interval as P i ; Calculate the frequency ratio of each interval: Pb i =P i / P z ; Among them Pb i is the frequency ratio of each interval frequency, and the range of i is [1, n]; Determine each Pb i Is it less than the too small proportion threshold? If so, delete the interval frequency corresponding to Pbi in the qualified grayscale histogram and mark it as modified grayscale histogram; Get the minimum and maximum values of the interval frequency in the X-axis data of the modified grayscale histogram, marked as Pmin and Pmax respectively.
[0009] Furthermore, determining whether the initial abnormal grayscale image contains a grayscale image caused by a depression in the middle area of the thermal paper to be detected includes the following sub-steps: The function error of the initial abnormal grayscale image is obtained by using the function error acquisition method and marked as the detection value; Methods for obtaining function errors include: Mark the edge of the initial abnormal grayscale image parallel to the parallel rolling axis as the starting edge; The initial abnormal grayscale image is divided into m equal regions using m-1 straight lines parallel to a starting edge, which are marked as equal regions; Calculate the mean grayscale value of the pixels in each equal area and mark it as the regional grayscale mean; Starting from a starting edge, the grayscale mean of each region is assigned a serial number along the direction edge. The serial number is a positive integer starting from 1. Mark the grayscale mean of the region with serial number 1 as the starting grayscale mean; Calculate the absolute value of the difference between the regional grayscale mean and the starting grayscale mean in order from small to large sequence numbers, and mark it as the sequential difference; The sequence differences are labeled in sequence according to the order in which the sequence differences are calculated, and are marked as sequence numbers, where the sequence numbers are integers starting from 1; A plane rectangular coordinate system is established with the sequence number as the X-axis and the sequence difference as the Y-axis, which is marked as the difference coordinate system. The sequence number and the corresponding sequence difference are plotted into the difference coordinate system to obtain a scatter plot, which is marked as the difference scatter plot; Set the default fitting function to: Y=a*X 2 +b*X+c; where a, b, and c are the parameters of the preset fitting function; X is the sequence number, and Y is the sequence difference; Fit the difference scatter plot with a preset fitting function to obtain specific values of a, b, and c, and substitute the specific values of a, b, and c into the preset fitting function to obtain a fitting function, which is marked as a difference fitting function; Substitute the sequence number into the difference fitting function to obtain the Y value, marked as Cy j ; Mark the sequence difference as Cs j ; Calculate Cy j With Cs j The mean square error, marked as function error, is calculated as: ; Where Cz is the function error, Cy j Substitute the difference fitting function for the jth sequence number to obtain the Y value, Cs j is the sequence difference corresponding to the jth sequence number, and k is the number of sequence numbers.
[0010] Furthermore, determining whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a depression in the middle area includes the following sub-steps: Obtaining a third number of transmittance images of thermal papers with no sag in the middle and unqualified coating obtained through the image acquisition scene, marking them as abnormal transmittance images, converting the abnormal transmittance images into grayscale images using a grayscale processing method, and marking them as abnormal grayscale images; The function error of each abnormal grayscale image is obtained by using the function error acquisition method and marked as an abnormal value; Get the minimum value of the outliers and mark it as the outlier threshold; Determine whether the detection value is less than the abnormal threshold value. If it is greater, send out an abnormal signal of the thermal paper coating to be detected.
[0011] In a second aspect, the present application provides a thermal paper coating quality image recognition system, comprising an image acquisition module, a grayscale processing module, an initial judgment module, and a final judgment module; The image acquisition module is used to establish an image acquisition scene, and acquire a light transmittance image of the thermal paper to be detected based on the image acquisition scene, which is marked as a light transmittance image of the thermal paper; The grayscale processing module is used to convert the thermal paper transmittance image into a grayscale image using a grayscale processing method, and mark it as a detection grayscale image; The initial judgment module is used to judge whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal. If abnormal, the detection grayscale image is marked as an initial abnormal grayscale image; The final judgment module is used to judge whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a depression in the middle area. If not, it sends a coating abnormality signal of the thermal paper to be detected.
[0012] In a third aspect, the present application provides an electronic device comprising a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the above method are performed.
[0013] In a fourth aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above method are executed.
[0014] Beneficial effects of the present invention: The present invention obtains a detection grayscale image, determines whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal, and determines whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a depression in the middle area. The advantage is that the coated thermal paper is observed to be qualified by light transmission. Compared with traditional detection methods, the use of real-time detection improves detection efficiency, eliminates the need for sampling detection, and improves the accuracy of the overall thermal paper coating qualification rate; The present invention determines whether the distribution range of the grayscale values of all pixels in the grayscale image is abnormal. The advantage is that during the transmission of thermal paper, due to the material of the thermal paper, there may be a middle depression in the thermal paper between the two transmission shafts. The different distances between the depressed part and the non-depressed part from the light source lead to different light intensities, causing qualified thermal paper to be judged as unqualified. Therefore, this method can improve the accuracy of judging the coating quality of thermal paper. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a functional block diagram of the system of the present invention; Figure 2 Schematic diagram of a qualified grayscale histogram of the present invention; Figure 3 is a schematic diagram of the difference coordinate system of the present invention; Figure 4 Flow chart of the steps of the method of the present invention. DETAILED DESCRIPTION
[0016] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0017] Example 1, please refer to Figure 1 As shown, the present application provides a thermal paper coating quality image recognition system, including an image acquisition module, a grayscale processing module, an initial judgment module and a final judgment module; The image acquisition module is used to establish an image acquisition scene, and obtain a light transmittance image of the thermal paper to be detected based on the image acquisition scene, and mark it as a light transmittance image of the thermal paper; The image acquisition module is configured with a scene establishment strategy, which includes: Two parallel rollers for transporting thermal paper are installed at the end of the coating machine. A plane area formed by the two parallel rollers is obtained, and a perpendicular line is drawn through the midpoint of the plane area and perpendicular to the plane area, marked as the vertical line in the area. A light source is installed on one side of the plane area and on the vertical line in the area, and a camera is installed on the other side of the plane area and on the vertical line in the area. In practical applications, 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 evenly illuminate the part of the thermal paper that can be photographed by the camera.
[0018] The grayscale processing module is used to convert the thermal paper transmittance image into a grayscale image using a grayscale processing method, and mark it as a detection grayscale image; The grayscale processing module is configured with grayscale processing strategies, which include: Get the RGB value of each pixel in the thermal paper transmittance image; Use the grayscale conversion formula to convert the RGB value into a grayscale value. The grayscale conversion formula is: RMH=1 / 3*R+1 / 3*G+1 / 3*B; RMH is the grayscale value, and R, G, and B are the three values in RGB value. Since the thermal paper is white and the light transmission image of the thermal paper is between black and white, the R, G, and B of the pixels in the light transmission image are equal, so the average weighted method is more appropriate. The initial judgment module is used to judge whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal. If abnormal, the detection grayscale image is marked as the initial abnormal grayscale image; The initial judgment module is configured with an initial judgment strategy, which includes: Statistically detect the grayscale value of each pixel in the grayscale image and mark it as the detected grayscale value; Get Pmin and Pmax; Count the number of grayscale values that are not in the range of [Pmin, Pmax], marked as Jsn; Get the total number of detected grayscale values, marked as Jsz; The detection ratio is calculated as: Jsh=Jsn / Jsz; where Jsh is the detection ratio; Obtaining a first quantity of transmittance images of unqualified thermal papers through an image acquisition scene, marking the images as unqualified transmittance images, converting the unqualified transmittance images into grayscale images using a grayscale processing method, marking the images as unqualified grayscale images, obtaining a grayscale value for each pixel in the unqualified grayscale images, and marking the pixels as unqualified grayscale values; Get the total number of unqualified grayscale values in any unqualified grayscale image, marked as Jlz; Count the number of unqualified grayscale values in the range [Pmin, Pmax], marked as Jln; The unqualified ratio is calculated as: Jlh=Jln / Jlz; where Jlh is the unqualified ratio; Get the unqualified ratio of each unqualified light transmittance image, and mark the minimum value of the unqualified ratio as Jlm; Determine whether Jsh is less than Jlm. If not, mark the detected grayscale image as the initial abnormal grayscale image; In practical applications, the number of grayscale values not in the range of [95, 191] is Jsn = 600,000, and the total number of grayscale values detected is Jsz = 2.07 million. The detection ratio is calculated as: Jsh = Jsn / Jsz = 0.290, and the detection ratio result is rounded to three decimal places. Similarly, the unqualified ratios of each unqualified transmittance image are calculated as 0.832, 0.691, 0.59, and 0.232, respectively, and the minimum value of the unqualified ratio is Jlm = 0.232. When Jsh = 0.290 > Jlm = 0.232, the detected grayscale image is marked as the initial abnormal grayscale image.
[0019] The initial judgment module is configured with a strategy for obtaining Pmin and Pmax, which includes: Obtaining a second number of light transmittance images of thermal papers with qualified coating obtained through the image acquisition scene, and marking them as qualified light transmittance images; The qualified light transmittance image is converted into a grayscale image using a grayscale processing method and marked as a qualified grayscale image; Count the grayscale value of each pixel in the qualified grayscale image and mark it as a qualified grayscale value; Divide the qualified grayscale values 0-255 into n equal intervals; the larger the n setting, the more accurate the subsequent data obtained; Count the frequency of qualified grayscale values in each equally divided interval respectively, and mark it as interval frequency; Draw a histogram with the qualified grayscale value as the X-axis and the interval frequency as the Y-axis, and mark it as the qualified grayscale histogram; Calculate the sum of the interval frequencies and mark it as P z ; Mark the frequency of each interval as P i ; Calculate the frequency ratio of each interval: Pb i =P i / P z ; Among them Pb i is the frequency ratio of each interval frequency, and the range of i is [1, n]; Determine each Pb i Is it less than the too small proportion threshold? If so, delete the interval frequency corresponding to Pbi in the qualified grayscale histogram and mark it as modified grayscale histogram; the too small proportion threshold is set to find the grayscale value range with less frequency distribution; the specific value depends on the setting of n; ... i Whether the frequency interval corresponding to the threshold value of the proportion is less than the too small one is marked as an too small interval; Obtain the minimum and maximum values of the interval frequency in the X-axis data of the modified grayscale histogram, and mark them as Pmin and Pmax respectively; because 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, that is, the range of grayscale values of qualified coated thermal paper; In practical applications, the qualified grayscale values 0-255 are divided into 8 equal intervals and a qualified grayscale histogram is established. Figure 2 As shown in the figure, since n=8, the too-small ratio threshold is set to 1 / 8 / 2=0.0625, the too-small interval is deleted, and the grayscale histogram is modified to obtain Pmin=95 and Pmax=191.
[0020] The final judgment module is used to determine whether the thermal paper to be tested, corresponding to the initial abnormal grayscale image, has a concave middle area. If not, a coating abnormality signal is issued. During the transmission of thermal paper, due to the material of the thermal paper, there may be a concave middle area between the two conveyor shafts. The different distances between the concave and non-concave areas from the light source result in different light intensities, causing qualified thermal paper to be judged as unqualified. The final judgment module is configured with a function error method strategy, which includes: The function error of the initial abnormal grayscale image is obtained by using the function error acquisition method and marked as the detection value; Methods for obtaining function errors include: Mark the edge of the initial abnormal grayscale image parallel to the parallel rolling axis as the starting edge; The initial abnormal grayscale image is divided into m equal areas using m-1 straight lines parallel to a starting edge, and these are marked as equal areas. If the thermographic image is concave in the middle, there will be a difference in the grayscale values between the equal areas in the middle of the thermographic image and the equal areas at the edge of the thermographic image. The larger the setting of m, the more accurate the subsequent data will be, but the amount of calculation will increase significantly. Therefore, m is set to a value that does not affect the subsequent results while reducing the amount of calculation, such as setting m to 10. Calculate the mean grayscale value of the pixels in each equal area and mark it as the regional grayscale mean; Starting from a starting edge, the grayscale mean of each region is assigned a serial number along the direction edge. The serial number is a positive integer starting from 1. Mark the grayscale mean of the region with serial number 1 as the starting grayscale mean; Calculate the absolute value of the difference between the regional grayscale mean and the starting grayscale mean in order from small to large sequence numbers, and mark it as the sequence difference; calculate the regional grayscale mean difference of each equal region that can be more prominent by the sequence difference; The sequence differences are labeled in sequence according to the order in which the sequence differences are calculated, and are marked as sequence numbers, where the sequence numbers are integers starting from 1; A plane rectangular coordinate system is established with the sequence number as the X-axis and the sequence difference as the Y-axis, which is marked as the difference coordinate system. The sequence number and the corresponding sequence difference are plotted in the difference coordinate system to obtain a scatter plot, which is marked as the difference scatter plot; the coordinate points of the sequence number and the corresponding sequence difference are marked as sequence difference coordinate points; Set the default fitting function to: Y=a*X 2 +b*X+c; where a, b, and c are the parameters of the preset fitting function; X is the sequence number, and Y is the sequence difference. Because the sag trend of thermal paper is similar to a quadratic equation curve, the sag of thermal paper causes the illumination distance to be similar to a quadratic equation curve, which in turn causes the illumination intensity on the thermal paper to be similar to a quadratic equation curve, which in turn causes the regional grayscale mean of each equal area to be similar to a quadratic equation curve. Therefore, the sequence difference can fit a quadratic equation curve. Therefore, the specific data of a, b, and c in the difference fitting function will vary depending on the degree of sag of different thermal papers. Fit the difference scatter plot with a preset fitting function to obtain specific values of a, b, and c, and substitute the specific values of a, b, and c into the preset fitting function to obtain a fitting function, which is marked as a difference fitting function; Substitute the sequence number into the difference fitting function to obtain the Y value, marked as Cy j ; Mark the sequence difference as Cs j ; Calculate Cyj With Cs j The mean square error, marked as function error, is calculated as: ; Where Cz is the function error, Cy j Substitute the difference fitting function for the jth sequence number to obtain the Y value, Cs j is the sequence difference corresponding to the jth sequence number, k is the number of sequence numbers; the default fitting function is set as: Y=a*X using the mean square error. 2 +b*X+c The accuracy of the fitted equation; In practical applications, m is set to 10, so the sequence number is an integer from 1 to 10. The sequence difference coordinate points are plotted into the difference coordinate system. Figure 3 As shown, 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, substitute the sequence number 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.
[0021] The final judgment module is configured with a final judgment strategy, which includes: Obtaining a third number of transmittance images of thermal papers with no sag in the middle and unqualified coating obtained through the image acquisition scene, marking them as abnormal transmittance images, converting the abnormal transmittance images into grayscale images using a grayscale processing method, and marking them as abnormal grayscale images; The function error of each abnormal grayscale image is obtained by using the function error method and marked as an abnormal value; because the scatter plot of the sequence number and sequence difference of the thermal paper with no depression in the middle and unqualified coating will not appear to be close to a quadratic equation curve, the Y=a*X 2 The function error obtained by +b*X+c fitting is large; Get the minimum value of the abnormal value and mark it as the abnormal threshold; the minimum value of the abnormal value is the minimum value of the function error when the middle does not sink and the coating is unqualified. If the abnormal threshold is greater than, it means that the thermal paper does not sink in the middle and the coating is unqualified; Determine whether the detection value is less than the abnormal threshold value. If it is greater, issue an abnormality signal of the thermal paper coating to be detected; In practical applications, 100 pieces of thermal paper with no sag in the middle and unqualified coating are obtained through the image acquisition scene. The abnormal transmittance images are converted into grayscale images using the grayscale processing method and marked as abnormal grayscale images. The abnormal values of each abnormal grayscale image are obtained using the acquisition function error method, which are 12, 32, 21, 43 and 89, respectively. The minimum value of the abnormal value is the abnormal threshold = 12. It is judged that the detection value 2.34 is less than the abnormal threshold 12, and no abnormal coating signal of the thermal paper to be detected is issued.
[0022] Example 2, please refer to Figure 4 As shown, in a second aspect, the present application provides a method for identifying thermal paper coating quality images, comprising the following steps: Step S1: Establish an image acquisition scene, and acquire a light transmittance image of the thermal paper to be detected based on the image acquisition scene, which is marked as a light transmittance image of the thermal paper. Step S1 includes the following sub-steps: Step S101: Two parallel rollers for transporting thermal paper are installed at the end of the coating machine. A plane area formed by the two parallel rollers is obtained, and a vertical line passing through the midpoint of the plane area and perpendicular to the plane area is drawn, marked as the vertical line in the area. A light source is installed on one side of the plane area and on the vertical line in the area, and a camera is installed on the other side of the plane area and on the vertical line in the area.
[0023] Step S2, converting the thermal paper transmittance image into a grayscale image using a grayscale processing method, and marking it as a detection grayscale image; Step S2 includes the following sub-steps: Step S201, obtaining the RGB value of each pixel in the thermal paper transmittance image; Step S202 , converting the RGB value into a grayscale value using a grayscale conversion formula, the grayscale conversion formula being: RMH=1 / 3*R+1 / 3*G+1 / 3*B; wherein RMH is the grayscale value, and R, G, and B are three values in the RGB value.
[0024] Step S3, determining whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal. If abnormal, the detection grayscale image is marked as an initial abnormal grayscale image. Step S3 includes the following sub-steps: Step S301, counting the grayscale value of each pixel in the grayscale image and marking it as the detected grayscale value; Step S302, obtaining Pmin and Pmax; Step S302 includes the following sub-steps: Step S30201, obtaining a second number of transmittance images of qualified thermal papers through an image acquisition scene, and marking them as qualified transmittance images; Step S30202: Convert the qualified light transmittance image into a grayscale image using a grayscale processing method, and mark it as a qualified grayscale image; calculate the grayscale value of each pixel in the qualified grayscale image, and mark it as a qualified grayscale value; Step S30203: Divide the qualified grayscale values from 0 to 255 into n equal intervals; count the frequencies of qualified grayscale values in each equal interval and mark them as interval frequencies; Step S30204: Draw a histogram with the qualified grayscale value as the X-axis and the interval frequency as the Y-axis, and mark it as a qualified grayscale histogram; Step S30205: Calculate the sum of the interval frequencies, marked as P z ; Step S30206: Mark each interval frequency as P i ; Step S30207, calculate the frequency ratio of each interval frequency: Pb i =P i / P z ; Among them Pb i is the frequency ratio of each interval frequency, and the range of i is [1, n]; Step S30208, determine each Pb i Is it less than the too small proportion threshold? If so, delete the interval frequency corresponding to Pbi in the qualified grayscale histogram and mark it as modified grayscale histogram; Step S30209, obtaining the minimum and maximum values of the interval frequencies in the X-axis data in the modified grayscale histogram, marked as Pmin and Pmax respectively.
[0025] Step S303: Count the number of grayscale values detected that are not within the range of [Pmin, Pmax], marked as Jsn; obtain the total number of grayscale values detected, marked as Jsz; Step S304, calculate the detection ratio: Jsh=Jsn / Jsz; where Jsh is the detection ratio; Step S305: Obtaining transmittance images of a first number of unqualified thermal papers through an image acquisition scene, marking them as unqualified transmittance images, converting the unqualified transmittance images into grayscale images using a grayscale processing method, marking them as unqualified grayscale images, obtaining the grayscale value of each pixel in the unqualified grayscale image, and marking them as unqualified grayscale values; Step S306, obtaining the total number of unqualified grayscale values in any unqualified grayscale image, marked as Jlz; counting the number of unqualified grayscale values in the range [Pmin, Pmax], marked as Jln; Step S307, calculate the unqualified ratio: Jlh=Jln / Jlz; where Jlh is the unqualified ratio; Step S308, obtaining the unqualified ratio of each unqualified light transmittance image, and marking the minimum value of the unqualified ratio as Jlm; Step S309: determine whether Jsh is less than Jlm. If not, mark the detected grayscale image as an initial abnormal grayscale image.
[0026] Step S4, determining whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a concave middle area; if not, issuing a coating abnormality signal of the thermal paper to be detected; Step S4 includes the following sub-steps: Step S401, obtaining a third number of transmittance images of thermal papers with no center sag and unqualified coating through an image acquisition scene, marking them as abnormal transmittance images, converting the abnormal transmittance images into grayscale images using a grayscale processing method, and marking them as abnormal grayscale images; Step S402: Obtain the function error of each abnormal grayscale image using a function error acquisition method and mark it as an abnormal value; Step S403, obtaining the minimum value of the abnormal value and marking it as the abnormal threshold; Step S404: determine whether the detection value is less than an abnormality threshold; if so, issue a coating abnormality signal for the thermal paper to be detected.
[0027] Example 3, a schematic diagram of the structure of an electronic device, which may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via 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 processor performs the steps of a method for image recognition of thermal paper coating quality to achieve the following functions: establishing an image acquisition scene, acquiring a transmittance image of the thermal paper to be tested based on the image acquisition scene, and marking it as the thermal paper transmittance image; converting the thermal paper transmittance image into a grayscale image using a grayscale processing method, and marking it as the detection grayscale image; determining whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal; if so, marking the detection grayscale image as an initial abnormal grayscale image; determining whether the thermal paper to be tested corresponding to the initial abnormal grayscale image has a concave middle area; if not, issuing a coating abnormality signal for the thermal paper to be tested.
[0028] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
[0029] Example 4. The present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes 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 the above methods, the method including: establishing an image acquisition scene, acquiring a transmittance image of the thermal paper to be detected based on the image acquisition scene, and marking it as a thermal paper transmittance image; using a grayscale processing method to convert the thermal paper transmittance image into a grayscale image, and marking it as a detection grayscale image; judging whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal, and if so, marking the detection grayscale image as an initial abnormal grayscale image; judging whether the thermal paper to be detected corresponding to the initial abnormal grayscale image is concave in the middle area, and if not, issuing an abnormal coating signal for the thermal paper to be detected.
[0030] Example 5. The present application also provides a computer-readable storage medium. The present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above thermal paper coating quality image recognition method are executed to achieve the following functions: establish an image acquisition scene, obtain a transmittance image of the thermal paper to be detected based on the image acquisition scene, and mark it as the thermal paper transmittance image; use a grayscale processing method to convert the thermal paper transmittance image into a grayscale image, and mark it as a detection grayscale image; determine whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal. If abnormal, mark the detection grayscale image as an initial abnormal grayscale image; determine whether the thermal paper to be detected corresponding to the initial abnormal grayscale image is concave in the middle area. If not, issue an abnormal coating signal for the thermal paper to be detected.
[0031] Through the description of the above embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the essence of the above technical solutions or the portion that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for enabling a computer device (such as a personal computer, server, or network device) to execute the methods described in various embodiments or certain portions of the embodiments.
[0032] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.
[0033] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for identifying thermal paper coating quality images, characterized in that: The steps include: Establish an image acquisition scene, and acquire a light transmittance image of the thermal paper to be detected based on the image acquisition scene, and mark it as a light transmittance image of the thermal paper; The thermal paper transmittance image is converted into a grayscale image using a grayscale processing method and marked as a detection grayscale image; Determine whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal. If abnormal, mark the detection grayscale image as the initial abnormal grayscale image; It is determined whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a concave middle area. If not, a coating abnormality signal of the thermal paper to be detected is issued.
2. The thermal paper coating quality image recognition method according to claim 1, characterized in that: Establishing an image acquisition scenario includes the following sub-steps: Two parallel rollers for transporting thermal paper are installed at the end of the coating machine. The plane area formed by the two parallel rollers is obtained, and a vertical line passing through the midpoint of the plane area and perpendicular to the plane area is drawn, marked as the vertical line in the area. A light source is installed on one side of the plane area and on the vertical line in the area, and a camera is installed on the other side of the plane area and on the vertical line in the area.
3. The thermal paper coating quality image recognition method according to claim 2, characterized in that: Grayscale processing methods include: Get the RGB value of each pixel in the thermal paper transmittance image; Use the grayscale conversion formula to convert the RGB value into a grayscale value. The grayscale conversion formula is: RMH=1 / 3*R+1 / 3*G+1 / 3*B; RMH is the grayscale value, and R, G, and B are three values in RGB value.
4. The thermal paper coating quality image recognition method according to claim 3, characterized in that: Determining whether the distribution range of the grayscale values of all pixels in the grayscale image is abnormal includes the following sub-steps: Statistically detect the grayscale value of each pixel in the grayscale image and mark it as the detected grayscale value; Get Pmin and Pmax; Count the number of grayscale values that are not in the range of [Pmin, Pmax], marked as Jsn; Get the total number of detected grayscale values, marked as Jsz; The detection ratio is calculated as: Jsh=Jsn / Jsz; where Jsh is the detection ratio; Obtaining a first quantity of transmittance images of unqualified thermal papers through an image acquisition scene, marking the images as unqualified transmittance images, converting the unqualified transmittance images into grayscale images using a grayscale processing method, marking the images as unqualified grayscale images, obtaining a grayscale value for each pixel in the unqualified grayscale images, and marking the pixels as unqualified grayscale values; Get the total number of unqualified grayscale values in any unqualified grayscale image, marked as Jlz; Count the number of unqualified grayscale values in the range [Pmin, Pmax], marked as Jln; The unqualified ratio is calculated as: Jlh=Jln / Jlz; Where Jlh is the proportion of unqualified; Get the unqualified ratio of each unqualified light transmittance image, and mark the minimum value of the unqualified ratio as Jlm; Determine whether Jsh is less than Jlm. If not, mark the detected grayscale image as the initial abnormal grayscale image.
5. The thermal paper coating quality image recognition method according to claim 4, characterized in that: Obtaining Pmin and Pmax includes the following sub-steps: Obtaining a second number of light transmittance images of thermal papers with qualified coating obtained through the image acquisition scene, and marking them as qualified light transmittance images; The qualified light transmittance image is converted into a grayscale image using a grayscale processing method and marked as a qualified grayscale image; Count the grayscale value of each pixel in the qualified grayscale image and mark it as a qualified grayscale value; Divide the qualified grayscale values 0-255 into n equal intervals; Count the frequency of qualified grayscale values in each equally divided interval respectively, and mark it as interval frequency; Draw a histogram with the qualified grayscale value as the X-axis and the interval frequency as the Y-axis, and mark it as the qualified grayscale histogram; Calculate the sum of the interval frequencies and mark it as P z ; Mark the frequency of each interval as P i ; Calculate the frequency ratio of each interval: Pb i =P i / P z ; Among them Pb i is the frequency ratio of each interval frequency, and the range of i is [1, n]; Determine each Pb i Is it less than the too small proportion threshold? If so, delete the interval frequency corresponding to Pbi in the qualified grayscale histogram and mark it as modified grayscale histogram; Get the minimum and maximum values of the interval frequency in the X-axis data of the modified grayscale histogram, marked as Pmin and Pmax respectively.
6. The thermal paper coating quality image recognition method according to claim 5, characterized in that: Determining whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a depression in the middle area includes the following sub-steps: The function error of the initial abnormal grayscale image is obtained by using the function error acquisition method and marked as the detection value; Methods for obtaining function errors include: Mark the edge of the initial abnormal grayscale image parallel to the parallel rolling axis as the starting edge; The initial abnormal grayscale image is divided into m equal regions using m-1 straight lines parallel to a starting edge, which are marked as equal regions; Calculate the mean grayscale value of the pixels in each equal area and mark it as the regional grayscale mean; Starting from a starting edge, the grayscale mean of each region is assigned a serial number along the direction edge. The serial number is a positive integer starting from 1. Mark the grayscale mean of the region with serial number 1 as the starting grayscale mean; Calculate the absolute value of the difference between the regional grayscale mean and the starting grayscale mean in order from small to large sequence numbers, and mark it as the sequential difference; The sequence differences are labeled in sequence according to the order in which the sequence differences are calculated, and are marked as sequence numbers, where the sequence numbers are integers starting from 1; A plane rectangular coordinate system is established with the sequence number as the X-axis and the sequence difference as the Y-axis, which is marked as the difference coordinate system. The sequence number and the corresponding sequence difference are plotted into the difference coordinate system to obtain a scatter plot, which is marked as the difference scatter plot; Set the default fitting function to: Y=a*X 2 +b*X+c; where a, b, and c are the parameters of the preset fitting function; X is the sequence number, and Y is the sequence difference; Fit the difference scatter plot with a preset fitting function to obtain specific values of a, b, and c, and substitute the specific values of a, b, and c into the preset fitting function to obtain a fitting function, which is marked as a difference fitting function; Substitute the sequence number into the difference fitting function to obtain the Y value, marked as Cy j ; Mark the sequence difference as Cs j ; Calculate Cy j With Cs j The mean square error, marked as function error, is calculated as: ; Where Cz is the function error, Cy j Substitute the difference fitting function for the jth sequence number to obtain the Y value, Cs j is the sequence difference corresponding to the jth sequence number, and k is the number of sequence numbers.
7. The thermal paper coating quality image recognition method according to claim 6, characterized in that: Determining whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a depression in the middle area also includes the following sub-steps: Obtaining a third number of transmittance images of thermal papers with no sag in the middle and unqualified coating obtained through the image acquisition scene, marking them as abnormal transmittance images, converting the abnormal transmittance images into grayscale images using a grayscale processing method, and marking them as abnormal grayscale images; The function error of each abnormal grayscale image is obtained by using the function error acquisition method and marked as an abnormal value; Get the minimum value of the outliers and mark it as the outlier threshold; Determine whether the detection value is less than the abnormal threshold value. If it is greater, send out an abnormal signal of the thermal paper coating to be detected.
8. A thermal paper coating quality image recognition system, applicable to a thermal paper coating quality image recognition method according to any one of claims 1 to 7, characterized in that: It includes image acquisition module, grayscale processing module, initial judgment module and final judgment module; The image acquisition module is used to establish an image acquisition scene, and acquire a light transmittance image of the thermal paper to be detected based on the image acquisition scene, which is marked as a light transmittance image of the thermal paper; The grayscale processing module is used to convert the thermal paper transmittance image into a grayscale image using a grayscale processing method, and mark it as a detection grayscale image; The initial judgment module is used to judge whether the distribution range of the grayscale values of all pixels in the detection grayscale image is abnormal. If abnormal, the detection grayscale image is marked as an initial abnormal grayscale image; The final judgment module is used to judge whether the thermal paper to be detected corresponding to the initial abnormal grayscale image has a depression in the middle area. If not, it sends a coating abnormality signal of the thermal paper to be detected.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 7 are executed.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are executed.
Citation Information
Patent Citations
Coated printing quality detection system and method based on ultraviolet spectrum
CN108593581A
Irregular metal button forming detection method based on machine vision
CN117197140A
Tablet quality detection method in medicine production process based on image data
CN117274251A
Gravure coating image recognition system
CN117994532A
Machine vision identification method and device for silicon wafer surface defect, and medium
WO2024250578A1
Cited By
Laser array detection method and device
CN120740935A
Method for detecting color rendering performance of thermo-sensitive paper by fusing multispectral imaging and infrared sensing
CN120870011A
Method for detecting color performance of thermal paper by fusing multispectral imaging and infrared sensing
CN120870011B
Thermal sensitive paper thickness deviation online detection method based on laser scanning
CN120907444A
Artificial intelligence-driven intelligent identification method for thermal paper production waste
CN120913185A