Character mask extraction method and device based on region growth and character recognition, equipment and medium

By combining region growing algorithms with deep learning text recognition technology, efficient and accurate text mask extraction for complex layouts is achieved, solving the problems of low efficiency and false positives and false negatives in traditional methods. It is adaptable to different materials and lighting conditions, improving the accuracy of text region detection and restoration quality.

CN121236767APending Publication Date: 2025-12-30ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511172130.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-12-30

AI Technical Summary

Technical Problem

Traditional text masking extraction methods are inefficient and prone to false positives and false negatives on complex layouts. They are also difficult to adapt to different materials and lighting conditions, and lack joint analysis of text semantics and visual features, resulting in poor restoration quality.

Method used

By combining region growing algorithms with deep learning text recognition technology, and through adaptive image enhancement, multi-layer region growing and morphological optimization, we can achieve accurate detection and mask extraction of text regions, and integrate semantic and visual feature analysis.

Benefits of technology

It significantly improves the efficiency and accuracy of text mask extraction, supports document image processing under different materials and lighting conditions, improves text region recall and mask accuracy, reduces false detection rate, and adapts to batch layout restoration needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121236767A_ABST
    Figure CN121236767A_ABST
Patent Text Reader

Abstract

The invention provides a character mask extraction method and device based on region growing and character recognition, equipment and a medium, and the method comprises the steps: processing an input original image, and obtaining a gray-scale processing image; calling a PP-OCRv4 model to carry out character detection on the gray processing image, and obtaining polygon coordinates of a character area and an original recognition text; determining an initial seed point, starting from the seed point, performing four-neighborhood growth based on a set gray difference threshold, and generating an initial character mask; expanding the growth area to obtain a final character mask; noise points in the final character mask are removed; filling holes in the final character mask; removing a non-character area to obtain a first processed character mask; performing character semantic verification to obtain a final processed character mask; and fusing all the final processed character masks, extracting to obtain a required character mask, processing different types of document images, accurately identifying a character region boundary, and simultaneously retaining semantic and visual features of characters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of technology, and in particular to a method, apparatus, device, and medium for extracting text masks based on region growing and text recognition. Background Technology

[0002] In the field of page layout restoration, traditional text mask extraction methods have significant shortcomings. Manual text mask extraction requires manually outlining text regions, which is cumbersome and inefficient when dealing with complex layouts (such as ancient books, damaged documents, and multilingual documents), making it difficult to meet the needs of batch page layout restoration. Existing automated technologies mainly rely on fixed thresholds or single feature extraction, which cannot adapt to document images with different materials and lighting conditions, often resulting in missed or false detections of text regions. Furthermore, existing technologies lack joint analysis of text semantics and visual features. When processing documents with slanted text, deformed text, or severe background interference, it is difficult to accurately preserve text details, leading to blurred text and structural distortion in the restored layout, severely impacting the quality and efficiency of page layout restoration. Summary of the Invention

[0003] The technical problem this invention aims to solve is to provide a method, apparatus, device, and medium for text mask extraction based on region growing and character recognition. By integrating region growing algorithms with deep learning character recognition technology, it achieves intelligent detection and mask extraction of text regions in document images. This method can adaptively process different types of document images, accurately identify text region boundaries, and preserve the semantic and visual features of the text, solving problems such as missed detections, false detections, and loss of details in traditional methods. Through automated processes, it significantly improves the efficiency of text mask extraction in page layout restoration, providing technical support for scenarios such as ancient book restoration, historical document digitization, and multilingual page layout analysis, meeting the practical needs of batch page layout restoration.

[0004] In a first aspect, the present invention provides a text mask extraction method based on region growing and text recognition, comprising the following steps:

[0005] Step 1: Convert the input original image to a grayscale image, and use adaptive histogram equalization to enhance contrast; use TextureDAT2 image enhancement algorithm or super-resolution algorithm to remove noise and obtain a grayscale processed image;

[0006] Step 2: Call the PP-OCRv4 model to perform text detection on the grayscale image, obtain the polygon coordinates of the text region and the original recognized text; for each text region, calculate its centroid or randomly select internal points as the initial seed points for region growth, ensuring that the initial seed points are located within the main body of the text.

[0007] Step 3: Starting from the initial seed point, perform four-neighbor growth based on the set gray-scale difference threshold to generate a preliminary text mask; based on the preliminary text mask, expand the growth area through color similarity calculation in the Lab color space to obtain the final text mask.

[0008] Step 4: Perform morphological opening operations using a defined rectangular kernel to remove noise points from the final text mask; fill the holes inside the final text mask using closing operations; filter based on the area of ​​connected components, set a minimum area, remove non-text areas, and obtain the first processed text mask.

[0009] Step 5: Text semantic verification to obtain the final processed text mask;

[0010] Step 6: Fuse all the final processed text masks together to extract the desired text mask.

[0011] Secondly, the present invention provides a text mask extraction device based on region growing and text recognition, comprising:

[0012] The image processing module converts the input raw image into a grayscale image, uses adaptive histogram equalization to enhance contrast, and removes noise using the TextureDAT2 image enhancement algorithm or a super-resolution algorithm to obtain a grayscale processed image.

[0013] The centroid module is determined by calling the PP-OCRv4 model to perform text detection on the grayscale image, obtaining the polygon coordinates of the text region and the original recognized text; for each text region, its centroid is calculated or an internal point is randomly selected as the initial seed point for region growth, ensuring that the initial seed point is located within the main body of the text.

[0014] The extended region module starts from the initial seed point and performs four-neighbor growth based on the set gray-level difference threshold to generate a preliminary text mask. Based on the preliminary text mask, the growth region is expanded by calculating the color similarity in the Lab color space to obtain the final text mask.

[0015] The mask processing module performs morphological opening operations using a set rectangular kernel to remove noise points from the final text mask; it fills the holes inside the final text mask through closing operations; and it filters based on the area of ​​connected components, sets a minimum area, removes non-text areas, and obtains the first processed text mask.

[0016] The semantic verification module performs text semantic verification and obtains the final processed text mask.

[0017] The fusion extraction module merges all the final processed text masks to extract the required text mask.

[0018] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.

[0019] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0020] One or more technical solutions provided by this invention have at least the following technical effects or advantages:

[0021] 1. High efficiency

[0022] Compared to traditional manual extraction methods, this invention achieves automated batch processing of text masks. The text mask extraction time for a single A4 document is significantly reduced from over 30 minutes of manual operation to 1-2 minutes of algorithm processing, improving processing efficiency by over 90%. Through parallel computing optimization, batch documents can be processed simultaneously, meeting the time requirements of large-scale layout restoration projects and significantly reducing labor costs.

[0023] 2. Accuracy

[0024] Text region recall: In tests on different types of documents (ancient books, newspapers, printed documents), the text region recall rate reached 98.5%, which is 15-20% higher than the traditional threshold method.

[0025] Mask accuracy: The average IoU (Intersection over Union) between the mask and the real text area is 0.92, improving the processing accuracy of slanted text (≤45°) and deformed text by 30%, effectively preserving the details of text strokes.

[0026] Anti-interference capability: In scenarios with background noise and dirt interference, the false detection rate is less than 3%, which is more than 50% lower than that of traditional methods.

[0027] 3. Compatibility

[0028] Cross-device adaptation: Supports document and image input with different resolutions (300dpi-1200dpi) and different materials (paper, film, electronic screen).

[0029] Multilingual support: It can effectively extract text masks from documents with mixed Chinese, English, Japanese and other languages ​​without the need to adjust parameters separately for each language type.

[0030] System Integration: It can be seamlessly integrated into existing layout analysis software (such as Adobe InDesign and ABBYYFineReader) as an automated text mask extraction plugin, compatible with mainstream document processing workflows.

[0031] 4. Application Scenarios

[0032] Digitization and Restoration of Ancient Books: Accurately extracting text masks from ancient books to assist in text restoration and layout reconstruction.

[0033] Historical document analysis: Extract text regions from yellowed and damaged historical documents, supporting content digitization and layout structure analysis.

[0034] Multilingual layout design: In multilingual typesetting scenarios, quickly extract text areas for each language to assist in optimizing the layout.

[0035] Document Image Understanding: Provides high-quality text region masks for tasks such as document image understanding and information extraction, improving the accuracy of subsequent algorithms.

[0036] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0037] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0038] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention;

[0039] Figure 2 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation

[0040] The overall concept of the technical solution in this application is as follows:

[0041] The text mask extraction method proposed in this invention is based on a joint processing framework of region growing and text recognition, and is implemented through the following key modules:

[0042] Text recognition module: Based on deep learning models such as PP-OCRv4, it accurately recognizes the text content in document images, locates the coordinates of text regions, font size and orientation, and provides initial seed points for region growing.

[0043] Region Growth Module: Through a two-layer region growth strategy (seed point growth and mask expansion), combined with grayscale threshold and color similarity calculation, the text region is progressively expanded to adapt to different lighting and background conditions.

[0044] Morphological optimization module: Utilizes morphological opening and closing operations to eliminate noise and holes generated during the growth process and optimize the edge smoothness of text masks.

[0045] Multi-dimensional verification module: By checking the semantic similarity of text, the shape features of the mask (such as aspect ratio and compactness), and the color consistency, non-text areas are filtered out to improve the accuracy of the mask.

[0046] 1. Image preprocessing

[0047] The input document image is converted to grayscale, and adaptive histogram equalization is used to enhance contrast and eliminate the effects of uneven lighting.

[0048] The TextureDAT2 image enhancement algorithm (or a similar super-resolution algorithm) is used to remove noise and improve the clarity of text edges.

[0049] Initial text localization and seed point generation

[0050] The PP-OCRv4 model is used to detect text in the image, and the polygon coordinates of the text region and the recognized text are obtained.

[0051] For each text region, calculate its centroid or randomly select an internal point as the initial seed point for region growth, ensuring that the initial seed point is located within the text body.

[0052] 2. Growth in two-layer regions

[0053] Single-layer region growth: Starting from the initial seed point, four-neighbor growth is performed based on the gray-level difference threshold (default 25) to generate a preliminary text mask.

[0054] Mask expansion growth: Based on the initial mask, the growth area is expanded by calculating the color similarity in the Lab color space (threshold 30) to cover the grayscale difference areas caused by uneven lighting.

[0055] 3. Morphological optimization and noise filtering

[0056] A 3×3 rectangular kernel is used for morphological opening operations to remove small noise points in the mask; a closing operation is used to fill tiny holes inside the text.

[0057] Based on connected component area filtering (minimum area 15 pixels), remove non-text region interference.

[0058] 4. Multi-dimensional verification and mask refinement

[0059] Text semantic verification: Perform text recognition on the grown region, calculate the similarity between the recognized text and the original OCR text (threshold 0.8), and remove semantically mismatched regions.

[0060] Shape feature verification: Analyze the aspect ratio, rectangularity and other features of connected components, and filter out regions that conform to the shape of text (e.g., aspect ratio > 0.5 and < 5).

[0061] Color consistency verification: Calculate the standard deviation of color distribution within the area to ensure uniform color in text areas and filter out background interference areas.

[0062] 5. Rotation correction and multi-view optimization

[0063] For text regions that are not accurately identified, perform multi-directional rotations of 0°, 90°, 180°, and 270°, and re-execute region growing and recognition. Select the direction with the highest recognition confidence (>0.8) as the final result.

[0064] By integrating the results from multiple perspectives, the desired text mask is extracted.

[0065] Region growing algorithm: an image segmentation technique that starts from a seed point and gradually merges adjacent pixels based on the similarity between pixels (such as grayscale and color) to form a target region.

[0066] Text recognition module: Based on deep learning OCR technology (such as PP-OCRv4), it is used to detect text regions in images and recognize text content.

[0067] Morphological opening operation: By performing erosion followed by dilation, small noise points in the image are removed, and the boundaries of the target region are smoothed.

[0068] Lab color space: a device-independent color model where L represents luminance and a and b represent color channels, suitable for color similarity calculations.

[0069] Semantic similarity: The similarity between the identified text and the original text is calculated using edit distance (such as Levenshtein distance) and is used to filter non-textual regions.

[0070] Example 1

[0071] like Figure 1 As shown, this embodiment provides a text mask extraction method based on region growing and character recognition, including the following steps:

[0072] Step 1: Convert the input original image to a grayscale image, and use adaptive histogram equalization to enhance contrast; use TextureDAT2 image enhancement algorithm or super-resolution algorithm to remove noise and obtain a grayscale processed image;

[0073] Step 2: Call the PP-OCRv4 model to perform text detection on the grayscale image, obtain the polygon coordinates of the text region and the original recognized text; for each text region, calculate its centroid or randomly select internal points as the initial seed points for region growth, ensuring that the initial seed points are located within the main body of the text.

[0074] Step 3: Starting from the initial seed point, perform four-neighbor growth based on the set gray-scale difference threshold to generate a preliminary text mask; based on the preliminary text mask, expand the growth area through color similarity calculation in the Lab color space to obtain the final text mask.

[0075] Step 4: Perform morphological opening operations using a defined rectangular kernel to remove noise points from the final text mask; fill the holes inside the final text mask using closing operations; filter based on the area of ​​connected components, set a minimum area, remove non-text areas, and obtain the first processed text mask.

[0076] Step 5: Text semantic verification to obtain the final processed text mask;

[0077] Step 6: Fuse all the final processed text masks together to extract the desired text mask.

[0078] In this embodiment, preferably, step 2 specifically involves: calling the PP-OCRv4 model to perform text detection on the grayscale image, obtaining the polygon coordinates, confidence level, and original recognized text of the text region; then rotating the text region with a confidence level lower than a set threshold by a set angle, and having the PP-OCRv4 model re-recognize the rotated text region. If the confidence level is greater than the set threshold, it is retained; if the confidence level is less than or equal to the set threshold, it is discarded.

[0079] Then, for each text region, calculate its centroid or randomly select an internal point as the initial seed point for region growth, ensuring that the initial seed point is located within the text body.

[0080] In this embodiment, preferably, step 4 specifically involves: performing morphological opening operations using a 3×3 rectangular kernel to remove noise points in the final text mask; filling the holes inside the final text mask using closing operations; and removing non-text areas based on connected component area filtering, setting the minimum area to 15 pixels, to obtain the first processed text mask.

[0081] The first similarity threshold is set to 30, and the second similarity threshold is set to 0.8.

[0082] In this embodiment, preferably, step 5 specifically involves: performing text recognition on the first processed text mask, calculating the similarity between the recognized text and the original recognized text, removing semantically mismatched regions to obtain the second processed text mask; setting the aspect ratio of the text shape region, removing regions in the second processed text mask that do not conform to the text shape to obtain the third processed text mask; calculating the standard deviation of the color distribution of the third processed text mask, filtering out interference regions to obtain the fourth processed text mask.

[0083] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.

[0084] Example 2

[0085] like Figure 2 As shown, this embodiment provides a text mask extraction device based on region growing and text recognition, including:

[0086] The image processing module converts the input raw image into a grayscale image, uses adaptive histogram equalization to enhance contrast, and removes noise using the TextureDAT2 image enhancement algorithm or a super-resolution algorithm to obtain a grayscale processed image.

[0087] The centroid module is determined by calling the PP-OCRv4 model to perform text detection on the grayscale image, obtaining the polygon coordinates of the text region and the original recognized text; for each text region, its centroid is calculated or an internal point is randomly selected as the initial seed point for region growth, ensuring that the initial seed point is located within the main body of the text.

[0088] The extended region module starts from the initial seed point and performs four-neighbor growth based on the set gray-level difference threshold to generate a preliminary text mask. Based on the preliminary text mask, the growth region is expanded by calculating the color similarity in the Lab color space to obtain the final text mask.

[0089] The mask processing module performs morphological opening operations using a set rectangular kernel to remove noise points from the final text mask; it fills the holes inside the final text mask through closing operations; and it filters based on the area of ​​connected components, sets a minimum area, removes non-text areas, and obtains the first processed text mask.

[0090] The semantic verification module performs text semantic verification and obtains the final processed text mask.

[0091] The fusion extraction module merges all the final processed text masks to extract the required text mask.

[0092] In this embodiment, preferably, step 2 specifically involves: calling the PP-OCRv4 model to perform text detection on the grayscale image, obtaining the polygon coordinates, confidence level, and original recognized text of the text region; then rotating the text region with a confidence level lower than a set threshold by a set angle, and having the PP-OCRv4 model re-recognize the rotated text region. If the confidence level is greater than the set threshold, it is retained; if the confidence level is less than or equal to the set threshold, it is discarded.

[0093] Then, for each text region, calculate its centroid or randomly select an internal point as the initial seed point for region growth, ensuring that the initial seed point is located within the text body.

[0094] In this embodiment, preferably, step 4 specifically involves: performing morphological opening operations using a 3×3 rectangular kernel to remove noise points in the final text mask; filling the holes inside the final text mask using closing operations; and removing non-text areas based on connected component area filtering, setting the minimum area to 15 pixels, to obtain the first processed text mask.

[0095] The first similarity threshold is set to 30, and the second similarity threshold is set to 0.8.

[0096] In this embodiment, preferably, step 5 specifically involves: performing text recognition on the first processed text mask, calculating the similarity between the recognized text and the original recognized text, removing semantically mismatched regions to obtain the second processed text mask; setting the aspect ratio of the text shape region, removing regions in the second processed text mask that do not conform to the text shape to obtain the third processed text mask; calculating the standard deviation of the color distribution of the third processed text mask, filtering out interference regions to obtain the fourth processed text mask.

[0097] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.

[0098] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3.

[0099] Example 3

[0100] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the implementation methods in Embodiment 1.

[0101] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.

[0102] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.

[0103] Example 4

[0104] This embodiment provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it can implement any of the implementation methods in Embodiment 1.

[0105] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0106] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0109] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for extracting a text mask based on region growing and text recognition, characterized in that: The method comprises the following steps: Step 1, converting the input original image into a gray image, and enhancing contrast by using adaptive histogram equalization; Step 2, calling a PP-OCRv4 model to perform text detection on the gray processing image, and obtaining polygon coordinates of a text region and original recognized text; For each text region, a centroid or a randomly selected internal point is taken as an initial seed point of region growth, to ensure that the initial seed point is located in the text body; Step 3, starting from the initial seed point, performing four-neighbor growth based on a set gray difference threshold, to generate a preliminary text mask; based on the preliminary text mask, a growing region is expanded through color similarity calculation in a Lab color space, to obtain a final text mask; Step 4, performing morphological opening operation by using a set rectangular kernel, to remove noise points in the final text mask; Step 5, performing text semantic verification, to obtain a final processing text mask; Step 6, fusing all the final processing text masks, to extract a required text mask. The step 2 specifically comprises: calling the PP-OCRv4 model to perform text detection on the gray processing image, and obtaining polygon coordinates, a confidence and original recognized text of the text region; then, performing angle rotation on a text region with a confidence lower than a set threshold, and re-recognizing the rotated text region by the PP-OCRv4 model; if the confidence is greater than the set threshold, the rotated text region is retained; if the confidence is less than or equal to the set threshold, the rotated text region is discarded. Then, for each text region, a centroid or a randomly selected internal point is taken as an initial seed point of region growth, to ensure that the initial seed point is located in the text body.

2. The method of claim 1, wherein the method is characterized by: The step 4 specifically comprises: performing morphological opening operation by using a 3*3 rectangular kernel, to remove noise points in the final text mask; filling holes in the final text mask through closing operation; based on connected domain area filtering, setting a minimum area as 15 pixels, and removing non-text regions, to obtain a first processing text mask. The first similarity threshold is set as 30, and the second similarity threshold is set as 0.

8.

3. The method of claim 1, wherein the method is characterized by: The step 5 specifically comprises: performing text recognition on the first processing text mask, calculating a similarity of recognized text and original recognized text, eliminating a region with unmatched semantics, to obtain a second processing text mask; setting a length-width ratio of a text form region, and eliminating a region not conforming to the text form in the second processing text mask, to obtain a third processing text mask; Calculating a standard deviation of color distribution of the third processing text mask, filtering an interference region, to obtain a fourth processing text mask.

4. The text mask extraction method based on region growing and character recognition according to claim 1, characterized in that: The method comprises the following steps: The processing image module converts the input original image into a gray image, and enhances contrast by using adaptive histogram equalization; 5. A text mask extraction device based on region growing and text recognition, characterized by: Step 2, calling a PP-OCRv4 model to perform text detection on the gray processing image, and obtaining polygon coordinates of a text region and original recognized text; For each text region, a centroid or a randomly selected internal point is taken as an initial seed point of region growth, to ensure that the initial seed point is located in the text body; Step 3, starting from the initial seed point, performing four-neighbor growth based on a set gray difference threshold, to generate a preliminary text mask; based on the preliminary text mask, a growing region is expanded through color similarity calculation in a Lab color space, to obtain a final text mask; Step 4, performing morphological opening operation by using a set rectangular kernel, to remove noise points in the final text mask; Step 5, performing text semantic verification, to obtain a final processing text mask; Step 6, fusing all the final processing text masks, to extract a required text mask. The center of mass module calls the PP-OCRv4 model to perform text detection on the gray-scale processed image, and obtains the polygon coordinates of the text region and the original recognized text; For each text region, the center of mass or a randomly selected internal point is calculated as the initial seed point for region growing, ensuring that the initial seed point is located within the text body. The region expansion module starts from the initial seed point and performs four-neighborhood growth based on a set gray-scale difference threshold to generate a preliminary text mask; based on the preliminary text mask, the region is expanded through color similarity calculation in the Lab color space to obtain a final text mask; The processing mask module performs morphological opening operation with a set rectangular kernel to remove noise points in the final text mask; The holes inside the final text mask are filled through closing operation; based on connected domain area filtering, a minimum area is set to remove non-text regions to obtain a first processed text mask; The semantic verification module performs text semantic verification to obtain a final processed text mask; The fusion extraction module fuses all the final processed text masks to extract the required text mask.

6. The character mask extraction device based on region growing and character recognition according to claim 5, characterized in that: Step 2: Call the PP-OCRv4 model to perform text detection on the gray-scale processed image, and obtain the polygon coordinates, confidence, and original recognized text of the text region; then rotate the text region with a confidence lower than the set threshold by a set angle, and the PP-OCRv4 model re-recognizes the rotated text region; if the confidence is greater than the set threshold, it is retained; if the confidence is less than or equal to the set threshold, it is discarded. Then, for each text region, the center of mass or a randomly selected internal point is calculated as the initial seed point for region growing, ensuring that the initial seed point is located within the text body.

7. The character mask extraction device based on region growing and character recognition of claim 5, wherein: Step 4: Perform morphological opening operation with a 3x3 rectangular kernel to remove noise points in the final text mask; fill the holes inside the final text mask through closing operation; based on connected domain area filtering, set the minimum area to 15 pixels, and remove non-text regions to obtain a first processed text mask; The first similarity threshold is set to 30, and the second similarity threshold is set to 0.

8.

8. The character mask extraction device based on region growing and character recognition according to claim 5, characterized in that: Step 5: Perform text recognition on the first processed text mask, calculate the similarity between the recognized text and the original recognized text, and remove the regions with unmatched semantics to obtain a second processed text mask; set the aspect ratio of the text form region, remove the regions in the second processed text mask that do not conform to the text form to obtain a third processed text mask; Calculate the standard deviation of the color distribution of the third processed text mask, filter the interference regions, and obtain a fourth processed text mask.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the method of any one of claims 1-4.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1-4.