A special font extraction method based on optical character recognition and contour analysis

CN122949522APending Publication Date: 2026-10-20SUZHOU TUXI OPTOELECTRONICS TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611345335.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-01
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0005]此外,仅依据字符面积、字符宽度或者字符高度等单一几何量判断字符字体是否异常时,还容易受到字符自身笔画数量及结构差异的影响

Benefits of technology

本发明利用光学字符识别获得的可见字符数量对字符区域形成过程进行约束,并根据候选字符区域数量与可见字符数量之间的关系调节形态学处理参数,有利于降低字符笔画断裂引起的明显过分割以及相邻字符粘连引起的明显欠分割,提高字符级分析对象的一致性和稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
Patent Text Reader

Abstract

This invention discloses a special font extraction method based on optical character recognition and contour analysis, specifically relating to the field of image processing technology. The method involves performing optical character recognition on the image to be detected to obtain text line detection boxes, character recognition results, and the number of visible characters; forming candidate character regions through binarization, morphological processing, and connected component analysis, and establishing their correspondence with visible characters; extracting and standardizing the aspect ratio, character area, contour perimeter, and Hu moments; performing DBSCAN clustering when clustering conditions are met to determine the main ordinary character reference cluster and the special font candidate set; and determining the special font characters based on the area difference between the ordinary character benchmark and the candidate object area, and extracting the corresponding character image region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and more specifically, to a special font extraction method based on optical character recognition and contour analysis. Background Technology

[0002] With the widespread use of public display screens, information publishing terminals, and other digital display devices, text in displayed images typically requires automatic detection and recognition using optical character recognition (OCR) technology. Existing OCR technology is mainly used to determine the location of text in an image and its corresponding content. However, for differences in font display characteristics between different characters within the same text line, further character-level image analysis is usually required.

[0003] In actual image display, to highlight certain text content, a small number of characters may use a font size significantly different from the surrounding main text, and may also have variations in character proportions or outline shape, making these characters visually distinct from the main ordinary font characters in the same text line. When such special font characters are interspersed among ordinary font characters, it is usually difficult to directly obtain the font display differences between these characters and the surrounding main characters based solely on the text content obtained from optical character recognition.

[0004] Existing technologies for processing special or uncommon fonts include schemes that pre-establish character feature templates and perform recognition through template matching, and schemes that prepare training samples based on predetermined font categories and build classification models. When the type of font to be processed or the application scenario changes, the corresponding templates, training samples, or classification models may need to be reconfigured or adapted. Existing OCR solutions for uncommon fonts involve a technical approach of creating character feature templates for the font and performing template matching after character segmentation.

[0005] Furthermore, judging whether a character font is abnormal based solely on a single geometric quantity such as character area, character width, or character height is easily affected by differences in the number and structure of the character's strokes. Even if different characters use the same font and size, the foreground area, proportions, and outline of different Chinese characters may still vary. At the same time, factors such as noise, brightness variations, stroke breaks, and adhesion of adjacent characters in the image may also affect character region segmentation and subsequent character-level feature analysis.

[0006] Therefore, there is a need in the art for a method that can extract special font characters from image text regions containing ordinary font characters. Summary of the Invention

[0007] To overcome the aforementioned deficiencies of the prior art, this invention provides a special font extraction method based on optical character recognition and contour analysis. The method obtains text line detection boxes, character recognition results, and the number of visible characters through optical character recognition. The number of visible characters constrains the formation of candidate character regions. Based on the multidimensional features of character contours, a character feature vector is constructed and standardized. DBSCAN clustering is performed when clustering conditions are met. Special font characters are selected and extracted using the area benchmark of ordinary characters as a reference, thus solving the problems mentioned in the background art.

[0008] To achieve the above objectives, the present invention provides the following technical solution: A special font extraction method based on optical character recognition and contour analysis includes the following steps: Step 1: Perform optical character recognition on the image to be detected to obtain the text line detection box, the text recognition result, and the number of visible characters; Step 2: Obtain the text line sub-image based on the text line detection box, binarize and morphologically process it, and perform connected component analysis on the binary image to extract candidate character regions; compare the number of candidate character regions with the number of visible characters. If the two are inconsistent, adjust the morphological processing parameters according to the quantitative relationship within the preset adjustment range. If the two are consistent, determine the candidate character regions. Step 3: Establish the correspondence between candidate character regions and visible characters in the text recognition results to determine the set of effective character regions for analysis; Step 4: Extract character contours from candidate character regions in the effective character region set, and construct and standardize character feature vectors based on aspect ratio, character area, contour perimeter, and Hu moment; Step 5: Set the minimum number of neighbors MinPts for DBSCAN, determine the neighborhood radius ε based on the standardized character feature vector, and perform DBSCAN clustering when the clustering conditions are met. Determine the main ordinary character reference cluster based on the number of samples in the non-noise cluster, and determine the special font candidate set based on the remaining non-noise clusters and noise characters. Step 6: Determine the area benchmark of ordinary characters based on the character area of ​​the main ordinary character reference cluster, determine the special font characters based on the area difference between the candidate objects in the special font candidate set and the ordinary character area benchmark, and extract the corresponding character image regions.

[0009] The special font characters referred to in this invention are characters whose corresponding candidate objects enter the special font candidate set in the same text line to be analyzed, and whose candidate area relative to the ordinary character area benchmark of the text line reaches a preset difference condition.

[0010] As a further aspect of the present invention, the morphological processing includes dilation and erosion processing, adjusting the morphological processing parameters according to the relationship between the number of candidate character regions and the number of visible characters, and re-extracting the candidate character regions.

[0011] As a further aspect of the present invention, a correspondence between candidate character regions and visible characters is established based on the spatial location of candidate character regions and the text reading order; when optical character recognition can provide character-level position information, consistency verification is performed based on the spatial correspondence between character-level positions and candidate character regions, and a set of valid analysis character regions is determined based on the preset analysis character type.

[0012] As a further aspect of the present invention, the character feature vector includes aspect ratio, character area, outline perimeter, and seven Hu moment components, and is standardized using the set of valid analytical character regions in the same text line as the standardization object.

[0013] As a further aspect of the present invention, a nearest neighbor distance curve is formed based on the nearest neighbor distance corresponding to the minimum number of neighbors MinPts; when a knee point is detected, the neighborhood radius ε is determined according to the nearest neighbor distance corresponding to the knee point; when no knee point is detected and there is a non-zero nearest neighbor distance, the neighborhood radius ε is determined according to the sum of the mean of all nearest neighbor distances and twice the standard deviation; when all nearest neighbor distances are zero, DBSCAN clustering of the current text line is not performed.

[0014] As a further aspect of the present invention, when there is a non-noise cluster with the largest number of samples in the DBSCAN clustering results, the non-noise cluster is determined as the main ordinary character reference cluster; the remaining non-noise clusters are respectively regarded as cluster candidate objects, and each noise character is respectively regarded as character candidate objects, and the cluster candidate objects and character candidate objects form a special font candidate set.

[0015] As a further aspect of the present invention, the average area of ​​each character in the main ordinary character reference cluster is determined as the ordinary character area benchmark; based on the area ratio between the candidate area of ​​each candidate object in the special font candidate set and the ordinary character area benchmark, as well as the preset lower limit and preset upper limit, special font characters with larger or smaller areas are determined.

[0016] The technical effects and advantages of the special font extraction method based on optical character recognition and contour analysis of this invention are as follows: This invention uses the number of visible characters obtained by optical character recognition to constrain the character region formation process, and adjusts the morphological processing parameters according to the relationship between the number of candidate character regions and the number of visible characters. This helps to reduce obvious oversegmentation caused by character stroke breakage and obvious undersegmentation caused by the adhesion of adjacent characters, thereby improving the consistency and stability of character-level analysis objects.

[0017] This invention utilizes aspect ratio, character area, outline perimeter, and Hu moment to jointly characterize the scale, overall proportion, and outline shape differences of characters. Compared to screening based solely on a single geometric quantity such as area, width, or height, this invention helps to reduce the impact of differences in the character's own structure on the judgment of a single geometric feature.

[0018] This invention establishes a relative scale reference for the current text line using a reference cluster of ordinary characters. It further determines the area difference between the cluster candidate objects and character candidate objects obtained by DBSCAN, so that the comprehensive feature difference of the character outline corresponds to the scale difference of the target font. Candidate objects whose area difference does not meet the preset conditions are not determined to be special font characters, and it allows the result of no special font characters to be obtained when there are no candidate objects that meet the conditions.

[0019] In addition to optical character recognition, this invention mainly performs image preprocessing, character contour feature calculation, and density clustering. It eliminates the need to train and deploy a dedicated font classification model for the specific font to be extracted, which helps reduce the storage, computation, and maintenance overhead of additional models in the special font extraction stage and improves deployment adaptability on edge computing platforms with limited computing resources. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the text line to be detected and the text line detection box.

[0021] Figure 2 This is a flowchart of a special font extraction method based on optical character recognition and contour analysis. Detailed Implementation

[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] Example 1

[0024] In this embodiment, a line of text in an image captured by a public display screen is used as the object to be detected. The text to be detected is "Rainy days make the road slippery, be careful when testing safety." The display size of "test" and "test" is significantly larger than that of other Chinese characters in the same text line. This text line is mainly composed of ordinary font characters, with characters of different display sizes interspersed among the main ordinary font characters, and each text line is an independent special font analysis unit.

[0025] The image to be detected is input into an optical character recognition program for text detection and character recognition. This embodiment uses PaddleOCR to perform optical character recognition, such as... Figure 1 As shown, the text line detection boxes and text recognition results corresponding to the text to be analyzed are obtained: "Rainy days make the road slippery, pay attention to safety." PaddleOCR's OCR pipeline can provide text detection and text recognition results, and can be configured to return more granular location box information. Based on the text recognition results, the characters with actual graphic representations in the image to be detected are counted. Among them, "rain," "day," "test," "road," "slippery," "pay attention," "know," "test," "safe," "safe," and commas all have corresponding graphic representations, therefore the number of visible characters in the current text line is 11; spaces and other content that do not form actual character graphics are not included in the number of visible characters. The text line detection boxes are used to determine the spatial range of subsequent text line sub-images, and the number of visible characters is used for quantity comparison during the candidate character region formation process.

[0026] Based on the obtained text line detection boxes and character recognition results, the following steps are performed sequentially: text line sub-image processing, candidate character region extraction, character correspondence, character feature calculation, DBSCAN clustering, and area difference determination. The processing flow is as follows: Figure 2 As shown.

[0027] Text line sub-images are cropped based on the position of the text line detection box in the image to be detected. Median filtering is applied to these sub-images, and they are then converted to grayscale. Adaptive thresholding is used for binarization to separate the character foreground from the background. Binarization unifies the pixel polarity of the character foreground and background, ensuring consistent pixel representation of the character foreground and providing a unified binary image basis for subsequent comparisons of candidate character regions within the same text line.

[0028] The binary image is subjected to dilation and erosion processing. By adjusting the dilation and erosion processing parameters, the connectivity state of the character foreground region is changed. After morphological processing, connected component analysis is performed on the binary image to extract the foreground connected regions. Each foreground connected region is used as a candidate character region, and the number of candidate character regions is counted.

[0029] The number of candidate character regions is compared with the number 11 of visible characters. When the number of candidate character regions is greater than the number of visible characters, it indicates that at least one visible character may correspond to multiple candidate character regions. At this time, the dilation processing parameter and / or the erosion processing parameter are adjusted within a preset adjustment range to improve the connection degree between the foreground regions inside the same character. When the number of candidate character regions is less than the number of visible characters, it indicates that at least two adjacent visible characters may correspond to the same candidate character region. At this time, the dilation processing parameter and / or the erosion processing parameter are adjusted within a preset adjustment range to reduce the connection degree between the foreground regions of adjacent characters. After completing one parameter adjustment, a binary image is re-acquired and connected component analysis is performed, and the number of candidate character regions is counted again.

[0030] The size and shape of the structural element used in morphological processing, as well as the number of iterations of dilation and erosion, form a limited parameter adjustment range in advance, and the parameter adjustment direction is selected according to the magnitude relationship between the number of candidate character regions and the number of visible characters. When the number of candidate character regions is equal to 11, the continuous adjustment of morphological processing parameters is stopped, and the binary image corresponding to the current morphological processing parameters is taken as the final binary image of the text line. Subsequent correspondence of candidate character regions, character contour extraction and character feature calculation are all performed based on this final binary image, so that the character area, contour perimeter and Hu moment in the same text line are derived from the same image processing state. After traversing the preset adjustment range, if the number of candidate character regions still cannot be consistent with the number of visible characters, the subsequent special font analysis of the current text line is terminated.

[0031] After the number of candidate character regions is consistent with the number of visible characters, the correspondence between the candidate character regions and each visible character in the text recognition result is continuously established. For the horizontal text of this embodiment, the candidate character regions are sequentially arranged according to their spatial positions in the text reading direction, and a correspondence is established with "雨", "天", "测", "路", "滑", ",", "注", "意", "试", "安", "全" in the text recognition result.

[0032] When the optical character recognition program obtains character-level position information at the same time, the character-level positions are further utilized to perform spatial consistency verification on the aforementioned correspondence. Specifically, the position range of the candidate character region is compared with the character-level position range of the corresponding visible character. When a character-level position forms a corresponding spatial correspondence with a candidate character region, the correspondence result of this character is accepted. When one character-level position corresponds to two or more separate candidate character regions at the same time, or one candidate character region forms obvious spatial overlap with two or more adjacent character-level positions at the same time, the current candidate character region division is not accepted, and the process returns to the aforementioned morphological parameter adjustment process to re-obtain candidate character regions. When the optical character recognition only provides text line-level detection boxes without providing character-level positions, the correspondence is established according to the spatial positions of the candidate character regions, the intervals between adjacent regions, and the text reading order; when a consistent correspondence cannot be established, the subsequent analysis of the current text line is terminated.

[0033] Through the above spatial correspondence verification, that the number of candidate character regions is equal to the number of visible characters is only used as one quantity condition for the formation of character regions, and the candidate character regions need to meet the spatial correspondence condition with the visible characters before proceeding to the subsequent character feature analysis, so that it is possible to handle the situation where although the total number of candidate character regions is equal to the number of visible characters, there exists a case where the quantities offset each other due to one character being split and adjacent characters being adhered at the same time.

[0034] After the correspondence between the candidate character regions and the visible characters is completed, the visible characters participating in the special font analysis are determined according to the preset analysis character type. The analysis character type in this embodiment is Chinese characters, so "雨", "天", "测", "路", "滑", "注", "意", "试", "安", and "全" participate in the subsequent special font analysis, and the candidate character regions corresponding to these Chinese characters form an effective analysis character region set; commas are not included in the effective analysis character region set. As a result, commas still participate in the quantity statistics as visible characters with actual graphic representations at the stage of comparing the number of candidate character regions with the number of visible characters, and are excluded according to the analysis character type after the character correspondence is completed, and 10 effective analysis character regions are finally obtained for the current text line.

[0035] For each candidate character region in the effective analysis character region set, the corresponding character contour is extracted from the final binary image. The bounding box width and height are obtained according to the bounding box of the candidate character region, and the ratio of the bounding box width to the height is determined as the aspect ratio; the number of foreground pixels in the candidate character region is counted and determined as the character area; the boundary length of the character contour is calculated and determined as the contour perimeter; seven Hu moment components are calculated according to the image moments of the candidate character region.

[0036] Following a uniform arrangement, the aspect ratio, character area, contour perimeter, and seven Hu moments corresponding to the same candidate character region are combined to form a character feature vector. Each valid analyzed character region obtains a character feature vector. The character area and contour perimeter record the character scale features under the current image conditions, the aspect ratio records the overall proportion of the candidate character region, and the Hu moments record the morphological features of the character contour. Since different Chinese characters have different contour structures, the Hu moments participate in subsequent clustering as a component of the character feature vector, and special font characters are not directly determined by a single Hu moment component.

[0037] Using the set of valid analytical character regions within the same text line as the standardization object, the character feature vectors are standardized for each feature dimension. This embodiment employs a standardization method based on mean and standard deviation. The mean and standard deviation of all valid analytical characters in the current text line are calculated for each feature dimension, and the standardized feature value of each character in that feature dimension is obtained based on the mean and standard deviation. These standardized feature values ​​form the standardized character feature vector for the corresponding character. When the standard deviation of a feature dimension is zero, the standardized feature value of each character in that feature dimension is set to zero. After standardization, each of the 10 valid analytical characters in the current text line corresponds to a standardized character feature vector.

[0038] The minimum number of neighbors for DBSCAN, MinPts, is set. In this embodiment, MinPts is set to 5. This parameter, together with the neighborhood radius ε, is used to determine the density neighborhood of DBSCAN. When the number of valid character regions to be analyzed is less than MinPts, the special font analysis of the current text line ends; the current text line has 10 valid character regions to be analyzed, which is not less than MinPts, so the neighborhood radius ε is determined.

[0039] For each standardized character feature vector, calculate its distance to other standardized character feature vectors and arrange them in ascending order of distance. The current sample itself is included in the number of samples corresponding to MinPts. Therefore, when MinPts is set to 5, select the four nearest neighbors of the current sample from the remaining samples, and determine the distance of the fourth nearest neighbor (the one furthest from the current sample) as the nearest neighbor distance of the current standardized character feature vector. Obtain the nearest neighbor distances of all standardized character feature vectors in this manner, and arrange the nearest neighbor distances in ascending order to form a nearest neighbor distance curve.

[0040] The Kneedle algorithm is used to detect knee points in the nearest neighbor distance curve, where the curve transitions from a flat to a steep slope. When a knee point is detected, the nearest neighbor distance corresponding to the knee point is determined as the neighborhood radius ε. When no knee point is detected and at least one nearest neighbor distance is greater than zero, the mean and standard deviation of all nearest neighbor distances are calculated, and the sum of the mean and twice the standard deviation is determined as the neighborhood radius ε. When all nearest neighbor distances are zero, DBSCAN clustering of the current text line is not performed, and the special font analysis of the current text line ends. Therefore, the neighborhood radius ε is determined based on the standardized character feature data of the current text line, without needing to pre-determine whether the current text line contains special font characters.

[0041] The standardized character feature vectors are clustered using DBSCAN with the determined minimum number of neighbors (MinPts) and neighborhood radius (ε) to obtain non-noise clusters and potentially noisy characters. The number of character samples contained in each non-noise cluster is counted. When a non-noise cluster with the largest number of samples exists in the DBSCAN clustering results, this non-noise cluster is determined as the main ordinary character reference cluster. The remaining non-noise clusters are used as cluster candidates, and each noisy character is used as a character candidate. A special font candidate set is formed by the cluster candidates and the character candidates.

[0042] In this embodiment, the text line to be detected mainly consists of ordinary font characters. When DBSCAN does not form a non-noise cluster, or when there are two or more non-noise clusters with the largest number of samples, the reference cluster for the main ordinary characters is not determined, and no ordinary character area benchmark is established for the current text line, thus ending the special font analysis of the current text line.

[0043] After determining the reference cluster of ordinary characters in the main body, the area of ​​each character in the reference cluster is read, and the average area of ​​each character is calculated. This average value is then used as the baseline for the area of ​​ordinary characters. For candidate clusters in the candidate set of special fonts, the average area of ​​each character in that candidate cluster is used as the candidate area of ​​that candidate cluster. For candidate characters in the candidate set of special fonts, the area of ​​the corresponding noise character is used as the candidate area of ​​that candidate character. The resulting candidate areas are then compared with the baseline for the area of ​​ordinary characters in the current text line.

[0044] The preset lower limit and the preset upper limit are configured before special font analysis is performed on the to-be-detected image. During system deployment, normal font texts are collected as calibration samples under display conditions and image acquisition conditions that are the same as or similar to the actual application conditions. The same candidate character region extraction and character area calculation processes as those for the to-be-detected text are performed on the calibration samples, so as to respectively obtain the area ratios of the normal font characters relative to the normal character area reference of the text line where the normal font characters are located. The preset lower limit and the preset upper limit are set according to the normal variation range of the area ratios in the calibration samples. The preset lower limit is greater than zero and less than one, and the preset upper limit is greater than one; after the calibration is completed, the set preset lower limit and preset upper limit remain unchanged under the corresponding application conditions.

[0045] For each cluster candidate object or character candidate object in the special font candidate set, the ratio of its candidate area to the normal character area reference is determined as the area ratio. When the area ratio is not less than the preset upper limit, the character in the corresponding candidate object is determined as a special font character with an excessively large area; when the area ratio is not greater than the preset lower limit, the character in the corresponding candidate object is determined as a special font character with an excessively small area; when the area ratio is greater than the preset lower limit and less than the preset upper limit, the character in the corresponding candidate object is not determined as a special font character.

[0046] When the characters "ce" and "shi" (forming the Chinese word for "test") are respectively located in cluster candidate objects or determined as character candidate objects after DBSCAN clustering, and their corresponding area ratios are not less than the preset upper limit, the corresponding characters are determined as special font characters with excessively large areas; if either of the two characters does not enter the special font candidate set, or the corresponding area ratio does not reach the preset upper limit, the character is not forcibly determined as a special font character based on the pre-set target text content. For other characters that enter the special font candidate set due to their own glyph structure differences but whose area ratios are still between the preset lower limit and the preset upper limit, they are also not determined as special font characters.

[0047] For target characters whose display size is smaller than the main normal font characters, the same character feature clustering and area comparison processes are adopted. When the corresponding character enters the special font candidate set and the area ratio is not greater than the preset lower limit, it is determined as a special font character with an excessively small area. When the special font candidate set is empty, or the area ratios of all candidate objects in the special font candidate set are between the preset lower limit and the preset upper limit, no special font character is output for the current text line.

[0048] Once the special font characters are identified, the candidate character regions corresponding to the special font characters are obtained based on the established correspondence between the candidate character regions and the visible characters in the text recognition results. Then, based on the position of the text line detection box in the image to be detected, the position of the candidate character regions in the text line sub-image is converted to the coordinate system of the image to be detected. Accordingly, the corresponding character image regions are extracted from the image to be detected, and the special font character image extraction result of the current text line is obtained.

[0049] For an image to be detected containing multiple text lines, the above processing is performed by each text behavior analysis unit. Each text line obtains its own visible character count, effective analysis character region set, standardized character feature vector, main ordinary character reference cluster, and ordinary character area benchmark, and outputs the corresponding special font character image region or the processing result without special font characters.

[0050] The method of this invention can be deployed on RK3576, RK3588, or other edge computing platforms with corresponding image processing capabilities. The optical character recognition program can be executed using the platform's AI computing unit, while text line image processing, connected component analysis, character contour calculation, character feature vector construction and standardization, DBSCAN clustering, and area ratio determination are performed by the processor.

[0051] The above description is merely a specific 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 special font extraction method based on optical character recognition and contour analysis, characterized in that, Includes the following steps: Step 1: Perform optical character recognition on the image to be detected to obtain the text line detection box, the text recognition result, and the number of visible characters; Step 2: Obtain the text line sub-image based on the text line detection box, binarize and morphologically process it, and perform connected component analysis on the binary image to extract candidate character regions; compare the number of candidate character regions with the number of visible characters. If the two are inconsistent, adjust the morphological processing parameters according to the quantitative relationship within the preset adjustment range. If the two are consistent, determine the candidate character regions. Step 3: Establish the correspondence between candidate character regions and visible characters in the text recognition results to determine the set of effective character regions for analysis; Step 4: Extract character contours from candidate character regions in the effective character region set, and construct and standardize character feature vectors based on aspect ratio, character area, contour perimeter, and Hu moment; Step 5: Set the minimum number of neighbors MinPts for DBSCAN, determine the neighborhood radius ε based on the standardized character feature vector, and perform DBSCAN clustering when the clustering conditions are met. Determine the main ordinary character reference cluster based on the number of samples in the non-noise cluster, and determine the special font candidate set based on the remaining non-noise clusters and noise characters. Step 6: Determine the area benchmark of ordinary characters based on the character area of ​​the main ordinary character reference cluster, determine the special font characters based on the area difference between the candidate objects in the special font candidate set and the ordinary character area benchmark, and extract the corresponding character image regions.

2. The special font extraction method based on optical character recognition and contour analysis according to claim 1, characterized in that, In step two, the morphological processing includes dilation and erosion. When the number of candidate character regions is greater than the number of visible characters, the dilation and / or erosion parameters are adjusted to increase the connectivity of the foreground regions within the same character. When the number of candidate character regions is less than the number of visible characters, the dilation and / or erosion parameters are adjusted to reduce the connectivity between the foreground regions of adjacent characters, and candidate character regions are re-extracted.

3. The special font extraction method based on optical character recognition and contour analysis according to claim 1, characterized in that, In step three, the visible characters are characters in the text recognition results that have actual graphic representations in the image to be detected. A correspondence between candidate character regions and visible characters is established based on the spatial position of the candidate character regions and the text reading order. Based on the preset analysis character type, visible characters participating in special font analysis are determined from the visible characters with established correspondences. The candidate character regions corresponding to the visible characters participating in special font analysis are then combined to form the set of effective analysis character regions.

4. The special font extraction method based on optical character recognition and contour analysis according to claim 1, characterized in that, In step four, the aspect ratio is determined based on the width and height of the bounding box of the candidate character region, the character area is the foreground area of ​​the candidate character region, the contour perimeter is the boundary length of the character contour, and the Hu moment includes seven Hu moment components. The aspect ratio, character area, contour perimeter, and seven Hu moments corresponding to the same candidate character region are combined to form a character feature vector, and a standardized character feature vector is obtained by taking the set of valid analyzed character regions of the same text line as the standardization object.

5. The special font extraction method based on optical character recognition and contour analysis according to claim 1, characterized in that, In step five, for each standardized character feature vector, the distances between this standardized character feature vector and other standardized character feature vectors are arranged in ascending order. The distance of the farthest neighbor sample that makes the number of the current standardized character feature vector and its neighboring samples reach the minimum number of neighbors MinPts is determined as the nearest neighbor distance. A nearest neighbor distance curve is formed according to the size of each nearest neighbor distance. When the Kneedle algorithm detects a knee point in the nearest neighbor distance curve that transitions from a flat segment to a steep segment, the nearest neighbor distance corresponding to the knee point is determined as the neighborhood radius ε. When the Kneedle algorithm does not detect the knee point and at least one nearest neighbor distance is greater than zero, the sum of the mean of all nearest neighbor distances and twice the standard deviation is determined as the neighborhood radius ε. When all nearest neighbor distances are zero, DBSCAN clustering of the current text line is not performed.

6. The special font extraction method based on optical character recognition and contour analysis according to claim 1, characterized in that, In step five, when there is a non-noise cluster with the largest number of samples in the DBSCAN clustering results, the non-noise cluster is determined as the main ordinary character reference cluster; The remaining non-noise clusters are each designated as cluster candidates, and each noise character is designated as a character candidate. The cluster candidates and character candidates together form a special font candidate set.

7. A special font extraction method based on optical character recognition and contour analysis according to claim 6, characterized in that, In step six, the average area of ​​each character in the main ordinary character reference cluster is determined as the ordinary character area benchmark; for cluster candidate objects, the average area of ​​each character in the cluster candidate object is determined as the candidate area; for character candidate objects, the character area of ​​the corresponding noise character is determined as the candidate area.

8. A special font extraction method based on optical character recognition and contour analysis according to claim 7, characterized in that, In step six, the ratio of the candidate area to the baseline area of ​​a normal character is determined as the area ratio. When the area ratio is not less than a preset upper limit, the character in the corresponding candidate object is determined as a special font character with a larger area. When the area ratio is not greater than a preset lower limit, the character in the corresponding candidate object is determined as a special font character with a smaller area. When the area ratio is greater than the preset lower limit and less than the preset upper limit, the character in the corresponding candidate object is not determined as a special font character. The preset lower limit is greater than zero and less than one, and the preset upper limit is greater than one.