A seal image extraction method, device, terminal and storage medium

By detecting and recognizing the contour of the seal image using elliptical arcs and filtering out invalid and duplicate elliptical arcs, the problem of low efficiency and poor accuracy in seal extraction in existing technologies is solved, and efficient and accurate seal image extraction is achieved.

CN116030480BActive Publication Date: 2026-01-27CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111235623.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-22
Publication Date
2026-01-27
Estimated Expiration
2041-10-22

AI Technical Summary

Technical Problem

In existing technologies, methods for extracting circular seals have high requirements for the quality of the seal files, high time and space complexity, and poor extraction results for overlapping seals, making it impossible to achieve fully automatic extraction.

Method used

By performing elliptical arc detection on the image to be recognized, the target elliptical arc corresponding to the contour of the seal image is determined, invalid and duplicate elliptical arcs are filtered out, and the seal image region is extracted, thereby improving the efficiency and accuracy of seal image extraction.

Benefits of technology

It achieves efficient and accurate extraction of seal images, reduces the requirements for seal document quality, and is suitable for practical office scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116030480B_ABST
    Figure CN116030480B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a seal image extraction method and device, a terminal and a storage medium, wherein the method comprises: acquiring a to-be-recognized image comprising a seal image; performing ellipse arc detection on the to-be-recognized image to determine a target ellipse arc corresponding to the contour of the seal image; determining a seal image region where the target ellipse arc is located in the to-be-recognized image; and performing image extraction based on the seal image region to obtain the seal image. In this way, the efficiency and accuracy of seal image extraction are improved, and the quality requirement of the to-be-recognized image comprising the to-be-extracted seal image is not high, and the practicability is strong.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer vision, and in particular to a method, apparatus, terminal and storage medium for extracting seal images. Background Technology

[0002] With the rapid development of internet technology and the impact of the pandemic, more and more companies are starting to work remotely. While sending documents is easy in remote work, the handling of essential office documents like seals is a critical issue. Due to the special nature of seals, reports of seal-related fraud are rampant, causing significant economic losses to many companies. Among related technologies, there are two main methods for extracting circular seals: circle detection-based extraction methods and closed region recognition-based extraction methods. These methods require high-quality seal documents and have high time and space complexity, and they are not effective at extracting overlapping seals from documents. Summary of the Invention

[0003] This application provides a method, apparatus, terminal, and storage medium for extracting seal images, which can detect partial elliptical arcs in the image to be identified and then extract the seal image, thereby improving the efficiency of seal image extraction.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] This application provides a method for extracting a seal image, the method comprising:

[0006] Obtain the image to be identified, including the seal image;

[0007] Elliptical arc detection is performed on the image to be identified to determine the target elliptical arc corresponding to the outline of the seal image;

[0008] In the image to be identified, determine the stamp image region where the target elliptical arc is located;

[0009] The seal image is obtained by extracting the image from the region of the seal image.

[0010] This application provides a seal image extraction device, the device comprising:

[0011] The acquisition module is used to acquire the image to be identified, including the seal image;

[0012] The first determining module is used to perform elliptical arc detection on the image to be identified and determine the target elliptical arc corresponding to the outline of the seal image;

[0013] The second determining module is used to determine the stamp image region where the target elliptical arc is located in the image to be identified;

[0014] The image extraction module is used to extract the image based on the seal image region to obtain the seal image.

[0015] This application provides a terminal, which includes at least: a controller and a storage medium configured to store executable instructions, wherein:

[0016] The controller is configured to execute stored executable instructions, which are configured to execute the seal image extraction method provided above.

[0017] This application provides a computer-readable storage medium storing computer-executable instructions configured to perform the seal image extraction method described above.

[0018] This application provides a method, apparatus, terminal, and storage medium for extracting seal images. By performing elliptical arc detection on a target elliptical arc in an image containing the seal image to be extracted, the target elliptical arc can be obtained. By extracting a portion of the elliptical arc from the image to be identified and filtering out unqualified seal image outlines, the target elliptical arc of the seal image outline in the image to be identified can be determined. Then, by determining the seal image region of the target elliptical arc in the image to be identified, and extracting the seal image based on the seal image region, the seal image can be obtained. This method can determine the circular seal image to be extracted and its position, and then extract the circular seal image, improving the efficiency and accuracy of seal image extraction. Furthermore, it does not have high requirements for the image quality of the acquired seal image, making it highly practical. Attached Figure Description

[0019] Figure 1 A schematic diagram illustrating the implementation flow of the seal image extraction method provided in this application embodiment;

[0020] Figure 2 A schematic diagram illustrating another implementation of the seal image extraction method provided in the embodiments of this application;

[0021] Figure 3 This is a schematic diagram illustrating another implementation process of the seal image extraction method provided in the embodiments of this application;

[0022] Figure 4 This is a schematic diagram illustrating another implementation process of the seal image extraction method provided in the embodiments of this application;

[0023] Figure 5 This is a schematic diagram of target color region extraction provided in an embodiment of this application;

[0024] Figure 6 A schematic diagram illustrating an example of an elliptical arc extracted using an elliptical arc extraction algorithm, provided in an embodiment of this application.

[0025] Figure 7 A schematic diagram showing the projection of the seal image pixels onto the x-axis and y-axis, respectively, in an embodiment of this application;

[0026] Figure 8 This is a schematic diagram illustrating an example of straightening an elliptical seal image provided in an embodiment of this application.

[0027] Figure 9 This is a schematic diagram of the extraction of a seal image provided in an embodiment of this application;

[0028] Figure 10 This is a schematic diagram of the structure of the seal image extraction device provided in the embodiments of this application;

[0029] Figure 11 This is a schematic diagram of the composition structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0030] To gain a more detailed understanding of the features and technical content of this application, the implementation of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit this application.

[0031] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application will be described below.

[0032] Circular seal extraction technology primarily extracts seals based on their shape or color features. There are two main types of seal extraction methods: circle detection-based methods and closed region recognition-based methods.

[0033] The circle detection-based extraction method typically involves preprocessing the original image first, such as smoothing noise and color space conversion. Then, a threshold control method is used to extract the color components of the target seal, and the image is converted to grayscale. Next, the Hough transform method is used to perform shape detection on the grayscale image to obtain the position of the seal in the image to be identified. Finally, the seal is separated from the image.

[0034] The extraction method based on closed region recognition is as follows: First, the image is binarized and noise is suppressed. Then, all closed regions in the seal file are identified by scanning the binarized image. Finally, the relevant seal regions are identified from the closed regions according to the seal parameters. Finally, the seal is separated from the image.

[0035] Both circle detection-based extraction methods and closed region identification-based extraction methods have certain drawbacks.

[0036] The extraction method based on circle detection has the following drawbacks: it cannot extract seals with unclear or missing outer contours; it cannot effectively distinguish whether a seal is valid, which can easily lead to missed or redundant extractions; the extraction method using Hough transform has high time and space complexity; and it performs poorly in extracting overlapping seals in the file.

[0037] Extraction methods based on closed region recognition have the following drawbacks: they require high-quality seal files and cannot extract non-closed seals; they require manual adjustment of parameters according to different seals, making fully automated extraction impossible and labor-intensive; they require traversing the image to obtain closed regions, resulting in high time complexity; and they are also ineffective at extracting overlapping seals from files.

[0038] Based on this, this application proposes a method for extracting seal images. In order to understand the features and technical content of this application embodiment in more detail, the implementation of this application embodiment will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference only and are not intended to limit the application embodiment.

[0039] This application provides a method for extracting seal images. Figure 1 This is a schematic diagram illustrating the implementation process of the seal image extraction method provided in the embodiments of this application, as shown below. Figure 1 As shown, the seal image extraction method includes the following steps:

[0040] Step S101: Obtain the image to be identified, including the seal image.

[0041] Here, in this embodiment of the application, the executing entity for the seal image extraction method can acquire and obtain a recognition image containing the seal image to be extracted within the screen content through a connected image acquisition device, such as by capturing the recognition image through a camera. Alternatively, it can acquire the recognition image containing the seal image to be extracted within the screen content through its own installed application, such as by receiving recognition images sent from other terminals through the application. The recognition image can be a page of a acquired document containing a seal image. The color of the seal image to be extracted can be gray, black, or red, etc. In this embodiment of the application, the shape of the seal image to be extracted is a circular seal.

[0042] In some embodiments, since the pixel resolution of the acquired image to be identified is high, the processing efficiency will be reduced during the image detection and recognition process. Therefore, pixel scaling and noise reduction processing are required on the acquired image to be identified to obtain a lower pixel resolution without changing the shape of the seal image to be extracted in the image to be identified.

[0043] Step S102: Perform elliptical arc detection on the image to be identified to determine the target elliptical arc corresponding to the outline of the seal image.

[0044] Here, due to shooting angle or operational errors during the scanning process, the shape of the seal to be extracted in the obtained seal image is often an ellipse rather than a regular circle. Therefore, elliptical arc detection is needed to improve the seal image extraction effect. In practice, due to non-standard operation when stamping, the image to be recognized may not have a continuous contour. Therefore, the contour of the seal to be extracted in the image to be recognized obtained by the terminal is not a complete and continuous curve, but a discontinuous curve. Therefore, elliptical arc detection is needed for the image to be recognized with a discontinuous curve contour to determine the target elliptical arc corresponding to the contour of the image to be recognized, and then extract the seal image based on the target elliptical arc. Moreover, since a circular arc is a special type of elliptical arc, even when the shape of the seal to be extracted in the acquired image to be recognized is a regular circle, elliptical arc detection can still extract the seal image.

[0045] In some embodiments, the gradient magnitude and gradient direction of the pixel in the image to be identified can be calculated. A pseudo-sorting method is used to quickly select the gradient maxima as the starting seed point to determine the edge position in the image. Pixels with similar gradient directions in the neighborhood are iteratively merged until no more pixels with similar gradient directions are found in the neighborhood. The pixel is then fitted as a line segment. For other unfitted pixels, the same method is used to find and fit them, resulting in multiple line segments. Line segments with the same endpoints are then connected and their shapes are fitted to obtain elliptical arcs. Due to irregular operations during the stamping process, the resulting stamp image may have duplicate, invalid, or erroneous stamp contours. Correspondingly, in the elliptical arc detection process, duplicate, invalid, and erroneous stamp contours are elliptical arcs with different parameters. Therefore, multiple elliptical arcs, i.e., a set of elliptical arcs, can be obtained. After fitting the elliptical arc, its parameters are obtained, such as the coordinates of the two endpoints of the elliptical arc, the coordinates of the center of the ellipse corresponding to the elliptical arc, and the lengths of the major and minor axes of the ellipse corresponding to the elliptical arc.

[0046] If the image to be identified contains only one stamp image, but multiple elliptical arcs are obtained when performing elliptical arc detection on the image to be identified, it is necessary to filter the multiple elliptical arcs, filter out invalid elliptical arcs, duplicate elliptical arcs, and elliptical arcs corresponding to the outline of misprinted stamps with missing internal stamp content, and obtain the target elliptical arc.

[0047] Step S103: In the image to be identified, determine the stamp image region where the target elliptical arc is located.

[0048] Here, after determining the target elliptical arc corresponding to the contour of the seal image to be extracted in the image to be identified, a square region including the seal to be extracted is constructed with the center of the ellipse corresponding to the target elliptical arc as the center and the length of the major axis of the ellipse corresponding to the target elliptical arc as the side length. This square region is taken as the seal image region where the target elliptical arc is located.

[0049] Step S104: Extract the image based on the seal image region to obtain the seal image.

[0050] Here, the seal image region includes the target elliptical arc corresponding to the outline of the seal image to be extracted. The seal image region is segmented in the original image to be identified or in the scaled image to be identified to obtain the seal image to be extracted.

[0051] In this embodiment, by performing elliptical arc detection on the image to be identified, which contains the image of the seal to be extracted, the target elliptical arc is obtained. By extracting a portion of the elliptical arc in the image to be identified and filtering out unqualified seal image outlines, the target elliptical arc of the seal image outline in the image to be identified is determined. Then, by determining the seal image region in the image to be identified based on the target elliptical arc and extracting the image from the image to be identified based on the seal image region, the seal image is obtained. This method can determine the circular seal image to be extracted and its position, and then extract the circular seal image, improving the efficiency and accuracy of seal image extraction. Moreover, it does not have high requirements for the image quality of the obtained seal image, making it highly practical.

[0052] In some feasible implementations, after acquiring the image to be identified, image processing is required to improve the speed of image extraction and analysis. Therefore, after step S101 above, the method further includes:

[0053] S1011: Preprocess the image to be identified to obtain the processed image.

[0054] Here, since the acquired images to be identified are photographs or documents, some of which are photocopies, these documents have a high pixel resolution. During image detection and extraction, the pixel resolution of the image reduces processing efficiency. Therefore, it is necessary to perform pixel scaling and noise reduction on the acquired images to obtain a lower pixel resolution image that does not alter the shape of the extracted stamp image. Preprocessing methods may include: scaling the resolution of the image to be identified when its pixel resolution exceeds a threshold; reducing noise in the stamp image; and dilating the image to improve its quality.

[0055] Correspondingly, after obtaining the processed image, elliptical arc detection can be performed on the processed image to determine the target elliptical arc corresponding to the contour of the image to be identified.

[0056] In the embodiments of this application, a seal image with low pixel resolution, unchanged shape of the seal image to be extracted in the image to be identified, and high image quality can be obtained, thereby improving the efficiency of subsequent elliptical arc detection and seal image extraction.

[0057] In some feasible implementations, the resolution of the image to be identified, which directly contains the image of the seal to be extracted, is too high, and the image is noisy with discontinuous local pixels, resulting in low efficiency during image detection and extraction. Therefore, it is necessary to process the acquired image to be identified to obtain an image with low pixel count, less noise, and clear contours, which can improve the efficiency of image detection and analysis. The method for processing the image to be identified in step S1011 above can be implemented through the following steps:

[0058] Step 1: Adjust the resolution of the image to be identified to obtain the first image.

[0059] Here, the images to be identified are photographs or documents. Some images are photocopies, which have higher pixel resolutions. However, during image detection and extraction, higher pixel resolution reduces processing efficiency. Therefore, pixel scaling of the acquired images is necessary. First, the first image is obtained. After acquiring the image to be identified, its resolution is determined. If the resolution is greater than a preset resolution threshold, the resolution is reduced. In one example, the resolution threshold is 1000*1000 pixels. If the resolution is greater than 1000*1000, the resolution is reduced; if it is less than 1000*1000, the resolution remains unchanged.

[0060] Step 2: Smooth the first image to obtain the second image.

[0061] Here, adjusting the resolution of the image to be recognized will not change its quality or shape. The processed image to be recognized, i.e., the first image, will contain noise, which will interfere with image detection and extraction. Therefore, noise reduction processing of the first image is necessary.

[0062] In some embodiments, a Gaussian filter is used to smooth the first image, i.e., to reduce noise, thereby suppressing the impact of image noise on subsequent image detection and extraction.

[0063] Step 3: Perform image dilation processing on the second image to obtain the processed image.

[0064] Here, the acquired image to be recognized has a blurred seal outline, so it needs to be processed to improve its quality. After adjusting the resolution and smoothing the image to be recognized, a dilation operation is performed on the resulting second image to improve its quality, thereby enhancing the effectiveness of subsequent elliptical arc detection.

[0065] In this embodiment, by adjusting the resolution, denoising, and dilating the acquired image to be identified, the quality of the image to be identified can be improved, thereby improving the effect of subsequent elliptical arc detection of the image to be identified and improving the efficiency and accuracy of seal image extraction.

[0066] In some feasible implementations, after image processing of the image to be recognized and before elliptical arc detection, it is necessary to detect the color features of the processed image so that elliptical arc detection can be performed on the image to be recognized based on different color features. Therefore, after step S1011 above, the color features of the processed image need to be detected in the following way, and elliptical arc detection is performed on the image to be recognized that has color features:

[0067] Step S1021: In the processed image, detect the color features of the processed image.

[0068] Here, the color of the seal image to be extracted in the acquired image to be identified may be black, gray, or red, etc. That is, the seal image to be extracted in the image to be identified has different color characteristics: achromatic color characteristics or chromatic color characteristics. Chromatic color characteristics refer to all colors other than black and white, while seals are primarily red. If the acquired image to be identified is a non-color printed document, then the acquired image to be identified has achromatic characteristics. In some embodiments, the color characteristics in the processed image to be identified can be detected based on the color value information of the pixels in the processed image to determine whether the image to be identified has chromatic color characteristics.

[0069] Step S1022: If the color feature is detected, perform color space conversion on the processed image.

[0070] Here, when the color value of a pixel in the processed image corresponds to the red color value in the RGB color space, it is determined that a color feature has been detected. The RGB color space is based on three primary colors: R (Red), G (Green), and B (Blue). Different degrees of superposition are used to produce a rich and wide range of colors, hence it is commonly known as the three-primary-color model.

[0071] Color spaces should conform to the visual perception characteristics of the human eye while also facilitating image processing. Image color transfer involves changing the image's color tone; ideally, changing one color attribute should not alter other color attributes. The HSV color space is created based on the intuitive characteristics of color: H (Hue), S (Saturation), and V (Value). Because color extraction is more effective in the HSV color space, processed images undergo color space conversion—from RGB to HSV.

[0072] Step S1023: In the converted color space, determine the target color region where the processed image is located.

[0073] Here, the image to be identified is extracted in the converted color space, and the image to be identified is red. In the converted color space, the participation threshold of HSV is set to: h∈[110,130], s∈[25,255], v∈[2.55,255], to determine the red region of the red stamp image in the processed image, and to effectively filter out interference from other colors in the stamp image. In the actual extraction process, the participation threshold of HSV can be adjusted according to the specific red color value to obtain better extraction results for the target color region.

[0074] Step S1024: Perform elliptical arc detection on the target color region to determine the target elliptical arc corresponding to the contour of the target color region.

[0075] Here, after determining the target color region, elliptical arc detection can be performed on the target color region to determine the target elliptical arc corresponding to the contour of the image to be recognized in the target color region.

[0076] For images to be identified that have non-color features, i.e., when the color of the stamp and the background are not clearly distinguishable, there is no need to perform color space conversion. Instead, elliptical arc detection is performed directly on the image to be identified to determine the target elliptical arc corresponding to the outline of the stamp image in the image to be identified.

[0077] In this embodiment of the application, when the image to be identified has color features, the image to be identified is converted to a color space, and the target color region of the color of the seal image in the image to be identified is effectively extracted in the converted color space. This effectively filters out interference from other colors in the extraction of the seal image from the image to be identified, thereby improving the efficiency of extracting the seal image.

[0078] In some feasible implementations, elliptical arc detection can be performed on the image to be identified based on the pixel gradient of the pixels in the image to be identified, so as to obtain the target elliptical arc corresponding to the seal image in the image to be identified. This application provides a seal image extraction method. Figure 2 This is a schematic diagram illustrating another implementation of the seal image extraction method provided in the embodiments of this application, as shown below. Figure 2 As shown, the seal image extraction method includes the following steps:

[0079] Step S201: Based on the pixel gradient of the image to be identified, perform shape fitting on the pixels in the image to be identified to obtain the set of elliptical arcs corresponding to the outline of the seal image.

[0080] Here, the set of elliptical arcs includes multiple elliptical arcs. Pixel gradients characterize the degree of change between adjacent pixels; when there are edge contours in the image to be recognized, there will definitely be a large gradient value. Conversely, when there are relatively smooth parts in the image to be recognized, the grayscale value changes less, and the corresponding gradient is also smaller. Shape fitting refers to fitting pixels with similar gradient directions into line segments, then fitting line segments that are continuous in position and have similar directions into elliptical arcs, and using these elliptical arcs as the elliptical arcs corresponding to the seal image contour in the image to be recognized.

[0081] In some embodiments, the gradient magnitude and gradient direction of the pixel in the image to be identified can be calculated. A pseudo-sorting method is used to quickly select the gradient maxima as the starting seed point to determine the edge position in the image. Pixels with similar gradient directions in the neighborhood are iteratively merged until no more pixels with similar gradient directions are found in the neighborhood. The pixel is then fitted as a line segment. For other unfitted pixels, the same method is used to find and fit them, resulting in multiple line segments. These line segments with the same endpoints are then connected and their shapes are fitted to obtain elliptical arcs. Due to irregular operations during the stamping process, the resulting stamp image may contain duplicate, invalid, or erroneous stamp outlines. Correspondingly, in the elliptical arc detection process, duplicate, invalid, and erroneous stamp outlines correspond to elliptical arcs with different parameters. Therefore, multiple elliptical arcs can be obtained, i.e., a set of elliptical arcs.

[0082] Step S202: Determine the parameter information of each elliptical arc in the set of elliptical arcs.

[0083] Here, after fitting the elliptical arc, we obtain the parameters of each elliptical arc, such as the coordinates of the two endpoints of the elliptical arc, the coordinates of the center of the ellipse corresponding to the ellipse arc, and the lengths of the major and minor axes of the ellipse corresponding to the ellipse arc.

[0084] Step S203: Determine the elliptical arc whose parameter information satisfies the preset parameter threshold as the target elliptical arc.

[0085] Here, due to non-standard operation when stamping, the acquired image to be identified also contains invalid and erroneous stamp images. Therefore, the multiple elliptical arcs in the detected elliptical set will include invalid and erroneous elliptical arcs. Based on the parameter information of each elliptical arc, invalid and erroneous elliptical arcs can be filtered out, and the elliptical arcs whose parameter information meets the preset parameter threshold can be determined as the elliptical arcs corresponding to the outline of the stamp image.

[0086] In this embodiment, due to the non-standard stamping operation and the thickness of the stamp outline itself, the continuous outlines of the image to be identified have similar gradient directions. Based on the gradient directions, multiple elliptical arcs corresponding to the stamp image outline are determined and fitted. According to a preset parameter threshold, invalid and erroneous elliptical arcs are filtered out from the multiple elliptical arcs to obtain the target elliptical arc. This can effectively distinguish whether the stamp image in the image to be identified is a valid stamp image, reducing the occurrence of missed detections and redundant detections.

[0087] In some embodiments, the parameter information of each elliptical arc includes at least the coordinates of the two endpoints of each elliptical arc, the coordinates of the center of each elliptical arc, and the lengths of the major and minor axes of the ellipse corresponding to each elliptical arc. An elliptical arc is determined to be the target elliptical arc if at least one of the following conditions is met:

[0088] The radian of the elliptical arc is greater than a preset radian threshold.

[0089] Here, the radian of the elliptical arc can be calculated based on the coordinates of its two endpoints and the coordinates of its elliptical center. A preset radian threshold is 0.15π. If the detected radian of an elliptical arc is less than this threshold, it is considered an invalid elliptical arc and is filtered out, retaining only those elliptical arcs with a radian greater than the preset threshold.

[0090] The ratio of the major axis length to the minor axis length of the elliptical arc is less than a preset ratio threshold.

[0091] Here, the preset ratio threshold is 0.8. When the ratio of the major axis length to the minor axis length of the elliptical arc is greater than the preset ratio threshold, it means that the seal image corresponding to the elliptical arc is not a circular seal image, and the elliptical arc is filtered out.

[0092] If the distance between the centers of any two elliptical arcs is less than a preset length threshold, the elliptical arc with the larger major axis length among the two elliptical arcs is determined as the target elliptical arc.

[0093] Here, the preset length threshold is 0.25 times the major axis length of the elliptical arc with the larger major axis length among the two elliptical arcs. If the distance between the centers of any two elliptical arcs is greater than the preset length threshold, it indicates that the two elliptical arcs correspond to the outlines of different seal images, and no filtering is required. If the distance between the centers of any two elliptical arcs is less than the preset length threshold, it indicates that the two elliptical arcs correspond to the same seal image and are overlapping elliptical arcs. To reduce duplicate extraction and improve the extraction efficiency of the seal image, one elliptical arc needs to be filtered, and the elliptical arc with the larger major axis length among the two elliptical arcs is determined as the target elliptical arc.

[0094] The projection density value of the pixels in the elliptical region where the elliptical arc is located is greater than the major axis of the elliptical arc; wherein, the elliptical region is determined based on the coordinates of the two endpoints of the elliptical arc and the coordinates of the center of the ellipse.

[0095] Here, the text content inside the stamp image is more valuable than the outer contour. To retain stamp images with missing circular contours but complete internal stamp content, misprinted stamp images with only partial circular contours and missing internal stamp content are filtered out. Therefore, to further distinguish whether the stamp image corresponding to an elliptical arc is a valid stamp image, further filtering of the elliptical arc is required. The elliptical region containing each elliptical arc is determined based on the coordinates of its two endpoints, and the pixels within this elliptical region are projected onto the x-axis and y-axis respectively, resulting in x-axis and y-axis projections. If the projection density value of either the x-axis or y-axis projection is less than half the length of the major axis of the ellipse, the stamp image corresponding to that elliptical arc is considered invalid and is filtered out.

[0096] In this embodiment of the application, multiple elliptical arcs obtained by elliptical arc detection of the seal image can be further screened and filtered according to preset parameter thresholds. This can effectively distinguish whether the seal image corresponding to the elliptical arc is a valid seal image, reducing the occurrence of missed detections and redundant detections.

[0097] In some feasible implementations, after determining the target elliptical arc corresponding to the contour of the image to be recognized, it is necessary to determine the stamp image region of the target elliptical arc in the image to be recognized. Therefore, the stamp image region where the target elliptical arc is located can be determined according to the following steps, that is, S103 is achieved through the following steps:

[0098] In the image to be identified, the area of ​​the stamp image where the target elliptical arc is located is determined based on the length of the major axis of the target elliptical arc.

[0099] Here, after determining the target elliptical arc corresponding to the contour of the seal image to be extracted in the image to be identified, a square region including the seal image to be extracted can be constructed with the center of the ellipse corresponding to the target elliptical arc as the center, based on the length of the major axis of the ellipse corresponding to the target elliptical arc. This square region is then used as the seal image region where the target elliptical arc is located.

[0100] In this embodiment of the application, the elliptical region of the target elliptical arc can be determined based on the length of the major axis of the target elliptical arc, thereby determining the specific position of the stamp image in the image to be identified.

[0101] In some feasible implementations, after determining the stamp image region of the target elliptical arc of the image contour to be identified, it is necessary to detect whether the stamp image region is tilted. If the stamp image region is tilted, it needs to be straightened to obtain the extracted stamp image. Step S104 can then be implemented through the following steps:

[0102] Step S1041: Determine the tilt angle of the stamp image area.

[0103] Here, the tilt angle may be due to the tilt of the camera or the tilt of the image placement. After determining the target elliptical arc corresponding to the contour of the seal image to be extracted in the seal image region, the tilt angle of the seal image region can be determined based on the tilt angle of the elliptical arc; alternatively, the tilt angle of the seal image region can be determined based on the tilt angle algorithm of the image to be recognized.

[0104] Step S1042: When the tilt angle is not zero, the seal image area is straightened to obtain the straightened seal image area.

[0105] Here, if the tilt angle is not zero, it indicates that the seal image region is tilted. The seal image and text within this region may also be tilted, requiring the seal image region to be straightened. This can be achieved by adjusting the tilt angle to obtain a pattern and text containing a standard shape for extraction, such as a circular seal and its text content. In some embodiments, an affine transformation can be performed on the seal image region based on the endpoint coordinates of the target elliptical arc, the corresponding ellipse center coordinates, and the lengths of the ellipse's major and minor axes, resulting in a straightened seal image region. An affine transformation, also known as an affine mapping, refers to a geometric transformation where a vector space undergoes a linear transformation followed by a translation to transform it into another vector space. This transformation includes rotation, translation, and scaling.

[0106] Step S1043: Segment the area of ​​the stamp image after it has been straightened to obtain the stamp image.

[0107] Here, the stamp image area after being corrected includes the stamp image to be extracted. The stamp image area is segmented out from the original image to be recognized or the image to be recognized after scaling, thus obtaining the stamp image to be extracted.

[0108] In this embodiment, the tilt angle of the seal image region where the target ellipse is located can be detected. If the seal image region is tilted, the seal image region can be straightened, the straightened seal image can be extracted, and the tilt of the seal image can be corrected.

[0109] This application proposes a method for extracting circular seal images based on elliptical arc recognition. This method locates feature information in the image to be identified by detecting and recognizing elliptical arcs, and a circular arc is a special type of elliptical arc. The advantage of this method is that it only needs to extract a portion of the elliptical arcs from the seal image, and calculates the position of the corresponding seal image using the elliptical arc parameters. It has low requirements for the quality of the seal document and is more suitable for practical office applications. Furthermore, this application also uses a minimum elliptical arc radius threshold to determine whether an error detection is detected; it identifies whether a seal is valid by the coverage of pixels in the seal image region on the horizontal and vertical axes; it distinguishes whether different elliptical arcs correspond to the same seal image or overlapping seal images by the distance between the centers of the elliptical arcs; and finally, it uses the ratio of the elliptical angle to the corresponding major and minor axes to restore the tilt generated during the photographing or scanning process.

[0110] This application provides a method for extracting seal images. Figure 3 This is another schematic diagram of the implementation process of the seal image extraction method provided in the embodiments of this application, combined with... Figure 3 The method for extracting seal images is explained below:

[0111] Step S301: File input.

[0112] Here, the image to be recognized carried in the input is obtained.

[0113] Step S302: Perform image preprocessing on the file.

[0114] Here, the images to be identified in the file undergo preprocessing such as resolution adjustment, smoothing, and image dilation.

[0115] Step S303: Detect whether the image to be identified has color features.

[0116] Here, if the image to be identified is detected to have color features, steps S304 to 308 are executed; if the image to be identified is not detected to have color features, steps S305 to 308 are executed.

[0117] Step S304: The image color space is converted from RGB to HSV.

[0118] Here, since color extraction is more effective in the HSV color space, the processed image to be identified is converted to the HSV color space.

[0119] Step S305: Perform elliptical arc detection and elliptical arc processing on the image to be identified to obtain the target elliptical arc of the seal image.

[0120] Here, when the image to be identified has color features, i.e., the color of the content is neither black nor gray, the color space of the image to be identified is first converted from RGB to HSV. Then, elliptical arc detection is performed on the image after color space conversion. When the image to be identified does not have color features, i.e., the color of the content is black or gray, elliptical arc detection is performed directly. After elliptical arc detection, multiple elliptical arcs may be detected in the same region of the image, and the elliptical arc parameters of each elliptical arc are obtained: the coordinates of the two endpoints of each elliptical arc, the coordinates of the center of each elliptical arc, and the lengths of the major and minor axes of the ellipse corresponding to each elliptical arc. However, for the same region in the image to be identified, there is only one stamp image to be extracted. Therefore, invalid, erroneous, or overlapping elliptical arcs may exist among the multiple detected elliptical arcs. It is necessary to process the multiple elliptical arcs detected in the image to be identified, and filter out invalid, erroneous, or overlapping elliptical arcs according to the parameters of each elliptical arc to obtain the target elliptical arc corresponding to the outline of the stamp image.

[0121] Step S306: Locate the stamp image region of the stamp image to be extracted based on the target elliptical arc, and perform an affine transformation on the stamp image region.

[0122] Here, after determining the target elliptical arc corresponding to the contour of the seal image to be extracted in the image to be recognized, a square region containing the seal image to be extracted is constructed with the center of the ellipse corresponding to the target elliptical arc as the center and the length of the major axis of the ellipse corresponding to the target elliptical arc as the side length. This square region is taken as the seal image region where the target elliptical arc is located. Since the image to be recognized may be tilted due to the tilt of the shooting or the tilt of the image placement, the seal image region where the target elliptical arc is located will also be tilted. Therefore, it is necessary to straighten the seal image region where the target elliptical arc is located by performing an affine transformation according to the parameters of the target elliptical arc to obtain a standard-shaped image region.

[0123] Step S307: Image segmentation, extract the seal image.

[0124] Here, based on the area of ​​the seal image where the target elliptical arc is located, the image to be identified is segmented to obtain the seal image to be extracted.

[0125] Step S308: Output the stamp image.

[0126] Here, the acquired seal image is output to the user's device.

[0127] In this embodiment, the position of the circular seal is determined by detecting the partial elliptical arc shape in the image to be recognized, effectively reducing the quality requirements for documents containing seal images and making it more suitable for practical office applications. Errors in the extraction results are controlled through elliptical arc parameters, and overlapping seal images are judged by the distance between the centers of any two detected elliptical arcs. This effectively distinguishes whether an image is a valid seal image, reducing missed and redundant detections. Finally, the seal image can be tilted and corrected using its major and minor axes and elliptical angles.

[0128] This application provides a method for extracting seal images. Figure 4 This is a schematic diagram illustrating another implementation process of the seal image extraction method provided in this application embodiment, combined with... Figure 4 The method for extracting seal images is explained below:

[0129] Step S401: Image preprocessing, scaling the high-resolution image to be recognized, smoothing the image to be recognized using a Gaussian filter, and performing image dilation operation.

[0130] Here, image preprocessing includes processes such as image scaling, image noise suppression, and image dilation.

[0131] Image scaling: As the precision of cameras or scanners increases, images with excessively high resolution will significantly reduce detection efficiency. Furthermore, local pixels in high-resolution images are often discontinuous, making it difficult to detect arcs using local detection methods. Moreover, seal image extraction only requires locating the seal image position and does not require overly precise details. In some embodiments, the input image to be identified is first judged, and the high-resolution input image to be identified is scaled proportionally to a resolution below 1000*1000 pixels to improve the detection efficiency and effect of the image to be identified. The formula for scaling the pixels of the image to be identified can be expressed as formula (1):

[0132]

[0133] Noise suppression: Data is inevitably subject to noise interference during generation and transmission. A Gaussian filter is needed to smooth the image and suppress the impact of image noise on subsequent steps. The two-dimensional Gaussian filter for image smoothing can be defined as formula (2):

[0134]

[0135] For the input image I(x,y), the smoothed image is represented by formula (3):

[0136] I σ (x,y)=I(x,y)*G(x,y,σ) (3);

[0137] In this embodiment, the Gaussian smoothing parameter used is σ = 0.25.

[0138] Image dilation operation improves the quality of the input image by dilating the original image, and blurs and repairs the outline of the circular stamp image to improve the effect of subsequent elliptical arc detection.

[0139] Step S402: Convert the image to be identified from the RGB color space to the HSV color space, and extract the red pixel area in the image to be identified by setting the parameter threshold.

[0140] Here, RGB to HSV color space conversion refers to the HSV color space using H (hue), S (saturation), and V (brightness) as color values ​​to locate colors. Experimental tests show that HSV achieves better results in color extraction, so the original file is converted to HSV space for subsequent operations. Taking the extraction of a red stamp image as an example, the HSV thresholds are set to h∈[110,130], s∈[25,255], and v∈[2.55,255] to extract the red color region from the file.

[0141] Color extraction, taking the extraction of a red stamp image as an example, involves processing the original image (the image to be identified) according to the color space parameter thresholds set above. The sample processing results are as follows: Figure 5 As shown. Figure 5 This is a schematic diagram of target color region extraction provided in an embodiment of this application. Figure 5 In Figures 501 and 502, the target color regions are extracted from the image to be recognized in a sample file the size of an A4 sheet of paper (the specific details inside the image to be recognized have been blurred; the same processing will be applied to subsequent images if the actual seal image appears). The color space conversion method can effectively extract the red area features in the image to be recognized and filter out interference information. In some embodiments, this step can be omitted when the seal color and the background color are not clearly distinguishable.

[0142] Step S403: Use the elliptical arc detection algorithm to perform elliptical detection on the image to be identified after color extraction, and obtain the elliptical arc parameters in the image to be identified; and judge the circular seal image, overlapping seal image, or the same seal image according to the elliptical arc parameters to determine the target elliptical arc.

[0143] Here, since an arc is a special type of elliptical arc, and due to errors in the shooting angle or scanning process, what is often obtained is an elliptical seal image outline rather than a regular circle, detecting elliptical arcs in the image to be identified improves the robustness of the extraction effect.

[0144] Elliptical arc detection: An elliptical arc mainly includes the following parameters: the coordinates of the two endpoints of the elliptical arc (x1, x2, y1, y2), the center of the ellipse corresponding to the ellipse arc (c... x ,c y ), lengths of major and minor axes (a x ,b x ), arc starting angle θ start and the endpoint angle θ end The elliptic arc detection algorithm is a linear time complexity algorithm, which has advantages such as higher reliability and parameter adaptability compared to the Hough transform.

[0145] Elliptical arc processing: This application provides a schematic diagram for elliptical arc extraction. Figure 6 This is a schematic diagram illustrating an example of an elliptical arc extracted using an elliptical arc extraction algorithm provided in an embodiment of this application. Figure 6 It can be seen that the extracted elliptical arcs 601, 602, 603, 604, 605, 606, 607 and 608 are still a complex case. There are invalid elliptical arcs, erroneous elliptical arcs and overlapping elliptical arcs among these elliptical arcs. Therefore, the extracted arcs need to be further processed to obtain the target elliptical arc.

[0146] To control errors, a minimum radian threshold of 0.15π is set. Arcs smaller than this threshold are considered invalid. A scaling threshold of 0.5 is also set, adaptively adjusting based on the image. Using the maximum arc radius as a baseline, arc radii less than 0.5 times the maximum radius are considered false detections. Additionally, a major-to-minor axis ratio threshold of 0.8 is set. While tilting is common in real-world applications, it's usually not excessive. If the tilt exceeds this ratio threshold, the elliptical arc is determined not to correspond to a circular stamp image.

[0147] To determine whether adjacent elliptical arcs correspond to the same or different seal images, a threshold parameter of 0.25 is set. When the distance between the centers of two elliptical arcs is greater than 0.25 times the major axis of the larger circle, they are considered to correspond to different seal images; conversely, when the distance is less than the threshold of 0.25, they are considered to correspond to the same seal image. To reduce redundant extraction and improve efficiency, these redundant elliptical arcs need to be filtered out, retaining only those with the largest diameter. This is because, in actual extraction, some redundant extraction areas can be retained, but incomplete extraction of the seal image should be avoided as much as possible.

[0148] To further distinguish whether an image is a valid seal image, this application provides a schematic diagram of the projection of seal image pixels. Figure 7 This is a schematic diagram showing the projection of the seal image pixels onto the x-axis and y-axis, respectively, as provided in the embodiments of this application. Figure 7 As shown, the pixels within the elliptical region 701 corresponding to the elliptical arc parameters are projected onto the x-axis and y-axis respectively, resulting in x-axis projection 702 and y-axis projection 703. When either projection density value in 702 or 703 is less than half the length of the major axis of the ellipse, the rest can be considered invalid stamp images and not extracted. The text content inside the stamp image is more valuable than the outer contour. The purpose is to retain stamp images with complete internal content but missing circular contours, while filtering out misprinted stamp images that only have partial circular contours and missing internal stamp image content.

[0149] Step S404: Calculate the parameters of the corresponding ellipse or circle based on the target elliptical arc, locate the seal image region where the target elliptical arc is located in the seal image, and perform a corrective transformation on the seal image region using affine transformation.

[0150] Here, based on the parameters of the target elliptical arc obtained in step S203 above: the coordinates of the two endpoints of the elliptical arc (x1, x2, y1, y2), the center of the ellipse corresponding to the elliptical arc (c x ,c y ), length of major axis and length of minor axis (a x ,b x and the starting angle θ of the arc start and the endpoint angle θ end It can locate the position of the seal image in the image to be recognized. The seal image is extracted based on the major axis length and ellipse angle, and segmentation can be performed on the original image or the image to be recognized after image resolution adjustment.

[0151] In some embodiments, the ellipse detection results are restored using an affine transformation. The affine transformation can restore the deformations caused to the image shape and text within the image during the capture or scanning process. An affine transformation, also known as an affine mapping, refers to a geometric transformation where a vector space undergoes a linear transformation followed by a translation to transform it into another vector space. This transformation includes rotation, translation, and scaling. Figure 8 This is a schematic diagram illustrating an example of straightening an elliptical seal image provided in an embodiment of this application. 801 shows the ellipse detection result obtained by performing ellipse image detection and extraction on the image to be recognized, and 802 shows the adjusted seal image after performing an affine transformation on the detection result.

[0152] Step S405: Separate the circular stamp image according to the target elliptical arc parameters.

[0153] Here, the final output is the extracted circular seal image, which is the seal image to be extracted. Figure 9 This is a schematic diagram of the extraction of the seal image provided in the embodiments of this application, such as... Figure 9 As shown, the seal image extraction method of this application embodiment can extract seal images under multiple different conditions: 901, 902, 903 and 904.

[0154] In this embodiment, the position of the circular seal is determined by detecting the partial elliptical arc shape in the image to be identified, effectively reducing the quality requirements for documents including seal images and making it more suitable for practical office applications. Errors in the extraction results are controlled through elliptical arc parameters, and overlapping seal images are judged by the distance between the centers of any two detected elliptical arcs. This effectively distinguishes whether an image is a valid seal image, reducing missed and redundant detections. Finally, the seal image can be tilted and corrected using its major and minor axes and elliptical angles.

[0155] This application provides a seal image extraction device. Figure 10 This is a schematic diagram of the structure of the seal image extraction device provided in the embodiments of this application, as shown below. Figure 10 As shown, the seal image extraction device 1000 includes: an acquisition module 1001, a first determination module 1002, a second determination module 1003, and an image extraction module 1004, wherein:

[0156] The acquisition module 1001 is used to acquire an image to be identified, including a seal image;

[0157] The first determining module 1002 is used to perform elliptical arc detection on the image to be identified and determine the target elliptical arc corresponding to the outline of the seal image;

[0158] The second determining module 1003 is used to determine the stamp image region where the target elliptical arc is located in the image to be identified;

[0159] The image extraction module 1004 is used to extract the image based on the seal image region to obtain the seal image.

[0160] In the above-described apparatus, the apparatus further includes:

[0161] The preprocessing module is used to preprocess the image to be identified to obtain the processed image.

[0162] The first determining module 1002 is further configured to perform elliptical arc detection on the processed image to determine the target elliptical arc corresponding to the outline of the seal image.

[0163] In the above-described apparatus, the preprocessing module includes:

[0164] An adjustment submodule is used to adjust the resolution of the image to be identified to obtain a first image;

[0165] A smoothing submodule is used to smooth the first image to obtain a second image;

[0166] The dilation processing submodule is used to perform image dilation processing on the second image to obtain the processed image.

[0167] In the above-described apparatus, the apparatus further includes:

[0168] A detection module is used to detect the color features of the processed image.

[0169] A conversion module is used to perform color space conversion on the processed image when the color features are detected;

[0170] The third determining module is used to determine the target color region where the processed image is located in the converted color space;

[0171] In the above-described device, the first determining module 1002 is further configured to perform elliptical arc detection on the target color region and determine the target elliptical arc corresponding to the contour of the target color region.

[0172] In the above-described apparatus, the first determining module 1002 includes:

[0173] The shape fitting submodule is used to perform shape fitting on the pixels in the image to be identified based on the pixel gradient of the image to be identified, so as to obtain a set of elliptical arcs corresponding to the outline of the seal image; wherein, the set of elliptical arcs includes multiple elliptical arcs.

[0174] The first determining submodule is used to determine the parameter information of each elliptical arc in the set of elliptical arcs;

[0175] The second determining submodule is used to determine the elliptical arc whose parameter information satisfies the preset parameter threshold as the target elliptical arc.

[0176] In the above-described device, the parameter information of each elliptical arc includes at least the coordinates of the two endpoints of each elliptical arc, the coordinates of the elliptical center of each elliptical arc, and the lengths of the major and minor axes of the ellipse corresponding to each elliptical arc.

[0177] The second determining submodule is further configured to determine the elliptical arc as the target elliptical arc if at least one of the following conditions is met:

[0178] The radian of the elliptical arc is greater than a preset radian threshold.

[0179] The ratio of the major axis length to the minor axis length of the elliptical arc is less than a preset ratio threshold.

[0180] If the distance between the centers of any two elliptical arcs is less than a preset length threshold, the elliptical arc with the larger major axis length among the two elliptical arcs is determined as the target elliptical arc.

[0181] The projection density value of the pixels in the elliptical region where the elliptical arc is located is greater than the major axis of the elliptical arc; wherein, the elliptical region is determined based on the coordinates of the two endpoints of the elliptical arc and the coordinates of the center of the ellipse.

[0182] In the above-described apparatus, the second determining module 1003 includes:

[0183] The third determining submodule is used to determine the stamp image region where the target elliptical arc is located in the image to be identified, based on the length of the major axis of the target elliptical arc.

[0184] In the above-described apparatus, the image extraction module 1004 includes:

[0185] The fourth determining submodule is used to determine the tilt angle of the seal image area;

[0186] The straightening processing submodule is used to straighten the seal image area when the tilt angle is not zero, so as to obtain the straightened seal image area.

[0187] The segmentation submodule is used to segment the area of ​​the stamp image after it has been straightened to obtain the stamp image.

[0188] Correspondingly, embodiments of this application provide an electronic device, Figure 11This is a schematic diagram of the composition structure of the electronic device provided in the embodiments of this application, as shown below. Figure 11 As shown, the electronic device 1100 includes at least: a controller 1101 and a storage medium 1102 configured to store executable instructions, wherein:

[0189] The controller 1101 is configured to execute stored executable instructions for implementing the provided seal image extraction method.

[0190] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0191] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0192] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0193] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0194] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0195] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0196] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0197] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0198] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for extracting a seal image, characterized in that, The method includes: Obtain the image to be identified, including the seal image; Elliptical arc detection is performed on the image to be identified to determine the target elliptical arc corresponding to the outline of the seal image; In the image to be identified, determine the stamp image region where the target elliptical arc is located; The seal image is obtained by extracting the image based on the seal image region; The step of performing elliptical arc detection on the image to be identified to determine the target elliptical arc corresponding to the contour of the seal image includes: Based on the pixel gradient of the image to be identified, the pixels in the image to be identified are shape fitted to obtain a set of elliptical arcs corresponding to the outline of the seal image; wherein, the set of elliptical arcs includes multiple elliptical arcs. Determine the parameter information of each elliptical arc in the set of elliptical arcs; The elliptical arc whose parameter information satisfies the preset parameter threshold is determined as the target elliptical arc; The parameter information of each elliptical arc includes at least the coordinates of its two endpoints, the coordinates of its elliptical center, and the lengths of its major and minor axes. An elliptical arc is determined to be the target elliptical arc if at least one of the following conditions is met: The radian of the elliptical arc is greater than a preset radian threshold. The ratio of the major axis length to the minor axis length of the elliptical arc is less than a preset ratio threshold. If the distance between the centers of any two elliptical arcs is less than a preset length threshold, the elliptical arc with the larger major axis length among the two elliptical arcs is determined as the target elliptical arc. The projection density value of the pixels in the elliptical region where the elliptical arc is located is greater than the major axis of the elliptical arc; wherein, the elliptical region is determined based on the coordinates of the two endpoints of the elliptical arc and the coordinates of the center of the ellipse.

2. The method according to claim 1, characterized in that, After acquiring the image to be identified, including the seal image, the method further includes: The image to be identified is preprocessed to obtain the processed image; The step of performing elliptical arc detection on the image to be identified to determine the target elliptical arc corresponding to the contour of the seal image includes: Elliptical arc detection is performed on the processed image to determine the target elliptical arc corresponding to the contour of the seal image.

3. The method according to claim 2, characterized in that, The preprocessing of the image to be identified to obtain the processed image includes: Adjust the resolution of the image to be identified to obtain a first image; The first image is smoothed to obtain the second image; The second image is subjected to image dilation processing to obtain the processed image.

4. The method according to claim 2, characterized in that, Before performing elliptical arc detection on the processed image to determine the target elliptical arc corresponding to the contour of the seal image, the method further includes: In the processed image, the color features of the processed image are detected; Upon detecting the color features, the processed image undergoes color space conversion; In the converted color space, determine the target color region where the processed image is located; Correspondingly, the step of performing elliptical arc detection on the processed image to determine the target elliptical arc corresponding to the contour of the seal image includes: Elliptical arc detection is performed on the target color region to determine the target elliptical arc corresponding to the contour of the target color region.

5. The method according to claim 1, characterized in that, The step of determining the stamp image region where the target elliptical arc is located in the image to be identified includes: In the image to be identified, the area of ​​the stamp image where the target elliptical arc is located is determined based on the length of the major axis of the target elliptical arc.

6. The method according to claim 1, characterized in that, The step of extracting the image based on the seal image region to obtain the seal image includes: Determine the tilt angle of the stamp image area; When the tilt angle is not zero, the seal image area is straightened to obtain a straightened seal image area. The stamp image is obtained by segmenting the area of ​​the stamp image after it has been corrected.

7. A seal image extraction device, characterized in that, The device includes: The acquisition module is used to acquire the image to be identified, including the seal image; The first determining module is used to perform elliptical arc detection on the image to be identified and determine the target elliptical arc corresponding to the outline of the seal image; The second determining module is used to determine the stamp image region where the target elliptical arc is located in the image to be identified; The image extraction module is used to extract the image based on the seal image region to obtain the seal image; The first determining module includes: The shape fitting submodule is used to perform shape fitting on the pixels in the image to be identified based on the pixel gradient of the image to be identified, so as to obtain a set of elliptical arcs corresponding to the outline of the seal image; wherein, the set of elliptical arcs includes multiple elliptical arcs. The first determining submodule is used to determine the parameter information of each elliptical arc in the set of elliptical arcs; The second determining submodule is used to determine the elliptical arc whose parameter information satisfies the preset parameter threshold as the target elliptical arc; The parameter information of each elliptical arc includes at least the coordinates of the two endpoints of each elliptical arc, the coordinates of the center of the ellipse of each elliptical arc, and the length of the major axis and the length of the minor axis of the ellipse corresponding to each elliptical arc. The second determining submodule is further configured to determine the elliptical arc as the target elliptical arc if at least one of the following conditions is met: The radian of the elliptical arc is greater than a preset radian threshold. The ratio of the major axis length to the minor axis length of the elliptical arc is less than a preset ratio threshold. If the distance between the centers of any two elliptical arcs is less than a preset length threshold, the elliptical arc with the larger major axis length among the two elliptical arcs is determined as the target elliptical arc. The projection density value of the pixels in the elliptical region where the elliptical arc is located is greater than the major axis of the elliptical arc; wherein, the elliptical region is determined based on the coordinates of the two endpoints of the elliptical arc and the coordinates of the center of the ellipse.

8. A terminal, characterized in that, The terminal includes at least: a controller and a storage medium configured to store executable instructions, wherein: The controller is configured to execute stored executable instructions, which are configured to perform the seal image extraction method provided in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions configured to perform the seal image extraction method provided in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Circular seal character recognition method

    CN107944452A

  • A method of separating a seal from an image and calibrating the seal

    CN109447068A