CN108804978A - A kind of printed page analysis method and device - Google Patents

A kind of printed page analysis method and device Download PDF

Info

Publication number
CN108804978A
CN108804978A CN201710293776.0A CN201710293776A CN108804978A CN 108804978 A CN108804978 A CN 108804978A CN 201710293776 A CN201710293776 A CN 201710293776A CN 108804978 A CN108804978 A CN 108804978A
Authority
CN
China
Prior art keywords
image
connected region
black connected
binary image
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710293776.0A
Other languages
Chinese (zh)
Other versions
CN108804978B (en
Inventor
唐文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710293776.0A priority Critical patent/CN108804978B/en
Publication of CN108804978A publication Critical patent/CN108804978A/en
Application granted granted Critical
Publication of CN108804978B publication Critical patent/CN108804978B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/413Classification of content, e.g. text, photographs or tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/414Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The present invention discloses a kind of printed page analysis method and device, and this method includes:Binary conversion treatment is carried out to the original image of the space of a whole page to be analyzed, progressively scans binary image, continued presence number in every row is less than level thresholds and gray value sets to 0 for 255 pixel gray value, obtains the first image;Binary image is scanned by column, continued presence number in each column is less than vertical threshold and gray value sets to 0 for 255 pixel gray value, obtains the second image.The pixel label 1 for being 0 by gray value on the first image and the second image, the pixel label 0 that gray value is 255 execute same position pixel or operate, obtain third image.The location information for obtaining black connected region on third image, is labeled original image, obtains the tab area on original image.The text for belonging to the same paragragh on original image can be as possible divided into the same tab area by the present invention, be conducive to improve subsequently with the efficiency for the content recognition that tab area is identification object.

Description

A kind of printed page analysis method and device
Technical field
The present invention relates to data processing fields, and in particular to a kind of printed page analysis method and device.
Background technology
In general, before the content (including text and picture etc.) on image is identified in system, first have to image The space of a whole page is analyzed, to determine to be used for the input object of content recognition, i.e., region to be identified on the image.
Stroke length smoothing algorithm (English:Run Length Smoothing Algorithm;Referred to as:RLSA it is) a kind of Common printed page analysis algorithm is made for dividing an image into different region to be identified (including text fragment, picture block etc.) The input object that the content on image is identified for follow-up system.
But the quantity in the region to be identified obtained after being divided to image using RLSA algorithms is usually more, and pass through The text in a paragragh will often be belonged to be divided into different regions to be identified, this dividing mode is not utilize system pair What the content in region to be identified was identified.Simultaneously as the quantity in region to be identified is more, system is also resulted in image Content recognition it is less efficient.
Invention content
In view of this, the present invention provides a kind of printed page analysis method and devices.
A kind of printed page analysis method provided by the invention, the method includes;
After carrying out binary conversion treatment to the original image of the space of a whole page to be analyzed, binary image, the binary image tool are obtained There are level thresholds and vertical threshold;
The binary image is progressively scanned, continued presence number is less than the level thresholds in often going and gray value is The gray value of 255 pixel is set to 0, and obtains the first image;
And the binary image is scanned by column, continued presence number in each column is less than the vertical threshold and ash The gray value for the pixel that angle value is 255 is set to 0, and obtains the second image;
The pixel that gray value in described first image and second image is 0 is labeled as 1, gray value is 255 Pixel is labeled as 0;
The pixel of same position in described first image and second image is executed or operated, third figure is obtained Picture;
The black connected region on the third image is obtained, and calculates the location information of each black connected region;
Using the location information, the original image of the space of a whole page to be analyzed is labeled, is obtained on the original image Tab area.
Preferably, the method further includes:
Obtain the black connected region on the binary image;
The width values of each black connected region are obtained, and calculate the average width of black connected region on the binary image Value;
The average width values are multiplied by the value that the first preset multiple obtains, the level thresholds as the binary image.
Preferably, the method further includes:
Obtain the black connected region on the binary image;
The high level of each black connected region is obtained, and calculates the mean height of black connected region on the binary image Value;
The average high level is multiplied by the value that the second preset multiple obtains, the vertical threshold as the binary image.
Preferably, the method further includes:
Obtain the black connected region on the binary image;
After the width values and high level that obtain each black connected region, square of the product of the width values and the high level is calculated Root, the wide high level as the black connected region;
Calculate the average wide high level of the black connected region on the binary image;
The average wide high level is multiplied by the value that third preset multiple obtains, the vertical threshold as the binary image And level thresholds.
Preferably, the location information of the black connected region includes the area minimum where the black connected region At least three apex coordinates of rectangle.
The present invention also provides a kind of printed page analysis device, described device includes;
Binary processing module obtains binary picture after carrying out binary conversion treatment for the original image to the space of a whole page to be analyzed Picture, the binary image have level thresholds and vertical threshold;
First zero setting module, for progressively scanning the binary image, continued presence number is less than described in often going The gray value for the pixel that level thresholds and gray value are 255 is set to 0, and obtains the first image;
Continued presence number in each column is less than described by the second zero setting module for scanning by column the binary image The gray value for the pixel that vertical threshold and gray value are 255 is set to 0, and obtains the second image;
Mark module, for gray value in described first image and second image to be labeled as 1 for 0 pixel, The pixel that gray value is 255 is labeled as 0;
Or operation module, it executes or grasps for the pixel to same position in described first image and second image Make, obtains third image;
First acquisition module for obtaining the black connected region on the third image, and calculates each black and connects The location information in logical region;
Labeling module is labeled the original image of the space of a whole page to be analyzed, obtains institute for utilizing the location information State the tab area on original image.
Preferably, described device further includes:
Second acquisition module, for obtaining the black connected region on the binary image;
First computing module, the width values for obtaining each black connected region, and calculate black on the binary image The average width values of color connected region;
Second computing module, for the average width values to be multiplied by the value that the first preset multiple obtains, as the two-value Change the level thresholds of image.
Preferably, described device further includes:
Third acquisition module, for obtaining the black connected region on the binary image;
Third computing module, the high level for obtaining each black connected region, and calculate black on the binary image The average high level of color connected region;
4th computing module, for the average high level to be multiplied by the value that the second preset multiple obtains, as the two-value Change the vertical threshold of image.
Preferably, described device further includes:
4th acquisition module, for obtaining the black connected region on the binary image;
5th computing module after the width values and high level for obtaining each black connected region, calculates the width values and institute The square root for stating the product of high level, the wide high level as the black connected region;
6th computing module, the average wide high level for calculating the black connected region on the binary image;
7th computing module, for the average wide high level to be multiplied by the value that third preset multiple obtains, as described two The vertical threshold and level thresholds of value image.
Preferably, first acquisition module is specifically used for obtaining the black connected region on the third image, and obtains Take at least three apex coordinates of the rectangle of the area minimum where each black connected region.
In printed page analysis method provided by the invention, after carrying out binary conversion treatment to the original image of the space of a whole page to be analyzed first, Binary image is obtained, the binary image has level thresholds and vertical threshold.Secondly, the binary picture is progressively scanned Continued presence number in every row is less than the level thresholds and gray value sets to 0 for the gray value of 255 pixel, obtained by picture First image;And the binary image is scanned by column, continued presence number in each column is less than the vertical threshold and ash The gray value for the pixel that angle value is 255 is set to 0, and obtains the second image.It again, will be in described first image and second image The pixel that gray value is 0 is labeled as 1, and the pixel that gray value is 255 is labeled as after 0, to described first image and described the The pixel of same position is executed or is operated on two images, obtains third image.Finally, the black on the third image is obtained Connected region, and calculate the location information of each black connected region;And the location information is utilized, to the version to be analyzed The original image in face is labeled, and obtains the tab area on the original image.
Printed page analysis method provided by the invention utilizes " or operation " to same position on the first image and the second image Pixel is handled, and black pixel point is more continuous on obtained third image, can be by the same paragragh on original image Text be divided into as possible in the same tab area, the negligible amounts of the tab area obtained from, after this is conducive to raising The continuous efficiency with the content recognition that tab area is identification object.
Description of the drawings
In order to more clearly explain the technical solutions in the embodiments of the present application, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is only some embodiments of the present application, for For those of ordinary skill in the art, without having to pay creative labor, it can also be obtained according to these attached drawings His attached drawing.
Fig. 1 is a kind of printed page analysis method flow diagram provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram of the original image of the space of a whole page to be analyzed provided in an embodiment of the present invention;
Fig. 3 is a kind of flow chart of the level thresholds setting method of binary image provided in an embodiment of the present invention;
Fig. 4 is a kind of flow chart of the vertical threshold setting method of binary image provided in an embodiment of the present invention;
Fig. 5 is a kind of vertical threshold of binary image provided in an embodiment of the present invention and the setting method of level thresholds Flow chart;
Fig. 6 is a kind of schematic diagram of first image provided in an embodiment of the present invention;
Fig. 7 is a kind of schematic diagram of second image provided in an embodiment of the present invention;
Fig. 8 is a kind of schematic diagram of third image provided in an embodiment of the present invention;
Fig. 9 is the schematic diagram of the minimum rectangle where a kind of black connected region provided in an embodiment of the present invention;
Figure 10 is a kind of schematic diagram of the original image comprising tab area provided in an embodiment of the present invention;
Figure 11 is a kind of structural schematic diagram of printed page analysis device provided in an embodiment of the present invention;
Figure 12 is a kind of part-structure schematic diagram of computer provided in an embodiment of the present invention.
Specific implementation mode
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation describes, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall in the protection scope of this application.
It is a kind of printed page analysis provided in an embodiment of the present invention that the present invention provides a kind of printed page analysis methods with reference to figure 1 Method flow diagram, the method can specifically include:
S101:After carrying out binary conversion treatment to the original image of the space of a whole page to be analyzed, binary image, the binary picture are obtained As having level thresholds and vertical threshold.
In the embodiment of the present invention, the source images of the space of a whole page to be analyzed include the image obtained to file photographing or scanning, usually To include the image of the contents such as text, picture.As shown in Fig. 2, being a kind of original of the space of a whole page to be analyzed provided in an embodiment of the present invention The schematic diagram of image.
Since the original image of the space of a whole page to be analyzed may be coloured image, in order to which the simplified printed page analysis to source images is processed Journey, the source images that the embodiment of the present invention is analysed to the space of a whole page in advance carry out binary conversion treatment, obtain the binaryzation of the original image Image.Specifically, binary image is gray level image, non-zero i.e. 255 image of gray value of as pixel, commonly known as Black white image, wherein the pixel that gray value is 0 is also referred to as black pixel point, and the pixel that gray value is 255 is also referred to as white Pixel.
In the embodiment of the present invention, level thresholds and vertical threshold are set for the binary image in advance.
In a kind of embodiment, an embodiment of the present invention provides a kind of level thresholds setting method of binary image, ginsengs Fig. 3 is examined, is a kind of flow chart of the level thresholds setting method of binary image provided in an embodiment of the present invention.The method packet It includes:
S301:Obtain the black connected region on the binary image.
The area for the connection that black connected region in the embodiment of the present invention is made of the pixel that continuous gray value is 0 Domain.
S302:The width values of each black connected region are obtained, and calculate black connected region on the binary image Average width values.
After black connected region of the embodiment of the present invention on obtaining the binary image, each black connection is calculated The width values in region, wherein the width values of black connected region are the width of the rectangle of the area minimum where the black connected region Value.
After the width values for obtaining each black connected region, the average value of the width values of each black connected region is sought, is made For the average width values of black connected region on the binary image.
S303:The average width values are multiplied by the value that the first preset multiple obtains, the level as the binary image Threshold value.
In the embodiment of the present invention, the first preset multiple is pre-set, rule of thumb usually 3 or so, obtaining described two On value image after the average width values of black connected region, the average width values are multiplied by first preset multiple, are obtained It is worth the level thresholds as the binary image.
In another embodiment, an embodiment of the present invention provides a kind of vertical threshold setting method of binary image, It is a kind of flow chart of the vertical threshold setting method of binary image provided in an embodiment of the present invention with reference to figure 4.The method Including:
S401:Obtain the black connected region on the binary image.
S402:The high level of each black connected region is obtained, and calculates black connected region on the binary image Average high level.
The high level of black connected region in the embodiment of the present invention is that the area where the black connected region is minimum The high value of rectangle.
Specifically, after the high level for obtaining each black connected region, the flat of the high level of each black connected region is sought Mean value, the average high level as black connected region on the binary image.
S403:The average high level is multiplied by the value that the second preset multiple obtains, as the vertical of the binary image Threshold value.
In the embodiment of the present invention, the second preset multiple is pre-set, is generally also rule of thumb 3 or so, described in acquisition On binary image after the average high level of black connected region, the average high level is multiplied by second preset multiple, is obtained Vertical threshold of the value as the binary image.
In addition, also a kind of embodiment provides a kind of setting side of the vertical threshold and level thresholds of binary image Method is a kind of vertical threshold of binary image provided in an embodiment of the present invention and the setting method of level thresholds with reference to figure 5 Flow chart.The method includes:
S501:Obtain the black connected region on the binary image.
S502:After the width values and high level that obtain each black connected region, the product of the width values and the high level is calculated Square root, the wide high level as the black connected region.
The embodiment of the present invention calculates the black connected region after the width values and high level for obtaining each black connected region The square root of the product of width values and high level, the wide high level as the black connected region.
Due to the relatively small black connected region of the relatively large and wide high level of wide high level, hanging down for binary image can be caused The setting of straight threshold value and level thresholds is inaccurate.So in order to ensure the vertical threshold being arranged for binary image and horizontal threshold The accuracy of value, the embodiment of the present invention in advance by be not belonging in the wide high level of each black connected region predetermined threshold range into Row is rejected.That is, if threshold range is set as 3-100, the wide high level less than 3 and more than 100 is rejected, The vertical threshold and level thresholds of binary image are only further determined using the wide high level more than 3 and less than 100.
S503:Calculate the average wide high level of the black connected region on the binary image.
After the wide high level for obtaining each black connected region, being averaged for the wide high level of each black connected region is sought Value, the average wide high level as the black connected region on the binary image.
It is in default for calculating the wide high level of average wide high level of each black connected region in a kind of realization method The wide high level of threshold range.
S504:The average wide high level is multiplied by the value that third preset multiple obtains, as hanging down for the binary image Straight threshold value and level thresholds.
In the embodiment of the present invention, third preset multiple is pre-set, is generally also rule of thumb 3 or so, described in acquisition On binary image after the average wide high level of black connected region, the average wide high level is multiplied by the third preset multiple, Vertical threshold and level thresholds of the obtained value respectively as the binary image.That is, being arranged through the above way Vertical threshold it is identical with level thresholds.
S102:The binary image is progressively scanned, continued presence number is less than the level thresholds and ash in often going The gray value for the pixel that angle value is 255 is set to 0, and obtains the first image.
In a kind of realization method, the binary image is progressively scanned, determines that continued presence number is small in often going It is 255 pixel in level thresholds and gray value, and the gray value of the pixel is set to 0, obtains the first image.Namely It says, continued presence number retouches into black less than the gray value of the white pixel point of level thresholds during the binary image is often gone Afterwards, the binary image obtained is referred to as the first image.It it is one of the present invention with reference to figure 6 in order to which vivider understand The schematic diagram for the first image that embodiment provides.
S103:The binary image is scanned by column, continued presence number in each column is less than the vertical threshold and ash The gray value for the pixel that angle value is 255 is set to 0, and obtains the second image.
In a kind of realization method, the binary image is scanned by column, determines that continued presence number is small in each column It is 255 pixel in the vertical threshold and gray value, and the pixel is set to 0, obtains the second image.It is appreciated that For the gray value that continued presence number in the binary image each column is less than to the white pixel point of vertical threshold retouches into black Afterwards, the binary image obtained is referred to as the second image.It it is one of the present invention with reference to figure 7 in order to which vivider understand The schematic diagram for the second image that embodiment provides.
It is worth noting that, the execution sequence of above-mentioned S102 and S103 is unrestricted, and it is the binaryzation with original image Image is as process object.Specifically, in a kind of realization method, S102 can be first carried out, then execute S103;Another realization side In formula, S103 can also be first carried out, then execute S102;In another realization method, S102 and S103 can also be executed side by side.
S104:The pixel that gray value in described first image and second image is 0 is labeled as 1, gray value is 255 pixel is labeled as 0.
It, will be in described first image and second image after obtaining the first image and the second image in practical application The pixel that upper gray value is 0 marks, and the pixel that gray value is 255, which marks, is.
It is to be understood that by black pixel point is labeled as 1 in described first image and on second image, white pixel Point is labeled as 0.
S105:The pixel of same position on described first image and second image is executed or operation, obtains the Three images.
It is right after completing to the label of each pixel in described first image and the second image in the embodiment of the present invention The pixel of described first image and same position on second image executes or operation.Wherein, or operation is bit manipulation One kind, for handling the identical binary number of two length, as long as being 1 there are one in corresponding binary bit, the end value of this As 1.
For example, value labeled the pixel A1 of the first row first row on the first image is 0, first on the second image Value labeled the pixel B1 of row first row is 1, wherein A1 and B1 is the picture of same position on the first image and the second image Vegetarian refreshments, then the value 0 and 1 being labeled A1 and B1 respectively execute or operation after, obtained end value 1.
In practical application, the pixel of described first image and same position on second image is performed both by or is operated Afterwards, third image is obtained, the labeled value of each pixel is described first image and second figure on the third image End value after executing or operate as the labeled value of the pixel of upper same position, including 0 or 1.Specifically, the third figure As upper labeled value be 0 pixel, gray value 255, as white pixel point, labeled value for 1 pixel, Its gray value is 0, as black pixel point.In fact, the picture in described first image with same position on second image Vegetarian refreshments, as long as being black pixel point there are one pixel, then the pixel of corresponding position is black on the third image obtained Pixel.In order to which vivider understand, with reference to figure 8, for the signal for the third image that one embodiment of the present of invention provides Figure.
S106:The black connected region on the third image is obtained, and calculates the position of each black connected region Information.
Black connected region, it is understood that for the irregular area for the connection being made of continuous black pixel point. The embodiment of the present invention obtains the black connected region on the third image, and calculates the position letter of each black connected region Breath.
In practical application, location information of the OpenCV connected regions algorithm to the black connected region got can be utilized It is calculated, specifically, it is first determined then the rectangle of the area minimum where black connected region obtains the position of the rectangle Confidence ceases, as the location information of the black connected region, for example, apex coordinate of the rectangle, the width values of the rectangle and high level Deng.As shown in figure 9, the schematic diagram of the minimum rectangle where the black connected region provided for one embodiment of the present of invention.
In a kind of embodiment, the location information of the black connected region is obtained specifically, obtaining the black connection At least three apex coordinates of the rectangle of the area minimum where region.Using the apex coordinate, the black can determine The rectangle of area minimum where connected region.In addition, in addition to obtaining at least three apex coordinates, the black can also be obtained The information such as width values, the high level of rectangle of area minimum where connected region.
S107:Using the location information, the original image of the space of a whole page to be analyzed is labeled, the original image is obtained On tab area.
The embodiment of the present invention after the location information of each black connected region, utilizes the position on obtaining third image Information is labeled the original image of the space of a whole page to be analyzed, obtains the tab area on the original image.
In order to which vivider understand, with reference to figure 10, what is provided for one embodiment of the present of invention includes tab area Original image schematic diagram.Wherein, each rectangle marked with grey filled lines on original image is tab area.
The embodiment of the present invention obtains each tab area on the original image by being labeled to the original image, Complete the printed page analysis to the original image.In practical application, after completing printed page analysis, include text on the original image Each tab area of the contents such as sheet, image can be as the object of content recognition.Specifically, by each tab area Content recognition, complete identification to the original image space of a whole page.
The embodiment of the present invention using " or operation " to the pixel of same position on the first image and the second image at It manages, black pixel point is more continuous on obtained third image, can draw the text of the same paragragh on original image as possible It assigns in the same tab area, the negligible amounts of the tab area obtained from, this is conducive to improve subsequently with tab area For the efficiency of the content recognition of identification object.
The embodiment of the present invention additionally provides a kind of printed page analysis device and is carried for one embodiment of the present of invention with reference to figure 11 A kind of structural schematic diagram of the printed page analysis device supplied, described device include;
Binary processing module 1101 obtains two-value after carrying out binary conversion treatment for the original image to the space of a whole page to be analyzed Change image, the binary image has level thresholds and vertical threshold;
First zero setting module 1102, for progressively scanning the binary image, continued presence number is less than in often going The gray value for the pixel that the level thresholds and gray value are 255 is set to 0, and obtains the first image;
Continued presence number in each column is less than by the second zero setting module 1103 for scanning by column the binary image The gray value for the pixel that the vertical threshold and gray value are 255 is set to 0, and obtains the second image;
Mark module 1104, for the pixel label for being 0 by gray value in described first image and second image It is 1, the pixel that gray value is 255 is labeled as 0;
Or operation module 1105, it is executed for the pixel to same position in described first image and second image Or operation, obtain third image;
First acquisition module 1106 for obtaining the black connected region on the third image, and calculates each black The location information of color connected region;
Labeling module 1107 is labeled the original image of the space of a whole page to be analyzed, obtains for utilizing the location information Tab area onto the original image.
In the embodiment of the present invention, in order to which the level thresholds of binary image are arranged, described device further includes:
Second acquisition module, for obtaining the black connected region on the binary image;
First computing module, the width values for obtaining each black connected region, and calculate black on the binary image The average width values of color connected region;
Second computing module, for the average width values to be multiplied by the value that the first preset multiple obtains, as the two-value Change the level thresholds of image.
In order to which the vertical threshold of binary image is arranged, described device further includes:
Third acquisition module, for obtaining the black connected region on the binary image;
Third computing module, the high level for obtaining each black connected region, and calculate black on the binary image The average high level of color connected region;
4th computing module, for the average high level to be multiplied by the value that the second preset multiple obtains, as the two-value Change the vertical threshold of image.
The embodiment of the present invention additionally provides a kind of vertical threshold and vertical threshold function with setting binary image Device, on the basis of modules in fig. 11, described device further includes:
4th acquisition module, for obtaining the black connected region on the binary image;
5th computing module after the width values and high level for obtaining each black connected region, calculates the width values and institute The square root for stating the product of high level, the wide high level as the black connected region;
6th computing module, the average wide high level for calculating the black connected region on the binary image;
7th computing module, for the average wide high level to be multiplied by the value that third preset multiple obtains, as described two The vertical threshold and level thresholds of value image.
In a kind of realization method, first acquisition module 1106 is specifically used for obtaining the black on the third image Connected region, and obtain at least three apex coordinates of the rectangle of area minimum where each black connected region.
The embodiment of the present invention using " or operation " to the pixel of same position on the first image and the second image at It manages, black pixel point is more continuous on obtained third image, can use up the text for belonging to the same paragragh on original image Amount is divided into the same tab area, the negligible amounts of the tab area obtained from, this is conducive to improve subsequently with mark Region is the efficiency for the content recognition for identifying object.
Correspondingly, the embodiment of the present invention also provides a kind of computer, it is shown in Figure 12, may include:
Processor 1201, memory 1202, input unit 1203 and output device 1204.Processing in browser server The quantity of device 1201 can be one or more, in Figure 12 by taking a processor as an example.In some embodiments of the invention, it handles Device 1201, memory 1202, input unit 1203 and output device 304 can be connected by bus or other means, wherein Figure 12 In for being connected by bus.
Memory 1202 can be used for storing software program and module, and processor 1201 is stored in memory by operation 1202 software program and module.Memory 1202 can include mainly storing program area and storage data field, wherein storage journey It sequence area can storage program area, the application program etc. needed at least one function.In addition, memory 1202 may include high speed with Machine access memory, can also include nonvolatile memory, a for example, at least disk memory, flush memory device or its His volatile solid-state part.Input unit 1203 can be used for receive input number or character information, and generate with it is clear Look at device server user setting and function control related key signals input.
Specifically in the present embodiment, processor 1201 can apply journey according to following instruction by one or more The corresponding executable file of process of sequence is loaded into memory 202, and is stored in memory by processor 1201 to run Application program in 1202, to realize various functions:
After carrying out binary conversion treatment to the original image of the space of a whole page to be analyzed, binary image, the binary image tool are obtained There are level thresholds and vertical threshold;
The binary image is progressively scanned, continued presence number is less than the level thresholds in often going and gray value is The gray value of 255 pixel is set to 0, and obtains the first image;
And the binary image is scanned by column, continued presence number in each column is less than the vertical threshold and ash The gray value for the pixel that angle value is 255 is set to 0, and obtains the second image;
The pixel that gray value in described first image and second image is 0 is labeled as 1, gray value is 255 Pixel is labeled as 0;
The pixel of same position in described first image and second image is executed or operated, third figure is obtained Picture;
The black connected region on the third image is obtained, and calculates the location information of each black connected region;
Using the location information, the original image of the space of a whole page to be analyzed is labeled, is obtained on the original image Tab area.
For device embodiments, since it corresponds essentially to embodiment of the method, so related place is referring to method reality Apply the part explanation of example.The apparatus embodiments described above are merely exemplary, wherein described be used as separating component The unit of explanation may or may not be physically separated, and the component shown as unit can be or can also It is not physical unit, you can be located at a place, or may be distributed over multiple network units.It can be according to actual It needs that some or all of module therein is selected to achieve the purpose of the solution of this embodiment.Those of ordinary skill in the art are not In the case of making the creative labor, you can to understand and implement.
It should be noted that herein, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also include other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.
It is provided for the embodiments of the invention a kind of printed page analysis method and device above to be described in detail, herein Applying specific case, principle and implementation of the present invention are described, and the explanation of above example is only intended to help Understand the method and its core concept of the present invention;Meanwhile for those of ordinary skill in the art, according to the thought of the present invention, There will be changes in the specific implementation manner and application range, in conclusion the content of the present specification should not be construed as to this The limitation of invention.

Claims (10)

1. a kind of printed page analysis method, which is characterized in that the method includes;
After carrying out binary conversion treatment to the original image of the space of a whole page to be analyzed, binary image is obtained, the binary image has water Flat threshold value and vertical threshold;
The binary image is progressively scanned, it is 255 that continued presence number, which is less than the level thresholds and gray value, in often going The gray value of pixel set to 0, obtain the first image;
And the binary image is scanned by column, continued presence number in each column is less than the vertical threshold and gray value Gray value for 255 pixel is set to 0, and obtains the second image;
The pixel that gray value in described first image and second image is 0 is labeled as 1, the pixel that gray value is 255 Point is labeled as 0;
The pixel of same position in described first image and second image is executed or operated, third image is obtained;
The black connected region on the third image is obtained, and calculates the location information of each black connected region;
Using the location information, the original image of the space of a whole page to be analyzed is labeled, the mark on the original image is obtained Region.
2. printed page analysis method according to claim 1, which is characterized in that the method further includes:
Obtain the black connected region on the binary image;
The width values of each black connected region are obtained, and calculate the average width values of black connected region on the binary image;
The average width values are multiplied by the value that the first preset multiple obtains, the level thresholds as the binary image.
3. printed page analysis method according to claim 1 or 2, which is characterized in that the method further includes:
Obtain the black connected region on the binary image;
The high level of each black connected region is obtained, and calculates the average high level of black connected region on the binary image;
The average high level is multiplied by the value that the second preset multiple obtains, the vertical threshold as the binary image.
4. printed page analysis method according to claim 1, which is characterized in that the method further includes:
Obtain the black connected region on the binary image;
After the width values and high level that obtain each black connected region, the square root of the product of the width values and the high level is calculated, Wide high level as the black connected region;
Calculate the average wide high level of the black connected region on the binary image;
The average wide high level is multiplied by the value that third preset multiple obtains, vertical threshold and water as the binary image Flat threshold value.
5. printed page analysis method according to claim 1, which is characterized in that the location information packet of the black connected region Include at least three apex coordinates of the rectangle of the area minimum where the black connected region.
6. a kind of printed page analysis device, which is characterized in that described device includes;
Binary processing module obtains binary image, institute after carrying out binary conversion treatment for the original image to the space of a whole page to be analyzed Stating binary image has level thresholds and vertical threshold;
First zero setting module, for progressively scanning the binary image, continued presence number is less than the level in often going The gray value for the pixel that threshold value and gray value are 255 is set to 0, and obtains the first image;
Continued presence number in each column is less than described vertical by the second zero setting module for scanning by column the binary image The gray value for the pixel that threshold value and gray value are 255 is set to 0, and obtains the second image;
Mark module, for gray value in described first image and second image to be labeled as 1 for 0 pixel, gray scale Value is labeled as 0 for 255 pixel;
Or operation module, it executes or operates for the pixel to same position in described first image and second image, Obtain third image;
First acquisition module for obtaining the black connected region on the third image, and calculates each black connected region The location information in domain;
Labeling module is labeled the original image of the space of a whole page to be analyzed, obtains the original for utilizing the location information Tab area on image.
7. printed page analysis device according to claim 6, which is characterized in that described device further includes:
Second acquisition module, for obtaining the black connected region on the binary image;
First computing module, the width values for obtaining each black connected region, and calculate black on the binary image and connect The average width values in logical region;
Second computing module, for the average width values to be multiplied by the value that the first preset multiple obtains, as the binary picture The level thresholds of picture.
8. the printed page analysis device described according to claim 6 or 7, which is characterized in that described device further includes:
Third acquisition module, for obtaining the black connected region on the binary image;
Third computing module, the high level for obtaining each black connected region, and calculate black on the binary image and connect The average high level in logical region;
4th computing module, for the average high level to be multiplied by the value that the second preset multiple obtains, as the binary picture The vertical threshold of picture.
9. printed page analysis device according to claim 6, which is characterized in that described device further includes:
4th acquisition module, for obtaining the black connected region on the binary image;
5th computing module after the width values and high level for obtaining each black connected region, calculates the width values and the height The square root of the product of value, the wide high level as the black connected region;
6th computing module, the average wide high level for calculating the black connected region on the binary image;
7th computing module, for the average wide high level to be multiplied by the value that third preset multiple obtains, as the binaryzation The vertical threshold and level thresholds of image.
10. printed page analysis device according to claim 6, which is characterized in that first acquisition module, specifically for obtaining The black connected region on the third image is taken, and obtains the rectangle of area minimum where each black connected region extremely Few three apex coordinates.
CN201710293776.0A 2017-04-28 2017-04-28 Layout analysis method and device Active CN108804978B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710293776.0A CN108804978B (en) 2017-04-28 2017-04-28 Layout analysis method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710293776.0A CN108804978B (en) 2017-04-28 2017-04-28 Layout analysis method and device

Publications (2)

Publication Number Publication Date
CN108804978A true CN108804978A (en) 2018-11-13
CN108804978B CN108804978B (en) 2022-04-12

Family

ID=64069665

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710293776.0A Active CN108804978B (en) 2017-04-28 2017-04-28 Layout analysis method and device

Country Status (1)

Country Link
CN (1) CN108804978B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109948598A (en) * 2019-05-15 2019-06-28 达而观信息科技(上海)有限公司 Document layout intelligent analysis method and device
CN113033338A (en) * 2021-03-09 2021-06-25 太极计算机股份有限公司 Method and device for identifying head news position of electronic newspaper
CN115147856A (en) * 2022-07-08 2022-10-04 上海弘玑信息技术有限公司 Form information extraction method and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5335087A (en) * 1990-03-31 1994-08-02 Goldstar Co., Ltd. Document acknowledge system having horizontal/vertical-run length smoothing algorithm circuits and a document region divide circuit
US20100158373A1 (en) * 2008-12-18 2010-06-24 Dalong Li Methods and apparatus for auto image binarization
CN102073862A (en) * 2011-02-18 2011-05-25 山东山大鸥玛软件有限公司 Method for quickly calculating layout structure of document image
CN102193795A (en) * 2010-03-12 2011-09-21 国际商业机器公司 Layout converter, layout conversion program, and layout conversion method
CN102375988A (en) * 2010-08-17 2012-03-14 富士通株式会社 File image processing method and equipment
CN102831200A (en) * 2012-08-07 2012-12-19 北京百度网讯科技有限公司 Commodity propelling method and device based on image character recognition
CN102890826A (en) * 2011-08-12 2013-01-23 北京多看科技有限公司 Method for resetting scan edition document
CN104598905A (en) * 2015-02-05 2015-05-06 广州中国科学院软件应用技术研究所 License plate positioning method and device
CN106355205A (en) * 2016-08-31 2017-01-25 西安西拓电气股份有限公司 Recognition method and device for figures in ultraviolet image
CN106446890A (en) * 2016-10-28 2017-02-22 中国人民解放军信息工程大学 Candidate area extraction method based on window scoring and superpixel segmentation

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5335087A (en) * 1990-03-31 1994-08-02 Goldstar Co., Ltd. Document acknowledge system having horizontal/vertical-run length smoothing algorithm circuits and a document region divide circuit
US20100158373A1 (en) * 2008-12-18 2010-06-24 Dalong Li Methods and apparatus for auto image binarization
CN102193795A (en) * 2010-03-12 2011-09-21 国际商业机器公司 Layout converter, layout conversion program, and layout conversion method
CN102375988A (en) * 2010-08-17 2012-03-14 富士通株式会社 File image processing method and equipment
CN102073862A (en) * 2011-02-18 2011-05-25 山东山大鸥玛软件有限公司 Method for quickly calculating layout structure of document image
CN102890826A (en) * 2011-08-12 2013-01-23 北京多看科技有限公司 Method for resetting scan edition document
CN102831200A (en) * 2012-08-07 2012-12-19 北京百度网讯科技有限公司 Commodity propelling method and device based on image character recognition
CN104598905A (en) * 2015-02-05 2015-05-06 广州中国科学院软件应用技术研究所 License plate positioning method and device
CN106355205A (en) * 2016-08-31 2017-01-25 西安西拓电气股份有限公司 Recognition method and device for figures in ultraviolet image
CN106446890A (en) * 2016-10-28 2017-02-22 中国人民解放军信息工程大学 Candidate area extraction method based on window scoring and superpixel segmentation

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
P. BARLAS 等: "A typed and handwritten text block segmentation system for heterogeneous and complex documents", 《DOCUMENT ANALYSIS SYSTEMS》 *
曾凡锋 等: "基于文本行重构的扭曲文档快速校正方法", 《计算机工程与设计》 *
朱永权: "档案管理数字化系统的研究", 《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》 *
李士进 等: "基于梯度与颜色信息融合的水文资料图像分割", 《数据采集与处理》 *
王涤琼: "对利用边界标定自动机进行文档图像分析的研究", 《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109948598A (en) * 2019-05-15 2019-06-28 达而观信息科技(上海)有限公司 Document layout intelligent analysis method and device
CN113033338A (en) * 2021-03-09 2021-06-25 太极计算机股份有限公司 Method and device for identifying head news position of electronic newspaper
CN113033338B (en) * 2021-03-09 2024-03-29 太极计算机股份有限公司 Electronic header edition headline news position identification method and device
CN115147856A (en) * 2022-07-08 2022-10-04 上海弘玑信息技术有限公司 Form information extraction method and electronic equipment
CN115147856B (en) * 2022-07-08 2023-04-28 上海弘玑信息技术有限公司 Table information extraction method and electronic equipment

Also Published As

Publication number Publication date
CN108804978B (en) 2022-04-12

Similar Documents

Publication Publication Date Title
CN109284674A (en) A kind of method and device of determining lane line
US8340433B2 (en) Image processing apparatus, electronic medium, and image processing method
CN103870597B (en) A kind of searching method and device of no-watermark picture
CN104134072A (en) Answer sheet identification method
WO2015107859A1 (en) Image comparison device, image sensor, processing system, and image comparison method
CN108509988B (en) Test paper score automatic statistical method and device, electronic equipment and storage medium
EP3120232A1 (en) Determining user handedness and orientation using a touchscreen device
CN108804978A (en) A kind of printed page analysis method and device
CN109145904A (en) A kind of character identifying method and device
CN105389541B (en) The recognition methods of fingerprint image and device
CN113344986A (en) Point cloud registration result evaluation method, device, equipment and storage medium
CN105260720A (en) Fingerprint identification method and device
CN110321837A (en) A kind of recognition methods, device, terminal and the storage medium of examination question score
CN112001406A (en) Text region detection method and device
CN108241859A (en) The bearing calibration of car plate and device
JP6055065B1 (en) Character recognition program and character recognition device
KR20150106824A (en) Gesture recognition apparatus and control method of gesture recognition apparatus
CN111104883A (en) Job answer extraction method, device, equipment and computer readable storage medium
US20190122041A1 (en) Coarse-to-fine hand detection method using deep neural network
CN113095292A (en) Gesture recognition method and device, electronic equipment and readable storage medium
CN111523387A (en) Method and device for detecting hand key points and computer device
US20160357395A1 (en) Information processing device, non-transitory computer-readable recording medium storing an information processing program, and information processing method
CN113610809A (en) Fracture detection method, fracture detection device, electronic device, and storage medium
CN112084103B (en) Interface test method, device, equipment and medium
CN109801428B (en) Method and device for detecting edge straight line of paper money and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant