A document classification method and device based on black labels
By printing black labels on documents and using scanning technology to identify and filter their numbers, the existing problems of low efficiency and poor accuracy in document classification are solved, and efficient and accurate automated classification is achieved.
Patent Information
- Application Number
- CN202010880602.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-27
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-08-27
AI Technical Summary
Existing document classification methods mostly rely on manual labor or need to extract text information, resulting in low efficiency, high cost, high complexity, and prone to misclassification.
Using a document classification method based on black labels, documents are classified by printing different numbers of black rectangular color blocks, scanning and preprocessing technology is used to identify and filter these color blocks, and their number is counted to determine the document type, simplifying the calculation process and reducing complexity.
It realizes automatic classification, improves work efficiency, reduces the amount of calculation and equipment requirements, has high classification accuracy, and the accuracy rate can reach more than 99%, avoiding the impact of misidentification and light interference.
Smart Images

Figure CN112052766B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a document classification method and device based on black labels, belonging to the field of image recognition. Background Art
[0002] Currently, document classification is mostly done manually, which is time-consuming, inefficient, and wastes human resources. In addition, manual classification is prone to misclassification.
[0003] Most existing document classification methods extract the text information of the document first, and then classify it according to the text information. Or directly input the document image into the neural network model for classification, which requires a lot of data and time for training, and is costly and complex. Summary of the invention
[0004] In order to solve the problems existing in the above-mentioned prior art, the present invention provides a document classification method and device based on black labels, which classifies documents according to the number of black labels. The method is simple and easy to implement, and there is no need to extract text information from images for a large number of complicated calculations. The method has a small amount of calculation, low complexity, low requirements for classification equipment, strong versatility, high classification accuracy, and can significantly improve work efficiency.
[0005] The technical solution of the present invention is as follows:
[0006] Technical solution 1:
[0007] A document classification method based on black labels comprises the following steps:
[0008] Printing a black label on the document to be classified, wherein the black label includes a plurality of black rectangular color blocks of equal size, parallel and equidistant, and printing different numbers of black rectangular color blocks according to the document type;
[0009] Scan the documents that need to be classified and obtain the document images with black labels;
[0010] Preprocessing the document image;
[0011] Identify black rectangular blocks in pre-processed document images;
[0012] Filter the identified black rectangular blocks;
[0013] The number of black rectangular color blocks that pass the screening is counted, and the type of the current document is determined according to the number of black rectangular color blocks that pass the screening.
[0014] Furthermore, the preprocessing is: gray-scale processing of the document image.
[0015] Furthermore, the specific steps of identifying the black rectangular blocks in the pre-processed document image are as follows:
[0016] Presetting a brightness difference threshold for reducing light interference;
[0017] A field is preset and divided into a first field and a second field. The pixels in the grayscale image are traversed, and the grayscale average values of the first field and the second field are calculated for each pixel. If the difference between the grayscale average values of the two exceeds the brightness difference threshold, the pixel is set to white, otherwise it is set to black. Finally, several white rectangular blocks are obtained for marking black rectangular blocks.
[0018] Furthermore, the area is equally divided vertically into a first area and a second area, and finally a plurality of white rectangular color blocks marking the horizontal outlines of the black rectangular color blocks are obtained.
[0019] Furthermore, the area is equally divided into a first area and a second area on the left and right, and finally a plurality of white rectangular color blocks marking the vertical outlines of the black rectangular color blocks are obtained.
[0020] Furthermore, the specific steps for screening the identified black rectangular blocks are as follows:
[0021] The minimum circumscribed rectangle of the white rectangular color block is extracted, and a threshold is preset to determine whether the size of the white rectangular color block area is reasonable. If the difference between the side length of the minimum circumscribed rectangle and the side length of the black rectangular color block exceeds the threshold, the white rectangular color block is deleted.
[0022] Furthermore, the method further includes screening the white rectangular color block, and the specific steps are as follows:
[0023] Preset a threshold for rectangularization detection;
[0024] The white pixels in the minimum bounding rectangle are counted, and if the ratio of the number of white pixels in the minimum bounding rectangle to the total number of pixels in the minimum bounding rectangle is lower than the threshold for rectangularization detection, the white rectangular color block is deleted.
[0025] Furthermore, the specific steps for counting the number of black rectangular blocks that pass the screening are as follows:
[0026] Determine whether the minimum circumscribed rectangles are parallel, merge the contours of the parallel minimum circumscribed rectangles, and generate several contour groups; select the contour group according to the placement orientation of the black label, and count the number of white rectangular blocks in the contour group, which is the number of black rectangular blocks that pass the screening.
[0027] Furthermore, the specific steps for determining whether the minimum circumscribed rectangles are parallel are:
[0028] Preset an angle threshold;
[0029] Connect the centroids of two minimum circumscribed rectangles to generate a straight line; use the horizontal line or vertical line as the reference line, calculate the angle between the straight line and the reference line, recorded as ∠A; calculate the angles between the lengths of the two adjacent minimum circumscribed rectangles and the reference line, recorded as ∠B and ∠C; if the angle difference between ∠A and ∠B and the angle difference between ∠A and ∠C do not exceed the angle threshold, the two rectangles are considered parallel; compare all minimum circumscribed rectangles pairwise according to the above steps.
[0030] Technical solution 2:
[0031] A device for a document classification method based on black labels includes a memory and a processor, wherein the memory stores instructions, and the instructions are suitable for being loaded by the processor and executing the following steps:
[0032] Printing a black label on the document to be classified, wherein the black label includes a plurality of black rectangular color blocks of equal size, parallel and equidistant, and printing different numbers of black rectangular color blocks according to the document type;
[0033] Scan the documents that need to be classified and obtain the document images with black labels;
[0034] Preprocessing the document image;
[0035] Identify black rectangular blocks in pre-processed document images;
[0036] Filter the identified black rectangular blocks;
[0037] The number of black rectangular color blocks that pass the screening is counted, and the type of the current document is determined according to the number of black rectangular color blocks that pass the screening.
[0038] Furthermore, the preprocessing is: gray-scale processing of the document image.
[0039] Furthermore, the specific steps of identifying the black rectangular blocks in the pre-processed document image are as follows:
[0040] Presetting a brightness difference threshold for reducing light interference;
[0041] A field is preset and divided into a first field and a second field. The pixels in the grayscale image are traversed, and the grayscale average values of the first field and the second field are calculated for each pixel. If the difference between the grayscale average values of the two exceeds the brightness difference threshold, the pixel is set to white, otherwise it is set to black. Finally, several white rectangular blocks are obtained for marking black rectangular blocks.
[0042] Furthermore, the area is equally divided vertically into a first area and a second area, and finally a plurality of white rectangular color blocks marking the horizontal outlines of the black rectangular color blocks are obtained.
[0043] Furthermore, the area is equally divided into a first area and a second area on the left and right, and finally a plurality of white rectangular color blocks marking the vertical outlines of the black rectangular color blocks are obtained.
[0044] Furthermore, the specific steps for screening the identified black rectangular blocks are as follows:
[0045] The minimum circumscribed rectangle of the white rectangular color block is extracted, and a threshold is preset to determine whether the size of the white rectangular color block area is reasonable. If the difference between the side length of the minimum circumscribed rectangle and the side length of the black rectangular color block exceeds the threshold, the white rectangular color block is deleted.
[0046] Furthermore, the method further includes screening the white rectangular color block, and the specific steps are as follows:
[0047] Preset a threshold for rectangularization detection;
[0048] The white pixels in the minimum bounding rectangle are counted, and if the ratio of the number of white pixels in the minimum bounding rectangle to the total number of pixels in the minimum bounding rectangle is lower than the threshold for rectangularization detection, the white rectangular color block is deleted.
[0049] Furthermore, the specific steps for counting the number of black rectangular blocks that pass the screening are as follows:
[0050] Determine whether the minimum circumscribed rectangles are parallel, merge the contours of the parallel minimum circumscribed rectangles, and generate several contour groups; select the contour group according to the placement orientation of the black label, and count the number of white rectangular blocks in the contour group, which is the number of black rectangular blocks that pass the screening.
[0051] Furthermore, the specific steps for determining whether the minimum circumscribed rectangles are parallel are:
[0052] Preset an angle threshold;
[0053] Connect the centroids of two minimum circumscribed rectangles to generate a straight line; use the horizontal line or vertical line as the reference line, calculate the angle between the straight line and the reference line, recorded as ∠A; calculate the angles between the lengths of the two adjacent minimum circumscribed rectangles and the reference line, recorded as ∠B and ∠C; if the angle difference between ∠A and ∠B and the angle difference between ∠A and ∠C do not exceed the angle threshold, the two rectangles are considered parallel; compare all minimum circumscribed rectangles pairwise according to the above steps.
[0054] The present invention has the following beneficial effects:
[0055] 1. The present invention automatically classifies by scanning the black labels on paper documents. The solution is simple and easy to implement. There is no need to extract text information from the image for a large number of complicated calculations. The calculation amount is small, the complexity is low, the requirements for classification equipment are low, the versatility is strong, the classification accuracy is high, and the work efficiency can be significantly improved.
[0056] 2. The present invention identifies the outline of the black rectangular color block and uses the white rectangular color block as a mark, and at the same time solves the problem of deviation caused by the influence of light when identifying the black mark.
[0057] 3. The present invention screens the side length and rectangular degree of the white rectangular color block, effectively avoiding misidentification and the occurrence of multiple identification situations. After a large number of test results, the recognition accuracy can reach more than 99%.
[0058] 4. The present invention avoids the situation where other documents are mistakenly recognized due to improper placement of documents by users, thereby enhancing user experience and improving recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 is a flow chart of the present invention;
[0060] Figure 2 This is a schematic diagram of a black mark in a document image being mixed into white due to the influence of light;
[0061] Figure 3 It is the document image after grayscale processing;
[0062] Figure 4 It is a schematic diagram of the field;
[0063] Figure 5 It is a schematic diagram of a white rectangular color block;
[0064] Figure 6 is a schematic diagram of the minimum enclosing rectangle;
[0065] Figure 7 A schematic diagram of a situation where documents are improperly placed. DETAILED DESCRIPTION
[0066] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0067] Embodiment 1
[0068] See also Figure 1 , a document classification method based on black labels, comprising the following steps:
[0069] Print a black label on the document to be classified. The black label includes a plurality of black rectangular color blocks of equal size and parallel and equidistant. Different numbers of black rectangular color blocks are printed according to the document type. The black label can be as follows: Figure 7It can be placed above the document as shown, or at other edges of the document;
[0070] Scan the documents that need to be classified and obtain the document images with black labels;
[0071] Preprocessing the document image;
[0072] Identify black rectangular blocks in pre-processed document images;
[0073] Filter the identified black rectangular blocks;
[0074] The number of black rectangular color blocks that pass the screening is counted, and the type of the current document is determined according to the number of black rectangular color blocks that pass the screening.
[0075] The number of black labels is not limited, but in practical applications, such as banks, documents are generally divided into 2 to 5 categories.
[0076] The beneficial effect of this embodiment is that automatic classification is performed by scanning the black labels on paper documents. This solution is simple and easy to implement, and there is no need to extract text information from the image for a large number of complicated calculations. It has a small amount of calculation, low complexity, low requirements for classification equipment, strong versatility, high classification accuracy, and can significantly improve work efficiency.
[0077] Embodiment 2
[0078] Furthermore, the preprocessing is: graying the document image, and the result is as follows: Figure 3 shown.
[0079] Furthermore, the specific steps of identifying the black label are as follows:
[0080] Presetting a brightness difference threshold for reducing light interference;
[0081] A field is preset and divided equally into a first field and a second field. The pixels in the grayscale image are traversed, and the grayscale average values of the first field and the second field of each pixel are calculated respectively. If the difference between the grayscale average values of the two exceeds a brightness difference threshold (the threshold in this embodiment is set to 50), the pixel is set to white (i.e., the grayscale value is set to 255), otherwise it is set to black (i.e., the grayscale value is set to 0); finally, a number of white rectangular color blocks for marking black rectangular color blocks are obtained.
[0082] Furthermore, the area is equally divided vertically into a first area and a second area, and finally a plurality of white rectangular color blocks marking the horizontal outlines of the black rectangular color blocks are obtained.
[0083] Furthermore, the area is equally divided into a first area and a second area on the left and right, and finally a plurality of white rectangular color blocks marking the vertical outlines of the black rectangular color blocks are obtained.
[0084] like Figure 4 As shown, in this embodiment, the domain is set as a rectangle and divided equally into upper and lower parts. If the coordinates of point A are (x, y), then the domain of point A is a rectangle with (x, y), (x+a, y), (x, y+b), and (x+a, y+b) as the four vertices. Figure 4 In the equation (a), a=12, b=12.
[0085] When the grayscale average difference in the area exceeds the threshold, it indicates that a horizontal outline of a black rectangular block appears in the area. Figure 5 As shown, several white rectangular blocks are obtained above the horizontal contour.
[0086] The improvement of this embodiment is that the outline of the black rectangular color block is identified and the white rectangular color block is used as a mark, and the problem of deviation caused by light when identifying the black mark is solved. Figure 2 As shown, the reflection causes white to mix into the black rectangular block in the image, affecting the recognition accuracy.
[0087] Embodiment 3
[0088] Furthermore, the specific steps of screening the white rectangular color blocks are:
[0089] Furthermore, the specific steps for screening the identified black rectangular blocks are as follows:
[0090] Extract the minimum bounding rectangle of the white rectangular color block (there is an open source algorithm for extracting the minimum bounding rectangle), preset a threshold for judging whether the size of the white rectangular color block area is reasonable, and delete the white rectangular color block if the difference between the side length of the minimum bounding rectangle and the side length of the black rectangular color block exceeds the threshold. Experiments show that the best effect is achieved when the threshold is set to 10% of the side length of the black rectangular color block.
[0091] like Figure 6 As shown, in the process of first identifying the black rectangular color block, a white document placed on a black background was mistakenly identified, and a rectangle C3 identifying the horizontal outline of the white document was generated. In the screening process, it was found that the difference between the length of rectangle C3 and the length of the black rectangular color block exceeded the threshold, so it was deleted.
[0092] Furthermore, the white rectangular blocks are further screened, and the specific steps are as follows:
[0093] Preset a threshold for rectangularization detection;
[0094] Count the white pixels (i.e., the grayscale value is 255) in the minimum bounding rectangle. If the ratio of the number of white pixels in the minimum bounding rectangle to the total number of pixels in the minimum bounding rectangle is lower than the threshold for rectangularization detection (the threshold is 0.9), delete the white rectangular color block.
[0095] The improvement of this embodiment is that the side length and rectangular degree of the white rectangular color block are screened, which effectively avoids the occurrence of misidentification and multiple identification. After a large number of test results, the recognition accuracy can reach more than 99%.
[0096] Embodiment 4
[0097] Furthermore, the specific steps for counting the number of white rectangular blocks that pass the screening are as follows:
[0098] Determine whether the minimum circumscribed rectangles are parallel, merge the contours of the parallel minimum circumscribed rectangles, and generate several contour groups; select the contour group according to the placement orientation of the black label, and count the number of white rectangular blocks in the contour group, which is the number of black rectangular blocks that pass the screening.
[0099] like Figure 7 As shown, the black label is printed on the top of the document. Due to improper document placement during scanning, the black labels of other documents will appear above the current document. The number of white rectangular blocks in the bottom contour group shall prevail. When the black label is printed at the bottom of the document, the number of white rectangular blocks in the top contour group shall prevail. When the black label is printed on the left side of the document, the number of white rectangular blocks in the rightmost contour group shall prevail, and so on.
[0100] Furthermore, an angle threshold is preset;
[0101] Connect the centroids of two minimum circumscribed rectangles to generate a straight line; take the horizontal line or vertical line as the reference line, calculate the angle between the straight line and the reference line, recorded as ∠A; calculate the angles between the lengths of the two adjacent minimum circumscribed rectangles and the reference line, recorded as ∠B and ∠C; if the angle difference between ∠A and ∠B and the angle difference between ∠A and ∠C do not exceed the angle threshold (in this embodiment, the black label is printed on the top of the document, the horizontal line is used as the reference line, and the angle threshold is 8 degrees), the two rectangles are considered to be parallel; compare all minimum circumscribed rectangles in pairs according to the above steps.
[0102] The improvement of this embodiment is that it avoids the situation where other documents are mistakenly recognized due to improper placement of documents by the user, thereby enhancing the user experience and improving the recognition accuracy.
[0103] Embodiment 5
[0104] A device for a document classification method based on black labels includes a memory and a processor, wherein the memory stores instructions, and the instructions are suitable for being loaded by the processor and executing the following steps:
[0105] See also Figure 1 , print a black label on the document to be classified, the black label includes a plurality of black rectangular color blocks of equal size and parallel and equidistant, and print different numbers of black rectangular color blocks according to the document type; the black label can be as follows Figure 7 It can be placed above the document as shown, or at other edges of the document;
[0106] Scan the documents that need to be classified and obtain the document images with black labels;
[0107] Preprocessing the document image;
[0108] Identify black rectangular blocks in pre-processed document images;
[0109] Filter the identified black rectangular blocks;
[0110] The number of black rectangular color blocks that pass the screening is counted, and the type of the current document is determined according to the number of black rectangular color blocks that pass the screening.
[0111] The number of black labels is not limited, but in practical applications, such as banks, documents are generally divided into 2 to 5 categories.
[0112] The beneficial effect of this embodiment is that automatic classification is performed by scanning the black labels on paper documents. This solution is simple and easy to implement, and there is no need to extract text information from the image for a large number of complicated calculations. It has a small amount of calculation, low complexity, low requirements for classification equipment, strong versatility, high classification accuracy, and can significantly improve work efficiency.
[0113] Embodiment 6
[0114] Furthermore, the preprocessing is: graying the document image, and the result is as follows: Figure 3 shown.
[0115] Furthermore, the specific steps of identifying the black label are as follows:
[0116] Presetting a brightness difference threshold for reducing light interference;
[0117] A field is preset and divided equally into a first field and a second field. The pixels in the grayscale image are traversed, and the grayscale average values of the first field and the second field of each pixel are calculated respectively. If the difference between the grayscale average values of the two exceeds a brightness difference threshold (the threshold in this embodiment is set to 50), the pixel is set to white (i.e., the grayscale value is set to 255), otherwise it is set to black (i.e., the grayscale value is set to 0); finally, a number of white rectangular color blocks for marking black rectangular color blocks are obtained.
[0118] Furthermore, the area is equally divided vertically into a first area and a second area, and finally a plurality of white rectangular color blocks marking the horizontal outlines of the black rectangular color blocks are obtained.
[0119] Furthermore, the area is equally divided into a first area and a second area on the left and right, and finally a plurality of white rectangular color blocks marking the vertical outlines of the black rectangular color blocks are obtained.
[0120] like Figure 4 As shown, in this embodiment, the domain is set as a rectangle and divided equally into upper and lower parts. If the coordinates of point A are (x, y), then the domain of point A is a rectangle with (x, y), (x+a, y), (x, y+b), and (x+a, y+b) as the four vertices. Figure 4 In the equation (a), a=12, b=12.
[0121] When the grayscale average difference in the area exceeds the threshold, it indicates that a horizontal outline of a black rectangular block appears in the area. Figure 5 As shown, several white rectangular blocks are obtained above the horizontal contour.
[0122] The improvement of this embodiment is that the outline of the black rectangular color block is identified and the white rectangular color block is used as a mark, and the problem of deviation caused by light when identifying the black mark is solved. Figure 2 As shown, the reflection causes white to mix into the black rectangular block in the image, affecting the recognition accuracy.
[0123] Embodiment 7
[0124] Furthermore, the specific steps of screening the white rectangular color blocks are:
[0125] Furthermore, the specific steps for screening the identified black rectangular blocks are as follows:
[0126] Extract the minimum bounding rectangle of the white rectangular color block (there is an open source algorithm for extracting the minimum bounding rectangle), preset a threshold for judging whether the size of the white rectangular color block area is reasonable, and delete the white rectangular color block if the difference between the side length of the minimum bounding rectangle and the side length of the black rectangular color block exceeds the threshold. Experiments show that the best effect is achieved when the threshold is set to 10% of the side length of the black rectangular color block.
[0127] like Figure 6 As shown, in the process of first identifying the black rectangular color block, a white document placed on a black background was mistakenly identified, and a rectangle C3 identifying the horizontal outline of the white document was generated. In the screening process, it was found that the difference between the length of rectangle C3 and the length of the black rectangular color block exceeded the threshold, so it was deleted.
[0128] Furthermore, the white rectangular blocks are further screened, and the specific steps are as follows:
[0129] Preset a threshold for rectangularization detection;
[0130] Count the white pixels (i.e., the grayscale value is 255) in the minimum bounding rectangle. If the ratio of the number of white pixels in the minimum bounding rectangle to the total number of pixels in the minimum bounding rectangle is lower than the threshold for rectangularization detection (the threshold is 0.9), delete the white rectangular color block.
[0131] The improvement of this embodiment is that the side length and rectangular degree of the white rectangular color block are screened, which effectively avoids the occurrence of misidentification and multiple identification. After a large number of test results, the recognition accuracy can reach more than 99%.
[0132] Embodiment 8
[0133] Furthermore, the specific steps for counting the number of white rectangular blocks that pass the screening are as follows:
[0134] Determine whether the minimum circumscribed rectangles are parallel, merge the contours of the parallel minimum circumscribed rectangles, and generate several contour groups; select the contour group according to the placement orientation of the black label, and count the number of white rectangular blocks in the contour group, which is the number of black rectangular blocks that pass the screening.
[0135] like Figure 7 As shown, the black label is printed on the top of the document. Due to improper document placement during scanning, the black labels of other documents will appear above the current document. The number of white rectangular blocks in the bottom contour group shall prevail. When the black label is printed at the bottom of the document, the number of white rectangular blocks in the top contour group shall prevail. When the black label is printed on the left side of the document, the number of white rectangular blocks in the rightmost contour group shall prevail, and so on.
[0136] Furthermore, an angle threshold is preset;
[0137] Connect the centroids of two minimum circumscribed rectangles to generate a straight line; take the horizontal line or vertical line as the reference line, calculate the angle between the straight line and the reference line, recorded as ∠A; calculate the angles between the lengths of the two adjacent minimum circumscribed rectangles and the reference line, recorded as ∠B and ∠C; if the angle difference between ∠A and ∠B and the angle difference between ∠A and ∠C do not exceed the angle threshold (in this embodiment, the black label is printed on the top of the document, the horizontal line is used as the reference line, and the angle threshold is 8 degrees), the two rectangles are considered to be parallel; compare all minimum circumscribed rectangles in pairs according to the above steps.
[0138] The improvement of this embodiment is that it avoids the situation where other documents are mistakenly recognized due to improper placement of documents by the user, thereby enhancing the user experience and improving the recognition accuracy.
[0139] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A document classification method based on black labels, characterized in that: The following steps are involved: Printing a black label on the document to be classified, wherein the black label includes a plurality of black rectangular color blocks of equal size, parallel and equidistant, and printing different numbers of black rectangular color blocks according to the document type; Scan the documents that need to be classified and obtain the document images with black labels; Preprocessing the document image, wherein the preprocessing comprises: graying the document image; Identify the black rectangular color block in the pre-processed document image, the specific steps are: preset a brightness difference threshold for reducing light interference; A region is preset and the region is equally divided into a first region and a second region. The pixels in the grayscaled image are traversed, and the grayscale average values of the first region and the second region of each pixel are calculated respectively. If the difference between the grayscale average values of the two exceeds the brightness difference threshold, the pixel is set to white, otherwise it is set to black. Finally, a number of white rectangular color blocks are obtained for marking black rectangular color blocks. Filter the identified black rectangular blocks; The number of black rectangular color blocks that pass the screening is counted, and the type of the current document is determined according to the number of black rectangular color blocks that pass the screening.
2. A document classification method based on black labels according to claim 1, characterized in that: The area is divided into a first area and a second area in equal parts vertically and horizontally, and finally a plurality of white rectangular color blocks are obtained, marking the horizontal outlines of the black rectangular color blocks.
3. The document classification method based on black labels according to claim 1 is characterized in that: The area is equally divided into a first area and a second area from left to right, and finally a plurality of white rectangular color blocks are obtained, marking the vertical outlines of the black rectangular color blocks.
4. The document classification method based on black labels according to claim 1 is characterized in that: The specific steps for screening the identified black rectangular blocks are: The minimum circumscribed rectangle of the white rectangular color block is extracted, and a threshold is preset to determine whether the size of the white rectangular color block area is reasonable. If the difference between the side length of the minimum circumscribed rectangle and the side length of the black rectangular color block exceeds the threshold, the white rectangular color block is deleted.
5. The document classification method based on black labels according to claim 4 is characterized in that: The method further includes screening the white rectangular color block, and the specific steps are as follows: Preset a threshold for rectangularization detection; The white pixels in the minimum bounding rectangle are counted, and if the ratio of the number of white pixels in the minimum bounding rectangle to the total number of pixels in the minimum bounding rectangle is lower than the threshold for rectangularization detection, the white rectangular color block is deleted.
6. A document classification method based on black labels according to claim 5, characterized in that: The specific steps to count the number of black rectangular blocks that pass the screening are: Determine whether the minimum circumscribed rectangles are parallel, merge the contours of the parallel minimum circumscribed rectangles, and generate several contour groups; select the contour group according to the placement orientation of the black label, and count the number of white rectangular blocks in the contour group, which is the number of black rectangular blocks that pass the screening.
7. The document classification method based on black labels according to claim 6 is characterized in that: The specific steps to determine whether the minimum circumscribed rectangles are parallel are: Preset an angle threshold; Connect the centroids of two minimum circumscribed rectangles to generate a straight line; use the horizontal line or vertical line as the reference line, calculate the angle between the straight line and the reference line, recorded as ∠A; calculate the angles between the lengths of two adjacent minimum circumscribed rectangles and the reference line, recorded as ∠B and ∠C; if the angle difference between ∠A and ∠B and the angle difference between ∠A and ∠C do not exceed the angle threshold, the two rectangles are considered parallel; compare all minimum circumscribed rectangles pairwise according to the above steps.
8. A document classification device based on black labels, characterized in that: The invention comprises a memory and a processor, wherein the memory stores instructions, and the instructions are suitable for being loaded by the processor and executing a document classification method based on black labels as claimed in any one of claims 1 to 7.
