CN111986222A - Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value - Google Patents

Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value Download PDF

Info

Publication number
CN111986222A
CN111986222A CN202010846589.2A CN202010846589A CN111986222A CN 111986222 A CN111986222 A CN 111986222A CN 202010846589 A CN202010846589 A CN 202010846589A CN 111986222 A CN111986222 A CN 111986222A
Authority
CN
China
Prior art keywords
image
threshold
pixel
gray
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010846589.2A
Other languages
Chinese (zh)
Inventor
田瑞
刘朋远
窦圣霞
丁海丽
严绍奎
张洁
周媛奉
马晓昉
张翔
张胜强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Marketing Service Center Of State Grid Ningxia Electric Power Co ltd Metering Center Of State Grid Ningxia Electric Power Co ltd
Original Assignee
Marketing Service Center Of State Grid Ningxia Electric Power Co ltd Metering Center Of State Grid Ningxia Electric Power Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Marketing Service Center Of State Grid Ningxia Electric Power Co ltd Metering Center Of State Grid Ningxia Electric Power Co ltd filed Critical Marketing Service Center Of State Grid Ningxia Electric Power Co ltd Metering Center Of State Grid Ningxia Electric Power Co ltd
Priority to CN202010846589.2A priority Critical patent/CN111986222A/en
Publication of CN111986222A publication Critical patent/CN111986222A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/14Fourier, Walsh or analogous domain transformations, e.g. Laplace, Hilbert, Karhunen-Loeve, transforms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • G06T2207/20032Median filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Geometry (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The invention discloses a smart meter chip image binarization processing method based on a self-adaptive mixed threshold, which comprises the following steps: s1, preprocessing the original image to obtain a gray image; s2, calculating a global threshold T according to the gray value of the whole gray imageg(ii) a S3, calculating the stroke width corresponding to each pixel point in the gray image, adaptively calculating the window width corresponding to each pixel, and calculating the window width of each pixel according to the pixel value in each windowLocal threshold Tw(ii) a S4, setting the global threshold TgAnd a local threshold TwObtaining a mixing threshold value T by combining calculation; and S5, carrying out binarization operation on the gray level image according to the mixed threshold value T to obtain an image after binarization processing. Compared with the prior art, the processing method provided by the invention aims at the problem of uneven image brightness of the chip of the intelligent electric meter, improves the traditional local threshold method, and performs weighted addition on the global threshold and the local threshold, thereby solving the problem that the local threshold algorithm does not consider the overall image effect.

Description

Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value
Technical Field
The invention relates to intelligent electric meter chip image processing, in particular to an intelligent electric meter chip image binarization processing method based on a self-adaptive mixed threshold value.
Background
The smart electric meter is an important basic device in a smart power grid, and problems such as mixed use and misuse of chips may occur in the processes of storage, transportation and installation, so that the chip type of the smart electric meter needs to be detected. Optical Character Recognition (OCR) is a relatively common image character recognition technique, and binarization is one of the most important steps of the technique. Due to the influences of various environmental factors such as complex background, shooting angle, strong and weak light and the like, the problems of uneven brightness, different sizes of partial characters and the like can occur in a shot chip image, so that the binarization effect is not ideal, and further the subsequent character recognition result is influenced.
Binarization refers to determining a threshold value according to the difference in grayscale characteristics between object information in an image and its background, so that the object and the background in the image are represented by two divided grayscale values. The spatial regions calculated according to the threshold value in the current binarization algorithm can be divided into two main categories: a global threshold algorithm and a local threshold algorithm. The global threshold algorithm is to calculate a global threshold according to the gray value of the whole image, and commonly used global threshold algorithms mainly include a large law method (Otsu), an iteration method and the like, and the algorithm is suitable for images with obvious double-peak gray histogram and uniform brightness. The local threshold rule is to determine the corresponding local threshold according to the gray value of each pixel and the neighborhood of the pixel. Common algorithms include Bernsen algorithm, Niblack algorithm, Sauvola algorithm and the like, the binarization effect of the algorithm for processing the image with uneven illumination is better than that of a global threshold value method, but the whole condition of the image is not considered, an over-segmentation effect and an artifact sometimes exist, and the effect is still not ideal. Moreover, most existing local thresholding methods require manual parameter adjustment to achieve optimal results, so fixed window sizes and parameter values cannot be handled efficiently for different image and character sizes.
Disclosure of Invention
The invention aims to overcome the defect that a chip image cannot be effectively binarized when a single global or local threshold algorithm is used due to the influence of uneven illumination and different sizes of chip image characters in the prior art, and provides a binarization processing method of an intelligent electric meter chip image based on a self-adaptive mixed threshold, aiming at the problem of uneven brightness of the intelligent electric meter chip image, the traditional local threshold method is improved, the global threshold and the local threshold are subjected to weighted addition, and the problem that the local threshold algorithm does not consider the overall effect of the image is solved; aiming at the problem of different sizes of chip image characters, the window width is automatically calculated for each pixel through stroke width conversion, and the local threshold is calculated according to different window widths and self-adaptive parameters, so that the mixed threshold is calculated in a self-adaptive mode, manual parameter adjustment is avoided, and the algorithm efficiency is improved.
The purpose of the invention is mainly realized by the following technical scheme:
the intelligent electric meter chip image binarization processing method based on the self-adaptive mixed threshold is characterized by comprising the following steps of: s1, preprocessing the original image to obtain a gray image; s2, calculating a global threshold T according to the gray value of the whole gray imageg(ii) a S3, calculating the stroke width corresponding to each pixel point in the gray level image, adaptively calculating the window width corresponding to each pixel, and calculating the local threshold T of each pixel according to the pixel value in each windoww(ii) a S4, setting the global threshold TgAnd a local threshold TwObtaining a mixing threshold value T by combining calculation; and S5, carrying out binarization operation on the gray level image according to the mixed threshold value T to obtain an image after binarization processing.
In the prior art, due to the influence of various environmental factors such as complex background, shooting angle and light intensity, the problems of uneven brightness, different sizes of partial characters and the like can occur in a shot intelligent electric meter chip image, so that the binarization effect is not ideal, and further the subsequent character recognition result is influenced. The spatial regions calculated according to the threshold value in the current binarization algorithm can be divided into two main categories: a global threshold algorithm and a local threshold algorithm. The global threshold algorithm is to calculate a global threshold according to the gray value of the whole image, and is suitable for images with obvious double-peak gray histogram and uniform brightness. The local threshold rule is to determine the corresponding local threshold according to the gray value of each pixel and the neighborhood of the pixel, and the binarization effect of the algorithm for processing the image with uneven illumination is better than that of the global threshold method, but the overall situation of the image is not considered, and sometimes an over-segmentation effect and an artifact exist, so the effect is still not ideal. According to the technical scheme, aiming at the problem of uneven image brightness of the intelligent electric meter chip, a traditional local threshold method is improved, a global threshold and a local threshold are subjected to weighted addition, a global threshold algorithm and a local threshold algorithm are combined, global and local characteristics are considered at the same time, the local threshold is optimized by using global information, and the problem that the overall effect of the image is not considered in the local threshold algorithm is solved. In the prior art, the local threshold value method adopted by the binarization of the character width difference needs to manually adjust parameters to obtain the optimal result, so that the fixed window size and parameter values cannot be effectively processed for different image and character sizes. One of the most important parameters in the local thresholding method is the window size, from which the local threshold can be calculated by extracting the desired features. Most of the local thresholding methods have fixed window sizes, and different regions of different images contain different information densities, and even in the same image, the stroke widths and sizes of characters may vary, so a fixed window size may work well for one image and not for others, and therefore their optimal values need to be set manually for a particular chip image. According to the technical scheme, aiming at the problem of different sizes of chip image characters, the window width is automatically calculated for each pixel through stroke width conversion, and the local threshold is calculated according to different window widths and self-adaption, so that manual parameter adjustment is avoided, and the processing efficiency is improved.
Further, the preprocessing the original image in S1 includes: s1.1, performing median filtering on an original image; s1.2, enhancing the image contrast by using a Laplace operator method.
The technical scheme provides a method for carrying out and processing on an original image. Median filtering is to replace the value of a point in a digital image or digital sequence with the median of the values of the points in a neighborhood of the point, so that the surrounding pixel values are close to the true values, thereby eliminating isolated noise points. According to the technical scheme, the noise of the original image is suppressed through median filtering, the edge information of the image is reserved, the fuzziness of the image is reduced, the original image is processed through a Laplacian method, and the image with the gray level mutation is generated, so that a better binarization effect is obtained.
Further, a specific method for performing median filtering on the original image in S1.1 is as follows: s1.1.1, firstly, taking a region with the size of 5 multiplied by 5 by taking each pixel point of an original image as a center; s1.1.2 and then sorting the pixels in the region by gray scale; s1.1.3, and finally replacing the center pixel with the median value of the array.
The technical scheme provides a specific method for performing median filtering on an original image, based on the image characteristics of a chip of an intelligent electric meter, a 5 x 5 area is selected by taking each pixel point as the center, a sequence of pixels in the area sorted according to the gray scale is obtained by utilizing a quick sorting principle, data is segmented, the image is quickly processed, and the processing efficiency is improved.
Further, the laplacian method used in S1.2 is specifically: s1.2.1, solving a laplacian operator for each pixel f (x, y) in the original image, specifically:
Figure BDA0002643232710000031
s1.2.2, according to the laplace operator, updating the value f (x, y) + c [. v ] of the pixel point2f(x,y)]Wherein c is 2. The technical scheme provides a specific calculation process of a Laplace operator method.
Further, S2 specifically includes: setting a gray level image f (x, y) to have N pixel points and L gray levels; dividing f (x, y) into C0And C1Two kinds, C0Class f (x, y) at gray level [0, Tg]Inner pixel point composition, C1Class f (x, y) at grey level [ T ]g+1,L]The inter-class variance of the two classes is: sigma2=μ0(m0-m)21(m1-m)2In which μ0And mu1Are respectively C0And C1Probability of two classes, m0And m1Are respectively C0And C1The gray level mean values of the two types, wherein m is the gray level mean value of the whole gray level image; in the gray scale range of L level, the threshold corresponding to the maximum inter-class variance is selected by adopting a traversal method, namely the threshold is the global threshold Tg
The technical scheme provides a method for calculating a global threshold, which is used for calculating the global threshold T according to the gray value of the whole gray imagegConsidering the global characteristics of the image, obtaining the global threshold value by calculating the maximum inter-class variance, and calculating the processThe method is simple and is not influenced by the brightness and the contrast of an image, and the image is divided into two parts through gray level classification. The larger the inter-class variance between the two classes is, the larger the difference between the two parts forming the image is, the smallest error probability is obtained by using the algorithm, and the efficiency and the accuracy of data processing can be effectively improved.
Further, S3 includes the steps of: s3.1, calculating the stroke width corresponding to each pixel point, and calculating the window width corresponding to each pixel in a self-adaptive manner, wherein the calculation formula is as follows: w (x, y) ═ 2 × a (x, y) +29, where a is the stroke width matrix and W (x, y) is the window width for each pixel; s3.2, obtaining the value of the adaptive parameter K of each point,
Figure BDA0002643232710000032
wherein S iswIs the standard deviation of the pixels within the window; s3.3, calculating a local threshold Tw
Figure BDA0002643232710000033
Wherein S iswIs the standard deviation of the pixels within the window, mwIs the average value of the pixels in the window, and K is the self-adaptive parameter of each pixel point.
Due to the influence of a plurality of environmental factors such as complex background, shooting angle, strong and weak light and the like, the shot chip image has the problem of different sizes of partial characters, so that the binarization effect is not ideal, and further the subsequent character recognition result is influenced. The technical scheme uses the mean value m of the gray levels in the windowwThe fixed parameter R is replaced to reduce the parameter and to enable the threshold to vary accurately according to the mean and standard deviation. Then, a square root is added to a coefficient part to construct a nonlinear factor, so that the influence of illumination change on a threshold value can be weakened, and an improved local threshold value formula is obtained; the technical scheme also provides a window width self-adaptive method, and the window width W (x, y) corresponding to each pixel point f (x, y) is calculated in a self-adaptive mode by using the stroke width matrix A. Because the optimal K values corresponding to different images are different, the use of the fixed K values is obviously not in line with the actual requirements, and the technical scheme also introduces the standard deviation of pixels in a window according to the characteristic of a local threshold algorithm to realize the K parametersThe adaptive calculation can ensure that the parameters can change according to different application scenes, and the accuracy of threshold calculation is ensured. In addition, in the technical scheme, the local threshold value binarization method is improved for the problem of uneven illumination, and the influence of uneven illumination on the binarization threshold value is weakened by constructing a nonlinear factor.
Further, the stroke width matrix a in S3.1 is obtained by the following method: s3.1.1, initializing all elements in the matrix A with the same dimension as the original image to infinity, and then detecting character edges by using a Canny algorithm on the original image; s3.1.2, calculating the gradient direction of each edge pixel point, and for any edge pixel u, the gradient direction guPerpendicular to the stroke boundary, along the path r ═ u + n ═ g, according to the gradient directionu(n > 0) another edge pixel v can be found; if the gradient direction g at vvAnd guConversely, the distance between pixels u and v in the path is taken as its stroke width; if no edge pixel v or g is foundvAnd guIf not, discarding the path; s3.1.3, along the direction of negative gradient-guSteps S3.1.1 and S3.1.2 are performed again to handle different background and text cases; s3.1.4, and finally, the matrix A formed by the stroke widths corresponding to the pixel points is the stroke width matrix.
The technical scheme provides a method for calculating a stroke width matrix A, wherein the method for acquiring the stroke width matrix A is based on an algorithm for operating a local image, the most possible stroke width of a certain pixel point is calculated according to a normal vector of the pixel point, the output of the algorithm is the matrix A with the same dimensionality as an original image, each element is the stroke width corresponding to the pixel at the position, and the window size corresponding to each pixel point can be estimated according to the stroke width of a character. The conventional method for estimating the stroke width of the character mainly comprises a run method, a normal vector method, a contour proportion method, a broad spectrum method and the like, and the technical scheme has small error of a stroke width estimation result based on a normal vector. The Canny algorithm adopted by the technical scheme is the prior art. In this embodiment, the matrices a in S3.1.1 and S3.1.4 are the same matrix, step S3.1.1 is initialization of the matrix, step S3.1.4 is the final result of the matrix, and the matrix a is a matrix with the same dimension as the original image, and each element of the matrix is initialized to infinity in step S3.1.1.
Further, S4 specifically includes: s4.1, firstly, calculating the gray mean value m of the whole gray image, and comparing the gray value of each pixel point with the mean value m, wherein the gray value smaller than m is classified as m1Class, greater than or equal to m is classified as m2Class, calculating the mean value T of the two classes1、T2(ii) a S4.2, then utilizing the weight parameter to carry out global threshold TgAnd local threshold T of each pixelwWeighting and according to the mean value of the gray levels T1、T2And (3) constraining the range of the pixel points to finally obtain the self-adaptive mixed threshold T of each pixel point, wherein the calculation formula is as follows:
Figure BDA0002643232710000041
wherein the weight parameter beta is belonged to (0, 1).
The technical scheme provides a global threshold TgAnd a local threshold TwCombining with a specific algorithm for calculating to obtain a mixed threshold T, and combining with a global threshold TgAnd a locally adaptive threshold TwAnd weighting the image to obtain a final self-adaptive mixed threshold, combining a global threshold algorithm and a local threshold algorithm, and optimizing the local threshold by using global information, thereby solving the problem that the local threshold algorithm does not consider the overall effect of the image.
Further, β is 0.2.
The inventors have conducted experiments with different β values and found that when β is 0.2, the accuracy PR and the recall ratio RC in the image after the binarization processing are both maximized.
Further, S5 specifically includes: if the gray value of a pixel in the gray image is less than T, the target is judged, and the gray value of the pixel is set to be 0; otherwise, the image is judged as the background, the pixel gray value is set to be 255, and the image after the binarization processing is obtained.
In conclusion, compared with the prior art, the invention has the following beneficial effects:
1. aiming at the problem of uneven image brightness of the chip of the intelligent electric meter, the traditional local threshold method is improved, the global threshold and the local threshold are subjected to weighted addition, and the problem that the overall effect of the image is not considered in the local threshold algorithm is solved.
2. Aiming at the problem of different sizes of chip image characters, the method automatically calculates the window width of each pixel by stroke width conversion, and calculates the local threshold according to different window widths and set self-adaptive parameters, thereby calculating the mixed threshold in a self-adaptive manner, avoiding manual parameter adjustment and improving the efficiency of the algorithm.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a flow chart of a smart meter chip image binarization processing method based on an adaptive mixed threshold value;
FIG. 2 shows the weight β parameter optimization result;
FIG. 3 is a grayscale image of a document image with uneven illumination;
FIG. 4 is an image of a document image with uneven illumination binarized by an Otsu algorithm;
FIG. 5 is an image of a document image with uneven illumination binarized by a Niblack algorithm;
FIG. 6 is an image of a document image with uneven illumination binarized by the Sauvola algorithm;
FIG. 7 is an image of a document image with uneven illumination after binarization processing by the method of embodiment 2;
FIG. 8 is an original image of an ammeter chip image with uneven corner illumination;
FIG. 9 is a grayscale image of an edge and corner illumination non-uniform ammeter chip image;
FIG. 10 is an image of an electric meter chip image with uneven corner illumination binarized by an Otsu algorithm;
FIG. 11 is an image of an electric meter chip image with uneven corner illumination and binarized by a Niblack algorithm;
FIG. 12 is an image of an electric meter chip image with uneven corner illumination binarized by a Sauvola algorithm;
FIG. 13 is an image of an electric meter chip image with uneven corner illumination, which has been subjected to binarization processing by the method of embodiment 2;
FIG. 14 is an original image of a chip image with center low brightness and varying character sizes;
FIG. 15 is a grayscale image of a chip image of a meter with center low brightness and varying character sizes;
FIG. 16 is an image of a center low-brightness and different-character-size electric meter chip image binarized by an Otsu algorithm;
FIG. 17 is an image of a center low-brightness and different-character-size ammeter chip image binarized by a Niblack algorithm;
FIG. 18 is a Sauvola-algorithm binarized image of a chip image of a meter with low center brightness and different character sizes;
FIG. 19 is a view showing a chip image with low center brightness and different character sizes after binarization processing by the method of embodiment 2;
FIG. 20 is an original image of a chip image with center highlighting and varying character sizes;
FIG. 21 is a grayscale image of a chip image of a meter with center highlight and varying character sizes;
FIG. 22 is an image of a center highlight and different character size electric meter chip image binarized by an Otsu algorithm;
FIG. 23 is an image of a chip image of a meter with center high brightness and different character sizes binarized by a Niblack algorithm;
FIG. 24 is a Sauvola-algorithm binarized image of a chip image of a meter with center high brightness and different character sizes;
fig. 25 is an image of a chip image with high center brightness and different character sizes, which has been binarized by the method of example 2.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
Example 1:
the embodiment comprises the following steps: s1, acquiring an original image, and preprocessing the original image to acquire a gray image; s2, calculating a global threshold T according to the gray value of the whole gray imageg(ii) a S3, calculating the stroke width corresponding to each pixel point in the gray level image, adaptively calculating the window width corresponding to each pixel, and calculating the local threshold T of each pixel according to the pixel value in each windoww(ii) a S4, setting the global threshold TgAnd a local threshold TwObtaining a mixing threshold value T by combining calculation; and S5, carrying out binarization operation on the gray level image according to the mixed threshold value T to obtain an image after binarization processing.
Preferably, the preprocessing the original image in S1 includes: s1.1, performing median filtering on the original image, wherein a preferred specific method for performing median filtering on the original image in S1.1 is as follows: s1.1.1, firstly, taking a region with the size of 5 multiplied by 5 by taking each pixel point of an original image as a center; s1.1.2 and then sorting the pixels in the region by gray scale; s1.1.3, and finally replacing the center pixel with the median value of the array. S1.2, enhancing image contrast by using a Laplace operator method, preferably, the Laplace operator method used in S1.2 is specifically as follows: s1.2.1, solving a laplacian operator for each pixel f (x, y) in the original image, specifically:
Figure BDA0002643232710000061
s1.2.2, according to the laplace operator, updating the value f (x, y) + c [. v ] of the pixel point2f(x,y)]Wherein c is 2.
Example 2:
as shown in fig. 1, the present embodiment further includes, on the basis of embodiment 1: s2 specifically includes: setting a gray level image f (x, y) to have N pixel points and L gray levels; dividing f (x, y) into C0And C1Two kinds, C0Class f (x, y) at gray level [0, Tg]Inner pixel point composition, C1Class f (x, y) at grey level [ T ]g+1,L]Inner pixel point composition, both of these typesThe between-class variance is: sigma2=μ0(m0-m)21(m1-m)2In which μ0And mu1Are respectively C0And C1Probability of two classes, m0And m1Are respectively C0And C1The gray level mean values of the two types, wherein m is the gray level mean value of the whole gray level image; in the gray scale range of L level, the threshold corresponding to the maximum inter-class variance is selected by adopting a traversal method, namely the threshold is the global threshold Tg. S3 includes the steps of: s3.1, calculating the stroke width corresponding to each pixel point, and calculating the window width corresponding to each pixel in a self-adaptive manner, wherein the calculation formula is as follows: w (x, y) ═ 2 × a (x, y) +29, where a is the stroke width matrix and W (x, y) is the window width for each pixel; s3.2, obtaining the value of the adaptive parameter K of each point,
Figure BDA0002643232710000071
wherein S iswIs the standard deviation of the pixels within the window; s3.3, calculating a local threshold Tw
Figure BDA0002643232710000072
Wherein S iswIs the standard deviation of the pixels within the window, mwIs the average value of the pixels in the window, and K is the self-adaptive parameter of each pixel point.
Preferably, the stroke width matrix a in S3.1 is obtained by: s3.1.1, initializing all elements in the matrix A with the same dimension as the original image to infinity (∞), and then detecting character edges by using a Canny algorithm on the original image; s3.1.2, calculating the gradient direction of each edge pixel point, and for any edge pixel u, the gradient direction guPerpendicular to the stroke boundary, along the path r ═ u + n ═ g, according to the gradient directionu(n > 0) another edge pixel v can be found; if the gradient direction g at vvAnd guConversely, the distance between pixels u and v in the path is taken as its stroke width; if no edge pixel v or g is foundvAnd guIf not, discarding the path; s3.1.3, along the direction of negative gradient-guStep S3.1 is performed again.1 and S3.1.2 to handle different background and text situations; s3.1.4, and finally, the matrix A formed by the stroke widths corresponding to the pixel points is the stroke width matrix.
Preferably, S4 is specifically: s4.1, firstly, calculating the gray mean value m of the whole gray image, and comparing the gray value of each pixel point with the mean value m, wherein the gray value smaller than m is classified as m1Class, greater than or equal to m is classified as m2Class, calculating the mean value T of the two classes1、T2(ii) a S4.2, then utilizing the weight parameter to carry out global threshold TgAnd local threshold T of each pixelwWeighting and according to the mean value of the gray levels T1、T2And (3) constraining the range of the pixel points to finally obtain the self-adaptive mixed threshold T of each pixel point, wherein the calculation formula is as follows:
Figure BDA0002643232710000073
wherein the weight parameter beta is belonged to (0, 1). Preferably, β is 0.2.
Preferably, S5 is specifically: if the gray value of a pixel in the gray image is less than T, the target is judged, and the gray value of the pixel is set to be 0; otherwise, the image is judged as the background, the pixel gray value is set to be 255, and the image after the binarization processing is obtained.
According to the intelligent electric meter chip image binarization processing method based on the self-adaptive mixed threshold, aiming at the problem of uneven illumination, a local threshold binarization method is improved, and the influence of uneven illumination on a binarization threshold is weakened by constructing a nonlinear factor. Then, aiming at the influence of different sizes of characters on binarization, estimating the character width based on stroke width conversion to obtain a self-adaptive window width, avoiding binarization error caused by fixed window width, and calculating a local threshold value according to different window widths and set self-adaptive parameters, thereby calculating a mixed threshold value in a self-adaptive manner, avoiding manual parameter adjustment and improving the efficiency of an algorithm; and finally, in order to further improve the binarization effect and avoid binarization area deviation caused by a single threshold, combining a global threshold algorithm and a local threshold algorithm, and optimizing a local threshold by using global information, thereby solving the problem that the local threshold algorithm does not consider the overall effect of the image.
Verification and comparative test: in order to verify the image processing method of the smart meter chip provided in embodiment 2, the inventor optimizes the weight parameter β in the first experiment; the inventors compared the binarization effects of the method of example 2 with the image processing using the existing Otsu algorithm, Niblack algorithm, and Sauvola algorithm in experiments two and three.
1. And (3) measurement indexes are as follows:
1.1, precision pr (precision), recall rc (recall):
Figure BDA0002643232710000081
PR and RC are commonly used image binarization quality evaluation indexes, the larger the values of PR and RC are, the better the binarization effect is, in the formula, NTTIs the number of correct target points in the binarized image, NFTIs the number of erroneous target points in the binarized image, NFTIs the number of the wrong target points in the original image.
1.2, F measurement index (FM):
Figure BDA0002643232710000082
the difference between the binarized image obtained by FM comprehensive consideration and the ideal binarized image is larger, and the binarization effect is better.
1.3, peak signal to noise ratio (PSNR):
Figure BDA0002643232710000083
PSNR is mainly used for representing the noise-containing condition of a binary image, wherein noise refers to pixels subjected to error binarization, the higher the value of PSNR is, the less the noise of the binary image is, D is the contrast of the image, and the corresponding D value of the binary image is 1; m, N are the height and width of the image, respectively; i isB(I, j) and IGTAnd (i, j) respectively corresponding to pixel points of the binary image and the ideal binary image.
1.4, reciprocal distance distortion metric (DRD):
Figure BDA0002643232710000084
DRD forEvaluating the visual distortion of the binary image, wherein the smaller the value of the visual distortion, the less the distortion and the better the binarization effect, wherein NUBN is the number of non-uniform 8 x 8 blocks in the image, and DRDk is the distance inverse distortion of each pixel.
2. Detailed experiments
2.1, experiment one
The weight parameter beta is optimized in the experiment, 5 images in the binary data set DIBCO2013 are taken, uneven illumination is added, the binary experiment is carried out under different beta values, and the result is shown in figure 2. It can be seen from fig. 2 that at β of 0.2, both average PR and RC reach a maximum. Therefore, the optimum value of β is 0.2.
2.2 experiment two
In the experiment, the method of example 2 was compared with the binarization of the image processing by the existing Otsu algorithm, the Niblack algorithm and the Sauvola algorithm, for the image with uneven illumination and dark spots. A standard binarization data set DIBCO2013 is used, random uneven illumination influence is added to the data set, parameter tuning is performed on each method, the comparison result of an illustration in the data set is shown in figures 3-7, wherein figures 3-7 are binarization comparison of uneven illumination document images. The data set was binarized for 16 images and the results averaged as shown in the table below.
Ostu Niblack Sauvola Example 2
PR(%) 67.74 39.65 96.12 97.49
RC(%) 67.74 39.65 96.01 97.13
PSNR 10.88 9.11 12.83 13.17
FM(%) 56.99 43.83 53.34 60.62
DRD 50.78 39.13 12.68 11.56
As can be seen from fig. 3 to 7 and the above table, for the image with uneven illumination and dark spots, the binarization effect is the best by using the method of embodiment 2 and the performance of the five evaluation indexes is also the best due to the improvement of the threshold formula and the introduction of the window adaptive algorithm based on stroke width transformation. However, the Sauvola algorithm cannot adaptively adjust the window width according to the image characteristics, the binarization effect of the edge region is not as good as that of the method in embodiment 2, and the effect evaluation of each index is lower than that of the method in embodiment 2. The Niblack algorithm has poor binarization effect on the edge highlight area and has more artifacts, the Otsu algorithm is sensitive to uneven illumination, so that the threshold values of the text area and the highlight area are inaccurate, misjudgment of a large area occurs, the binarization effect is poor, and the three indexes of recall rate RC, accuracy rate PR and DRD of the two algorithms are poor.
2.3, experiment III
The experiment is carried out by selecting several common scenes with uneven illumination and chip images with different character sizes aiming at the binarization effect of the chip image of the intelligent electric meter in practical application. The experimental result images are shown in fig. 8-13, fig. 14-19 and fig. 20-25, wherein fig. 8-13 are graphs comparing the edge illumination non-uniform electric meter chip image binaryzation, fig. 14-19 are graphs comparing the center low brightness and different character sizes, fig. 20-25 are graphs comparing the center high brightness and different character sizes,
as can be seen from fig. 8-13, fig. 14-19 and fig. 20-25, because the gray levels of some background areas of the chip image are similar to the gray level of the text due to the influence of the non-uniform illumination, Otsu using the global threshold value has a more serious phenomenon of the false binarization of the background. The Niblack algorithm retains target information of chip characters, but generates an over-segmentation effect, generates a large amount of artifacts, and is the most serious in FIG. 17. The Sauvola algorithm outperforms the Otsu algorithm and the Niblack algorithm, but still produces more noise than the example 2 method. The binarization effect of the method of the embodiment 2 is the best, the target information is completely reserved, only a few artifacts exist, and the influence on the subsequent character recognition is small.
In the images with different sizes of the two groups of characters, namely fig. 14 to 19 and fig. 20 to 25, the algorithm of the embodiment 2 has the best binarization effect on the characters, the outline of the characters is clearer, the noise points of the peripheral adhesion are less, the images are closest to the real image, and the other three algorithms all have certain problems, so that the characters are incomplete and unclear.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. The intelligent electric meter chip image binarization processing method based on the self-adaptive mixed threshold is characterized by comprising the following steps of:
s1, preprocessing the original image to obtain a gray image;
s2, calculating a global threshold T according to the gray value of the whole gray imageg
S3, calculating the stroke width corresponding to each pixel point in the gray level image, adaptively calculating the window width corresponding to each pixel, and calculating the local threshold T of each pixel according to the pixel value in each windoww
S4, setting the global threshold TgAnd a local threshold TwObtaining a mixing threshold value T by combining calculation;
and S5, carrying out binarization operation on the gray level image according to the mixed threshold value T to obtain an image after binarization processing.
2. The intelligent meter chip image binarization processing method based on the adaptive mixed threshold value as claimed in claim 1, wherein the preprocessing of the original image in S1 includes:
s1.1, performing median filtering on an original image;
s1.2, enhancing the image contrast by using a Laplace operator method.
3. The intelligent electric meter chip image binarization processing method based on the adaptive mixed threshold value as claimed in claim 2, wherein a specific method for performing median filtering on the original image in S1.1 is as follows:
s1.1.1, firstly, taking a region with the size of 5 multiplied by 5 by taking each pixel point of an original image as a center;
s1.1.2 and then sorting the pixels in the region by gray scale;
s1.1.3, and finally replacing the center pixel with the median value of the array.
4. The intelligent meter chip image binarization processing method based on the adaptive mixed threshold value as claimed in claim 2, wherein the laplacian operator method used in S1.2 specifically is:
s1.2.1, solving a laplacian operator for each pixel f (x, y) in the original image, specifically:
Figure FDA0002643232700000011
s1.2.2, updating the value of the pixel point according to the Laplace operator
Figure FDA0002643232700000012
Wherein c is 2.
5. The intelligent meter chip image binarization processing method based on the adaptive mixing threshold value as claimed in claim 1, wherein the S2 is specifically: setting a gray level image f (x, y) to have N pixel points and L gray levels; dividing f (x, y) into C0And C1Two kinds, C0Class f (x, y) at gray level [0, Tg]Inner pixel point composition, C1Class f (x, y) at grey level [ T ]g+1,L]The inter-class variance of the two classes is: sigma2=μ0(m0-m)21(m1-m)2In which μ0And mu1Are respectively C0And C1Probability of two classes, m0And m1Are respectively C0And C1The gray level mean values of the two types, wherein m is the gray level mean value of the whole gray level image; in the L-level gray scale range, traversal is adoptedThe method selects the threshold corresponding to the maximum inter-class variance, namely the global threshold Tg
6. The adaptive mixing threshold based intelligent electric meter chip image binarization processing method as claimed in claim 1, wherein the S3 includes steps of:
s3.1, calculating the stroke width corresponding to each pixel point, and calculating the window width corresponding to each pixel in a self-adaptive manner, wherein the calculation formula is as follows: w (x, y) ═ 2 × a (x, y) +29, where a is the stroke width matrix and W (x, y) is the window width for each pixel;
s3.2, obtaining the value of the adaptive parameter K of each point,
Figure FDA0002643232700000021
wherein S iswIs the standard deviation of the pixels within the window;
s3.3, calculating a local threshold Tw
Figure FDA0002643232700000022
Wherein S iswIs the standard deviation of the pixels within the window, mwIs the average value of the pixels in the window, and K is the self-adaptive parameter of each pixel point.
7. The image binarization processing method for the smart meter chip based on the adaptive mixed threshold value as claimed in claim 6, wherein the stroke width matrix A in S3.1 is obtained by the following method:
s3.1.1, initializing all elements in the matrix A with the same dimension as the original image to infinity, and then detecting character edges by using a Canny algorithm on the original image;
s3.1.2, calculating the gradient direction of each edge pixel point, and for any edge pixel u, the gradient direction guPerpendicular to the stroke boundary, along the path r ═ u + n ═ g, according to the gradient directionu(n > 0) another edge pixel v can be found; if the gradient direction g at vvAnd guInstead, the distance between pixels u and v in the path is taken as its penDrawing the width; if no edge pixel v or g is foundvAnd guIf not, discarding the path;
s3.1.3, along the direction of negative gradient-guSteps S3.1.1 and S3.1.2 are performed again to handle different background and text cases;
s3.1.4, and finally, the matrix A formed by the stroke widths corresponding to the pixel points is the stroke width matrix.
8. The intelligent meter chip image binarization processing method based on the adaptive mixing threshold value as claimed in claim 1, wherein the S4 is specifically:
s4.1, firstly, calculating the gray mean value m of the whole gray image, and comparing the gray value of each pixel point with the mean value m, wherein the gray value smaller than m is classified as m1Class, greater than or equal to m is classified as m2Class, calculating the mean value T of the two classes1、T2
S4.2, then utilizing the weight parameter to carry out global threshold TgAnd local threshold T of each pixelwWeighting and according to the mean value of the gray levels T1、T2And (3) constraining the range of the pixel points to finally obtain the self-adaptive mixed threshold T of each pixel point, wherein the calculation formula is as follows:
T=β×Tg+(1-β)Tw
Figure FDA0002643232700000023
wherein the weight parameter beta is belonged to (0, 1).
9. The image binarization processing method for the smart meter chip based on the adaptive mixed threshold value as claimed in claim 8, wherein β ═ 0.2.
10. The intelligent meter chip image binarization processing method based on the adaptive mixing threshold value as claimed in claim 1, wherein the S5 is specifically: if the gray value of a pixel in the gray image is less than T, the target is judged, and the gray value of the pixel is set to be 0; otherwise, the image is judged as the background, the pixel gray value is set to be 255, and the image after the binarization processing is obtained.
CN202010846589.2A 2020-08-21 2020-08-21 Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value Pending CN111986222A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010846589.2A CN111986222A (en) 2020-08-21 2020-08-21 Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010846589.2A CN111986222A (en) 2020-08-21 2020-08-21 Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value

Publications (1)

Publication Number Publication Date
CN111986222A true CN111986222A (en) 2020-11-24

Family

ID=73442759

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010846589.2A Pending CN111986222A (en) 2020-08-21 2020-08-21 Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value

Country Status (1)

Country Link
CN (1) CN111986222A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434498A (en) * 2020-12-10 2021-03-02 清研灵智信息咨询(北京)有限公司 Intelligent form construction method based on cloud platform
CN113362319A (en) * 2021-06-30 2021-09-07 深圳市创想三维科技股份有限公司 Laser printing method and device based on image processing, laser printer and computer readable storage medium
CN113808034A (en) * 2021-08-09 2021-12-17 天津大学 Local self-adaptive wavelet image denoising method combined with global threshold
CN116721042A (en) * 2023-08-10 2023-09-08 广东石油化工学院 Multi-threshold binarization-based image tilt correction method
WO2023173557A1 (en) * 2022-03-15 2023-09-21 平安科技(深圳)有限公司 Image processing method and apparatus, and electronic device and storage medium
CN117115035A (en) * 2023-09-04 2023-11-24 长春奥普光电技术股份有限公司 Uneven illumination image correction method
CN117392685A (en) * 2023-11-09 2024-01-12 深圳市深档数码技术有限公司 Scanned document quality improving method, device, storage medium and equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101170641A (en) * 2007-12-05 2008-04-30 北京航空航天大学 A method for image edge detection based on threshold sectioning
CN102289668A (en) * 2011-09-07 2011-12-21 谭洪舟 Binaryzation processing method of self-adaption word image based on pixel neighborhood feature
CN105374015A (en) * 2015-10-27 2016-03-02 湖北工业大学 Binary method for low-quality document image based on local contract and estimation of stroke width
CN105447491A (en) * 2014-07-25 2016-03-30 北京大学深圳研究生院 Signboard image binaryzation method and device
CN109543686A (en) * 2018-10-24 2019-03-29 重庆师范大学 Character recognition based on adaptive multi-thresholding pre-processes binarization method
CN111046872A (en) * 2019-12-12 2020-04-21 深圳市杰恩世智能科技有限公司 Optical character recognition method
CN111145193A (en) * 2019-12-30 2020-05-12 广州医软智能科技有限公司 Adaptive global threshold value binarization method
CN111160358A (en) * 2019-12-30 2020-05-15 浪潮(北京)电子信息产业有限公司 Image binarization method, device, equipment and medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101170641A (en) * 2007-12-05 2008-04-30 北京航空航天大学 A method for image edge detection based on threshold sectioning
CN102289668A (en) * 2011-09-07 2011-12-21 谭洪舟 Binaryzation processing method of self-adaption word image based on pixel neighborhood feature
CN105447491A (en) * 2014-07-25 2016-03-30 北京大学深圳研究生院 Signboard image binaryzation method and device
CN105374015A (en) * 2015-10-27 2016-03-02 湖北工业大学 Binary method for low-quality document image based on local contract and estimation of stroke width
CN109543686A (en) * 2018-10-24 2019-03-29 重庆师范大学 Character recognition based on adaptive multi-thresholding pre-processes binarization method
CN111046872A (en) * 2019-12-12 2020-04-21 深圳市杰恩世智能科技有限公司 Optical character recognition method
CN111145193A (en) * 2019-12-30 2020-05-12 广州医软智能科技有限公司 Adaptive global threshold value binarization method
CN111160358A (en) * 2019-12-30 2020-05-15 浪潮(北京)电子信息产业有限公司 Image binarization method, device, equipment and medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434498A (en) * 2020-12-10 2021-03-02 清研灵智信息咨询(北京)有限公司 Intelligent form construction method based on cloud platform
CN113362319A (en) * 2021-06-30 2021-09-07 深圳市创想三维科技股份有限公司 Laser printing method and device based on image processing, laser printer and computer readable storage medium
CN113808034A (en) * 2021-08-09 2021-12-17 天津大学 Local self-adaptive wavelet image denoising method combined with global threshold
CN113808034B (en) * 2021-08-09 2023-07-28 天津大学 Local self-adaptive wavelet image denoising method combined with global threshold
WO2023173557A1 (en) * 2022-03-15 2023-09-21 平安科技(深圳)有限公司 Image processing method and apparatus, and electronic device and storage medium
CN116721042A (en) * 2023-08-10 2023-09-08 广东石油化工学院 Multi-threshold binarization-based image tilt correction method
CN117115035A (en) * 2023-09-04 2023-11-24 长春奥普光电技术股份有限公司 Uneven illumination image correction method
CN117392685A (en) * 2023-11-09 2024-01-12 深圳市深档数码技术有限公司 Scanned document quality improving method, device, storage medium and equipment

Similar Documents

Publication Publication Date Title
CN111986222A (en) Intelligent electric meter chip image binarization processing method based on self-adaptive mixed threshold value
CN107680054B (en) Multi-source image fusion method in haze environment
Su et al. Binarization of historical document images using the local maximum and minimum
WO2017121018A1 (en) Method and apparatus for processing two-dimensional code image, and terminal and storage medium
CN110210477B (en) Digital instrument reading identification method
CN109658424B (en) Improved robust two-dimensional OTSU threshold image segmentation method
JP2008067387A (en) Methods and systems for identifying text in digital images
US7411699B2 (en) Method and apparatus to enhance digital image quality
CN110647795A (en) Form recognition method
CN108805835B (en) SAR image bilateral filtering method based on truncation statistical characteristics
CN109190632A (en) A kind of binarization method of ancient books file and picture
CN116630813B (en) Highway road surface construction quality intelligent detection system
CN105701491A (en) Method for making fixed-format document image template and application thereof
CN115512224A (en) Road crack detection method with enhanced curve fitting contrast
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
CN118279304B (en) Abnormal recognition method, device and medium for special-shaped metal piece based on image processing
CN117274113A (en) Broken silicon wafer cleaning effect visual detection method based on image enhancement
CN116468958A (en) Communication tower safety detection method and system
CN117351001A (en) Surface defect identification method for regenerated aluminum alloy template
CN105608683B (en) A kind of single image to the fog method
CN108205678B (en) Nameplate character recognition processing method containing bright spot interference
CN106815851A (en) A kind of grid circle oil level indicator automatic reading method of view-based access control model measurement
CN107967690B (en) Self-adaptive ferrographic abrasive particle image binarization processing method
Tabatabaei et al. A novel method for binarization of badly illuminated document images
Wilkinson Gaussian-weighted moving-window robust automatic threshold selection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201124

RJ01 Rejection of invention patent application after publication