A method for quickly matching and identifying cover code spraying
Patent Information
- Application Number
- CN202311393425.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-10-25
AI Technical Summary
人工读取的方法不仅增加了工人的劳动强度,而且随着产能的不断扩大,工人长时间工作容易视觉疲劳,导致识别的效率以及准确率得不到保障
[0039]Compared to existing technologies, this invention offers the following advantages: A method for rapidly matching and identifying meter cover inkjet codes: First, the meter cover region is extracted through image cropping, binarization, and a selection strategy. Then, the image gradient of the meter cover region is calculated and morphological operations are combined to obtain candidate target regions. Next, extraction strategies are formulated for different target regions to obtain model inkjet code regions and serial number inkjet code regions. Finally, an open-source algorithm is used to match the model of the same type of meter cover and identify its serial number. Experimental results show that the method of this invention has good universality and accuracy, and can effectively match and identify two different types of water meter covers.
Smart Images

Figure CN117523174B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition technology, specifically relating to a method for quickly matching and recognizing inkjet printing on watch covers. Background Technology
[0002] After water meter covers are manufactured, inkjet printing is the primary method for recording the cover model and corresponding serial number information, playing an indispensable role in quality traceability and storage management. Currently, many water meter cover manufacturers still manually check the model and serial number of the covers after production. This manual method not only increases the labor intensity of workers, but also leads to visual fatigue due to prolonged work as production capacity expands, resulting in compromised efficiency and accuracy. Therefore, traditional manual identification methods can no longer meet daily production needs, necessitating an automatic matching and serial number inkjet printing detection method using image recognition technology. Summary of the Invention
[0003] The purpose of this invention is to provide a method for rapidly matching and identifying meter cover inkjet codes. First, the meter cover region is extracted through image cropping, binarization, and the formulation of appropriate filtering strategies. Then, the gradient of the meter cover region image is calculated, and morphological operations are used to obtain candidate target regions. Next, extraction strategies are formulated for different target regions to obtain the model number inkjet code region and the serial number inkjet code region of the meter cover. Finally, an open-source algorithm is used to achieve model matching and serial number identification for meter covers of the same type. Experimental results show that the method of this invention has good accuracy and universality, and can match and identify the serial number inkjet codes of different types of water meter covers.
[0004] To achieve the above objectives, the technical solution of the present invention is: a method for quickly matching and identifying watch cover inkjet codes. First, the watch cover region is extracted through image cropping, binarization, and the formulation of a screening strategy. Then, the gradient of the watch cover region image is calculated and morphological operations are used to obtain candidate target regions. Next, extraction strategies are formulated for different candidate target regions to obtain the model inkjet code region and the serial number inkjet code region of the watch cover. Finally, the model and serial number of watch covers of the same type are matched and identified.
[0005] In one embodiment of the present invention, the extraction of the cover area is specifically implemented as follows:
[0006] S11, Image cropping: Based on the image information obtained from the shooting, the image is cropped according to its height using formula (1);
[0007]
[0008] Where h0 and w0 are the height and width of the initial image, hi w represents the height of the cropped image. i This is the width of the cropped image; here, only the height of the image is cropped.
[0009] S12. Image Binarization: First, use the cv2.cvtColor function (color space conversion function) to convert the cropped image to grayscale to obtain a grayscale image; then, use the cv2.threshold function (binarization function) to set the threshold to 50 and perform binarization processing on the grayscale image to obtain a binary image.
[0010] S13. Cover area location: Based on the binary image, a filtering strategy is formulated to obtain the cover area: First, traverse all contours in the binary image and calculate the contour area. Extract the contour with the largest area and fill it with the largest bounding rectangle. Then, use formula (2) to assign the filling result to the corresponding position of the binary image with the same size as the original image and an initial value of 0. Finally, use the cv2.minEnclosingCircle function (minimum bounding circle function) to obtain the center coordinates (x, y) and radius length of the minimum bounding circle of the corresponding contour on the original image. After multiplying the radius length by 1.2, fill it with the largest bounding rectangle to obtain the target area.
[0011]
[0012] Among them, I c To create a binary image of the same size as the original image with an initial value of 0, I b This is the binary image obtained after filling;
[0013] S14, Extraction of the cover area: From the target area obtained in S13, obtain the coordinates (x1, y1) of the upper left corner and (x2, y2) of the lower right corner of the white area. Calculate the height and width of the white area using formula (3). Finally, crop the image at the corresponding position from the original image to obtain the cover area map.
[0014] height,width=y1-y2,x1-x2 (3).
[0015] In one embodiment of the present invention, the specific implementation of obtaining the candidate target region is as follows:
[0016] S21. Image gradient calculation: First, use the cv2.cvtColor function (color space conversion function) to convert the extracted cover area image into a grayscale image; then, use the Sobel operator in the X and Y directions to filter the converted grayscale image, calculate the gradient in the two directions, and calculate the total gradient of the image through formula (4) to obtain the total gradient image.
[0017] G(i,j)=Ω(i,j)*S X +Ω(i,j)*S Y (4)
[0018] Among them, S X With S Y The operators are divided into two directions: Ω(i,j) represents a 3*3 local image window centered at pixel (i,j), and G(i,j) represents the value at pixel (i,j) in the image gradient calculation result.
[0019] S22, Morphological Operations:
[0020] First, construct two rectangular structuring elements E1 and E2:
[0021]
[0022]
[0023] Where H is the height of the image, and n i and m i These represent the number of rows and columns of the corresponding matrix, respectively.
[0024] Then, the structuring elements E1 and E2 are used to perform closing and opening operations on the total gradient graph, respectively.
[0025] S23. Image binarization: Based on the grayscale images E1 and E2 obtained after the morphological operation in S22, binarization processing is performed on them respectively.
[0026] In one embodiment of the present invention, the specific implementation method for obtaining the model inkjet area and the serial number inkjet area of the watch cover is as follows:
[0027] S41, Model Marking Area Extraction
[0028] Since the model number inkjet printing recognition area is located on the left and right sides of the watch cover, based on the binarized image corresponding to E1 obtained by S23, the following extraction steps are formulated: First, divide the image into 3 equal parts and take the left and right side images; then, define a rectangular structuring element E of size (n,n) to perform two dilation operations on the image; finally, traverse the contours in the obtained image, retain the part with the largest contour area, fill it with the largest bounding rectangle, and then perform a dilation operation once more using a rectangular structuring element E of size (n,n) to obtain the images of the left and right side areas of the watch cover.
[0029] The coordinates of the upper left corner (x1, y1) and the lower right corner (x2, y2) of the white area in the images of the left and right sides of the watch cover are obtained respectively. The height and width of the white area are calculated by formula (3) respectively. Finally, the corresponding image is cropped from the original image to obtain the left and right sides of the watch cover, that is, the watch cover model inkjet area.
[0030] S42. Extraction of the serial number inkjet printing area
[0031] Since the serial number inkjet printing area is located on the upper part of the cover, based on the binarized image corresponding to E2 obtained from S23, the following extraction steps are formulated: First, the image is divided into two parts according to height, and the upper part of the image is cropped; then, the contours in the image are traversed and the contour area is calculated. Contour areas with a contour area greater than 20000 and a length-to-width ratio greater than 6 of the largest bounding rectangle are retained and filled with the largest bounding rectangle.
[0032] For the filled target area, define a rectangular structuring element E of size (m,k) to perform two dilation operations on the image to obtain the dilated binary image. Then, calculate the height and width of the white area using formula (3). Finally, crop the image at the corresponding position from the original image to obtain the cover number inkjet area.
[0033] In one embodiment of the present invention, the specific implementation method for matching the model and identifying the serial number of the same type of watch cover is as follows:
[0034] S51, Template Matching
[0035] Based on the meter cover model inkjet area obtained by S41, the cv2.matchTemplate function (template matching function) is used to perform template matching on other water meter cover images of the same model, and the matched area is marked in the matched image with a rectangle;
[0036] S53, Character Recognition
[0037] Based on the cover number inkjet area obtained from S42, the image is first denoised using the cv2.fastNLMeansDenoising function (non-local averaging denoising function); then, the image is converted to grayscale and then converted to binary using the Otsu algorithm; finally, the cv2.copyMakeBorder function (boundary filling function) is used to expand the image around its perimeter, and a character recognition engine is used to recognize the number characters in the expanded image and place the recognition result in the upper left corner of the original image to obtain the final recognition result.
[0038] In one embodiment of the present invention, in S41, n = H / 48; in S42, m = k / 4.
[0039] Compared to existing technologies, this invention offers the following advantages: A method for rapidly matching and identifying meter cover inkjet codes: First, the meter cover region is extracted through image cropping, binarization, and a selection strategy. Then, the image gradient of the meter cover region is calculated and morphological operations are combined to obtain candidate target regions. Next, extraction strategies are formulated for different target regions to obtain model inkjet code regions and serial number inkjet code regions. Finally, an open-source algorithm is used to match the model of the same type of meter cover and identify its serial number. Experimental results show that the method of this invention has good universality and accuracy, and can effectively match and identify two different types of water meter covers. Attached Figure Description
[0040] Figure 1 This is a flowchart of the method of the present invention.
[0041] Figure 2 Image cropping results: (a) original image, (b) cropped image.
[0042] Figure 3 The results of image binarization are: (a) grayscale image, (b) binary image.
[0043] Figure 4 Results for locating the cover area: (a) Filtered results, (b) Filled results, (c) Target area.
[0044] Figure 5 This is the result of extracting the cover area.
[0045] Figure 6 Image gradient calculation results: (a) grayscale image, (b) gradient map in the X direction, (c) gradient map in the Y direction, (d) total gradient map.
[0046] Figure 7 The results of morphological operations are: (a) the result corresponding to element E1, and (b) the result corresponding to element E2.
[0047] Figure 8 The binarized result is: (a) Figure 7 (a) Binarization result, (b) Figure 7 (b) Binarization result.
[0048] Figure 9 The binarized results are: (a) the left side of the cover, and (b) the right side of the cover.
[0049] Figure 10 The final results are: (a) the inkjet printing area on the left side of the cover, and (b) the inkjet printing area on the right side of the cover.
[0050] Figure 11 The final results are: (a) the area that meets the conditions, and (b) the area with the numbered inkjet printing.
[0051] Figure 12 This is the final result.
[0052] Figure 13 This is the template matching result.
[0053] Figure 14 Image preprocessing for numbered regions: (a) Denoising result, (b) Preprocessing result.
[0054] Figure 15 The result is the character recognition.
[0055] Figure 16 This is the result of extracting the cover area.
[0056] Figure 17 The results are from template matching and character recognition. Detailed Implementation
[0057] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings.
[0058] like Figure 1 As shown, this invention provides a method for quickly matching and identifying meter cover inkjet printing. Unlike general injection-molded products, different models of water meter covers share similar shapes and fonts, and the inkjet printing positions are relatively fixed. Therefore, appropriate algorithm steps can be formulated to achieve meter cover model matching and number identification: First, the meter cover region is extracted through image cropping, binarization, and the formulation of appropriate filtering strategies; then, the gradient of the meter cover region image is calculated, and morphological operations are used to obtain candidate target regions; next, extraction strategies are formulated for different target regions to obtain the meter cover model inkjet printing region and the meter cover number inkjet printing region; finally, an open-source algorithm is used to achieve model matching and number identification for meter covers of the same type.
[0059] The following is a detailed implementation process of the present invention.
[0060] 1. Extraction of the cover area
[0061] The cover area refers to the central image region captured in the image after the water meter cover is manufactured and fixed. Extracting the cover area aims to remove background interference, providing a basis for subsequent processing steps.
[0062] (1) Image cropping: Based on the image information obtained from the shooting, the image is cropped according to its height using formula (1).
[0063]
[0064] Where h0 and w0 are the height and width of the initial image, h iThe height of the cropped image is shown below; only the height is cropped here. This cropping method can remove unnecessary background noise to some extent, reducing the difficulty of locating the water meter cover area in subsequent steps, while also improving the effectiveness and applicability of the parameters set in the algorithm. The water meter cover images shown below are all images after cropping preprocessing.
[0065] (2) Image binarization: First, use the cv2.cvtColor function to binarize the image. Figure 2 (b) Grayscale conversion; then, the grayscale image is binarized using the cv2.threshold function with a threshold of 50. The processing results are as follows: Figure 3 (a) and Figure 3 As shown in (b).
[0066] (3) Positioning of the cover area: According to Figure 3 Based on the result of (b), we need to formulate a certain filtering strategy to obtain the cover area. First, we traverse all contours in the binary image and calculate the contour area, extracting the contour with the largest area, such as... Figure 4 As shown in (a), and filled with the maximum bounding rectangle. Figure 4 (b); Then, the filling result is assigned to the corresponding position of the binary image with the same size as the original image and an initial value of 0 using formula (2); Finally, the cv2.minEnclosingCircle function is used to obtain the center coordinates (x, y) and radius length of the smallest circumcircle of the contour on the original image. Here, the radius length is empirically multiplied by 1.2, and the target area is obtained by filling with the largest circumcircle rectangle. Figure 4 (c). The location result of the cover area is as follows: Figure 4 As shown.
[0067]
[0068] Among them, I c I is a binary image of the same size as the original image and initialized to 0. b The resulting binary image after filling is... Figure 4 (b)
[0069] (4) Extraction of the cover area: from Figure 4 (c) The coordinates of the upper left corner (x1, y1) and the lower right corner (x2, y2) of the white area are obtained. The height and width of the white area are calculated using formula (3). Finally, the corresponding positions of the image are cropped from the original image to obtain the cover area, such as Figure 5 As shown.
[0070] height,width=y1-y2,x1-x2 (3)
[0071] 2. Candidate Target Region Extraction
[0072] The target area refers to the image area containing the model number inkjet print on the left and right sides of the water meter, as well as the numerical serial number inkjet print below the central barcode. Candidate target area extraction aims to extract the image area containing the water meter model number and numerical serial number inkjet print. The specific extraction steps are as follows:
[0073] (1) Image gradient calculation: First, use the cv2.cvtColor function to calculate the image gradient. Figure 5 The image is converted to grayscale. Then, the Sobel operators in the X and Y directions are used to filter the grayscale image, and the gradients in both directions are calculated. The total gradient of the image is then calculated using formula (4). The result of the total gradient calculation is as follows: Figure 6 As shown in (d).
[0074] G(i,j)=Ω(i,j)*S X +Ω(i,j)*S Y (4)
[0075] Among them, S X With S Y The operators are divided into two directions: Ω(i,j) represents a 3*3 local image window centered at pixel (i,j), and G(i,j) represents the value at pixel (i,j) in the image gradient calculation result.
[0076] (2) Morphological operations: First, construct two rectangular structuring elements E1 and E2:
[0077]
[0078]
[0079] Where H is the height of the image, and n i and m i These represent the number of rows and columns of the corresponding matrix, respectively. Then, using structuring elements E1 and E2 respectively... Figure 6 (d) The results undergo closing and opening operations. Different structuring elements are defined for different extracted regions to perform morphological operations, aiming to fill internal defects in the target regions, connect the target regions, and eliminate small noise areas. The final result is as follows: Figure 7 As shown.
[0080] (3) Image binarization: Based on the grayscale image obtained after morphological operations, the following steps are taken respectively: Figure 7 (a) and Figure 7 (b) Using the cv2.threshold function, the threshold is set to 150, and the Otsu[1] algorithm is used to perform binarization. The results are as follows: Figure 8As shown.
[0081] 3 Target Area Filtering
[0082] like Figure 8 As shown, the algorithm successfully extracted the model marking areas on both sides of the water meter and the serial number marking area below the barcode. However, it also extracted some non-target areas, i.e., some noise areas. To improve the efficiency and accuracy of template matching and character recognition, this invention formulates different target area filtering strategies based on different target areas.
[0083] 3.1 Extraction of the model coding area
[0084] according to Figure 8 (a) Given the obtained binary image, with the model number coding area located on the left and right sides of the cover, the following extraction steps were implemented: First, the image was divided into three equal parts, taking the left and right side regions. Then, a rectangular structuring element E of size (n,n) was defined to perform two dilation operations on the image, aiming to connect the discrete target regions. Here, n = H / 48, and H is the image height. Finally, the contours in the obtained image were traversed, retaining the part with the largest contour area. After filling with the largest bounding rectangle, a second dilation operation was performed using E to extract a more complete target region. The final result is shown below. Figure 9 As shown.
[0085] according to Figure 9 The results were obtained respectively. Figure 9 (a) and Figure 9 (b) The coordinates of the upper left corner (x1, y1) and the lower right corner (x2, y2) of the white area are used to calculate the height and width of the white area using formula (3). Finally, the corresponding positions of the image are cropped from the original image to obtain the left and right sides of the cover. The result is as follows. Figure 10 As shown.
[0086] 3.2 Extraction of the numbered inkjet printing area
[0087] according to Figure 8 (b) Given the obtained binary image, and the numbered inkjet area located above the cover, the following extraction steps are defined: First, divide the image into two equal parts based on height, and crop the image of the upper region; then, traverse the contours in the image and calculate the contour area, retaining contour areas with an area greater than 20000 and an aspect ratio greater than 6 for the largest circumscribed rectangle. The extraction result is as follows: Figure 11 As shown in (a), the maximum bounding rectangle is used for filling. When processing another type of cover template, this method retains two areas, setting conditions to retain the area at the bottom relative to the top, and then filling it with the maximum bounding rectangle, as shown in [example image]. Figure 11 As shown in (b).
[0088] For the padded target region, a rectangular structuring element E of size (m,k) is defined to perform two dilation operations on the image. The purpose is to extract a more complete target region. m = k / 4. After obtaining the dilated binary image, the height and width of the white area are calculated using formula (3). Finally, the corresponding image is cropped from the original image to obtain the cover number coding area. The result is as follows. Figure 12 As shown.
[0089] 4. Template Matching and Character Recognition
[0090] 4.1 Template Matching
[0091] Get as Figure 10 After showing the template areas on the left and right sides of the meter cover, the cv2.matchTemplate function is used to perform template matching on other water meter cover images of the same model using the TM_CCORR_NORMED method. The matched areas are marked with rectangles in the matched image. The final result is as follows. Figure 13 As shown.
[0092] 4.2 Character Recognition
[0093] Get as Figure 12 After the numbered inkjet area shown, to improve the accuracy of character recognition, the cv2.fastNLMeansDenoising function is first used to denoise the image, and the result is as follows. Figure 14 As shown in (a); then, after converting the image to grayscale, the Otsu algorithm is used to convert the image to binary; finally, the cv2.copyMakeBorder function is used to expand the image around its edges, resulting in the final image shown. Figure 14 As shown in (b).
[0094] In obtaining Figure 14 (b) Then, Google's Tesseract-OCR[2] character recognition engine was used to recognize the numbered characters in the image and the recognition result was placed in the upper left corner of the original image. The final result is as follows. Figure 15 As shown.
[0095] To verify the effectiveness of the proposed method, this invention collected a dataset of 21 images of two different types of water meter covers taken in real-world scenarios using a fixed camera or a mobile phone, and conducted template matching and character recognition experiments on the two types of water meter covers.
[0096] The experiment was conducted on an AMD Ryzen 5800H 3.20GHz processor, 16GB RAM, and Windows 10 operating system. The PyCharm integrated development environment was used, and Python was used for programming, with the open-source library OpenCV assisting in the programming.
[0097] Experimental Analysis
[0098] From 21 images of two types of water meter covers in real-world scenes, we first extracted the cover area. Partial results are shown below. Figure 16 As shown. It can be seen that the meter cover extraction method proposed in this invention is applicable to both types of water meter covers and can extract the cover area relatively completely. Then, we will... Figure 16 The first column of images showing two types of water meters is used as template images. The model coding areas on the left and right sides of the meter cover are extracted and used as template images for template matching of water meter covers with the same model coding. Simultaneously, character recognition is performed on the serial number coding on the meter cover. The final result is as follows: Figure 17 As shown.
[0099] from Figure 17 As can be seen, the method of the present invention can match the left and right inkjet printing areas of the same model cover for both different types of water meter covers and correctly identify and display the serial number inkjet printing in the upper left corner, verifying that the method of the present invention has good universality and accuracy.
[0100] References:
[0101] [1]Otsu NA Threshold Selection Method from Gray-Level Histograms[J].IEEE Transactions on Systems Man&Cybernetics,2007,9(1):62-66.
[0102] [2] Smith, Ray. "An overview of the Tesseract OCR engine." Ninthinternational conference on document analysis and recognition (ICDAR 2007). Vol. 2. IEEE, 2007.
[0103] The above are preferred embodiments of the present invention. Any changes made to the technical solution of the present invention that do not exceed the scope of the technical solution of the present invention shall fall within the protection scope of the present invention.
Claims
1. A method for rapidly matching and identifying inkjet prints on a watch cover, characterized in that, First, the watch cover region is extracted through image cropping, binarization, and a selection strategy. Then, the gradient of the watch cover region image is calculated, and morphological operations are used to obtain candidate target regions. Next, extraction strategies are formulated for different candidate target regions to obtain the model number and serial number inkjet printing regions of the watch cover. Finally, model matching and serial number identification are performed for watch covers of the same type. The specific implementation of the watch cover region extraction is as follows: S11, Image cropping: Based on the image information obtained from the shooting, the image is cropped according to its height using formula (1); (1) in , The initial image height and width, This represents the height of the cropped image. This is the width of the cropped image; here, only the height of the image is cropped. S12. Image Binarization: First, use the color space conversion function cv2.cvtColor to convert the cropped image to grayscale to obtain a grayscale image; then, use the binarization function cv2.threshold to set the threshold to 50 and perform binarization processing on the grayscale image to obtain a binary image. S13, Cover Area Location: Based on the binary image, a filtering strategy is formulated to obtain the cover area: First, traverse all contours in the binary image and calculate the contour area, extract the contour with the largest area, and fill it with the largest bounding rectangle; then, assign the filling result to the corresponding position of the binary image with the same size as the original image and an initial value of 0 through formula (2); finally, use the minimum bounding circle function cv2.minEnclosingCircle to obtain the center coordinates (x, y) and radius length radius of the minimum bounding circle of the corresponding contour on the original image, multiply the radius length radius by 1.2, and fill it with the largest bounding rectangle to obtain the target area; (2) in, To create a binary image of the same size as the original image with an initial value of 0. This is the binary image obtained after filling; S14. Extraction of the cover area: Based on the target area obtained in S13, obtain the coordinates of the upper left corner of the white area. and the coordinates of the bottom right corner The height and width of the white area are calculated using formula (3), and finally the corresponding image is cropped from the original image to obtain the cover area image. (3) The specific implementation method for obtaining the candidate target region is as follows: S21. Image gradient calculation: First, the extracted cover area image is converted into a grayscale image using the color space conversion function cv2.cvtColor; then, the converted grayscale image is filtered by the Sobel operators in the X and Y directions respectively, the gradients in the two directions are calculated, and the total gradient of the image is calculated by formula (4) to obtain the total gradient image. (4) in, and Operators divided into two directions, Represented by pixels A 3x3 local image window centered on the image. Represents the pixel points in the image gradient calculation result The value at; S22, Morphological Operations: First, construct two rectangular structural elements. , : (5) (6) in, The height of the image. and These represent the number of rows and columns of the corresponding matrix, respectively. Then, using structural elements respectively and Perform closing and opening operations on the overall gradient graph; S23, Image binarization: obtained after the morphological operations in S22. and Based on the corresponding grayscale images, binarization is performed separately.
2. The method for quickly matching and identifying inkjet printing on a watch cover according to claim 1, characterized in that, The specific implementation method for obtaining the model inkjet area and the serial number inkjet area of the watch cover is as follows: S41, Model Marking Area Extraction Since the model number inkjet printing recognition area is located on the left and right sides of the watch cover, based on S23... For the corresponding binarized image, the following extraction steps are defined: First, divide the image into three equal parts and extract the left and right side regions; then, define a rectangular structuring element E of size (n,n) to perform two dilation operations on the image; finally, traverse the contours in the obtained image, retain the part with the largest contour area, fill it with the largest bounding rectangle, and then perform a dilation operation once more using a rectangular structuring element E of size (n,n) to obtain the images of the left and right side regions of the watch cover. Obtain the coordinates of the top-left corner of the white area in the images of the left and right sides of the watch cover, respectively. Coordinates of the bottom right corner The height and width of the white area are calculated by formula (3), and the corresponding image is cropped from the original image to obtain the left and right sides of the cover, i.e. the cover model inkjet printing area. S42. Extraction of the serial number inkjet printing area Since the serial number inkjet printing area is located above the cover, based on S23... For the corresponding binarized image, the following extraction steps are defined: First, the image is divided into two parts according to its height, and the upper region is cropped; then, the contours in the image are traversed and the contour area is calculated. Contour areas with a contour area greater than 20000 and a length-to-width ratio greater than 6 of the largest bounding rectangle are retained and filled with the largest bounding rectangle. For the filled target region, define a size of The rectangular structuring element E performs two dilation operations on the image to obtain the dilated binary image. Then, the height and width of the white area are calculated using formula (3). Finally, the image at the corresponding position is cropped from the original image to obtain the cover number inkjet area.
3. The method for quickly matching and identifying inkjet printing on a watch cover according to claim 2, characterized in that, The specific implementation method for matching the model and identifying the serial number of the same type of watch cover is as follows: S51, Template Matching Based on the meter cover model inkjet area obtained by S41, the template matching function cv2.matchTemplate is used to perform template matching on other water meter cover images of the same model, and the matched area is marked in the matched image with a rectangle. S53, Character Recognition Based on the cover number inkjet area obtained by S42, the image is first denoised using the non-local averaging denoising function cv2.fastNLMeansDenoising; then, the image is converted to grayscale and then converted to binary image using the Otsu algorithm; finally, the boundary filling function cv2.copyMakeBorder is used to expand the image around its perimeter, and the character recognition engine is used to recognize the number characters in the expanded image and place the recognition result in the upper left corner of the original image to obtain the final recognition result.
4. The method for quickly matching and identifying inkjet printing on a watch cover according to claim 2, characterized in that, In S41, n = H / 48; in S42, .
Citation Information
Patent Citations
Express bar code automatic recognizing system and method based on image processing
CN107096720A
Part code spraying detection method based on a convolutional neural network
CN109871938A