[0036] The present invention will be further described below in conjunction with specific embodiments. The online evaluation method for the printing quality of the two-dimensional code provided by the present invention is based on digital image processing technology and is used for detecting the output quality of the two-dimensional code printer and the preservation quality of the two-dimensional code. The hardware equipment used includes digital scanners, QR code printers, service point terminal computers and cloud network servers. The QR code printers and digital scanners are connected to the service point terminal computers to realize printing at each node according to actual needs. The QR code and scan include the formatted form of the QR code; the service point terminal computer is connected to the Internet to communicate with the cloud network server, and the service point terminal computer transmits the digital scanned image of the form to the sports network server for processing and identification.
[0037] Connect the terminal computer to the Internet and a digital scanner during application; open the scanner's special software, scan the form containing the QR code and other forms into the local terminal computer; the terminal computer scans the local directory and scans to the newly added digital image transmission To the cloud form recognition and QR code recognition server; the cloud server calls the QR code printing quality evaluation module before recognizing the QR code to evaluate the printing quality of the QR code and record the daily evaluation results; the cloud server is processing After finishing the gap of the QR code recognition task, according to the series of evaluation results of the QR code print quality, evaluate the working status of the print output of different printing points. If you open a new print service point, you only need to configure the corresponding network access method to expand the use of the cloud server. If the output quality of a QR code printing point is unqualified, the cloud server sends a message to the terminal computer of the printing point, prompting the staff to check or replace the barcode printer. According to key factors such as temperature and humidity, combined with the information of the cloud server, the barcode printer at the working point can be adjusted or even replaced.
[0038] Among them, the standard for evaluating the printing quality of the QR code is based on the quality characteristics of the QR code image, such as grayscale distribution characteristics, directional black and white ratio characteristics, aspect ratio characteristics, overall black and white ratio characteristics, and printer missing teeth characteristics. Wherein, the grayscale distribution feature includes a first grayscale distribution feature and a second grayscale distribution feature. The above two or more quality characteristics can be selected according to the actual situation.
[0039] The method of extracting quality features is as follows:
[0040] 1) Reading the target image: Specifically, the operator inputs the optical information of the form to be analyzed into the computer with a scanner; then adopts the rapid detection and extraction method of the two-dimensional code to determine the position and range of the two-dimensional code in the target image.
[0041] Among them, the two-dimensional code rapid detection and extraction method is: preprocessing the target image, including denoising and smoothing filtering; converting the processed image into a gray image; using the laplace operator to calculate the edge in the gray image; calculating the edge The integral map of the graph; divide the image into several blocks, and calculate the sum of the number of edges in each sub-image; traverse all the sub-images, if the sum of the number of edges in the sub-image is greater than the set threshold, the area is considered to be a QR code Graphics area.
[0042] 2) According to the position and range of the two-dimensional code, a local image area is extracted as the image range for the subsequent processing of the two-dimensional code, and this area is called a region of interest (ROI). Subsequent processing is only performed inside the ROI area to reduce calculation pressure.
[0043] 3) Count the distribution of pixel gray values in the ROI area to obtain a gray level histogram h, and use the gray level histogram h to calculate the absolute central moment of the ROI area as the first gray level distribution feature. The calculation method of the absolute central moment of the ROI area is:
[0044] A C M ( h ) = X i = 0 255 ( | i - X i = 0 255 i · h [ i ] | · h [ i ] )
[0045] Among them, the gray value i ranges from 0 to 255; normalize the gray histogram, that is, divide each item of the histogram by its integral value, so that h satisfies Then h[i] represents the ratio of pixels with gray value i to all pixels.
[0046] 4) Use the Otsu algorithm (OTSU) to binarize the image in the ROI area and obtain the segmentation threshold T OTSU.
[0047] 5) According to the segmentation threshold T of Otsu algorithm OTSU Calculate the Fisher distance of the pixel gray value distribution corresponding to the black and white color blocks with the gray histogram h as the second gray distribution feature.
[0048] The Fisher distance calculation method corresponding to the pixel gray value distribution of the black and white color blocks is:
[0049] F ( h ) = ( w b μ b - w w μ w ) 2 w b 2 σ b 2 + w w 2 σ w 2
[0050] Among them, then with Respectively represent the weight of dark pixels and light pixels, μ b = X i = 0 T O T S U ( i · h [ i ] ) / w b with μ w = X i = T O T S U + 1 255 ( i · h [ i ] ) / w w Respectively represent the average value of dark pixels and light pixels, and σ b = X i = 0 T O T S U ( i - μ b ) 2 · h [ i ] / w b with σ w = X i = T O T S U + 1 255 ( i - μ b ) 2 · h [ i ] / w w Represents the variance of dark pixels and light pixels, respectively.
[0051] 6) Randomly select several pixel segments in the x direction and y direction in the RIO area, scan to obtain the length of the smallest white line segment in each pixel segment, and calculate the average L of all the smallest white line segments w , Scan to obtain the length of the smallest black line segment in each pixel segment, and calculate the average L of all the smallest black line segments b ,will As a directional black and white ratio feature.
[0052] 7) Fit the ROI area into a rotatable rectangular frame, calculate the length of the long side and the short side of the rectangular frame, and use the ratio of the length of the short side to the long side as the aspect ratio feature.
[0053] 8) Calculate the number of black pixels Q in the binarized image in the ROI area respectively w And the number of white pixels Q b And will As a feature of overall black and white ratio.
[0054] 9) Use the probability Hough transform to calculate all the white lines in the binarized image in the ROI area, traverse all the white lines detected, and detect that they are located in the center of the ROI area and perpendicular to the image x axis and the length exceeds the ROI area height x% ( For example, 80%) white straight line, the BOOL amount is regarded as the feature of missing teeth of the printer, that is, when the white straight line satisfies the above three characteristics at the same time, the BOOL amount is true, otherwise it is false.
[0055] The steps for online evaluation of QR code printing quality are as follows:
[0056] Extract the quality characteristics of the two-dimensional code images with qualified and unqualified quality offline respectively, and train to obtain the Bayesian classifier parameters for judging whether the quality is qualified;
[0057] Load the Bayesian classifier parameters obtained through the above training into the online classifier;
[0058] Extract the quality characteristics of the two-dimensional code image in the observed sample image and input it into the online classifier to obtain the probability value of qualified quality;
[0059] When the probability value of the observed sample quality is lower than the set threshold, it is judged as unqualified. For example, taking a full score of 1.0 as an example, when the probability value is lower than 0.6, the algorithm returns a warning signal, and the cloud server sends a message to the terminal computer of the printing point, prompting the staff to check or replace the barcode printer.
[0060] In the above steps, a multi-stage process is adopted for the area of the two-dimensional code, and a variety of area-level features are used to respectively detect possible printing errors. The discrimination process is carried out by multi-feature joint decision-making; multi-level work is jointly completed to evaluate the quality of QR code printing, and the detection results are subjected to confidence filtering to eliminate accidental results.
[0061] The invention mainly consists of a software system. The software part includes the background data processing part and the man-machine interface part. The software runs on the server side of the network system in the form of services to realize true remote automation services. Use digital and information technology to improve the conversion efficiency of traditional paper media to computer information data. In particular, it provides a valuable technical foundation for improving the experience of the public's health checkup and improving the efficiency and accuracy of process processing.