CN117523174A - Method for rapidly matching and identifying sprayed codes of meter cover - Google Patents

Method for rapidly matching and identifying sprayed codes of meter cover Download PDF

Info

Publication number
CN117523174A
CN117523174A CN202311393425.9A CN202311393425A CN117523174A CN 117523174 A CN117523174 A CN 117523174A CN 202311393425 A CN202311393425 A CN 202311393425A CN 117523174 A CN117523174 A CN 117523174A
Authority
CN
China
Prior art keywords
image
area
table cover
cover
code spraying
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
CN202311393425.9A
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.)
Minjiang University
Original Assignee
Minjiang University
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 Minjiang University filed Critical Minjiang University
Priority to CN202311393425.9A priority Critical patent/CN117523174A/en
Publication of CN117523174A publication Critical patent/CN117523174A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/09Recognition of logos

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to a method for rapidly matching and identifying a spray code of a watch cover. Firstly, extracting a table cover region through steps of image cutting, binarization, establishment of a proper screening strategy and the like; then, calculating gradients of the table cover region images and obtaining candidate target regions by using morphological operations; then, respectively making extraction strategies aiming at different target areas to obtain a model code spraying area and a number code spraying area of the table cover; finally, model matching and number identification of the same type of meter covers are realized through an open source algorithm. Experimental results show that the method has good accuracy and universality, and can be used for respectively matching and identifying the serial numbers of different types of water meter cover models.

Description

Method for rapidly matching and identifying sprayed codes of meter cover
Technical Field
The invention belongs to the technical field of image recognition, and particularly relates to a method for rapidly matching and recognizing a table cover code spraying.
Background
After the production of the water meter cover is finished, the code spraying is carried out on the water meter cover to be used as a main method for recording the type and the corresponding number information of the water meter cover, and the water meter cover has indispensable functions in the aspects of quality tracing and storage management. Currently, after the formation of the water meter cover is completed, many water meter cover manufacturers still adopt a method of manually identifying and spraying codes to check the model number and the number of the water meter cover. The manual reading method not only increases the labor intensity of workers, but also is easy to visually fatigue due to the continuous expansion of productivity, so that the recognition efficiency and accuracy are not guaranteed. Therefore, the conventional manual identification method cannot meet the daily production requirement, and a detection method for automatically matching the water meter cover types and identifying the serial numbers by spraying codes is needed to be realized through an image identification technology.
Disclosure of Invention
The invention aims to provide a method for quickly matching and identifying a table cover code spraying, which comprises the steps of firstly, cutting out images, binarizing, formulating a proper screening strategy and the like to realize extraction of a table cover region; then, calculating gradients of the table cover region images and obtaining candidate target regions by using morphological operations; then, respectively making extraction strategies aiming at different target areas to obtain a model code spraying area and a number code spraying area of the table cover; finally, model matching and number identification of the same type of meter covers are realized through an open source algorithm. Experimental results show that the method has good accuracy and universality, and can be used for respectively matching and identifying the serial numbers of different types of water meter cover models.
In order to achieve the above purpose, the technical scheme of the invention is as follows: a method for fast matching and identifying the code spraying of the table cover includes cutting out images, binarizing and setting up screening strategies to extract the table cover area; then, calculating gradients of the table cover region images and obtaining candidate target regions by using morphological operations; then, respectively making extraction strategies for different candidate target areas to obtain a model code spraying area and a number code spraying area of the table cover; and finally, identifying the model matching and the number of the same type of meter cover.
In an embodiment of the present invention, the table cover area extraction is specifically implemented as follows:
s11, cutting images: cutting the image according to the height through a formula (1) according to the image information obtained by shooting;
wherein h is 0 ,w 0 H is the height and width of the initial image i To the height of the cut image, w i For the width of the cut image, only the height of the image is cut;
s12, binarizing the image: firstly, graying the cut image by using a cv2.cvtColor function (color space conversion function) to obtain a gray map; then, a threshold value is set to 50 by using a cv2.Threshold function (binarization function), and binarization processing is performed on the gray scale map to obtain a binary map;
s13, positioning a surface cover area: according to the binary image, a screening strategy is formulated to obtain a table cover area: firstly, traversing all contours in a binary image, calculating the areas of the contours, extracting the contours with the largest areas, and filling by using the largest circumscribed rectangle; then, assigning the filling result to the corresponding position of the binary image with the same size as the original image and an initialization value of 0 through a formula (2); finally, using a cv2.minEnclosing circle function (minimum circumcircle function) to obtain a center coordinate point (x, y) of a minimum circumcircle of a corresponding outline on an original image and a radius length radius, and filling a maximum circumrectangle after the radius length radius is 1.2 to obtain a target area;
wherein I is c Is a binary image with the same size as the original image and an initial value of 0, I b The binary image is obtained after filling;
s14, extracting a table cover area: the target region obtained in S13 acquires the coordinates (x 1 ,y 1 ) And the coordinates of the lower right corner point (x 2 ,y 2 ) Calculating the height and width of the white area through a formula (3), and finally cutting out the image at the corresponding position from the original image to obtain a table cover area diagram;
height,width=y 1 -y 2 ,x 1 -x 2 (3)。
in an embodiment of the present invention, the specific implementation manner of obtaining the candidate target area is as follows:
s21, calculating image gradient: first, the extracted table cover region map is converted into a gray map using a cv2.cvtcolor function (color space conversion function); then, respectively adopting Sobel operators in the X direction and the Y direction to filter the converted gray level image, calculating gradients in the two directions, and calculating the total gradient of the image through a formula (4) to obtain a total gradient image;
G(i,j)=Ω(i,j)*S X +Ω(i,j)*S Y (4)
wherein S is X And S is equal to Y Operators divided into two directions, wherein omega (i, j) represents a 3*3 local image window taking a pixel point (i, j) as a center, and G (i, j) represents a value at the pixel point (i, j) in an image gradient calculation result;
s22, morphological operation:
first, two rectangular structural elements E are constructed 1 、E 2
Wherein H is the height of the image, n i And m i Representing the number of rows and columns of the corresponding matrix respectively;
then, respectively utilize the structural element E 1 And E is 2 Executing a Closing operation and an Opening operation on the total gradient map;
s23, binarizing the image: e obtained after morphological operation S22 1 And E is 2 And respectively performing binarization processing on the basis of the corresponding gray level map.
In an embodiment of the present invention, the specific implementation manner of the model code spraying area and the number code spraying area of the obtained table cover is as follows:
s41, model code spraying area extraction
Because the model code-spraying identification areas are positioned at the left side and the right side of the meter cover, E is obtained based on S23 1 Corresponding to the binarization map, the following extraction steps are formulated: firstly, taking left and right side area images according to the width of the image being 3 times; then, defining a rectangular construction element E with the size of (n, n) to perform expansion operation on the image twice; finally, traversing the outline in the obtained image, reserving the part with the largest outline area, filling by using the largest circumscribed rectangle, and then executing one-time expansion operation by using a rectangular construction element E with the size of (n, n) to obtain images of the left side area of the table cover and the right side area of the table cover;
respectively acquiring coordinates (x) of upper left corner points of white areas in images of left areas of the table cover and right areas of the table cover 1 ,y 1 ) With the lower right corner coordinates (x 2 ,y 2 ) Calculating the height and width of the white area respectively through a formula (3), and finally cutting out images at corresponding positions from the original image to obtain areas on the left side and the right side of the watch cover, namely a watch cover model code spraying area;
s42, code spraying area extraction
Since the numbering spray area is located in the area above the watch cover, E is obtained based on S23 2 Corresponding to the binarization map, the following extraction steps are formulated: firstly, dividing an image into two parts according to the height, and intercepting an image of an upper area; then traversing the outline in the image, calculating the outline area, reserving an outline area with the outline area larger than 20000 and the aspect ratio of the circumscribed maximum rectangle larger than 6, and filling by using the maximum circumscribed rectangle;
and (3) defining a rectangular constructional element E with the size of (m, k) for the filled target area, performing expansion operation on the image twice, obtaining an expanded binary image, respectively calculating the height and width of the white area through a formula (3), and finally cutting out the image at the corresponding position from the original image to obtain the table cover number code spraying area.
In an embodiment of the present invention, the specific implementation manner of model matching and number identification for the same type of table covers is as follows:
s51, template matching
Performing template matching on other water meter cover images of the same model by using a cv2.matchtemplate function (template matching function) based on the table cover model code spraying area obtained in the step S41, and marking the matched area in a matched image by using a rectangular frame;
s53, character recognition
Based on the table cover number code spraying region obtained in the step S42, firstly denoising the image by using a cv2.fastNLMeansDenoising function (non-local average denoising function); then converting the image into a gray level image, and converting the image into a binary image by using an Otsu algorithm; and finally, expanding the periphery of the image by using a cv2.CopyMakeBorder function (boundary filling function), identifying numbered characters in the image after expanding the periphery by using a character identification engine, and placing the identification result in the upper left corner of the original image to obtain a final identification result.
In one embodiment of the present invention, in S41, n=h/48; in S42 the process proceeds to the step of,m=k/4。
compared with the prior art, the invention has the following beneficial effects: the invention discloses a method for rapidly matching and identifying a spray code of a meter cover, which comprises the following steps: firstly, extracting a table cover region through steps of image cutting, binarization, screening strategy formulation and the like; then, calculating the image gradient of the table cover area and combining morphological operation to obtain a candidate target area; then, respectively making extraction strategies aiming at different target areas to obtain a model code spraying area and a number code spraying area; finally, matching of the same type of table cover model and identification of the number are achieved through an open source algorithm. Experimental results show that the method has good universality and accuracy, and can be used for effectively matching and identifying two different types of water meter covers.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Fig. 2 is an image cropping result: (a) original image, (b) clipping result.
Fig. 3 is an image binarization result: (a) gray scale map, (b) binary map.
FIG. 4 shows the results of the table cover area positioning: (a) screening results, (b) filling results, and (c) target area.
Fig. 5 shows the table cover region extraction result.
Fig. 6 is an image gradient calculation result: (a) gray scale map, (b) X-direction gradient map, (c) Y-direction gradient map, (d) total gradient map
Fig. 7 shows the morphological operation result: (a) E (E) 1 Element correspondence result, (b) E 2 The element corresponds to the result.
Fig. 8 shows the binarization result: (a) Fig. 7 (a) binarization results, (b) fig. 7 (b) binarization results.
Fig. 9 shows the binarization result: (a) a left side area of the bezel and (b) a right side area of the bezel.
Fig. 10 shows the final result: (a) The left side area of the meter cover is sprayed with a code field, and (b) the right side area of the meter cover is sprayed with a code field.
Fig. 11 shows the final result: (a) a conforming area and (b) a numbering code-spraying area.
Fig. 12 is the final result.
Fig. 13 is a template matching result.
Fig. 14 is a numbering region image preprocessing: (a) denoising results, (b) preprocessing results.
Fig. 15 is a character recognition result.
Fig. 16 is a table cover region extraction result.
Fig. 17 is a template matching and character recognition result.
Detailed Description
The technical scheme of the invention is specifically described below with reference to the accompanying drawings.
As shown in FIG. 1, the method for quickly matching and identifying the code spraying of the water meter cover is different from a common injection molding product, and the water meter covers of different models have the characteristics of similar forms, similar fonts and the like, and the code spraying positions are relatively fixed. Therefore, proper algorithm steps can be formulated to realize the matching of the table cover model numbers and the identification of the numbers: firstly, extracting a table cover region through steps of image cutting, binarization, establishment of a proper screening strategy and the like; then, calculating gradients of the table cover region images and obtaining candidate target regions by using morphological operations; then, respectively making extraction strategies aiming at different target areas to obtain a model code spraying area and a number code spraying area of the table cover; finally, model matching and number identification of the same type of meter covers are realized through an open source algorithm.
The following is a specific implementation procedure of the present invention.
1 table cover region extraction
The meter cover area is the central image area where the obtained image is located and is fixed after the production of the meter cover is completed. The extraction of the table cover area aims at removing interference of the background area and provides a basis for the subsequent processing steps.
(1) Image clipping: and cutting the image according to the height through a formula (1) according to the image information obtained by shooting.
Wherein h is 0 ,w 0 H is the height and width of the initial image i For the height of the cropped image, only the height of the image is cropped here. The cutting mode can remove redundant background noise to a certain extent, reduces the difficulty of the subsequent steps when the water meter cover area is positioned, and improves the effectiveness and applicability of the setting parameters in the algorithm. The water meter cover images appearing hereinafter are all pictures after clipping pretreatment.
(2) Image binarization: first graying out fig. 2 (b) using a cv2.cvtcolor function; then, a threshold value is set to 50 using a cv2.threshold function, and binarization processing is performed on the gray map. The processing results are shown in fig. 3 (a) and 3 (b), respectively.
(3) Positioning a meter cover area: from the results of fig. 3 (b), we need to formulate a certain screening strategy to obtain the table cover area. Firstly, traversing all contours in a binary diagram, calculating the areas of the contours, extracting the contours with the largest areas, as shown in fig. 4 (a), and filling by using the largest circumscribed rectangle to obtain fig. 4 (b); then, assigning the filling result to the corresponding position of the binary image with the same size as the original image and an initialization value of 0 through a formula (2); finally, a cv2.minenclosingcircle function is used to obtain a center coordinate point (x, y) of a minimum circumscribing circle of the outline on the original image and a radius length radius, wherein after the radius length radius is empirically 1.2, a target area is obtained by filling with a maximum circumscribing rectangle (fig. 4 c). The results of the table cover area positioning are shown in fig. 4.
Wherein I is c Is a binary diagram with original diagram equal in size and initial value of 0, I b The binary image obtained after filling is shown in FIG. 4 (b).
(4) And (3) extracting a table cover area: from the result of FIG. 4 (c), the coordinates (x) of the upper left corner of the white region thereof are obtained 1 ,y 1 ) And the coordinates of the lower right corner point (x 2 ,y 2 ) And (3) calculating the height and width of the white area through a formula (3), and finally cutting out the image at the corresponding position from the original image to obtain a table cover area, as shown in fig. 5.
height,width=y 1 -y 2 ,x 1 -x 2 (3)
2 candidate target region extraction
The target area is the image area where the model code spray on the left side and the right side of the water meter and the digital code spray under the middle bar code are located. The candidate target area is extracted to extract the water meter model and the image area where the digital code is located, and the specific extraction steps are as follows:
(1) Image gradient calculation: first, fig. 5 is converted into a gray scale using a cv2.cvtcolor function; then, the gray scale map is filtered by Sobel operators in the X direction and the Y direction respectively, gradients in the two directions are calculated, and the total gradient of the image is calculated through a formula (4). The total gradient calculation result is shown in fig. 6 (d).
G(i,j)=Ω(i,j)*S X +Ω(i,j)*S Y (4)
Wherein S is X And S is equal to Y An operator divided into two directions, Ω (i, j) represents a 3*3 local image window centered on the pixel (i, j), and G (i, j) represents a value at the pixel (i, j) in the image gradient calculation result.
(2) Morphological operations: first two rectangular structural elements E are formed 1 、E 2
Wherein H is the height of the image, n i And m i Representing the number of rows and columns, respectively, of the corresponding matrix. Then, respectively utilize the structural element E 1 And E is 2 A closed operation (Closing) and an open operation (Opening) are performed on the result of fig. 6 (d). Different structural elements are defined for different extraction regions to perform morphological operations aimed at filling internal defects of the target region, connecting the target regions, and eliminating small noise regions, the final result being shown in fig. 7.
(3) Image binarization: on the basis of the gray-scale map obtained after morphological operation, binarization processing was performed using a cv2.Threshold function, setting the threshold to 150, and using Otsu [1] algorithm, respectively, for fig. 7 (a) and 7 (b), and the result is shown in fig. 8.
3 target region screening
As shown in fig. 8, the algorithm successfully extracts the code spraying areas of the model numbers on the left side and the right side of the water meter and the code spraying areas of the numbers below the bar codes. But also some non-target areas, i.e. some noisy areas, are extracted. In order to improve the efficiency and the precision of template matching and character recognition, the invention formulates different target area screening strategies according to different target areas.
3.1 type code spraying region extraction
According to the binary diagram obtained in fig. 8 (a), and the model code-spraying identification areas are positioned at the left and right sides of the table cover, the following extraction steps are formulated: firstly, taking left and right side area images according to the width of the image being 3 times; then, a rectangular structuring element E of size (n, n) is defined to perform a dilation operation on the image twice, with the aim of connecting the discrete target areas. Where n=h/48, H is the high of the image. And finally traversing the outline in the obtained image, reserving the part with the largest outline area, filling by using the largest circumscribed rectangle, and then executing one expansion operation by using E to extract a more complete target area. The final results are shown in FIG. 9.
From the result of fig. 9, the upper left corner coordinates (x) of the white areas of fig. 9 (a) and 9 (b) are acquired, respectively 1 ,y 1 ) With the lower right corner coordinates (x 2 ,y 2 ) And (3) respectively calculating the height and the width of the white area through a formula (3), and finally cutting out the image at the corresponding position from the original image to obtain the left and right side areas of the table cover, wherein the result is shown in fig. 10.
3.2 code-spraying region extraction
According to the binary diagram obtained in fig. 8 (b), and the numbered code spraying area is located in the area above the table cover, the following extraction steps are formulated: firstly, dividing an image into two parts according to the height, and intercepting an image of an upper area; then, the contours in the image are traversed, the contour area is calculated, the contour area is reserved for the contour area which is larger than 20000 and the aspect ratio of the circumscribed maximum rectangle is larger than 6, the extraction result is shown in fig. 11 (a), and the largest circumscribed rectangle is used for filling. When the method is used for processing other types of table cover templates, two areas are reserved, the area with the relative position being lower is reserved under the setting condition, and the largest circumscribed rectangle is used for filling, and the result is shown in fig. 11 (b).
For the filled target region, a rectangular structuring element E of size (m, k) is defined to perform a dilation operation on the image twice, in order to extract a more complete target region, wherein,m=k/4. After the expanded binary image is obtained, the height and the width of the white area are calculated respectively through a formula (3), and finally the image at the corresponding position is cut out from the original image to obtain a table cover number code spraying area, and the result is shown in fig. 12.
4 template matching and character recognition
4.1 template matching
After the template areas on the left side and the right side of the meter cover shown in fig. 10 are obtained, template matching is performed on other meter cover images of the same model by using a cv2.Matchtemplate function, the method is that the matched areas are marked in the matched images by rectangular frames, and the final result is shown in fig. 13.
4.2 character recognition
After the numbered code-spraying area shown in fig. 12 is obtained, in order to improve the accuracy of character recognition, firstly, denoising the image by using a cv2.fastNLMeansDenoising function, and the result is shown in fig. 14 (a); then converting the image into a gray level image, and converting the image into a binary image by using an Otsu algorithm; finally, expansion was performed around the image using the cv2.copymakeborder function, and the final result was shown in fig. 14 (b).
After obtaining fig. 14 (b), the numbered characters in the image are recognized using the Tesseract-OCR [2] character recognition engine of google and the recognition result is placed in the upper left corner of the original, and the final result is shown in fig. 15.
In order to verify the effectiveness of the method provided by the invention, the invention collects two different table cover type picture data sets shot by using a fixed camera or a mobile phone under 21 real scenes, and performs template matching and character recognition experiments on the two types of water meter covers.
The experiment is run under the software and hardware environment of an AMD Ryzen 5800H 3.20GHz processor, a 16GB RAM and a Windows10 operating system, and is programmed by using a Pycham integrated development environment and a Python language and assisted programming by using an open source library OpenCV.
Experimental analysis
For two types of water meter cover images under 21 real scenes, we first extract the cover areas, and the partial results of the extraction are shown in fig. 16. It can be seen that the method for extracting the meter cover provided by the invention is applicable to two types of water meter covers, and can extract the meter cover area more completely. Then, we use the two types of water meter images in the first column in fig. 16 as template images, extract the model code spraying areas on the left and right sides of the meter cover, and use the template images as template images to perform template matching on the water meter cover with the same model code spraying, and at the same time perform character recognition on the serial code spraying on the meter cover, and the final result is shown in fig. 17.
As can be seen from fig. 17, the method of the present invention can match the code spraying areas on the left and right sides of the same type of water meter cover for two different types of water meter covers, correctly identify the code spraying of the number and display the code spraying on the upper left corner, and verifies that the method of the present invention has good universality and accuracy.
Reference is made to:
[1]Otsu N.A Threshold Selection Method from Gray-Level Histograms[J].IEEE Transactions on Systems Man&Cybernetics,2007,9(1):62-66.
[2]Smith,Ray."An overview of the Tesseract OCR engine."Ninth international conference on document analysis and recognition(ICDAR 2007).Vol.2.IEEE,2007.。
the above is a preferred embodiment of the present invention, and all changes made according to the technical solution of the present invention belong to the protection scope of the present invention when the generated functional effects do not exceed the scope of the technical solution of the present invention.

Claims (6)

1. A method for fast matching and identifying the table cover code spraying is characterized in that firstly, table cover region extraction is realized through image cutting, binarization and screening strategy formulation; then, calculating gradients of the table cover region images and obtaining candidate target regions by using morphological operations; then, respectively making extraction strategies for different candidate target areas to obtain a model code spraying area and a number code spraying area of the table cover; and finally, identifying the model matching and the number of the same type of meter cover.
2. The method for quickly matching and identifying the table cover code spraying according to claim 1, wherein the table cover area extraction is specifically implemented as follows:
s11, cutting images: cutting the image according to the height through a formula (1) according to the image information obtained by shooting;
wherein h is 0 ,w 0 H is the height and width of the initial image i To the height of the cut image, w i For the width of the cut image, only the height of the image is cut;
s12, binarizing the image: firstly, graying the cut image by using a color space conversion function cv2.cvtColor function to obtain a gray level map; then, setting a threshold value to be 50 by using a binarization function cv2.threshold function, and performing binarization processing on the gray level map to obtain a binary map;
s13, positioning a surface cover area: according to the binary image, a screening strategy is formulated to obtain a table cover area: firstly, traversing all contours in a binary image, calculating the areas of the contours, extracting the contours with the largest areas, and filling by using the largest circumscribed rectangle; then, assigning the filling result to the corresponding position of the binary image with the same size as the original image and an initialization value of 0 through a formula (2); finally, a minimum circumscribing circle function cv2.minenclossing circle function is used for obtaining a center coordinate point (x, y) of a minimum circumscribing circle of a corresponding outline on an original image and radius length radius, and after radius length radius is 1.2, a target area is obtained by filling a maximum circumscribing rectangle;
wherein I is c Is a binary image with the same size as the original image and an initial value of 0, I b The binary image is obtained after filling;
s14, extracting a table cover area: the target region obtained in S13 acquires the coordinates (x 1 ,y 1 ) And the coordinates of the lower right corner point (x 2 ,y 2 ) Calculating the height and width of the white area through a formula (3), and finally cutting out the image at the corresponding position from the original image to obtain a table cover area diagram;
height,width=y 1 -y 2 ,x 1 -x 2 (3)。
3. the method for quickly matching and identifying the table cover code spraying according to claim 2, wherein the specific implementation manner of obtaining the candidate target area is as follows:
s21, calculating image gradient: firstly, converting the extracted table cover region map into a gray map by using a color space conversion function cv2.cvtColor function; then, respectively adopting Sobel operators in the X direction and the Y direction to filter the converted gray level image, calculating gradients in the two directions, and calculating the total gradient of the image through a formula (4) to obtain a total gradient image;
G(i,j)=Ω(i,j)*S X +Ω(i,j)*S Y (4)
wherein S is X And S is equal to Y Operators divided into two directions, wherein omega (i, j) represents a 3*3 local image window taking a pixel point (i, j) as a center, and G (i, j) represents a value at the pixel point (i, j) in an image gradient calculation result;
s22, morphological operation:
first, two rectangular structural elements E are constructed 1 、E 2
Wherein H is the height of the image, n i And m i Representing the number of rows and columns of the corresponding matrix respectively;
then, respectively utilize the structural element E 1 And E is 2 Executing a Closing operation and an Opening operation on the total gradient map;
s23, binarizing the image: e obtained after morphological operation S22 1 And E is 2 And respectively performing binarization processing on the basis of the corresponding gray level map.
4. The method for quickly matching and identifying the code spraying of the table cover according to claim 3, wherein the specific implementation manner of the code spraying area of the model and the code spraying area of the number of the table cover is as follows:
s41, model code spraying area extraction
Because the model code-spraying identification areas are positioned at the left side and the right side of the meter cover, E is obtained based on S23 1 Corresponding to the binarization map, the following extraction steps are formulated: firstly, taking left and right side area images according to the width of the image being 3 times; then, defining a rectangular construction element E with the size of (n, n) to perform expansion operation on the image twice; finally, traversing the outline in the obtained image, reserving the part with the largest outline area, filling by using the largest circumscribed rectangle, and then executing one-time expansion operation by using a rectangular construction element E with the size of (n, n) to obtain images of the left side area of the table cover and the right side area of the table cover;
respectively acquiring coordinates (x) of upper left corner points of white areas in images of left areas of the table cover and right areas of the table cover 1 ,y 1 ) With the lower right corner coordinates (x 2 ,y 2 ) Calculating the height and width of the white area respectively through a formula (3), and finally cutting out images at corresponding positions from the original image to obtain areas on the left side and the right side of the watch cover, namely a watch cover model code spraying area;
s42, code spraying area extraction
Since the numbering spray area is located in the area above the watch cover, E is obtained based on S23 2 Corresponding to the binarization map, the following extraction steps are formulated: firstly, dividing an image into two parts according to the height, and intercepting an image of an upper area; then traversing the outline in the image, calculating the outline area, reserving an outline area with the outline area larger than 20000 and the aspect ratio of the circumscribed maximum rectangle larger than 6, and filling by using the maximum circumscribed rectangle;
and (3) defining a rectangular constructional element E with the size of (m, k) for the filled target area, performing expansion operation on the image twice, obtaining an expanded binary image, respectively calculating the height and width of the white area through a formula (3), and finally cutting out the image at the corresponding position from the original image to obtain the table cover number code spraying area.
5. The method for quickly matching and identifying the code spraying of the meter covers according to claim 4, wherein the specific implementation manner of the model matching and the identification of the numbers of the meter covers of the same type is as follows:
s51, template matching
Based on the table cover type code spraying area obtained in the step S41, performing template matching on other water cover images of the same type by using a template matching function cv2.Matchtemplate function, and marking the matched area in a matched image by using a rectangular frame;
s53, character recognition
Based on the table cover number code spraying area obtained in the step S42, firstly denoising the image by using a non-local average denoising function cv2.fastNLMeansDenoising function; then converting the image into a gray level image, and converting the image into a binary image by using an Otsu algorithm; and finally, expanding the periphery of the image by using a boundary filling function cv2.copyMakeBorder function, identifying numbered characters in the image after expanding the periphery by using a character identification engine, and placing the identification result in the upper left corner of the original image to obtain a final identification result.
6. The method for quick match and identification of a cover code as claimed in claim 1, wherein in S41, n = H/48; in S42 the process proceeds to the step of,m=k/4。
CN202311393425.9A 2023-10-25 2023-10-25 Method for rapidly matching and identifying sprayed codes of meter cover Pending CN117523174A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311393425.9A CN117523174A (en) 2023-10-25 2023-10-25 Method for rapidly matching and identifying sprayed codes of meter cover

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311393425.9A CN117523174A (en) 2023-10-25 2023-10-25 Method for rapidly matching and identifying sprayed codes of meter cover

Publications (1)

Publication Number Publication Date
CN117523174A true CN117523174A (en) 2024-02-06

Family

ID=89759683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311393425.9A Pending CN117523174A (en) 2023-10-25 2023-10-25 Method for rapidly matching and identifying sprayed codes of meter cover

Country Status (1)

Country Link
CN (1) CN117523174A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117782523A (en) * 2024-02-23 2024-03-29 天津七一二移动通信有限公司 MMI automatic detection device with mechanical keys and detection method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117782523A (en) * 2024-02-23 2024-03-29 天津七一二移动通信有限公司 MMI automatic detection device with mechanical keys and detection method

Similar Documents

Publication Publication Date Title
CN111474184B (en) AOI character defect detection method and device based on industrial machine vision
CN109409355B (en) Novel transformer nameplate identification method and device
CN117523174A (en) Method for rapidly matching and identifying sprayed codes of meter cover
JP2002259994A (en) Automatic image pattern detecting method and image processor
CN110119741A (en) A kind of card card image information recognition methods having powerful connections
CN114359998B (en) Identification method of face mask in wearing state
CN105825218A (en) Identification method and apparatus of automobile vehicle identification codes
CN114359538A (en) Water meter reading positioning and identifying method
CN110472625A (en) A kind of pieces of chess visual identity method based on Fourier descriptor
CN112686265A (en) Hierarchic contour extraction-based pictograph segmentation method
CN115240210A (en) System and method for auxiliary exercise of handwritten Chinese characters
JP7044504B2 (en) Image processing device, image processing method and image processing program
CN110610163B (en) Table extraction method and system based on ellipse fitting in natural scene
CN110826384A (en) System and method for enhancing iris recognition accuracy
CN103971376A (en) Application program execution method and device
CN112418143A (en) Traffic sign identification method for unmanned vehicle
CN114332629A (en) Method for measuring delay of multi-pesticide fog drops impacting leaf surface based on high-speed visual coupling contour feature extraction
Medvedeva et al. Vehicle license plate recognition based on edge detection
CN113283262A (en) Two-dimensional code positioning method and device, electronic equipment and machine readable medium
CN112581487A (en) Method for automatically extracting detection area and positioning kernel
JP2871590B2 (en) Image extraction method
CN112465906A (en) Zebra fish posture detection method and system based on micro-operation system
CN111046848A (en) Gait monitoring method and system based on animal running platform
CN108961248A (en) It is a kind of applied to the cabinet surface scratch detection method comprising complex information
CN117690142B (en) Wafer character preprocessing method, device and storage medium

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