Handwritten font recognition and storage method for cold data archiving management
By combining multi-directional projection and cluster analysis with a pre-trained model to correct handwritten fonts, the problem of high recognition error rate caused by handwritten font style variation in cold data archiving management is solved, and efficient font recognition and storage are achieved.
Patent Information
- Application Number
- CN202511678238.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2045-11-17
AI Technical Summary
In cold data archiving and management, existing technologies suffer from a decrease in OCR recognition accuracy due to style variations in handwritten fonts, and the high cost of acquiring high-quality labeled data. Single image enhancement techniques fail to effectively distinguish between the intrinsic structure and style shift of fonts, leading to an increased recognition error rate.
By dividing the intrinsic structure main area and the style-induced offset area through multi-directional projection, the influence of style is quantified by combining spatial distribution differences, cluster analysis is performed, and a pre-trained style correction model is used to correct handwritten fonts, generating a corrected image with a more regular structure.
It effectively reduces the misrecognition rate of handwritten fonts in OCR recognition, improves the efficiency of rapid batch recognition and storage of cold data handwritten archives, and reduces the processing burden of complex styles.
Smart Images

Figure CN121564731A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, specifically to a method for recognizing and storing handwritten characters for cold data archiving management. Background Technology
[0002] In today's era of data explosion, the scale of cold data accumulated across industries continues to expand. A large portion of this cold data still exists in the form of handwritten paper archives. These handwritten archives carry important historical information and business value, and are indispensable raw data resources in the process of industry development. However, in the specific scenario of cold data archiving and management, these handwritten data often suffer from problems such as handwriting fading and paper damage due to their age or limited preservation conditions. More importantly, the strong personal styles of different writers can lead to huge variations in font structure. This stylized writing seriously interferes with the recognition accuracy of traditional OCR engines.
[0003] Currently, mainstream solutions to the problem of handwritten font style variation rely on training deep neural network models with large-scale labeled data, or employ single image enhancement techniques focused on stroke thinning and contour extraction. However, for cold data, obtaining sufficient, high-quality labeled data is extremely costly and often impractical. Moreover, the structure of a single font is significantly affected by style, and its intrinsic structure (such as standard strokes and glyphs) is easily masked by style-induced shift features (such as extra strokes and tilting deformations). Single image enhancement techniques fail to distinguish between the stable intrinsic structure of a font and style-induced shifts in principle, often resulting in distortion of the font structure or excessive removal of style features after enhancement, which in turn reduces the fidelity of information. Summary of the Invention
[0004] To address the technical problem that handwriting style affects font structure, leading to increased misrecognition rates in handwritten font identification, this invention provides a handwritten font recognition and storage method for cold data archiving management. The specific technical solution adopted is as follows:
[0005] This invention proposes a method for handwritten font recognition and storage for cold data archiving management, the method comprising:
[0006] Collect multiple handwritten text images and segment each text image into multiple single-font images;
[0007] For each single font image, projection is performed in multiple projection directions; based on the distribution characteristics of the number of effective pixels in each projection direction, the single font image is divided into the intrinsic structure main area and the style-induced offset area, where the effective pixels are the non-background pixels corresponding to the font strokes; the style influence of the single font image is determined according to the spatial distribution difference characteristics between the intrinsic structure main area and the style-induced offset area.
[0008] For each text image, the individual font images are clustered according to their style influence to form clusters; the clustering degree of the clusters is determined based on the number of individual font images and the range of style influence values within each cluster; and the font structure ambiguity of the text image is determined based on the differences in clustering degree between each cluster.
[0009] The overall font blur is determined based on the number of individual font images and the blur of the font structure in all text images;
[0010] The text image and overall font ambiguity are input into a pre-trained style correction model, which outputs a corrected text image. An OCR algorithm is used to identify and store the handwritten font in the corrected text image.
[0011] Furthermore, the projection of each individual font image in multiple projection directions includes:
[0012] The core projection direction is the diagonal line from the top left corner to the bottom right corner of the single-font image; the reference axis is the diagonal line from the bottom left corner to the top right corner of the single-font image.
[0013] Around the core projection direction, select multiple projection directions at set intervals within a preset angle range;
[0014] Along the reference axis from the starting end to the ending end, all selected projection directions are sequentially numbered to form a continuous numbering sequence, where the total number of numbering sequences is equal to the total number of projection directions of a single font image.
[0015] Furthermore, the method of dividing a single font image into an intrinsic structure main region and a style-induced shift region based on the distribution characteristics of the number of effective pixels in each projection direction includes:
[0016] Count the number of valid pixels in each projection direction;
[0017] A coordinate system is constructed with the number corresponding to the projection direction as the abscissa and the number of effective pixels in the projection direction as the ordinate; a direction projection curve is generated by data fitting; the total number of effective pixels on the direction projection curve is obtained as the total number of effective pixels.
[0018] The image region corresponding to the interval on the directional projection curve that meets the preset conditions is defined as the intrinsic structure main region; the image region corresponding to the remaining part of the directional projection curve is defined as the style-induced shift region, wherein the style-induced shift region contains several discontinuous regions.
[0019] Furthermore, the preset conditions are: the number of consecutive and cumulative effective pixels within the interval exceeds a preset first ratio of the total number of effective pixels, and the number of effective pixels in each projection direction within the interval is greater than the number of effective pixels in any projection direction outside the interval.
[0020] Furthermore, the process for determining the style influence includes:
[0021] Get the total number of projection directions for a single font image;
[0022] Calculate the arithmetic mean of the total number of projection directions of all single-font images in the text image containing the single-font image, and use it as the average number of projection directions; calculate the absolute difference between the total number of projection directions and the average number of projection directions, and use it as the first difference.
[0023] Calculate the Euclidean distance between the centroid of the intrinsic structure main region and the centroid of each style-induced offset region; sum all Euclidean distances to obtain the total distance value;
[0024] Calculate the product of the first difference and the total distance value as the style influence.
[0025] Furthermore, the process of clustering individual font images for each text image according to style influence to form clusters includes:
[0026] The stylistic influence of single-font images is used as a clustering feature;
[0027] The density clustering algorithm is adopted, with the continuous distribution of style influence as the core rule. A threshold is set for the style influence difference between adjacent single font images. When the style influence difference of multiple consecutive single font images is less than the style influence difference threshold, they are divided into the same initial clustering unit.
[0028] If the number of single-font images contained in the initial cluster unit is lower than the preset lower limit, the target initial cluster unit is determined; the target initial cluster unit is merged into the adjacent initial cluster unit with the nearest style influence value.
[0029] Boundary checks are performed on the merged cluster units to ensure that the range of style influence values within the same cluster does not exceed a preset range, ultimately forming multiple clusters.
[0030] Furthermore, the aggregation degree determination process includes:
[0031] Count the number of first single-font images contained in a single cluster; obtain the maximum and minimum style influence among all single-font images in a single cluster;
[0032] The difference between the maximum and minimum style influence within a cluster is calculated and used as the second difference.
[0033] The ratio of the number of first single-font images to the second difference is calculated as the clustering degree of the cluster. When the second difference is zero, the clustering degree takes the value of a preset maximum constant.
[0034] Furthermore, the font structure ambiguity determination process includes:
[0035] Calculate the arithmetic mean of the clustering degree of all clusters in the text image, and use it as the mean clustering degree;
[0036] Calculate the absolute difference between the cluster degree of each cluster and the mean cluster degree, and use it as the cluster degree deviation value of each cluster.
[0037] Sum all clustering deviation values to obtain the overall clustering deviation index;
[0038] The reciprocal of the overall clustering deviation index is used as the font structure blur of the text image.
[0039] Furthermore, the overall font ambiguity determination process includes:
[0040] Count the number of single-font images contained in each text image;
[0041] Sum the number of individual font images for all text images to obtain the total number of individual font images;
[0042] The weighted sum of the font structure blur of each text image is obtained by using the proportion of the number of single font images in each text image to the total number of single font images as the weight.
[0043] The weighted sum is normalized to obtain the overall font blur in multiple text images.
[0044] Furthermore, the step of inputting the text image and overall font ambiguity into the pre-trained style correction model and outputting the corrected text image includes:
[0045] The input text image is preprocessed to obtain a standardized image;
[0046] The standardized image and the overall font ambiguity are used as joint inputs and imported into a pre-trained style correction model. The model dynamically adjusts the correction intensity of stylized features in the standardized image using the overall font ambiguity.
[0047] The intrinsic structural features and style shift features in the standardized image are extracted and separated by the model, and the style shift features are corrected by combining the overall font ambiguity.
[0048] The corrected features are fused and reconstructed to generate a corrected text image, in which the stroke continuity and structural integrity of the corrected text image are superior to those of the input text image.
[0049] The present invention has the following beneficial effects:
[0050] This invention divides the intrinsic structure main area and the style-induced offset area through multi-directional projection, and quantifies the style influence degree by combining spatial distribution differences. It accurately separates the inherent structure of the font from style interference, providing a clear basis for subsequent correction and effectively reducing the misrecognition rate of handwritten fonts in OCR. Cluster analysis is performed on single-page text images to determine the font structure ambiguity through clustering differences. The overall ambiguity is calculated by weighting the number of fonts on multiple pages, realizing the progressive quantification of style features from single fonts to multi-page documents. This allows the correction model to adapt to the overall style trend and avoids correction deviations caused by the randomness of single pages. The pre-trained style correction model, combined with the overall ambiguity, can specifically strengthen the correction of style offset areas, generating corrected images with more regular structures. This reduces the processing burden of complex styles on the OCR algorithm and improves the efficiency of rapid batch recognition and storage of cold data handwritten documents. Attached Figure Description
[0051] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is a flowchart of a handwritten font recognition and storage method for cold data archiving management, provided in one embodiment of the present invention.
[0053] Figure 2 This is an example diagram illustrating the style influence determination process provided in one embodiment of the present invention;
[0054] Figure 3 This is an example diagram illustrating the overall font ambiguity determination process provided in one embodiment of the present invention. Detailed Implementation
[0055] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a handwritten font recognition and storage method for cold data archiving management proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0057] The following description, in conjunction with the accompanying drawings, details a specific scheme for a handwritten font recognition and storage method for cold data archiving management provided by the present invention.
[0058] Please see Figure 1 The diagram illustrates a flowchart of a handwritten font recognition and storage method for cold data archiving management according to an embodiment of the present invention. The method includes:
[0059] S101: Collect multiple handwritten text images and segment each text image into multiple single-font images.
[0060] It is important to understand that handwritten fonts exhibit different styles in terms of font structure due to factors such as the writer's personal habits and writing environment. However, the handwritten font style of the same person usually tends to be consistent.
[0061] It should be noted that common equipment (such as scanners, high-definition cameras, and other image acquisition devices) can be used to digitize handwritten archives (such as paper handwritten documents, handwritten record sheets, etc.) in cold data archiving scenarios to obtain clear images of handwritten text.
[0062] It should be noted that after acquiring the handwritten text image, it is necessary to preprocess the handwritten text image, including common preprocessing operations such as grayscale conversion, noise reduction, and edge enhancement.
[0063] It should be noted that the specific method for segmenting each text image into multiple single-font images is a well-known technique in the art, and will not be elaborated upon in this embodiment. For example, an image segmentation algorithm is used to process each acquired handwritten text image. First, the boundaries of text rows and columns are determined through row segmentation and column segmentation. Then, based on the gap features between fonts, the continuous handwritten content in the text row or text column is split into independent single-font images.
[0064] S102: For each single font image, project it in multiple projection directions; based on the distribution characteristics of the number of effective pixels in each projection direction, divide the single font image into the intrinsic structure main area and the style-induced offset area, where the effective pixels are the non-background pixels corresponding to the font strokes; determine the style influence of the single font image according to the spatial distribution difference characteristics between the intrinsic structure main area and the style-induced offset area.
[0065] It should be understood that since different fonts have different structures, which are manifested as different font structure types, such as left-right structure and up-down structure, horizontal projection is more sensitive to capturing the font features of the up-down structure, while less sensitive to the left-right structure. Similarly, vertical projection is more sensitive to capturing the left-right structure and less sensitive to the up-down structure. Therefore, in order to avoid using a single-direction projection to capture font structure features, multi-directional projection can be performed on a single-font image to comprehensively capture the stroke distribution features of the font in different spatial dimensions, that is, the font structure features.
[0066] In this embodiment, the diagonal direction from the upper left corner to the lower right corner of the single-font image is used as the core projection direction; the diagonal direction from the lower left corner to the upper right corner of the single-font image is used as the reference axis; around the core projection direction, multiple projection directions are selected at a set interval within a preset angle range; along the reference axis from the starting end to the ending end, all selected projection directions are sequentially numbered to form a continuous number sequence, where the total number of the number sequence is the total number of projection directions of the single-font image.
[0067] The core projection direction, which is the main analysis axis, can capture the stroke features of the font distributed along the main diagonal (such as the Chinese character strokes "捺" and "斜钩", etc.).
[0068] The reference axis is used to locate and calibrate the spatial positions of other projection directions to form a coordinate system reference, that is, each projection direction has a corresponding number.
[0069] It should be noted that the specific values of the preset angle range and the set interval are determined according to the actual situation, and are not specifically limited in this embodiment. For example, within the preset angle range (such as ±30°) around the core projection direction, multiple projection directions are selected at a set interval (such as 10°). Assuming that the core projection direction is 45°, the preset range is ±20°, and the interval is 10°, then three directions of 35°, 45° (core), and 55° will be selected to form a multi-angle coverage around the core.
[0070] It should be noted that the number of projection directions selected by different single-font images at a set interval within the preset angle range may be different, so the total number of projection directions is not a fixed value, but may change dynamically according to factors such as the structural features of the single font and the requirements for analysis accuracy.
[0071] For example, for different fonts (such as the simple "one" and the complex "win"), the algorithm may dynamically adjust the preset angle range for actual analysis, narrowing the range for fonts with fewer strokes and retaining the full range for fonts with more strokes. Another example is that for fonts with variable stroke directions (such as cursive), a smaller interval (such as 3°) is used to capture more details, resulting in an increase in the total number of projection directions; for fonts with regular structures (such as printed fonts), a larger interval (such as 10°) is used, and the total number of projection directions decreases.
[0072] Here, it should be noted that the projection directions are sorted and numbered in sequence along the reference axis from the starting end (such as the lower left corner) to the ending end (such as the upper right corner), forming a continuous number sequence (such as 1, 2, 3......n), where n represents the total number of the number sequence, that is, the total number of projection directions of a single-font image.
[0073] It should be understood that since the effective pixel points are the pixels of the font strokes themselves (not the background blank area), the distribution of the number of effective pixel points can reflect the structural characteristics of the font. In each projection direction, the area where the effective pixel points are dense and continuous corresponds to the core structure of the font, that is, the intrinsic structure of the font (such as the main strokes of "horizontal" and "vertical" in Chinese characters); while the areas where the effective pixel points are sparse, scattered or deviate from the core structure of the font (such as the additional strokes generated by connected writing and the parts with excessive stroke inclination) are mainly caused by the personal style of the writer rather than the inherent structure of the font itself.
[0074] In this embodiment, the number of effective pixel points in each projection direction is counted; a coordinate system is constructed with the number corresponding to the projection direction as the abscissa and the number of effective pixel points in the projection direction as the ordinate; a direction projection curve is generated through data fitting; all the numbers of effective pixel points on the direction projection curve are obtained as the total number of effective pixel points; the image area corresponding to the interval that meets the preset conditions on the direction projection curve is defined as the main area of the intrinsic structure; the image area corresponding to the remaining part of the direction projection curve is defined as the style-induced offset area, where the style-induced offset area contains several discontinuous areas.
[0075] An effective pixel point refers to the pixel point belonging to the font stroke itself in a single-font image, rather than a background pixel point. Specifically, after image preprocessing (such as binary processing), a handwritten font image will present two main pixel states: one is the pixel that constitutes the font stroke (usually shown as a dark color, such as black), which directly reflects the structural form of the font and is the key information carrier for font recognition, and is defined as an effective pixel point; the other is the pixel of the blank area outside the font (usually shown as a light color, such as white), which only exists as a background and does not contain font structure information, and is called a background pixel point.
[0076] It should be noted that the specific method of generating the directional projection curve through data fitting is an existing technical means, which will not be described in detail in this embodiment. For example, the discrete effective pixel number data is transformed into a continuous "directional projection curve" by means of smooth curve fitting, which is used to present the stroke distribution density of the font in different projection directions.
[0077] It should be noted that the preset conditions are: the number of consecutive and cumulative effective pixels within the interval exceeds a preset first ratio of the total number of effective pixels, and the number of effective pixels in each projection direction within the interval is greater than the number of effective pixels in any projection direction outside the interval.
[0078] It should be noted that the specific value of the preset first ratio is determined according to actual needs, and this embodiment does not impose a specific limitation. For example, the preset first ratio can be 80%.
[0079] Style-induced offset area: This area has a small number of effective pixels and is scattered. It usually corresponds to unnecessary strokes (such as cursive or redundant embellishments) or structural offsets (such as stroke tilt or deformation) caused by writing style. Since the influence of writing style is random, it often presents as a distribution of multiple discontinuous small blocks.
[0080] The process of determining style influence is as follows Figure 2 As shown, it includes:
[0081] S102-1: Obtain the total number of projection directions for a single font image.
[0082] The total number of projection directions reflects the dimensionality of structural feature extraction from a single font image.
[0083] S102-2: Calculate the arithmetic mean of the total number of projection directions of all single-font images in the text image containing the single-font image, and use it as the average number of projection directions; calculate the absolute difference between the total number of projection directions and the average number of projection directions, and use it as the first difference.
[0084] The first difference is used to reflect the degree of deviation of the projection dimension of the current font from that of other fonts in the same text.
[0085] S102-3: Calculate the Euclidean distance between the centroid of the intrinsic structure main region and the centroid of each style-induced offset region; sum all Euclidean distances to obtain the total distance value.
[0086] Centroid, the geometric center of a region, can be represented in coordinates using a two-dimensional coordinate system, i.e., the coordinates of the geometric center.
[0087] It should be noted that the specific calculation method of Euclidean distance is a common technical means, and will not be described in detail in this embodiment.
[0088] S102-4: Calculate the product of the first difference and the total distance value as the style influence.
[0089] It is important to understand that if the first difference is larger, it means that the stroke distribution characteristics of the font are more significantly different from the overall trend of the font in the same text, and may be more deeply influenced by personal writing style; if the total distance value is larger, it means that the style-induced offset is further away from the font's intrinsic structure, and the structural deformation is more obvious.
[0090] S103: For each text image, the individual font images are clustered according to their style influence to form clusters; the clustering degree of the clusters is determined based on the number of individual font images and the range of style influence values within each cluster; the font structure ambiguity of the text image is determined based on the differences in clustering degree between each cluster.
[0091] It is important to understand that the degree of font shape deviation is affected not only by the writing style but also by the font's structural type (such as left-right or top-bottom structures). Therefore, it is necessary to further distinguish between "style-induced deformation" and "differences brought about by the structure itself." Thus, it is also necessary to further analyze all individual font images in the same text image (such as each Chinese character in an article). Clustering methods can be used to analyze fonts with similar levels of writing style interference, that is, individual fonts with similar style influence values, in order to quantify the influence of the font structure itself. Then, based on the differences between clusters, the degree of ambiguity of style on structure can be quantified.
[0092] In this embodiment, the style influence of a single font image is used as the clustering feature. A density clustering algorithm is employed, with the continuous distribution of style influence as the core rule. A threshold for the difference in style influence between adjacent single font images is set. When the difference in style influence of multiple consecutive single font images is less than the threshold, they are divided into the same initial cluster unit. If the number of single font images contained in the initial cluster unit is lower than a preset lower limit, a target initial cluster unit is determined. The target initial cluster unit is merged into the adjacent initial cluster unit with the closest style influence value. Boundary verification is performed on the merged cluster units to ensure that the range of style influence values within the same cluster does not exceed a preset range, ultimately forming multiple clusters.
[0093] It is understandable that the clusters are initially divided into two categories: one type is fonts with low style influence (such as regular structure and few deviations from the original structure) that may cluster together; the other type is fonts with high style influence (such as loose structure and obvious style deviation) that cluster together.
[0094] It should be noted that the specific value of the preset style influence difference threshold is determined according to actual needs, and this embodiment does not impose a specific limitation. For example, the preset style influence difference threshold is set to 5, which is used as the standard for judging the "similarity" between single font images.
[0095] To prevent isolated points from being isolated due to random errors if the initial cluster unit is too small, if the number of single-font images contained in the initial cluster unit is less than a preset lower limit (e.g., 3), the initial cluster unit is determined to be the target initial cluster unit. The target initial cluster unit is then merged into the "adjacent initial cluster unit with the nearest style influence value". For example, if the average style influence value of a target initial cluster unit is 20, and one of the adjacent initial cluster units has an average style influence value of 18 and the other has an average style influence value of 25, then the target initial cluster unit is merged into the adjacent initial cluster unit with an average style influence value of 18.
[0096] Range: The difference between the maximum and minimum style influence within the same cluster.
[0097] It should be noted that the preset range is determined according to actual needs, and this embodiment does not impose a specific limitation. For example, the preset range can be set to 25-30.
[0098] It is important to understand that since the degree of font shape deviation is affected not only by style but also by the structure of the font itself, in order to comprehensively reflect the similarity and concentration of fonts within a cluster, clusters can be analyzed from two dimensions: "quantity" and "numerical concentration".
[0099] In this embodiment, the number of first single-font images contained in a single cluster is counted; the maximum and minimum style influence of all single-font images in a single cluster are obtained; the difference between the maximum and minimum style influence in the cluster is calculated as the second difference; and the ratio of the number of first single-font images to the second difference is calculated as the clustering degree of the cluster.
[0100] It should be noted that when the second difference is zero, it means that the style influence of all fonts in the cluster is exactly the same, and the clustering degree is set to the preset maximum constant.
[0101] It should be noted that the preset maximum constant can be dynamically determined based on the normal clustering fluctuation range. This embodiment does not impose a specific limitation. For example, if the clustering degree usually fluctuates between 0 and 1000 in actual calculations, the preset maximum constant can be set to 10000 to ensure that the preset maximum constant is significantly higher than the normal clustering fluctuation range, so that the special case of "completely identical fonts" can be distinguished at a glance.
[0102] The first single-font image count refers to the total number of single-font images contained in a single cluster.
[0103] It is important to understand that if the number of first single-font images in a cluster is larger, it reflects the larger the scale of the cluster, indicating that the style features within the cluster are more prevalent in the text. If the second difference in a cluster is smaller, it indicates that the fonts within the cluster are more similar in terms of the degree of style interference, and the features are more concentrated. Combining the number of first single-font images and the second difference, the larger the ratio, the higher the clustering degree, that is, the font style features within the cluster are concentrated and representative.
[0104] In this embodiment, the arithmetic mean of the clustering degree of all clusters in the text image is calculated as the clustering degree mean; the absolute difference between the clustering degree of each cluster and the clustering degree mean is calculated as the clustering degree deviation value of each cluster; all clustering degree deviation values are summed to obtain the overall clustering degree deviation index; the reciprocal of the overall clustering degree deviation index is used as the font structure blur of the text image.
[0105] It's important to understand that handwriting styles, such as messy, cursive, or other structural changes, actually distort the structure of the font, making the original left-right or top-bottom structure less clear. In other words, handwriting style blurs the font structure. Fonts unaffected by handwriting style can be largely distinguished from other fonts due to their inherent structure, resulting in greater differences between clusters. However, the influence of handwriting style reduces these differences, making some structurally similar fonts appear even more similar. The degree of blurring makes structural features more similar. Therefore, the consistency of font structure can be quantified by measuring the dispersion of the clustering degree of each cluster.
[0106] The mean clustering degree reflects the overall level of concentration of writing style features across all clusters.
[0107] The overall clustering deviation index reflects the total deviation of the clustering degree of all clusters from the overall mean.
[0108] It is important to understand that if the overall deviation index of the clustering degree in a certain text image is smaller, it means that the clustering degree of each cluster in the text image is closer and the whole is more unified. This reflects that the handwriting style causes greater confusion to the font structure and the higher the degree of ambiguity.
[0109] S104: Determine the overall font blur based on the number of individual font images and the font structure blur of all text images.
[0110] The process of determining the overall font blur is as follows: Figure 3 As shown, it includes:
[0111] S104-1: Count the number of single-font images contained in each text image.
[0112] The number of individual font images, the total number of individual font images contained in each text image, reflects the importance of the corresponding text image in the overall analysis. The more individual font images there are, the greater the impact on the overall font blurriness.
[0113] S104-2: Sum the number of individual font images for all text images to obtain the total number of individual font images.
[0114] S104-3: Using the proportion of the number of single-font images in each text image to the total number of single-font images as weights, the font structure blur of each text image is weighted and summed to obtain a weighted sum value.
[0115] Since a larger proportion of individual font images in a text image relative to the total number of individual font images indicates a greater impact of the font structure ambiguity on the "overall font ambiguity," meaning a higher weight, and if the corresponding font structure ambiguity is also greater, it means the font structure in the text image is more blurred and irregular. Therefore, in all text images (especially those containing many fonts), most font structures are blurry and inconsistent in style, resulting in a chaotic font style and a more blurred overall font structure. Thus, the weighted sum can be expressed by the following formula:
[0116]
[0117] in, K represents the total number of single-font images; This represents the number of single-font images in the p-th text image; P represents the total number of text images. denoted by , where represents the font structure blur of the p-th text image; E represents the weighted summation value.
[0118] It should be noted that the analysis target is a text image, and the core feature of a text image is that it contains recognizable text. Therefore, in a real-world scenario, a text image cannot be without fonts, so the total number of single-font images cannot be zero.
[0119] S104-4: Normalize the weighted sum to obtain the overall font blur in multiple text images.
[0120] It should be noted that the normalization method is an existing technical means, which will not be described in detail in this embodiment. For example, a normalization method based on the maximum value is adopted.
[0121] S105: Input the text image and overall font ambiguity into the pre-trained style correction model, and output the corrected text image; use the OCR algorithm to recognize and store the handwritten font in the corrected text image.
[0122] In this embodiment, the input text image is preprocessed to obtain a standardized image. The standardized image and the overall font ambiguity are used as joint inputs and imported into a pre-trained style correction model. The model dynamically adjusts the correction intensity of stylistic features in the standardized image using the overall font ambiguity. The model extracts and separates the intrinsic structural features and style shift features in the standardized image, and corrects the style shift features by combining the overall font ambiguity. The corrected features are then fused and reconstructed to generate a corrected text image. The stroke continuity and structural integrity of the corrected text image are superior to those of the input text image.
[0123] It should be noted that the image preprocessing operations will not be described in detail in this embodiment. For example, some common operations include: size normalization (scaling the image to a fixed size to ensure that the image specifications of the input model are uniform) and edge enhancement (highlighting the edge contours of the font strokes and strengthening structural features).
[0124] The model uses overall font ambiguity as a "regulatory signal for correction strategies." For example, if the overall font ambiguity is high (the overall style is chaotic), the model will automatically increase the correction intensity—making more significant adjustments to style features that deviate from the standard structure (such as excessive ligatures and stroke distortion); if the overall font ambiguity is low (the overall style is regular), the model will reduce the correction intensity—only fine-tuning local style shifts to avoid over-correction that could damage the natural characteristics of the font.
[0125] It should be noted that the construction and training methods of the pre-trained style correction model are well-known techniques to those skilled in the art, and will not be elaborated upon in this embodiment. For example, the pre-trained style correction model can be a deep learning-based artificial intelligence model that learns the mapping relationship between the intrinsic structure of handwritten fonts and style shifts through large-scale training data. The training data typically includes two parts: a large number of real handwritten text images (as input) and corresponding standard correction images (as labels, which can be generated by manual annotation or standard printed fonts). The training data needs to cover various writing styles (such as regular script, running script, and cursive handwriting) and images of different qualities (such as clear, blurry, and noisy samples).
[0126] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0127] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for handwritten font recognition and storage for cold data archiving management, characterized in that, The method includes: Collect multiple handwritten text images and segment each text image into multiple single-font images; For each single font image, projection is performed in multiple projection directions; based on the distribution characteristics of the number of effective pixels in each projection direction, the single font image is divided into the intrinsic structure main area and the style-induced offset area, where the effective pixels are the non-background pixels corresponding to the font strokes; the style influence of the single font image is determined according to the spatial distribution difference characteristics between the intrinsic structure main area and the style-induced offset area. For each text image, the individual font images are clustered according to their style influence to form clusters; the clustering degree of the clusters is determined based on the number of individual font images and the range of style influence values within each cluster; and the font structure ambiguity of the text image is determined based on the differences in clustering degree between each cluster. The overall font blur is determined based on the number of individual font images and the blur of the font structure in all text images; The text image and overall font ambiguity are input into a pre-trained style correction model, which outputs a corrected text image. An OCR algorithm is used to identify and store the handwritten font in the corrected text image.
2. The handwritten font recognition and storage method for cold data archiving management according to claim 1, characterized in that, The projection of each individual font image in multiple projection directions includes: The core projection direction is the diagonal line from the top left corner to the bottom right corner of the single-font image; the reference axis is the diagonal line from the bottom left corner to the top right corner of the single-font image. Around the core projection direction, select multiple projection directions at set intervals within a preset angle range; Along the reference axis from the starting end to the ending end, all selected projection directions are sequentially numbered to form a continuous numbering sequence, where the total number of numbering sequences is equal to the total number of projection directions of a single font image.
3. The handwritten font recognition and storage method for cold data archiving management according to claim 2, characterized in that, Based on the distribution characteristics of the number of effective pixels in each projection direction, the single font image is divided into an intrinsic structure main region and a style-induced shift region, including: Count the number of valid pixels in each projection direction; A coordinate system is constructed with the number corresponding to the projection direction as the abscissa and the number of effective pixels in the projection direction as the ordinate; a direction projection curve is generated by data fitting; the total number of effective pixels on the direction projection curve is obtained as the total number of effective pixels. The image region corresponding to the interval on the directional projection curve that meets the preset conditions is defined as the intrinsic structure main region; the image region corresponding to the remaining part of the directional projection curve is defined as the style-induced shift region, wherein the style-induced shift region contains several discontinuous regions.
4. The handwritten font recognition and storage method for cold data archiving management according to claim 3, characterized in that, The preset conditions are: the number of consecutive and cumulative effective pixels within the interval exceeds a preset first ratio of the total number of effective pixels, and the number of effective pixels in each projection direction within the interval is greater than the number of effective pixels in any projection direction outside the interval.
5. A method for handwritten font recognition and storage for cold data archiving management according to claim 4, characterized in that, The process for determining the influence of style includes: Get the total number of projection directions for a single font image; Calculate the arithmetic mean of the total number of projection directions of all single-font images in the text image containing the single-font image, and use it as the average number of projection directions; calculate the absolute difference between the total number of projection directions and the average number of projection directions, and use it as the first difference. Calculate the Euclidean distance between the centroid of the intrinsic structure main region and the centroid of each style-induced offset region; sum all Euclidean distances to obtain the total distance value; Calculate the product of the first difference and the total distance value as the style influence.
6. The handwritten font recognition and storage method for cold data archiving management according to claim 1, characterized in that, The individual font images for each text image are clustered according to style influence to form clusters, including: The stylistic influence of single-font images is used as a clustering feature; The density clustering algorithm is adopted, with the continuous distribution of style influence as the core rule. A threshold is set for the style influence difference between adjacent single font images. When the style influence difference of multiple consecutive single font images is less than the style influence difference threshold, they are divided into the same initial clustering unit. If the number of single-font images contained in the initial cluster unit is lower than the preset lower limit, the target initial cluster unit is determined; the target initial cluster unit is merged into the adjacent initial cluster unit with the nearest style influence value. Boundary checks are performed on the merged cluster units to ensure that the range of style influence values within the same cluster does not exceed a preset range, ultimately forming multiple clusters.
7. A method for handwritten font recognition and storage for cold data archiving management according to claim 6, characterized in that, The clustering determination process includes: Count the number of first single-font images contained in a single cluster; obtain the maximum and minimum style influence among all single-font images in a single cluster; The difference between the maximum and minimum style influence within a cluster is calculated and used as the second difference. The ratio of the number of first single-font images to the second difference is calculated as the clustering degree of the cluster. When the second difference is zero, the clustering degree takes the value of a preset maximum constant.
8. A method for handwritten font recognition and storage for cold data archiving management according to claim 7, characterized in that, The process of determining the ambiguity of the font structure includes: Calculate the arithmetic mean of the clustering degree of all clusters in the text image, and use it as the mean clustering degree; Calculate the absolute difference between the cluster degree of each cluster and the mean cluster degree, and use it as the cluster degree deviation value of each cluster. Sum all clustering deviation values to obtain the overall clustering deviation index; The reciprocal of the overall clustering deviation index is used as the font structure blur of the text image.
9. A method for handwritten font recognition and storage for cold data archiving management according to claim 8, characterized in that, The overall font ambiguity determination process includes: Count the number of single-font images contained in each text image; Sum the number of individual font images for all text images to obtain the total number of individual font images; The weighted sum of the font structure blur of each text image is obtained by using the proportion of the number of single font images in each text image to the total number of single font images as the weight. The weighted sum is normalized to obtain the overall font blur in multiple text images.
10. A method for handwritten font recognition and storage for cold data archiving management according to claim 1, characterized in that, The process of inputting the text image and overall font ambiguity into a pre-trained style correction model and outputting a corrected text image includes: The input text image is preprocessed to obtain a standardized image; The standardized image and the overall font ambiguity are used as joint inputs and imported into a pre-trained style correction model. The model dynamically adjusts the correction intensity of stylized features in the standardized image using the overall font ambiguity. The intrinsic structural features and style shift features in the standardized image are extracted and separated by the model, and the style shift features are corrected by combining the overall font ambiguity. The corrected features are fused and reconstructed to generate a corrected text image, in which the stroke continuity and structural integrity of the corrected text image are superior to those of the input text image.
Citation Information
Patent Citations
Calligraphic style identification method based on overall feature extracting and training
CN102842046A
Screen projection method and receiving terminal and projection terminal which are used for screen projection
CN106506811A
OCR font recognition method and system based on clustering feature extraction
CN115063808A
Method for detecting surface defects of smart phone panel
CN117351008A
Multi-dimensional data processing analysis method, device and system and storage medium
CN118211038A