Electronic seal character recognition method based on image recognition

Through the automatic electronic seal detection system based on image processing and convolutional neural networks, the problems of low efficiency and large errors in traditional seal recognition methods have been solved, and efficient and accurate recognition of electronic seal text has been achieved, thereby improving government office efficiency and information security.

CN120708238APending Publication Date: 2025-09-26GANSU WANWEI INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510906344.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Traditional seal recognition methods rely on manual verification and are easily affected by natural wear and tear, image blur, and forgery, resulting in large recognition errors and low efficiency, making it difficult to meet the high requirements of modern office environments.

Method used

An automatic electronic seal text detection system based on image processing and convolutional neural networks is adopted, including a six-step process of seal positioning, correction, binarization, circular image conversion to rectangular image, text detection and recognition. The HSV color space is used to identify the red area to locate the seal, the tilt is corrected through the image correction algorithm, the polar coordinate transformation is used to convert the image format, and the convolutional neural network is combined to perform high-precision text recognition.

Benefits of technology

It has achieved automated and accurate recognition of electronic seal text, improved processing efficiency and accuracy, reduced human errors, and promoted government office efficiency and information security management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120708238A_ABST
    Figure CN120708238A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of character recognition, in particular to an electronic seal character recognition method based on image recognition. Through an accurate seal positioning technology, it is ensured that a seal image is accurately extracted from a complex background. And then, an advanced image correction algorithm is utilized to automatically correct the inclined or deformed seal, and the standard form of the seal is recovered. Then, seal binarization processing is implemented, image information is simplified, and follow-up processing is facilitated. Afterwards, the processed seal image is converted into a matrix form, which is convenient for a computer to carry out efficient analysis. Afterwards, the characters on the seal can be accurately recognized through the classic character recognition technology, transverse alignment display of the characters is achieved through an intelligent algorithm, and the situation that the characters of the traditional circular electronic seal are difficult to read and recognize visually is thoroughly changed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of character recognition, in particular to an electronic seal character recognition method based on image recognition. Background Art

[0002] Traditional seal recognition methods rely heavily on manual verification. This approach is not only susceptible to factors such as natural seal wear, blurred images, and forgeries, which can lead to recognition errors, but also leads to a dramatic increase in manual workload as business scale expands, resulting in low efficiency and difficulty meeting the high demands for document processing speed and accuracy in modern office environments. With the deepening trend towards electronic office and paperless processes, the electronic transformation of seals has become inevitable. However, since seals are mostly circular in design, the text layout on them differs significantly from conventional horizontal and vertical text, posing significant challenges to accurately identifying text information on electronic seals. Summary of the Invention

[0003] Exploring and applying advanced image processing and classic text recognition technologies to achieve automated detection and recognition of electronic seal text in government electronic documents can not only effectively overcome the above-mentioned difficulties, but also significantly improve processing efficiency and accuracy, reduce human errors, and have strong application value in promoting government office efficiency and enhancing information security management.

[0004] This paper pioneers the design of an automatic electronic seal text detection system based on advanced image recognition technology. After correcting irregular electronic seals, this system uses classic convolutional neural network technology for text recognition. The electronic seal text detection and recognition process includes six steps: seal positioning, seal correction, seal binarization, conversion of the circular seal image to a matrix image, text detection, and text recognition. The overall process is shown in the figure below.

[0005] Step 1: Use image pixel value analysis strategy to achieve accurate positioning of electronic seal in complex image background.

[0006] Step 2: Use image correction algorithms to ensure that the seal image reaches the optimal processing state, laying a solid foundation for subsequent steps.

[0007] Step 3: The system uses binarization technology to perform in-depth processing on the corrected image, effectively simplifying the image information.

[0008] Step 4: The system introduces polar coordinate transformation technology to seamlessly and accurately convert the circular seal image into a rectangular matrix format.

[0009] Step 5: By carefully analyzing the boundaries between the blank area and the text area, outline the specific outline of each character.

[0010] Step 6: Relying on advanced convolutional neural network technology, deep learning and intelligent recognition are performed on the extracted text features, achieving high-precision detection and recognition of the text on the electronic seal. Description of the Drawings

[0011] Figure 1 Flow chart of text detection and recognition of electronic seal Figure 2 Example diagram of electronic seal correction Figure 3 Example diagram of the corrected electronic seal Figure 4 Example diagram of converting the circular image of the electronic seal into a rectangular image; Figure 5 Expansion effect diagram of the electronic seal; Figure 6 Example diagram of pixel features of the electronic seal expanded into a rectangular seal; Figure 7 Example diagram of the upward alignment of the rectangular image of the electronic seal; Figure 8 Example diagram of text detection of the electronic seal. Detailed Implementation Manner

[0012] It is further described as follows in combination with implementation cases: (I) Seal Positioning In the process of electronic seal text recognition, the primary task is to quickly locate the position of the electronic seal, which constitutes the first step of seal text recognition. When it comes to electronic seal recognition, first, the RGB values on the electronic document are obtained, especially the quantization measurements of the brightness of red, green, and blue light rays, and these measurement values are converted into digital information. Given that government departments generally use red as the standard color of electronic seals, therefore, by identifying the red area in the image, the specific position of the electronic seal can be directly locked. This process not only simplifies the recognition process but also significantly improves the accuracy and efficiency of processing.

[0013] Since the color of the electronic seal may vary when it is stamped, this article uses the HSV values of the human visual hexagon cone model to distinguish the three colors of red, green, and blue. According to experience, the HSV value of red is: h>300 or h<25; the value of yellow is: 35<h<85; the value of green is: 95<h<200. Here, h represents the HSV value. In order to convert the RGB value to the HSV value, the following method is used in this article for distinction: The method for converting the RGB value of the image to the HSV value is as follows: Here, R represents the red level of the image, G represents the green level of the image, and B represents the blue level of the image. The maximum value of R, G, and B is taken as v. When h>300 or h<25, the corresponding area is the red area, and the corresponding red area is the location of the electronic seal.

[0014] (2) Seal correction During the process of electronic seal stamping, the seal angle may be incorrect due to the process of dragging the seal, which will affect the subsequent electronic seal text recognition. This article corrects the seal after positioning by the following methods, such as Figure 2 shown.

[0015] 1. To ensure the bottom of the seal text is parallel, we need to operate precisely within the positioned electronic seal image area. The specific steps are as follows: Step 1: In the left area of ​​the seal image, identify and record the coordinates (x1, y1) of the red pixel A of the last character in the bottom row of text. Step 2: Repeat the same process on the right side to find the coordinates (X2, Y2) of the red pixel B of the last character in the bottom row of text. These two coordinates will help us ensure the bottom of the seal text is horizontally aligned.

[0016] 2. By comparing whether y1 and y2 are equal, determine whether the electronic seal is deflected.

[0017] 3. If the electronic seal is deflected, then point A and point B are connected to form a straight line L1. A straight line L2 is generated perpendicular to L1 and centered at the center of the electronic seal. The intersection of L1 and L2 is set as point C. The corresponding coordinates are , the point where L1 intersects the y-axis is D, and the coordinates of point D can be calculated as (0, y) based on the straight line company. According to the trigonometric formula, This is the angle that the electronic seal needs to rotate clockwise. After the correction, the electronic seal is corrected, and the text at the bottom of the electronic seal is displayed horizontally. The example of the corrected electronic seal is shown in the figure below: (3) Binarization of seals In order to significantly improve the efficiency and accuracy of seal image processing, this paper adopts a binarization processing method for electronic seal images. The specific steps are as follows: Step 1: Convert the original RGB image to grayscale to simplify the image information.

[0018] Step 2: Based on the grayscale image pixel value range of [0, 255], a threshold of 128 is set as the benchmark for distinguishing black from white. Specifically, pixel values ​​greater than 128 are considered black, while those less than or equal to 128 are considered white.

[0019] 0.3*R+0.59*G+0.11*B=gray Here, R, G, and B represent the red, green, and blue levels of the image, respectively, while gray represents the grayscale value of the image after grayscaling. After this conversion, we further binarize the image using a specific method to simplify the image data and facilitate subsequent processing.

[0020] Given the circular shape of government electronic seals, their pixel values ​​are similar to those of the text within them. To mitigate potential interference from the ring's edge pixels on text recognition, we uniformly set all pixels extending from the seal's center radius outward to the 9 / 10 position to white, effectively distinguishing and mitigating the impact of edges on text recognition.

[0021] (IV) Converting the circular image of an electronic seal into a rectangular image In order to facilitate text recognition in the later stage, we convert the binary electronic seal image into a rectangular image by polar coordinate transformation. Each coordinate point in the circular image with a radius of R is scaled according to the scale factor. , transform each coordinate point P (x, y) in the circular image into a A coordinate point Q(i,j) in the matrix image is shown in the figure below: The length of the rectangle is the circumference of the circle, that is, ; The height of the rectangle is the radius of the circle, that is Therefore, the angle conversion factor of the circular image to the rectangular image is , the conversion relationship between the coordinates (x, y) on the circular image and the rectangular image is: The basic principle of polar coordinates for converting a circular image into a rectangular image is: The process of converting a circle into a rectangle is essentially a mapping from polar coordinates to Cartesian coordinates, combined with parametric expansion. The specific steps are as follows: Polar coordinate representation: The polar coordinate equation of a circle is r = R ( R is the radius), angle θ ∈[0,2 π ).

[0022] Parametric expansion: Angle θ Linearly mapped to the width direction of the rectangle ( x axis), radius r Mapping to the height direction ( y axis).

[0023] Extreme value processing: By adjusting the mapping range, ensure that the rectangle covers the complete geometric information of the circle.

[0024] The code examples for converting a circular image into a rectangular image and polar coordinates into a polar coordinate are as follows: import numpy as np import matplotlib.pyplot as plt # Parameters R = 1.0 # The radius of the circle W, H = 6, 2 # Rectangle width and height # Generate polar coordinate points theta = np.linspace(0, 2*np.pi, 100) r = np.linspace(0, R, 50) Theta, Rr = np.meshgrid(theta, r) # Mapping to rectangle X = (W / (2 * np.pi)) * Theta Y = H * (1 - Rr / R) # Drawing plt.figure(figsize=(8, 4)) plt.subplot(121) plt.title("Original Circle (Polar)") plt.scatter(Rr ​​* np.cos(Theta), Rr * np.sin(Theta), s=1) plt.axis('equal') plt.subplot(122) plt.title("Mapped Rectangle") plt.scatter(X, Y, s=1) plt.xlim(0, W) plt.ylim(0, H) plt.show() During the image conversion and compression process, due to technical limitations, the characters in the converted electronic seal image exhibited significant misalignment, failing to maintain their original parallel arrangement. This issue is clearly demonstrated in the expanded diagram, which shows the obvious misalignment and misalignment between the characters.

[0025] (5) Text detection To address the issue of electronic seal text not maintaining consistent horizontality after unfolding, we implemented a series of analytical measures based on the characteristic of uniform height for each character on an electronic seal. Specifically, when a circular electronic seal image is converted to a rectangular image, according to the conversion rules, the bottom of the image generally corresponds to the five-pointed star at the center of the seal. Upon unfolding, this appears as a continuous gray area at the bottom, while the text is concentrated in the upper portion of the image. After binarization, the central region exhibits a distinct blank space. The following is an example of an unfolded electronic seal image.

[0026] This paper uses the binarization method to allocate regions for rectangular images, and selects the interval corresponding to the black top as the target interval. Since the top of the matrix image is the text part of the electronic seal, this paper uses the following method to process it: (1) Traverse from left to right and filter the area where both the bottom and top of the matrix are black. Since there is no text part, the top area is white. For the convenience of calculation, The matrix is ​​divided into 3 The matrix traverses the pixel values ​​from 0 to M on the x-axis and from 2N / 3 to N on the y-axis. In addition, considering that the thickness of the edge of the government electronic seal is less than one tenth of the electronic seal radius, and for the convenience of calculation, N is proportionally expanded to 10,000 pixels. The screening method in this paper is: Where c_p represents the pixel value of the corresponding pixel point, from x=0 to x=m, and the pixel value of the y-axis from 2N / 3 to N. When the corresponding pixel value set is greater than or equal to N / 10, it is the area where the text is located, thus filtering out the area where the pixel coordinates of the black pixel point appearing from x=m1 and the white pixel point starting from x=m2.

[0027] (2) The filtered area is the electronic seal text area. To ensure the alignment of the electronic seal text, the pixel values ​​of the filtered area are traversed from x=m1 to x=m2. In this area, the pixel points that are not black points when y=N are moved upward as a whole until black pixels are aligned with the straight line x=N, so that the tops of the text pixels are aligned, as shown in the figure below.

[0028] At this point, we have aligned the text in an irregular circular image of an electronic seal. Considering that the text content of the electronic seal occupies the edge of the electronic seal, which is half of the radius, we select the matrix corresponding to the four points (x=m1, y=N / 2), (x=m2, y=N / 2), (x=m1, y=N), and (x=m2, y=N) as the text recognition detection area, thereby obtaining the specific position of the text, as shown below: (6) Electronic seal text recognition After the extracted seal is preprocessed and polar coordinate expanded, the circular text inside the seal is expanded into horizontally arranged text. The expanded text is input into the classic convolutional neural network for text area detection and recognition.

[0029] Convolutional Layer (CNN): First, the extracted text regions are resized to a uniform height of h = 32 pixels and a width of w = 160 pixels, and converted to a grayscale image format with a channel count of c = 1. These preprocessed images are then fed into the CNN network, where features are extracted through convolution. Each feature vector is precisely mapped to a rectangular region in the original image, effectively capturing the image's local characteristics.

[0030] Recurrent Neural Network (RNN) layer: The feature vector output by the CNN layer is further passed to the RNN layer, which employs a two-layer bidirectional LSTM network architecture, with each layer containing 256 units. The bidirectional LSTM design enables the network to simultaneously consider the context of the sequence, enhancing the model's ability to capture contextual dependencies. After processing by the RNN layer, it outputs a posterior probability matrix W, which contains the predicted information for the character sequence and provides the basis for the subsequent transcription process.

[0031] Connected Temporal Classification (CTC) layer: In the CTC layer, the posterior probability matrix W output by the RNN is converted into the final character sequence output. The CTC mechanism converts the probability distribution into a specific character sequence by finding the character with the highest probability in each column of the matrix W as the label for that column. This process eliminates the need for strict alignment of the input and output sequences, greatly simplifying the training process. During training, the gradient descent algorithm is still used to optimize the model parameters, ensuring that the model can accurately transcribe the text information in the image into a readable character sequence.

[0032] In summary, the present invention has successfully overcome the technical difficulties of electronic seal text detection by integrating a series of innovative image processing, feature extraction and intelligent recognition technologies, demonstrating broad application potential and important practical value, and providing strong technical support for the development of related fields.

[0033] Using the method proposed in this paper, we systematically address the challenges of difficult text recognition and alignment on circular electronic seals. First, precise seal positioning technology ensures accurate extraction of the seal image from a complex background. Subsequently, advanced image correction algorithms automatically correct tilted or deformed seals, restoring their standard form. Next, the seal is binarized to simplify the image information for subsequent processing. The processed seal image is then converted into a matrix format for efficient computer analysis. Finally, classic text recognition technology enables precise identification of the text on the seal and, through intelligent algorithms, horizontal alignment of the text. This fundamentally overcomes the previous difficulty in visually reading and recognizing text on circular electronic seals. This technical solution not only significantly improves the accuracy and efficiency of electronic seal text verification but also lays a solid foundation for the widespread application and promotion of electronic seals, promoting further development in the fields of digital office and information security.

[0034] Glossary Convolutional neural networks (CNNs) are a type of feedforward neural network with a deep structure that incorporates convolutional computations. They are a representative algorithm for deep learning. Convolutional neural networks possess representational learning capabilities and can perform shift-invariant classification of input information based on their hierarchical structure. Therefore, they are also known as "translation-invariant artificial neural networks."

Claims

1. A method for electronic seal character recognition based on image recognition, characterized in that It includes the following steps: (I) Seal positioning The HSV values of the human vision hexagonal pyramid model HSV are used to distinguish different colors. In this step, the HSV values of red are: h>300 or h<25; for yellow: 35<h<85; for green: 95<h<200; where h represents the HSV value; In order to convert RGB values to HSV values, the following method is adopted in this article to convert the RGB values of the image to HSV values: Among them, R represents the red color level of the image, G represents the green color level of the image, B represents the blue color level of the image, and the maximum value of R, G, and B is taken as v; when h>300 or h<25, the corresponding area is the red area, and the corresponding red area is the position where the electronic seal is located; (II) Seal correction The first step: In the left area of the seal image, identify and record the coordinates (x1, y1) of the red pixel point A of the last character in the bottom row of text; The second step: Perform the same operation in the right area to find the coordinates (X2, y2) of the red pixel point B of the last character in the bottom row of text; these two coordinate points will assist in horizontally aligning the bottom of the seal text: By comparing whether y1 and y2 are equal, it is judged whether the electronic seal is deflected; If the electronic seal is deflected, then point A and point B are connected to form a straight line L1, and a straight line L2 is generated which is perpendicular to L1 and has the center of the electronic seal as the circle center. The intersection of L1 and L2 is set as point C. The corresponding coordinates are , the point where L1 intersects the y-axis is D, and the coordinates of point D can be calculated as (0, y) based on the straight line company. According to the trigonometric formula, That is the angle by which the electronic seal needs to be rotated. After rotating the positioned electronic seal clockwise by degrees, the correction of the electronic seal is completed; (III) Binary processing of the seal The first step: Perform grayscale processing on the original RGB image; The second step: Based on the characteristics of the grayscale image pixel value range [0, 255], a threshold value of 128 is set as the benchmark for distinguishing black and white; the part with pixel values greater than 128 is determined to be black, and those less than or equal to 128 are regarded as white; 0.3*R + 0.59*G + 0.11*B = gray Among them, R, G, and B respectively represent the red, green, and blue color levels of the image, and gray represents the grayscale value obtained after the image is grayscale processed; through this conversion, the image is further binary processed; (IV) Converting the circular image of the electronic seal into a rectangular image The binary electronic seal image is converted into a rectangular image by polar coordinate conversion. Each coordinate point in the circular image with a radius of R is converted according to the scaling ratio. , transform each coordinate point P (x, y) in the circular image into a coordinate point Q (i, j) in the matrix image of length , where the length of the rectangle is the circumference of the circle, that is ; The height of the rectangle is the radius of the circle, that is ; Therefore, the angle conversion factor of the circular image to the rectangular image is , the conversion relationship between the coordinates (x, y) on the circular image and the rectangular image is: The process of converting a circle into a rectangle is essentially a mapping from polar coordinates to Cartesian coordinates. Combining parametric expansion, the specific steps are as follows: Polar coordinate representation: The polar coordinate equation of a circle is r = R ( R is the radius), angle θ ∈[0,2 π ); Parametric expansion: Angle θ Linearly mapped to the width direction of the rectangle ( x axis), radius r Mapping to the height direction ( y axis); Extreme value processing: By adjusting the mapping range, ensure that the rectangle covers the complete geometric information of the circle; (V) Text detection When the circular image of the electronic seal is converted into a rectangular image, according to the conversion rule, the bottom of the image usually corresponds to the five-star at the center of the seal, and after expansion, it appears as a continuous gray area at the bottom, while the upper part of the image is concentrated with text, and after the middle area is binary processed, it shows a relatively obvious blank feature; Perform area allocation on the rectangular image according to binary, and select the interval corresponding to all black at the top as the target interval; Since the top of the matrix image is the text part of the electronic seal, the following method is adopted in this article for processing: (1) Traverse from left to right and filter the area where the bottom and top of the matrix are both black; since there is no text part, the top area is white. For the convenience of calculation, The matrix is ​​divided into 3 , traverse the pixel values ​​from 0 to M on the x-axis and from 2N / 3 to N on the y-axis in sequence. The thickness of the electronic seal edge is less than one tenth of the electronic seal radius. N is proportionally expanded to 10,000 pixels: Where c_p represents the pixel value of the corresponding pixel point, from x=0 to x=m, and the pixel value of the y-axis from 2N / 3 to N. When the corresponding pixel value set is greater than or equal to N / 10, it is the area where the text is located, thus filtering out the area where the pixel coordinates of the black pixel point appearing from x=m1 and the white pixel point from x=m2 onwards; (2) The filtered area is the electronic seal text area, ensuring the alignment of the electronic seal text. Then, the pixel values ​​of the filtered area are traversed from x=m1 to x=m2. In this area, the pixel points that are not black points when y=N are moved upward as a whole until a black pixel point is aligned with the straight line x=N, thereby aligning the top of the text pixel points; The text in an irregular circular image of an electronic seal is aligned as a whole. Considering that the text content of the electronic seal is located at the edge of the electronic seal and occupies half of the radius, a matrix corresponding to the four points (x=m1, y=N / 2), (x=m2, y=N / 2), (x=m1, y=N), and (x=m2, y=N) is selected as the text recognition detection area to obtain the specific position of the text. (6) Electronic seal text recognition After preprocessing and polar coordinate expansion of the extracted seal, the circular text inside the seal is expanded into horizontally arranged text. The expanded text is input into a classic convolutional neural network for text area detection and recognition; Convolutional CNN: First, the extracted text regions are normalized to a uniform height of h = 32 pixels and a width of w = 160 pixels, and converted to a grayscale image format with c = 1 channel. These preprocessed images are then fed into the CNN network, where features are extracted through convolution. Each feature vector is precisely mapped to a rectangular region in the original image, effectively capturing the image's local characteristics. Recurrent Neural Network (RNN) layer: The feature vectors output by the CNN layer are further passed to the RNN layer, which uses a two-layer bidirectional LSTM network architecture, with each layer containing 256 units. The bidirectional LSTM design enables the network to simultaneously consider the context of the sequence, enhancing the model's ability to capture contextual dependencies. After processing by the RNN layer, a posterior probability matrix W is output, which contains the predicted information of the character sequence. Connected Time Series Classification (CTC) layer: In the CTC layer, the posterior probability matrix W output by the RNN is converted into the final character sequence output. The CTC mechanism achieves the conversion from probability distribution to specific character sequence by finding the character corresponding to the maximum probability in each column of the matrix W as the label of that column.

Citation Information

Cited By

  • Round seal text recognition method based on color filtering and coordinate transformation

    CN122090433A