CPC G06T 5/40 (2013.01) [G06T 7/136 (2017.01); G06V 10/764 (2022.01); G06T 2207/10024 (2013.01)] | 5 Claims |
1. A production monitoring and analysis method based on an image data algorithm, comprising:
obtaining a gray image of an image where a product identification code is located, obtaining a reconstructed gray level of each pixel in a gray histogram according to a mean value of the gray level, a maximum gray level, a minimum gray level, and a gradient of each pixel in the gray image, and obtaining a reconstructed gray histogram according to the reconstructed gray level of each pixel in the gray histogram;
a specific expression of the reconstructed gray level of each pixel is as follows:
wherein H(i,j) represents a reconstructed gray level of a pixel (i,j), xmax represents the maximum gray level, xmin, represents the minimum gray level, xij represents a gray level of a pixel (i, j), x represents the mean value of the gray level, and G(i,j) represents a gradient of the pixel (i,j) in the gray image;
obtaining a segmentation threshold of an Otsu algorithm for segmenting the reconstructed gray histogram, correcting the segmentation threshold to obtain a new segmentation threshold according to several pixels corresponding to each gray level in the reconstructed gray histogram, and segmenting the reconstructed gray histogram to obtain a sub-gray histogram according to the new segmentation threshold;
a specific expression of the new segmentation threshold is as follows:
wherein Sp represents the new segmentation threshold, nq represents a number of gray levels corresponding to a pixel q in the reconstructed gray histogram, Σnqq represents an area corresponding to the gray level in the reconstructed gray histogram, and xT represents the segmentation threshold;
obtaining a lateral segmentation threshold of the sub-gray histogram according to a total number of pixels in each sub-gray histogram and a length of a gray level interval of the sub-gray histogram, and obtaining an adjustment of the gray level in the sub-gray histogram according to the lateral segmentation threshold of the sub-gray histogram and all the gray levels greater than the lateral segmentation threshold; and
correcting the sub-gray histogram to obtain a corrected sub-gray histogram according to the adjustment of the gray level in the sub-gray histogram, the lateral segmentation threshold of the sub-gray histogram, and all the gray levels greater than the lateral segmentation threshold, obtaining an enhanced gray image according to the corrected sub-gray histogram, and identifying a recognition code in the enhanced gray image and completing a product classification.
|