Document analysis, dongba text electronic file generation method and related equipment

By using document analysis methods to identify and segment Dongba script, the problems of high difficulty in collecting Dongba script samples and the difficulty in digitization are solved. The generated electronic files support efficient analysis and extraction of Dongba script and are adapted to the page layout of electronic files.

CN115393880BActive Publication Date: 2025-11-07SUZHOU VOCATIONAL UNIVERSITY (SUZHOU OPEN UNIVERSITY)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211057527.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-31
Publication Date
2025-11-07
Estimated Expiration
2042-08-31

AI Technical Summary

Technical Problem

The collection of Dongba script samples is difficult due to the lack of standardized datasets, the difficulty in digitizing handwritten paper materials, and the limitations of existing technologies in efficiently analyzing and extracting Dongba script.

Method used

It provides document analysis methods that identify the global structure and feature regions of document images, segment non-target text within paragraphs, identify and extract Dongba script, and generate electronic files.

Benefits of technology

It achieves efficient analysis and extraction of Dongba script, and the generated electronic file format is superior to the original image. It supports separate analysis and extraction of Dongba script and adapts to the page layout of electronic files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115393880B_ABST
    Figure CN115393880B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and discloses a document analysis method, a method for generating an electronic file of Dongba text data and related equipment.The document analysis method comprises the following steps: obtaining a document image; analyzing the global structure of the document image, identifying the element region and the structural region of the document image; locally analyzing the element region, identifying the target text and the paragraph distribution in the document image; the target text and the non-target text are contained in the paragraph; and the non-target text in the paragraph is segmented.Through the above method, the present application can effectively analyze the layout structure of the document image, and is beneficial to realizing the separate analysis and extraction of each text character in the Dongba text data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a document analysis method, a Dongba text data electronic file generation method, an electronic device and a computer readable storage medium. BACKGROUND

[0002] The Dongba text belongs to a type of pictographic text, which is in a transition period from pictographic text to phonetic text. This means that, on the one hand, the Dongba text has not yet developed into a type of ideographic text with relatively fixed and unified character forms, and there are many problems such as large differences in writing individualization and many variant characters. On the other hand, the Dongba text may not yet have a standardized public data set. Moreover, a large number of Dongba text-related document materials are very old handwritten paper materials, and are stored in major libraries and museums around the world, further increasing the difficulty of collecting Dongba text samples.

[0003] With the popularization and sharing of electronic files, there should be a more convenient and efficient way to collect Dongba text samples. SUMMARY

[0004] Therefore, the present application aims to provide a document analysis method, a Dongba text data electronic file generation method, an electronic device and a computer readable storage medium, which can effectively analyze the layout structure of a document image and facilitate the separate analysis and extraction of each character in the Dongba text data.

[0005] To achieve the above-mentioned purpose, the technical solution adopted by the present application is to provide a document analysis method. The document analysis method comprises: acquiring a document image; analyzing the global structure of the document image, identifying the element area and the structural area of the document image; locally analyzing the element area, identifying the target text and the paragraph distribution in the document image; the target text and non-target text are contained in the paragraph; and the non-target text in the paragraph is segmented.

[0006] In an embodiment of the present application, the local analysis on the element region, the identification of the target text and the paragraph distribution in the document image comprises: obtaining the projection of the document image in a first direction and performing segmentation to obtain first direction text blocks; the first direction is parallel to the text layout direction in the document image, and the distribution of each first direction text block is taken as the paragraph distribution; obtaining the height feature of the first direction text block in a second direction; the first direction is perpendicular to the second direction; in response to the height feature of the first direction text block in the second direction meeting a first preset condition, it is determined that the first direction text block contains target text; obtaining the projection of the first direction text block containing the target text in the second direction and performing segmentation to obtain a plurality of intermediate text blocks; in response to the intermediate text blocks meeting a subdivision condition, performing subdivision segmentation processing on the intermediate text blocks to form new intermediate text blocks until the new intermediate text blocks do not meet the subdivision condition, and obtaining target text blocks; and the remaining text blocks are taken as non-target text blocks.

[0007] In an embodiment of the present application, the height of the target text in the second direction is higher than the height of the non-target text in the second direction; the preset condition is that the height of the first direction text block in the second direction is greater than a height threshold; and the subdivision segmentation condition comprises that there is a distance between adjacent texts in the intermediate text block which is greater than a distance threshold.

[0008] In an embodiment of the present application, after obtaining the target text blocks, the method further comprises: obtaining an interval parameter between adjacent text blocks; in response to the interval parameter being less than an interval threshold, merging the adjacent text blocks until the interval parameter between the adjacent text blocks is greater than the interval threshold; and taking the text block containing the original target text block as the target text block.

[0009] In an embodiment of the present application, the element region comprises the target text blocks and the non-target text blocks; and the segmentation of the non-target text in the paragraph comprises: performing clustering processing on the non-target text blocks to classify the non-target text.

[0010] In an embodiment of the present application, the clustering processing on the non-target text blocks comprises: obtaining the distribution density of each non-target text block based on the length of the non-target text block in the first direction and / or the second direction; the first direction is perpendicular to the second direction; generating a density set and initializing a center point set; taking the non-target text block with the maximum distribution density as the initial center point, and calculating the text blocks belonging to the neighborhood of the non-target text block with the maximum distribution density; cutting from the density set to the center point set; calculating the neighborhood text blocks of the non-target text block with the maximum new distribution density in the density set and cutting to the center point set until the number of elements in the center point set matches the number of classification clusters.

[0011] In an embodiment of the present application, the obtaining the document image comprises: obtaining an original document image; scaling the original document image to a target size to form a normalized image; obtaining an initial gray threshold value of iterative training; comparing the initial gray threshold value with a gray value of each pixel point of the normalized image to divide the normalized image into a first sub-region and a second sub-region; obtaining an average gray value of each pixel point of the first sub-region and an average gray value of each pixel point of the second sub-region respectively, and obtaining an average value of the two average gray values to obtain a gray process value; participating in the iterative training by using the gray process value until a difference between the gray process values obtained by adjacent iterative training is less than a difference threshold value, and taking the gray process value obtained by the later iterative training as the gray threshold value; and performing binaryzation processing on the normalized image by using the gray threshold value to obtain a document image participating in document analysis.

[0012] To achieve the above object, the present application employs another technical solution, which provides a method for generating an electronic file of Tibetan-Buddhist materials. The method for generating the electronic file of Tibetan-Buddhist materials comprises: collecting a document image; analyzing the document image by using the document analysis method in any one of the above embodiments; and generating the electronic file based on the analysis data.

[0013] To achieve the above object, the present application employs another technical solution, which provides an electronic device. The electronic device comprises: a processor configured to execute instructions to implement the document analysis method in any one of the above embodiments, or the method for generating the electronic file of Tibetan-Buddhist materials in any one of the above embodiments.

[0014] To achieve the above object, the present application employs another technical solution, which provides a computer readable storage medium. The computer readable storage medium is configured to store instructions / program data, which can be executed to implement the document analysis method in any one of the above embodiments, or the method for generating the electronic file of Tibetan-Buddhist materials in any one of the above embodiments.

[0015] Compared with the prior art, the present application can analyze the global structure of a document image, and identify element regions and structural regions of the document image. The element regions include a text part, and the structural regions include a header and a footer. In this way, the layout structure of the document image can be effectively analyzed, so that the pages of the electronic file can be adapted when the electronic file is generated. In addition, the present application can identify the positions of target characters and non-target characters in the document image respectively, which is equivalent to distinguishing Tibetan-Buddhist characters from other characters, so that the characters of the Tibetan-Buddhist materials and other characters can be analyzed and extracted separately when the electronic file is generated. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to make the technical solutions in the embodiments of the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description only only some embodiments of the present application, and all other embodiments obtained by those of ordinary skill in the art without creative work based on the accompanying drawings are within the protection scope of the present application.

[0017] Figure 1 is a flowchart of an embodiment of the method for generating electronic files of Dongba text data of the present application;

[0018] Figure 2 is a flowchart of an embodiment of the document analysis method of the present application;

[0019] Figure 3 is a flowchart of another embodiment of the document analysis method of the present application;

[0020] Figure 4 is a flowchart of the document analysis method shown in Figure 3 ;

[0021] Figure 5 is a distribution diagram of an embodiment of the clustering processing of the present application;

[0022] Figure 6 is a structural diagram of an embodiment of the electronic device of the present application;

[0023] Figure 7 is a structural diagram of an embodiment of the computer readable storage medium of the present application. DETAILED DESCRIPTION

[0024] The technical solutions of the present application will be described clearly and completely by specific embodiments. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work are within the protection scope of the present application.

[0025] To solve the technical problem that the Dongba text sample collection is difficult in the prior art. The present application provides a document analysis method, a method for generating electronic files of Dongba text data, an electronic device and a computer readable storage medium. The document analysis method comprises: acquiring a document image; analyzing the global structure of the document image, identifying the element area and the structural area of the document image; locally analyzing the element area, identifying the target text and the paragraph distribution in the document image; the target text and non-target text are contained in the paragraph; and the non-target text in the paragraph is segmented. The present application will be described in detail below.

[0026] Please refer to Figure 1 ,Figure 1 is a flowchart of an embodiment of the method for generating an electronic file of Dongba script materials. It should be noted that the method for generating an electronic file of Dongba script materials described in this embodiment is not limited to the following steps:

[0027] S101: Collecting document images.

[0028] In this embodiment, the Dongba script materials are paper Dongba script books, dictionaries, etc. Each page of the Dongba script materials is photographed, and the photographed image is the document image.

[0029] For example, the document image can be collected from Naxi Pictographic Character Dictionary, Moxi Pictographic Character Dictionary, etc.

[0030] S102: Analyzing the document image using a document analysis method.

[0031] In this embodiment, the collected document images are analyzed using a document analysis method to analyze the global structure and local details of the document image. The specific document analysis method will be described in detail later.

[0032] S103: Generating an electronic file based on the analysis data.

[0033] In this embodiment, after the analysis of the document image is completed, an electronic file can be generated based on the analysis data. The analysis data can include the relative positional relationship of each character in the document image.

[0034] The electronic file can be a non-editable file such as a picture or a pdf document, or an editable file such as a word document or a note, without limitation.

[0035] For example, after analyzing the document image using the document analysis method, a non-editable file such as a picture can be generated based on the analysis data, and the picture can be used as the final output electronic file. The relative positions of the characters in the picture are accurate, and the relative position information of the characters can be included. Further, the picture can be used as a sample in the sample set for character extraction to obtain an editable file as an electronic file. Alternatively, the character extraction can be performed using methods such as OCR (Optical Character Recognition), or other existing character extraction methods, which will not be described here.

[0036] At the same time, the electronic file can be used as an electronic file of Dongba script materials for circulation, and the format is better than that of the directly collected document image.

[0037] Optionally, the target characters and non-target characters obtained by the document analysis method can be directly copied to the corresponding positions according to the distribution mode, which is not limited herein.

[0038] The target characters are Dongba characters, and the non-target characters can be annotated Chinese characters, international phonetic alphabets, English, Tibetan, and traditional Chinese characters, which are not limited herein.

[0039] The document analysis method of the present application is described in detail below. The document analysis method of the present application can be used to analyze Dongba documents, other types of books, magazines, dictionaries, and the like, which are not limited herein. In the following, the document analysis method of the present application is applied to the generation method of Dongba document electronic files, which is used as an example for illustration, but the application scenarios of the document analysis method are not limited. In other embodiments, the document analysis method of the present application can also be used to analyze documents such as oracle bone inscriptions, which are not limited herein.

[0040] Please refer to Figure 2 , Figure 2 is a flowchart of an embodiment of the document analysis method of the present application. It should be noted that the document analysis method described in this embodiment is not limited to the following steps:

[0041] S201: Obtain a document image.

[0042] In this embodiment, the document image is a picture of a document to be analyzed, such as Dongba documents. The document image can be a raw document image obtained by directly shooting the document to be analyzed, or a document image obtained by preprocessing the raw document image, which is not limited herein.

[0043] S202: Analyze the global structure of the document image, and identify the element area and the structural area of the document image.

[0044] In this embodiment, after obtaining the document image, the global structure of each document image can be analyzed to identify the element area and the structural area of the document image.

[0045] The element area can refer to the text content part in the document image, and the structural area can refer to the header, footer, page number identifier, and the like, which are not limited herein.

[0046] S203: Perform local analysis on the element area to identify the target characters and the paragraph distribution in the document image; the paragraph contains target characters and non-target characters.

[0047] In this embodiment, the element area is locally analyzed to identify the target characters and the paragraph distribution in the document image. The paragraph contains target characters and / or non-target characters.

[0048] The non-target character can be a note character, a pronunciation note, or the like of the target character.

[0049] The target character and the non-target character are usually obviously different, for example, in font size, thickness, or the like. Therefore, after the target character in the document image is recognized, the remaining text content can be considered as the non-target character. The recognized paragraph distribution can serve as a reference for the layout of the pages in the electronic file when the electronic file is reconstructed, and adapt to the content layout of the document image.

[0050] S204: segmenting the non-target characters in the paragraph.

[0051] In the present embodiment, after the target character and the paragraph distribution are recognized, each non-target character in the paragraph is segmented, that is, each non-target character is independent, so as to facilitate the analysis and extraction of each non-target character.

[0052] It can be seen that, in the present embodiment, the global structure of the document image can be obtained, which serves as a reference for the layout of the pages in the electronic file when the electronic file is reconstructed. In addition, each target character and non-target character is segmented, so as to facilitate the analysis and extraction of each target character, and facilitate the analysis and extraction of the non-target character, improve the functionality after the document analysis, and enrich the flexibility of the analysis data in use.

[0053] Please refer to Figure 3 and Figure 4 , Figure 3 is a flowchart of another embodiment of the document analysis method of the present application, Figure 4 is Figure 3 the effect diagram of the document analysis method shown in FIG. 8. It should be noted that the method for generating the Dongba text electronic file described in the present embodiment is not limited to the following steps:

[0054] Obtain the original document image. The original document image refers to the image obtained by directly photographing or scanning the Dongba text material. In other words, the original document image has not been processed.

[0055] Since the size of the collected original document image can be different, it is necessary to adapt to different sizes of the original document image when analyzing each original document image respectively. Therefore, in order to improve the efficiency of document analysis, the original document image can be scaled to a target size to form a standardized image in the present embodiment.

[0056] In a popular way, the size of the original document image can be calculated, compared and calculated with the target size to obtain the scaling rate required for scaling the original document image to the standardized image. The specific scaling rate formula is as follows:

[0057] (Formula 1-1)

[0058] (Formula 1-2)

[0059] wherein, x represents the length of the first direction; y represents the length of the second direction; the first direction is perpendicular to the second direction; the size of the original document image is x0*y0; the target size is x1*y1; S x represents the scaling rate of the original image in the first direction; S y represents the scaling rate of the original image in the second direction.

[0060] wherein, the first direction is parallel to the text layout direction in the document image. Generally, the text layout direction is usually divided into vertical right writing, horizontal left writing, etc.

[0061] Taking the text layout direction as horizontal left writing as an example, the reading direction of the reader is the horizontal direction, and the reading is from the left side of the document. When the document image is correctly placed, that is, it conforms to the normal reading direction, the first direction is the horizontal direction, and the second direction is the vertical direction. The first direction and the second direction in the following are the same as this, and will not be repeated here.

[0062] In an alternative embodiment, if the text layout direction is inclined, then the first direction is parallel to the inclined text direction, in other words, the first direction is parallel to the text layout direction, which will not be repeated here.

[0063] In this way, the scaling formula of the original image scaling from the original size to the normalized image of the target size is as follows:

[0064] (Formula 1-3)

[0065] wherein, the size of the original document image is x0*y0; S x , S y are the scaling rates obtained by formula 1-1 and formula 1-2.

[0066] After obtaining the normalized image, the normalized image can be converted into a binary image to simplify the complexity of the document. Based on the gray value of each pixel point in the normalized image, a gray threshold value for binary processing can be obtained, and the normalized image is binary processed based on the gray threshold value to obtain a document image for participating in document analysis.

[0067] Specifically, an initial gray threshold value of iterative training can be obtained. Optionally, the initial gray threshold value can be randomly selected; or the gray values of each pixel point in the normalized image are obtained, and the average value of the maximum gray value and the minimum gray value is calculated. As shown in the following formula:

[0068] (Formula 2-1)

[0069] Where Max represents the maximum gray value of each pixel in the normalized image; Min represents the minimum gray value of each pixel in the normalized image; and T0 represents the initial gray threshold.

[0070] The grayscale values ​​of each pixel in the normalized image are compared with an initial grayscale threshold. The normalized image is then segmented using the initial grayscale threshold to form a first sub-region and a second sub-region, which is equivalent to segmenting the target image and the background image. The first sub-region consists of all pixels with a grayscale value greater than or equal to T0, and the second sub-region consists of all pixels with a grayscale value less than T0.

[0071] The average grayscale value of each pixel in the first sub-region and the average grayscale value of each pixel in the second sub-region are obtained respectively. The average of the two values ​​is then used to obtain the grayscale value. The specific formula is as follows:

[0072] (Equation 2-2)

[0073] Where T1 is the grayscale value; μ1 is the average grayscale value of each pixel in the first sub-region; and μ2 is the average grayscale value of each pixel in the second sub-region.

[0074] Grayscale process values ​​are used in iterative training. Each iteration of training involves segmenting the normalized image using grayscale process values ​​to form a first sub-region and a second sub-region. New grayscale process values ​​are obtained based on the average grayscale values ​​of the first and second sub-regions, and these new grayscale process values ​​are used in the next iteration of training.

[0075] The grayscale process values ​​are used in iterative training until the difference between the grayscale process values ​​obtained in adjacent training iterations is less than a difference threshold. The grayscale process value obtained in the subsequent training iteration is then used as the grayscale threshold. The difference threshold can be 0.1, 0.25, 0.5, 0.8, etc., and is not limited here.

[0076] Taking a difference threshold of 0.5 as an example, the termination condition for iterative training is as follows:

[0077] (Equation 2-3)

[0078] Where i represents the number of training iterations, and i is a positive integer, i.e., i = 1, 2, 3, ...; T i T i+1 This represents the grayscale process value obtained in adjacent training iterations.

[0079] When T i T i+1 If the conditions shown in Formula 2-3 are met, then T will be... i+1 As the grayscale threshold, otherwise T i+1Assigning T to i and calculate the new T i+1 .

[0080] The normalized image is binarized by using the gray threshold value to obtain the document image for document analysis. The gray threshold value obtained through iterative training can be considered as the optimal gray threshold value adapted to the current normalized image. Since the gray value distribution of each pixel point in the normalized image can be uneven, when the average value of each gray value is used as the gray threshold value for binarization, the accuracy of the division of the text area and the background area can be poor, that is, the reliability of the binary document image obtained by binarization is low, which further affects the reliability of document analysis.

[0081] After obtaining the document image, the global structure of the document image can be analyzed, and the element area and the structural area of the document image can be identified. The element area can refer to the text part of the document image, including target text and non-target text; the structural area can be the header, footer, etc.

[0082] Taking the East-Ba language data "Naxi-English-Chinese Glossary" as an example, in the "Naxi-English-Chinese Glossary", in addition to the East-Ba pictographic characters, other characters are all printed characters. That is, when the book is typeset, the position of the document header is relatively fixed, but considering the tilt, displacement, etc. in the document image acquisition process, the global structure of the document image can be analyzed, and the position of the header in the document can be counted. For example, by counting the document images of all the text pages in the document, it is found that the header y-coordinate of the document image is located in the [1, 450] pixel range. The value of all pixel points with a y-coordinate less than 450 pixels in the document image can be set to 1 (white) in combination with the header position feature, so as to effectively remove the header of the document, that is, to eliminate the structural area of the document image, which is conducive to reducing the interference in the analysis of the element area and improving the reliability of the document analysis. Further, based on the header position feature, the structural area of the electronic file can be automatically constructed when the electronic file is generated.

[0083] After identifying the element area of the document image, the element area can be locally analyzed. The target text and the paragraph distribution in the document image are identified; the paragraph contains target text and non-target text.

[0084] Specifically, the document image is projected in the first direction and segmented to obtain the first direction text block, which is equivalent to obtaining the reading order of each text block in actual reading. The distribution of each first direction text block is the paragraph distribution.

[0085] The height feature of the first direction text block in the second direction is acquired, so as to analyze the features and attributes of the text character block. The first direction is perpendicular to the second direction; for example, the first direction can be the horizontal direction and the second direction can be the vertical direction relative to the text paragraph. Optionally, the horizontal projection algorithm can be used to segment the document image to obtain the first direction text block.

[0086] In response to the height feature of the first direction text block in the second direction meeting the first preset condition, it is determined that the target character is contained in the first direction text block. Optionally, the height of the target character in the second direction is higher than the height of the non-target character in the second direction; and the preset condition is that the height of the first direction text block in the second direction is greater than a height threshold.

[0087] In other words, it is equivalent to finding the difference between the single text line and the text line containing the Dongba pictograph by analyzing the height feature of the text character block - the height of the text line containing the Dongba character is generally higher, obtaining the height range of the single text line, and realizing the separation of the single text line and the text line containing the Dongba pictograph.

[0088] The projection of the first direction text block containing the target character in the second direction is obtained and segmented to obtain a plurality of intermediate text blocks. In response to the intermediate text block meeting the subdivision condition, the intermediate text block is subjected to a subdivision segmentation process to form a new intermediate text block, until the new intermediate text block does not meet the subdivision condition, to obtain a target character block; and the remaining character blocks are non-target character blocks. That is, the relative position information between the text blocks can be obtained in the present application, so as to facilitate integration in the correct reading order, and the relative positions between the character blocks in the electronic file can be similar to those in the document image.

[0089] The subdivision segmentation process is, for example, first direction segmentation and second direction segmentation of the intermediate text block. The subdivision segmentation condition includes that the distance between adjacent characters in the intermediate text block is greater than a distance threshold.

[0090] The reason for the subdivision segmentation process is that in addition to the Dongba characters and Chinese characters, the document can also include international phonetic alphabet, English, Tibetan and traditional Chinese characters and other fonts, so that part of the text line cannot be completely separated. Therefore, after the horizontal projection segmentation is completed, the projection segmentation algorithm is used to further identify the large character block, and the large character block not containing the Dongba character is removed. Moreover, each character can be obtained as a separate character block as much as possible, so as to facilitate character recognition of the characters that can be recognized, and to obtain an electronic file with higher operability. For example, the user can reach the target position in the electronic file by searching for the annotation content, specific characters, etc., which will not be described here.

[0091] Considering that the Dongba characters include more combinations of up-down and left-right structure, that is, have combined characters, in the process of projection segmentation, the Dongba characters are prone to over-segmentation. Therefore, the interval parameters between adjacent character blocks can be obtained. In response to the interval parameter being less than an interval threshold, the adjacent character blocks are merged until the interval parameters between the adjacent character blocks are all greater than the interval threshold. The character block containing the original target character block is taken as the target character block.

[0092] Taking 5 pixels as an example of the interval threshold, when the horizontal or vertical segmentation gap is less than 5 pixels, it is considered that there is over-segmentation, and the adjacent character blocks should be merged, and then the position information of the Dongba characters is determined, that is, the distribution of the target character block is determined.

[0093] Further, the implementation of non-target characters in the segmented paragraph is specifically described below.

[0094] As described above, the element area includes the target character block and the non-target character block. The non-target character block can be clustered and processed, and the non-target characters can be classified. For example, the K-means clustering algorithm can be used to classify other character blocks in the document, segment the text line, and extract individual characters.

[0095] Specifically, the distribution density of each non-target character block is obtained based on the length of the non-target character block in the first direction and / or the second direction. The first direction is perpendicular to the second direction. Specifically, as shown in the following formula:

[0096] (Formula 3-1)

[0097] Wherein, h i and h j are the heights of the i th and j th character blocks, dis(h i , h j ) is the Euclidean distance between h i and h j , σ is a density parameter, P ij is all paths between the connection data h i and h j , and l is the number of data in the path connecting the data points h i and h j .

[0098] A density set is generated and a center point set is initialized. As shown in the following formula:

[0099] (Formula 3-2)

[0100] Wherein, D is the density set; M is the center point set.

[0101] The non-target character block with the maximum distribution density is selected as an initial center point, and character blocks belonging to the neighborhood of the non-target character block with the maximum distribution density are calculated.

[0102] (Formula 3-3)

[0103] (Formula 3-4)

[0104] wherein aver(dis) represents the average value of distances between all character blocks, and coefR is an adjustment coefficient of the neighborhood radius.

[0105] After the initial center point is obtained, the initial center point is cut from the density set to the center point set, that is, the initial center point is added to the center point set, and the initial center point is deleted from the center point set.

[0106] The neighborhood character blocks of the non-target character block with the maximum new distribution density in the density set are repeatedly calculated, and the neighborhood points of the center points in the center point set need not be considered in the calculation. After the new neighborhood character blocks are obtained, the target character block with the maximum distribution density is cut to the center point set, until the number of elements in the center point set matches the number of classification clusters, and the segmentation of the non-target character block is realized. The number of elements in the center point set matches the number of classification clusters, and the specific formula is shown in the following formula:

[0107] (Formula 3-5)

[0108] wherein M represents the center point set, |M| represents the number of elements in the center point set, and k represents the number of classification clusters, for example, the number of character types in the non-target character.

[0109] It can be seen that the present application is aimed at the structural features of Dongba character documents such as dictionaries, realizes the analysis of the structure of Dongba documents, and extracts the text lines, text paragraphs, independent Dongba pictograph characters, Chinese characters, Tibetan characters and English letters in the documents. Moreover, the present application can adapt to the structural analysis and character extraction of most Dongba documents on the market at present, and can lay a good foundation for establishing the character library / sample library of Dongba characters.

[0110] Please refer to Figure 6 , Figure 6 is a structural schematic diagram of an embodiment of the electronic device.

[0111] In an embodiment, the electronic device 10 comprises a processor 11, which can also be referred to as a CPU (Central Processing Unit). The processor 11 can be an integrated circuit chip having signal processing capability. The processor 11 can also be a general purpose processor, a DSP, an ASIC, an FPGA, or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof. The general purpose processor can be a microprocessor or the processor 11 can also be any conventional processor.

[0112] The electronic device 10 can further comprise a memory (not shown in the figure) for storing instructions and data required for the operation of the processor 11.

[0113] The processor 11 is configured to execute instructions to implement the document analysis method in any of the above embodiments, or the method for generating an electronic file of Tibetan script materials in any of the above embodiments.

[0114] Please refer to Figure 7 , Figure 7 is a structural schematic diagram of an embodiment of the computer readable storage medium of the present application.

[0115] In an embodiment, the computer readable storage medium 20 is configured to store instructions / program data 21, which can be executed to implement the document analysis method in any of the above embodiments, or the method for generating an electronic file of Tibetan script materials in any of the above embodiments, which will not be repeated here.

[0116] In the several embodiments of the present application, it should be understood that the disclosed system, apparatus, and method can be implemented in other ways. For example, the apparatus embodiments described above are merely schematic. The division of the modules or units is a logical function division, and another division mode can be used in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices, or units, and can be electrical, mechanical, or other forms.

[0117] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.

[0118] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0119] The integrated unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a computer readable storage medium 20 and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned computer readable storage medium 20 includes a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, a server, and various media that can store program codes.

[0120] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method of document analysis, characterized by, The method comprises: obtaining a document image; analyzing a global structure of the document image, identifying an element region and a structure region of the document image; locally analyzing the element region, identifying target text and paragraph distribution in the document image; the paragraph contains target text and non-target text; the locally analyzing the element region, identifying target text and paragraph distribution in the document image comprises: obtaining a first direction projection of the document image and segmenting to obtain a first direction text block; wherein the first direction is parallel to the text layout direction in the document image, and the distribution of each first direction text block is taken as the paragraph distribution; obtaining the height feature of the first direction text block in the second direction; the first direction is perpendicular to the second direction; in response to the height feature of the first direction text block in the second direction meeting a first preset condition, it is determined that the first direction text block contains the target text; obtaining the projection of the first direction text block containing the target text in the second direction and segmenting to obtain a plurality of intermediate text blocks; in response to the intermediate text block meeting a subdivision condition, performing subdivision segmentation processing on the intermediate text block to form a new intermediate text block, until the new intermediate text block does not meet the subdivision condition, to obtain a target text block; the remaining text blocks are taken as non-target text blocks; the height of the target text in the second direction is higher than the height of the non-target text in the second direction; the preset condition is that the height of the first direction text block in the second direction is greater than a height threshold; the subdivision segmentation condition includes that the distance between adjacent characters in the intermediate text block is greater than a distance threshold segmenting the non-target text in the paragraph.

2. The document analysis method of claim 1, wherein, After obtaining the target text block and the target text block, the method further comprises: obtaining an interval parameter between adjacent text blocks; in response to the interval parameter being less than an interval threshold, merging adjacent text blocks until the interval parameter between adjacent text blocks is greater than the interval threshold; taking a text block containing an original target text block as a target text block.

3. The document analysis method of claim 1, wherein, The element region includes target text blocks and non-target text blocks; the segmenting the non-target text in the paragraph comprises: performing clustering processing on the non-target text blocks to classify the non-target text.

4. The document analysis method of claim 1, wherein, The clustering processing on the non-target text blocks comprises: obtaining the distribution density of each non-target text block based on the length of the non-target text block in the first direction and / or the second direction; the first direction is perpendicular to the second direction; generating a density set and initializing a center point set; taking a non-target text block with the maximum distribution density as an initial center point, calculating the text blocks belonging to the neighborhood of the non-target text block with the maximum distribution density; cutting from the density set to the center point set; calculating the neighborhood text blocks of the non-target text block with the maximum new distribution density in the density set, and cutting to the center point set until the number of elements in the center point set matches the number of classification clusters.

5. The document analysis method of claim 1, wherein, The method comprises: obtaining an original document image; scaling the original document image to a target size to form a normalized image; obtaining an initial gray scale threshold value of iterative training; comparing the initial gray scale threshold value with the gray scale value of each pixel point of the normalized image, and dividing the normalized image into a first sub-region and a second sub-region; obtaining the average gray scale value of each pixel point of the first sub-region and the average gray scale value of each pixel point of the second sub-region, and obtaining the average value of both to obtain a gray scale process value; participating in iterative training using the gray scale process value until the difference between the gray scale process values obtained by the iterative training of adjacent times is less than a difference threshold value, and taking the gray scale process value obtained by the subsequent iterative training as a gray scale threshold value; using the gray scale threshold value to perform binary processing on the normalized image to obtain the document image for document analysis.

6. A method for generating an electronic file of Tibetan Buddhist materials, characterized in that, comprising: collecting a document image; analyzing the document image using the document analysis method according to any one of claims 1-5; generating an electronic file based on the analysis data.

7. An electronic device, comprising: comprising: a processor configured to execute instructions to implement the document analysis method according to any one of claims 1-5, or the method for generating an electronic file of Dongba script material according to claim 6.

8. A computer-readable storage medium, characterized in that, the computer readable storage medium is configured to store instructions / program data that can be executed to implement the document analysis method according to any one of claims 1-5, or the method for generating an electronic file of Dongba script material according to claim 6.

Citation Information

Patent Citations

  • Method for quickly calculating layout structure of document image

    CN102073862A

  • Method and system for analyzing table in PDF document, storage medium and electronic equipment

    CN110472208A