Method, apparatus, electronic device and medium for determining text information in a seal image
By performing two positioning processing and graphic conversion in the seal image, and combining the neural network model to identify text information, the problem of manual verification of seals is solved, and efficient and accurate seal text information detection is achieved.
Patent Information
- Application Number
- CN202210454697.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-04-26
AI Technical Summary
In the prior art, seal inspection mainly relies on manual verification, resulting in low verification effect and prone to missed judgments and misjudgment problems.
By determining the position of the seal object in the image to be identified, performing two positioning processing and graphic conversion, an accurate rectangular seal image is obtained, combining the neural network model to identify text information, using the image mask to remove background interference, and performing text information voting to determine text information in the seal object.
It improves the efficiency of checking text information in the seal image, can quickly identify and correct seal errors, and improves the accuracy and efficiency of detection.
Smart Images

Figure CN114782957B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and can be applied to the field of financial technologies. More specifically, it relates to a method, apparatus, device, medium, and program product for determining text information in a seal image. Background Art
[0002] In the business scenarios of most current fields, the detection of seals is involved. Facing the problem of seal detection, manual methods are often adopted. For example, staff will compare the seal on the material with the seal template to determine whether the seal is missing or mis-stamped.
[0003] However, this method that relies on manual visual inspection of the text information in the seal image not only has a low verification effect, but also is extremely prone to missed judgments and misjudgments. Summary of the Invention
[0004] In view of the above problems, the present disclosure provides a method, apparatus, device, medium, and program product for determining text information in a seal image. Through the method for determining text information in a seal image, the verification efficiency of the text information in the seal image can be improved, which is beneficial to quickly finding the documents with seal errors among many documents with seals.
[0005] According to a first aspect of the present disclosure, there is provided a method for determining text information in a seal image, including: determining the position of a seal object in an image to be recognized, obtaining a first positioning result and a first seal image corresponding to the first positioning result; in the case where the seal object is a seal with a target shape, performing a second positioning process on the first seal image to obtain a second positioning result and a second seal image corresponding to the second positioning result; according to the second positioning result, performing a graphic conversion process on the target shape seal area in the second seal image to obtain a rectangular area corresponding to the target shape seal area and a third seal image corresponding to the rectangular area; and determining the text information in the seal object according to the third seal image.
[0006] According to an embodiment of the present disclosure, the target shape includes a circle or an ellipse. When determining that the seal object is a seal of the target shape, performing a second positioning process on the first seal image to obtain a second positioning result and a second seal image corresponding to the second positioning result, including: determining a target color area and a non-target color area in the first seal image; performing a first denoising process on the first seal image; the first denoising process includes suppressing text information in the non-target color area; performing a binarization process on the first seal image after the first denoising process, determining that the value corresponding to the target color area is a first value, and the value corresponding to the non-target color area is a second value; performing a preset traversal scanning process on the binarized first seal image to determine coordinate information corresponding to the first value; performing a circular fitting process according to the coordinate information to determine the coordinate information of the center of the circle and the radius of the circle; and using the coordinate information of the center of the circle and the radius of the circle as the second positioning result, and obtaining a second seal image corresponding to the second positioning result.
[0007] According to an embodiment of the present disclosure, the method further includes: based on a preset prior condition, performing a second denoising process on the first seal image to determine an image mask of the background text in the first seal image; the preset prior condition includes: a prior condition set according to the font color of the background text; removing the background text from the second seal image according to the image mask to obtain a second seal image with the background text removed.
[0008] According to an embodiment of the present disclosure, determining the text information in the seal object according to the third seal image includes: inputting the third seal image into at least two neural network models to obtain at least two text information recognition results corresponding to the third seal image; and performing a vote election on the text information according to the at least two text information recognition results to determine the text information in the seal object.
[0009] The second aspect of the present disclosure provides an apparatus for determining text information in a seal image, including: a first positioning processing module for determining the position of a seal object in an image to be recognized, obtaining a first positioning result and a first seal image corresponding to the first positioning result; a second positioning processing module for performing a second positioning process on the first seal image when it is determined that the seal object is a target-shaped seal, obtaining a second positioning result and a second seal image corresponding to the second positioning result; a graphic conversion module for performing a graphic conversion process on the target-shaped seal area in the second seal image according to the second positioning result, obtaining a rectangular area corresponding to the target-shaped seal area and a third seal image corresponding to the rectangular area; and a determination module for determining the text information in the seal object according to the third seal image.
[0010] The third aspect of the present disclosure provides an electronic device, including: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method for determining text information in a seal image as described above.
[0011] The fourth aspect of the present disclosure further provides a computer-readable storage medium having executable instructions stored thereon, and when the instructions are executed by a processor, the processor is caused to execute the method for determining text information in a seal image as described above.
[0012] The fifth aspect of the present disclosure further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method for determining text information in a seal image as described above is implemented.
[0013] The method for determining text information in a seal image provided in this embodiment can improve the verification efficiency of the text information in the seal image through a complete process of determining the text information in the seal image, which is beneficial to quickly finding documents with seal errors among many documents with seals. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Through the following description of the embodiments of the present disclosure with reference to the drawings, the above content and other objects, features and advantages of the present disclosure will become clearer. In the drawings:
[0015] Figure 1 Schematically shows an application scenario diagram of a method, apparatus, device, medium and program product for determining text information in a seal image according to an embodiment of the present disclosure;
[0016] Figure 2 Schematically shows a flowchart of a method for determining text information in a seal image according to an embodiment of the present disclosure;
[0017] Figure 3 A schematic diagram schematically showing a second seal image according to an embodiment of the present disclosure;
[0018] Figure 4 A schematic diagram schematically showing a third seal image according to an embodiment of the present disclosure;
[0019] Figure 5 A block diagram schematically showing a device for determining text information in a seal image according to an embodiment of the present disclosure; and
[0020] Figure 6 A block diagram schematically showing an electronic device suitable for implementing a method for determining text information in a seal image according to an embodiment of the present disclosure. Detailed implementation manners
[0021] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, many specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. However, it is obvious that one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts of the present disclosure.
[0022] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0023] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0024] In the case of using expressions such as "at least one of A, B, and C", generally, it should be interpreted according to the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include, but is not limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0025] Embodiments of the present disclosure provide a method and apparatus for determining text information in a seal image, determining the position of a seal object in an image to be recognized to obtain a first positioning result and a first seal image corresponding to the first positioning result; in the case where the seal object is a target-shaped seal, performing a second positioning process on the first seal image to obtain a second positioning result and a second seal image corresponding to the second positioning result; according to the second positioning result, performing a graphic conversion process on the target-shaped seal area in the second seal image to obtain a rectangular area corresponding to the target-shaped seal area and a third seal image corresponding to the rectangular area; and determining the text information in the seal object according to the third seal image.
[0026] Figure 1 FIG. schematically shows an application scenario diagram of a method, apparatus, device, medium and program product for determining text information in a seal image according to an embodiment of the present disclosure.
[0027] As Figure 1 shown, the application scenario 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0028] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0029] The terminal devices 101, 102, 103 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0030] The server 105 may be a server providing various services, such as a background management server that supports websites browsed by users using the terminal devices 101, 102, 103 (only as an example). The background management server may analyze and process data such as received user requests, and feedback the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0031] It should be noted that the method for determining the text information in the seal image provided by the embodiments of the present disclosure can generally be executed by the server 105. Correspondingly, the device for determining the text information in the seal image provided by the embodiments of the present disclosure can generally be set in the server 105. The method for determining the text information in the seal image provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Correspondingly, the device for determining the text information in the seal image provided by the embodiments of the present disclosure can also be set in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105.
[0032] It should be understood that Figure 1 the numbers of terminal devices, networks and servers in
[0033] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks and servers. Figure 1 The following will be based on Figure 2 the described scenario, and will describe in detail the method for determining the text information in the seal image of the disclosed embodiments through
[0034] Figure 2 FIG. schematically shows a flowchart of the method for determining the text information in the seal image according to the embodiments of the present disclosure.
[0035] As Figure 2 shown, this embodiment includes operation S210 to operation S240, and the method for determining the text information in the seal image can be executed by the server.
[0036] In the technical solution of the present disclosure, the processing of data such as acquisition, collection, storage, use, processing, transmission, provision, disclosure and application complies with the provisions of relevant laws and regulations, takes necessary confidentiality measures, and does not violate public order and good customs.
[0037] In operation S210, determine the position of the seal object in the image to be recognized, obtain the first positioning result and the first seal image corresponding to the first positioning result.
[0038] The image to be recognized can be an image with a seal object, such as a document image with a seal. For example, through optical recognition technology for target detection, the detection object includes the seal.
[0039] For example, an image with a seal can be used as training data, and the position and category labels of the seal are generated for each image. The category can include circular seals, oval seals, etc. Then, the deep learning model is trained using the pictures with seals and the labels to obtain a trained deep training model. When applying this deep training model, the image to be recognized can be used as input data to obtain the position of the seal object. For example, the detection box will enclose the seal object. The image in the detection box is used as the first seal image, and the coordinate information of the detection box is used as the first positioning result. For example, if the detection box is rectangular, the first positioning result includes the coordinate information of the four corners of the rectangular detection box.
[0040] It can be understood that there may be some interfering factors in the first seal image corresponding to the first positioning result. For example, the image may also include some other text contents except the seal text, such as "seal impression", "seal signature", "signature information", "date information", etc.
[0041] In operation S220, when it is determined that the seal object is a target-shaped seal, the first seal image is subjected to a second positioning process to obtain a second positioning result and a second seal image corresponding to the second positioning result.
[0042] It can be understood that the detection effect of optical character recognition on curved text is poor, which is likely to cause misjudgment of text information. In circular or oval seals, there are many curved texts.
[0043] Performing a second positioning process on the first seal image to obtain a more accurate positioning result. For example, the circular or oval outer border of a circular or oval seal is located to obtain a positioning result corresponding to the outer border as the second positioning result; further, image extraction is performed according to the second positioning result to obtain a second seal image corresponding to the second positioning result. It can be understood that the second seal image only includes the regional image inside the circular (or oval) seal, that is, it does not include the partial area that only belongs to the detection box outside the circular (or oval) seal, thus avoiding the possible text interference outside the circular (or oval) seal and facilitating more accurate determination of the text information in the seal image.
[0044] It can be understood that there may still be some interfering factors in the second seal image corresponding to the second positioning result. For example, the image may also include text information overlapping with the circular (or oval) seal object, because usually some text contents are covered to a certain extent when stamping.
[0045] In operation S230, according to the second positioning result, the target-shaped seal area in the second seal image is subjected to a graphic conversion process to obtain a rectangular area corresponding to the target-shaped seal area and a third seal image corresponding to the rectangular area.
[0046] See Figure 3 and Figure 4 . It can be understood that the second positioning result includes the coordinate information of the outer border of the circular (or oval) seal. Therefore, using the coordinate information of the outer border of the circular (or oval) seal, the circular (or oval) seal area in the second seal image (such as the second seal image 301 shown in Figure 3 ) is subjected to graphic transformation, changing the circle (or oval) to a rectangle, and a rectangular area corresponding to the circular (or oval) seal area is obtained. This rectangular image is used as the third seal image corresponding to the rectangular area (such as the third seal image 401 shown in Figure 4 ).
[0047] For example, the original coordinate system is positioned as (X, Y), the center coordinate is (x0, y0), and the new coordinate system is r and α (α is the deflection angle of the reference position of the circular (or oval) shape). It can be assumed that the radius of the circular (or oval) shape is 200. Then, the size of the new rectangular image can be set as (200, 360 + δ), where 360 refers to the period of the circular (or oval) shape, and δ is a margin parameter to prevent the selected reference point from being exactly text. Then, the corresponding relationship between the r and α coordinate systems and the circular (or oval) XY is: X = r * cos(α % 360) + x0; Y = r * sin(α % 360) + y0.
[0048] Through image conversion processing, the circular (or oval) image can be changed into a rectangular image, thereby reducing the use of curved samples when determining the text information in the seal object subsequently, and further reducing the influence brought by the curved samples, which is beneficial to obtaining a more accurate determination result of the text information.
[0049] In operation S240, according to the third seal image, determine the text information in the seal object.
[0050] For example, perform optical character recognition on the third seal image, and use the obtained character recognition result as the text information in the seal object.
[0051] For example, use the dot seal image as input data and input it into a trained deep learning model, and the output result is the text information in the seal object.
[0052] Using the determined text information in the seal object, it can be compared with the text in the reserved template corresponding to the seal. If the comparison result is consistent, it is considered that the seal is correct; if the comparison result is inconsistent, that is, there is a deviation, a reminder can be issued for manual verification by the staff.
[0053] The method for determining text information in a seal image provided in this embodiment obtains an accurate positioning result of the seal through two positioning processes, that is, a second seal image corresponding to the second positioning result. This second seal image has to a certain extent avoided interference factors. At the same time, through image conversion processing, an image such as a circular or elliptical image can be converted into a rectangular image, thereby reducing the use of curved samples when subsequently determining the text information in the seal object, and further reducing the influence brought by the curved samples, which is conducive to obtaining a more accurate text information determination result. Through the complete process of determining text information in a seal image, the verification efficiency of text information in the seal image can be improved, which is conducive to quickly finding documents with seal errors among many documents with seals.
[0054] The target shape includes a circle or an ellipse. In the case where the seal object is a seal with the target shape, a second positioning process is performed on the first seal image to obtain a second positioning result and a second seal image corresponding to the second positioning result, including: determining the target color area and non-target color area in the first seal image; performing a first denoising process on the first seal image; the first denoising process includes suppressing the text information in the non-target color area; performing a binarization process on the first seal image after the first denoising process, determining that the value corresponding to the target color area is the first value, and the value corresponding to the non-target color area is the second value; performing a preset traversal scanning process on the binarized first seal image to determine the coordinate information corresponding to the first value; performing a circular fitting process based on the coordinate information to determine the coordinate information of the center of the circle and the radius of the circle; and using the coordinate information of the center of the circle and the radius of the circle as the second positioning result, and obtaining a second seal image corresponding to the second positioning result.
[0055] Generally, the color of a seal is red or blue, etc. Therefore, the target color can be red or blue, etc., and the non-target color area can be white, black, etc. For example, if the color of a certain seal is red, then the target color is red; the background color of the stamped area is white, and there may also be some black or blue text in this background area, then white, black, or blue is the non-target color area.
[0056] First, determine the target color area and non-target color area in the first seal image; in order to better obtain the text information in the seal image and extract only the text information content in the seal as much as possible, it is necessary to denoise the first seal image, such as enhancing the text information in the target color area and suppressing the text information in the non-target color area; after denoising, perform binarization processing, for example, the image value of the target color area is 1 (the first value), and the image value of the non-target color area is 0 (the second value), and perform row and column scanning to determine the coordinate information corresponding to the first value; it can be understood that this coordinate information includes the coordinate information of a circular (or elliptical) area, and circular fitting processing can be performed according to the coordinate information to determine the coordinate information of the center of the circle and the radius of the circle. Finally, use the coordinate information of the center of the circle and the radius of the circle as the second positioning result, and obtain the second seal image corresponding to the second positioning result.
[0057] For example, since the seal area obtained from the first seal image is relatively rough, in order to improve the positioning accuracy, it is necessary to accurately position the seal object. Since the seal area is mainly red (i.e., the target color), and other areas are background areas (white, gray or other lighter colors, i.e., non-target colors), and the signature or printing area (blue or black, i.e., non-target colors), the following strategy can be used to highlight the seal color and suppress other colors. Divide the first seal image into three color channels of rgb, and the processed image = r channel - (g channel + b channel) / 2 (the r, g, and b values of the background area and the black area are relatively close, and the b value of the blue part is larger, so the value of the red (i.e., the target color) area in the finally processed image is larger, and the values of other positions (i.e., non-target colors) are smaller). The red (i.e., the target color) area is highlighted, and other areas are suppressed. Then, threshold transformation can be performed on the image, such as using the Otsu threshold method to binarize the image, the image value of the red (i.e., the target color) area is 1, and the non-red area (i.e., the non-target color) is 0. Then perform row and column scanning. The scanning steps can be to start from the first row and traverse from the leftmost and rightmost to the middle. When the first point with a value of 1 is encountered, record the current coordinate position (x i , y i ), and then continue to scan the next row. When the left and right sides meet and no point with a value of 1 has been encountered, it is considered that there is no seal area in this row, and then scan the next row. After the scanning is completed, it can be understood that most of the extracted points (possibly due to the breakage of the seal, resulting in this point being inside the seal) belong to the points on the edge of the seal. Then, perform circular fitting on the extracted points to obtain the position of the center point of the circle and the radius. Thus, the seal is accurately positioned.
[0058] The method for determining text information in a seal image provided in this embodiment includes: determining a target color area and a non-target color area in a first seal image; performing a first denoising process on the first seal image; the first denoising process includes suppressing text information in the non-target color area; performing a binarization process on the first seal image after the first denoising process, determining that the value corresponding to the target color area is a first value, and the value corresponding to the non-target color area is a second value; performing a preset traversal scanning process on the binarized first seal image to determine coordinate information corresponding to the first value; performing a circular fitting process based on the coordinate information to determine the coordinate information of the center of the circle and the radius of the circle; and using the coordinate information of the center of the circle and the radius of the circle as a second positioning result, and obtaining a second seal image corresponding to the second positioning result, which can reduce interference factors while accurately positioning the seal object, and is beneficial to improving the accuracy of determining text information.
[0059] The method for determining text information in a seal image further includes: based on a preset prior condition, performing a second denoising process on the first seal image to determine an image mask of background text in the first seal image; the preset prior condition includes: a prior condition set according to the font color of the background text; removing the background text from the second seal image according to the image mask to obtain a second seal image with the background text removed.
[0060] It can be understood that there may be a lot of messy text interference in the first seal image. To improve the verification accuracy, it is necessary to remove the text interference in the background text.
[0061] For example, the prior condition is that the text belongs to dark colors, and the colors may generally be blue or black. Therefore, the signature part can be enhanced to remove the interference of the red (i.e., the target color) area and the background area. For example, calculate 255 - the red (i.e., the target color) channel, and perform binarization on the image to obtain an image mask of the background text in the first seal image. Perform a restoration process according to the image mask of the background text in the first seal image. For example, for each white point, if it is mapped to the first seal image, it can extend 10 pixels in its four directions of up, down, left, and right; if it encounters a red (i.e., the target color) pixel and there is no other color (such as white) pixel before encountering the red (i.e., the target color) pixel, it can be considered that this point may be the covered seal part, and the average value of the red (i.e., the target color) points can be calculated to fill this point; otherwise, it is considered to be the background color, and the median value of the surrounding pixels can be filled.
[0062] The method for determining text information in a seal image provided in this embodiment can remove the text interference covered by the seal to a certain extent. By removing the background text, interference factors are reduced. Using the second seal image with the background text removed is beneficial to improving the accuracy of determining text information.
[0063] Based on the third seal image, determining the text information in the seal object includes: inputting the third seal image into at least two neural network models to obtain at least two text information recognition results corresponding to the third seal image; and performing a voting election on the at least two text information recognition results to determine the text information in the seal object.
[0064] See Figure 4 The third seal image 401 shown. For example, input the third seal image 401 (ABCDEFGHIJK) into three neural network models, respectively perform text information recognition on the third seal image 401, and obtain three text recognition results. For example, the recognition result of the first neural network model is: ADCBFFOHLJK, the recognition result of the second neural network model is: QBCDEBGUIIK, and the recognition result of the third neural network model is: ABODEFGHIJR. Perform a voting election on these three text information recognition results, that is, the minority obeys the majority, such as integrated voting, to determine a voting election result; use this voting election result as the text information in the seal object.
[0065] For example, if the result of recognizing the first character as 'A' is more, then it is considered that the first character is A, and so on. For example, if the result of recognizing the last character as 'K' is more, then it is considered that the last character is K; the final voting election result is: ABCDEFGHIJK. It can be seen that determining the text information in the seal object through voting election is accurate.
[0066] Furthermore, there may be both curved text and non-curved text, such as horizontal text, in the seal. For this situation, further correction can be carried out. For example, horizontal text will cause chaos in the text structure after image conversion. Therefore, the first seal image correction process can be performed. For example, the text recognition coordinates are x1, y1, x2, and y2 (the first positioning result); the center position of the rectangular image is (w / 2, h / 2). It can be understood that wh is the size of the rectangular image. Then, it can be considered that when the seal is placed upright, its central text should be in the center of the image. Therefore, through calculation, the rotation angle of the rectangle is approximately [((x1 + x2) / 2 - w / 2) / w] * (360 + δ). Rotate the image according to this rotation angle of the rectangle. Then, perform text recognition on the rotated image, map the recognition result to the rectangular image. If it is found that the threshold with the outer contour text exceeds the preset standard value (such as 0.6), then exclude this text information, and the remaining is the horizontal text.
[0067] The method for determining text information in a seal image provided in this embodiment determines the text information in the seal object through a vote based on at least two text information recognition results, which can improve the accuracy of determining text information to a certain extent and is conducive to improving the verification efficiency of text information in the seal image.
[0068] Based on the above method for determining text information in a seal image, the present disclosure also provides a device for determining text information in a seal image. The following will be combined with Figure 5 to describe this device in detail.
[0069] Figure 5 Schematically shows a structural block diagram of a device for determining text information in a seal image according to an embodiment of the present disclosure.
[0070] As Figure 5 shown, the device 500 for determining text information in a seal image in this embodiment includes a first positioning processing module 510, a second positioning processing module 520, a graphic conversion module 530, and a determination module 540.
[0071] The first positioning processing module 510 is configured to determine the position of the seal object in the image to be recognized, obtain a first positioning result and a first seal image corresponding to the first positioning result; the second positioning processing module 520 is configured to perform second positioning processing on the first seal image when it is determined that the seal object is a target-shaped seal, obtain a second positioning result and a second seal image corresponding to the second positioning result; the graphic conversion module 530 is configured to perform graphic conversion processing on the target-shaped seal area in the second seal image according to the second positioning result, obtain a rectangular area corresponding to the target-shaped seal area and a third seal image corresponding to the rectangular area; and the determination module 540 is configured to determine the text information in the seal object according to the third seal image.
[0072] In some embodiments, the target shape includes a circle or an ellipse. The second positioning processing module is configured to: determine a target color area and a non-target color area in the first seal image; perform a first denoising process on the first seal image; the first denoising process includes suppressing text information in the non-target color area; perform a binarization process on the first seal image after the first denoising process, determining that the value corresponding to the target color area is a first value and the value corresponding to the non-target color area is a second value; perform a preset traversal scanning process on the binarized first seal image to determine coordinate information corresponding to the first value; perform a circular fitting process based on the coordinate information to determine the coordinate information of the center of the circle and the radius of the circle; and use the coordinate information of the center of the circle and the radius of the circle as the second positioning result, and obtain a second seal image corresponding to the second positioning result.
[0073] In some embodiments, the apparatus further includes: a denoising processing module configured to perform a second denoising process on the first seal image based on a preset prior condition to determine an image mask of background text in the first seal image; the preset prior condition includes: a prior condition set according to the font color of the background text; a background text processing module configured to perform background text removal processing on the second seal image according to the image mask to obtain a second seal image with the background text removed.
[0074] In some embodiments, the determining module is configured to input the third seal image into at least two neural network models to obtain at least two text information recognition results corresponding to the third seal image; and perform a voting election on the text information according to the at least two text information recognition results to determine the text information in the seal object.
[0075] According to an embodiment of the present disclosure, any plurality of modules among the first positioning processing module 510, the second positioning processing module 520, the graphic conversion module 530, and the determination module 540 may be combined and implemented in one module, or any one of them may be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules may be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first positioning processing module 510, the second positioning processing module 520, the graphic conversion module 530, and the determination module 540 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or may be implemented by any other reasonable means such as hardware or firmware through integration or packaging of circuits, or may be implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, at least one of the first positioning processing module 510, the second positioning processing module 520, the graphic conversion module 530, and the determination module 540 may be at least partially implemented as a computer program module, and when the computer program module is run, corresponding functions may be executed.
[0076] Figure 6 A block diagram of an electronic device suitable for implementing a method for determining text information in a seal image according to an embodiment of the present disclosure is schematically shown.
[0077] As Figure 6 shown, the electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which may perform various appropriate actions and processes according to a program stored in a read only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general microprocessor (such as a CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (such as an application specific integrated circuit (ASIC)), and so on. The processor 601 may also include on-board memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0078] In the RAM 603, various programs and data required for the operation of the electronic device 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flow according to the embodiments of the present disclosure by executing the programs in the ROM 602 and / or the RAM 603. It should be noted that the programs may also be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to the embodiments of the present disclosure by executing the programs stored in the one or more memories.
[0079] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, and the input / output (I / O) interface 605 is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the I / O interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read from it can be installed into the storage portion 608 as needed.
[0080] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.
[0081] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, device, or apparatus. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include one or more memories other than the ROM 602 and / or RAM 603 and / or ROM 602 and RAM 603 described above.
[0082] An embodiment of the present disclosure further includes a computer program product, which includes a computer program that contains program code for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program code is used to enable the computer system to implement the method for determining text information in a seal image provided by the embodiment of the present disclosure.
[0083] When the computer program is executed by the processor 601, it executes the above functions defined in the system / apparatus of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, apparatuses, modules, units, etc. can be implemented by computer program modules.
[0084] In one embodiment, the computer program can rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program can also be transmitted and distributed in the form of a signal on a network medium, and be downloaded and installed through the communication part 609, and / or be installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0085] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or be installed from the removable medium 611. When the computer program is executed by the processor 601, it executes the above functions defined in the system of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. can be implemented by computer program modules.
[0086] According to embodiments of the present disclosure, program code for executing the computer programs provided by the embodiments of the present disclosure may be written in any combination of one or more programming languages. Specifically, these computing programs may be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. The programming languages include, but are not limited to, programming languages such as Java, C++, Python, the "C" language, or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0087] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0088] Those skilled in the art can understand that the features recited in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly recited in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features recited in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.
[0089] The embodiments of the present disclosure have been described above. However, these embodiments are merely for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments have been described separately above, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and these substitutions and modifications should fall within the scope of the present disclosure.
Claims
1. A method for determining text information in a seal image, comprising: Determining the position of a seal object in an image to be recognized, obtaining a first positioning result and a first seal image corresponding to the first positioning result; When it is determined that the seal object is a seal with a target shape, performing a second positioning process on the first seal image to obtain a second positioning result and a second seal image corresponding to the second positioning result; According to the second positioning result, performing a graphic conversion process on the target shape seal area in the second seal image to obtain a rectangular area corresponding to the target shape seal area and a third seal image corresponding to the rectangular area; And Determining the text information in the seal object according to the third seal image; Wherein, the target shape includes a circle or an ellipse, and when it is determined that the seal object is a seal with a target shape, performing a second positioning process on the first seal image to obtain a second positioning result and a second seal image corresponding to the second positioning result, including: Determining a target color area and a non-target color area in the first seal image; Performing a first denoising process on the first seal image; the first denoising process includes suppressing text information in the non-target color area; Performing a binarization process on the first seal image after the first denoising process, determining that the value corresponding to the target color area is a first value, and the value corresponding to the non-target color area is a second value; Performing a preset traversal scanning process on the binarized first seal image to determine coordinate information corresponding to the first value; Performing a circular fitting process according to the coordinate information to determine the coordinate information of the center of the circle and the radius of the circle; and Taking the coordinate information of the center of the circle and the radius of the circle as the second positioning result, and obtaining a second seal image corresponding to the second positioning result; The method further includes: Comparing the determined text information in the seal object with the text in a reserved template corresponding to the seal object. When the comparison result is consistent, the seal object is correct. When the comparison result is inconsistent, a reminder is issued.
2. The method according to claim 1, the method further includes: Based on a preset prior condition, performing a second denoising process on the first seal image to determine an image mask of background text in the first seal image; The preset prior condition includes: a prior condition set according to the font color of the background text; Performing background text removal processing on the second seal image according to the image mask to obtain a second seal image with the background text removed.
3. The method according to claim 1, wherein, The determining the text information in the seal object according to the third seal image includes: Inputting the third seal image into at least two neural network models to obtain at least two text information recognition results corresponding to the third seal image; and Performing a vote election of text information according to the at least two text information recognition results to determine the text information in the seal object.
4. An apparatus for determining text information in a seal image, comprising: The first positioning processing module is used to determine the position of the seal object in the image to be recognized, obtain the first positioning result and the first seal image corresponding to the first positioning result; The second positioning processing module is used to perform second positioning processing on the first seal image when it is determined that the seal object is a seal with a target shape, obtain the second positioning result and the second seal image corresponding to the second positioning result; The graphic conversion module is used to perform graphic conversion processing on the target shape seal area in the second seal image according to the second positioning result, obtain a rectangular area corresponding to the target shape seal area, and a third seal image corresponding to the rectangular area; And The determination module is used to determine the text information in the seal object according to the third seal image; The target shape includes a circle or an ellipse, and the second positioning processing module is used to: Determine the target color area and non-target color area in the first seal image; Perform first denoising processing on the first seal image; the first denoising processing includes suppressing the text information in the non-target color area; Perform binarization processing on the first seal image after the first denoising processing, and determine that the value corresponding to the target color area is the first value, and the value corresponding to the non-target color area is the second value; Perform a preset traversal scanning process on the binarized first seal image to determine the coordinate information corresponding to the first value; Perform circular fitting processing according to the coordinate information to determine the coordinate information of the center of the circle and the radius of the circle; And Use the coordinate information of the center of the circle and the radius of the circle as the second positioning result, and obtain the second seal image corresponding to the second positioning result; The device is further used to: Compare the determined text information in the seal object with the text in the reserved template corresponding to the seal object. When the comparison result is consistent, the seal object is correct. When the comparison result is inconsistent, a reminder is issued.
5. The device according to claim 4, further comprising: The denoising processing module is used to perform second denoising processing on the first seal image based on a preset prior condition to determine the image mask of the background text in the first seal image; The preset prior condition includes: the prior condition set according to the font color of the background text; The background text processing module is used to perform background text removal processing on the second seal image according to the image mask to obtain the second seal image with the background text removed.
6. An electronic device, comprising: One or more processors; A storage device for storing one or more programs, Wherein, when the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method according to any one of claims 1 to 3.
7. A computer-readable storage medium, on which executable instructions are stored, and when the instructions are executed by a processor, the processor is caused to execute the method according to any one of claims 1 to 3.
8. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Image processing method, apparatus and device, and storage medium
CN112507946A
Circular seal character recognition method and device, computer equipment and storage medium
CN113627423A
Method and device for identifying seal in image, computer equipment and readable storage medium
CN113627432A