[go: up one dir, main page]

CN105373790B - layout analysis method and device - Google Patents

layout analysis method and device Download PDF

Info

Publication number
CN105373790B
CN105373790B CN201510696674.4A CN201510696674A CN105373790B CN 105373790 B CN105373790 B CN 105373790B CN 201510696674 A CN201510696674 A CN 201510696674A CN 105373790 B CN105373790 B CN 105373790B
Authority
CN
China
Prior art keywords
layout element
layout
opposite side
expansion
threshold
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.)
Active
Application number
CN201510696674.4A
Other languages
Chinese (zh)
Other versions
CN105373790A (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.)
Beijing Hanvon Digital Technology Co ltd
Original Assignee
Beijing Hanvon Digital Technology 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 Beijing Hanvon Digital Technology Co ltd filed Critical Beijing Hanvon Digital Technology Co ltd
Priority to CN201510696674.4A priority Critical patent/CN105373790B/en
Publication of CN105373790A publication Critical patent/CN105373790A/en
Application granted granted Critical
Publication of CN105373790B publication Critical patent/CN105373790B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • G06V10/225Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition based on a marking or identifier characterising the area

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Character Input (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Processing Or Creating Images (AREA)

Abstract

本发明涉及一种版面分析方法和装置,该版面分析方法包括以下步骤:输入包括多个版面元素的待处理图像;在每个版面元素所在的区域内绘制封闭曲线;自适应调整所述封闭曲线至所述版面元素的边缘;根据自适应调整至所述版面元素边缘的封闭曲线从所述待处理图像中提取每个版面元素。

The invention relates to a layout analysis method and device. The layout analysis method comprises the following steps: inputting an image to be processed including a plurality of layout elements; drawing a closed curve in the area where each layout element is located; adaptively adjusting the closed curve to the edge of the layout element; each layout element is extracted from the to-be-processed image according to a closed curve adaptively adjusted to the edge of the layout element.

Description

Printed page analysis method and apparatus
Technical field
The present invention relates to image procossing, in particular to a kind of printed page analysis method and apparatus.
Background technique
The printed page analysis of file and picture is the important component and complex documents optics word of document information processing system Symbol identification (OCR) essential link, it is to realize the digitized important link of paper document.
Printed page analysis technology is widely used in the fields such as document automatically retrieval, office automation.Printed page analysis mainly includes Page Segmentation and area type identify two large divisions.
In recent years, with the development of Digital manufacturing technology, automatic printed page analysis technology is also more and more mature.But for Complicated newspaper layout, due to space of a whole page element type multiplicity, layout is complicated, adapts to the full automatic of all newspaper layouts Printed page analysis Technical comparing is few, and there is not yet in field of character recognition can adapt to the general of various application scenarios up to now Printed page analysis device.
Existing automatic printed page analysis method needs extremely complex algorithm, and can not provide very high precision.Therefore The method that space of a whole page element is manually specified is developed.
For example, CN103336961A proposes a kind of interactive natural scene Method for text detection, by manually drawing one Bar line, an extended area is chosen according to this line in page image, final by concrete analysis in this extended area It obtains text filed.This method is suitable for extracting the character area a width figure on image, identifying text, making to calculate Mechanism solution picture material.
However, it is often imperfect when this interactive mode natural scene Method for text detection is for choosing image or advertisement, Because this method detection is text filed in image, if the region for not having text often to obtain mistake in image. For choosing text, since this method is extended the not information using text to mark line, but expand downwards upwards without exception Open up the 1/3 of testing image height, to the 1/3 of from left to right extending marking line length, therefore obtain be it is rough text filed, can not Carry out accurate space of a whole page extraction and analysis.
In view of above-mentioned deficiency in the prior art, need to propose that one kind quickly and effectively can be marked accurately and be identified each The printed page analysis method of space of a whole page element.
Summary of the invention
The invention proposes a kind of printed page analysis method and apparatus, quickly and effectively can accurately mark and identify each version Surface element.
According to the first aspect of the invention, a kind of printed page analysis method is the following steps are included: input step, input include more The image to be processed of a space of a whole page element;Plot step draws closed curve in the region where each space of a whole page element;Adaptively Set-up procedure adaptively adjusts the closed curve to the edge of the space of a whole page element;Extraction step, according to adaptive adjustment The encapsulated coil to the edge of the space of a whole page element extracts each space of a whole page element from the image to be processed.
According to the second aspect of the invention, the closed curve is rectangle frame, which includes extending in a first direction The first opposite side and the second opposite side for extending in a second direction;And the adaptive set-up procedure includes by first opposite side It adaptively adjusts with second opposite side to the edge of the space of a whole page element;The extraction step include according to adaptively adjust to First opposite side and second opposite side at the edge of the space of a whole page element extract each space of a whole page from the image to be processed Element.
According to the third aspect of the invention we, the space of a whole page element includes picture, title and text, also, described adaptive Set-up procedure include: judge first opposite side and second opposite side be in blank space or push down picture or push down title or The text of text;If pushing down picture or pushing down the text of title or text, carry out first extension, will first opposite side with Second opposite side extends to the edge of the space of a whole page element;If executing first in blank space and shrinking, by described first pair Side and second opposite side are contracted to the edge of the space of a whole page element.
According to the fourth aspect of the invention, height threshold and width threshold value have been pre-defined for title and text, height The space of a whole page element for being respectively greater than the height threshold and the width threshold value with width is considered as text, is carrying out the first extension Or after first shrinks, judge whether the height of the rectangle frame and width are greater than height threshold and width threshold value;If it is, The space of a whole page element is judged for text, carries out the second extension and third extension;If it is not, then judging the space of a whole page element for mark Topic, without the second extension and third extension, wherein second extension includes by first opposite side in the first direction On extend to the edge of the space of a whole page element;The third extension includes extending second opposite side in this second direction To the edge of the space of a whole page element.
According to the fifth aspect of the invention, in second extension, first opposite side and the space of a whole page element are obtained The spacing between next row black pixel point in said first direction carries out the spacing and defined first spacing threshold Compare, if the spacing is less than first spacing threshold, first opposite side is extended into a pixel wide, and repeat It states and compares;If the spacing is greater than first spacing threshold, stop second extension.
According to the sixth aspect of the invention, in third extension, second opposite side and the space of a whole page element are obtained The spacing between next row black pixel point in this second direction carries out the spacing and defined second spacing threshold Compare, if the spacing is less than second spacing threshold, second opposite side is extended into a pixel wide, and repeat It states and compares;If the spacing is greater than second spacing threshold, stop the third extension.
According to the seventh aspect of the invention, it shrinks in first extension, described first, second extension and described the After three extensions, the outside edges of first opposite side and second opposite side towards the space of a whole page element are extended into predetermined quantity Pixel wide.
According to the eighth aspect of the invention, a kind of printed page analysis device includes: input unit, and it includes multiple for being used to input The image to be processed of space of a whole page element;Display unit shows the image to be processed inputted;Detection unit, when user is each When drawing closed curve on space of a whole page element region, the detection unit detects the position of the closed curve;Adjustment unit, It is used to adjust the closed curve;Extraction unit is used to be extracted from the image to be processed according to the closed curve The space of a whole page element;And processing unit, controlling the adjustment unit according to the testing result of the detection unit will be described Closed curve is adjusted to the edge of space of a whole page element, and controls the extraction unit and extract each space of a whole page element.
According to the ninth aspect of the invention, the closed curve is rectangle frame, which includes extending in a first direction The first opposite side and the second opposite side for extending in a second direction, and the detection unit detects first opposite side and described the The position of two opposite side;The processing unit controls the adjustment unit for described first according to the testing result of the detection unit Opposite side and second opposite side are adjusted to the edge of space of a whole page element, and control the extraction unit and extract each space of a whole page element.
According to the tenth aspect of the invention, the space of a whole page element includes picture, title and text, also, the processing is single Member judges first opposite side according to the testing result of the detection unit and second opposite side is in blank space or to push down Picture or the text for pushing down title or text;If pushing down picture or pushing down the text of title or text, the processing unit It controls the adjustment unit and carries out the first extension, first opposite side and second opposite side are extended into the space of a whole page element Edge;If the processing unit, which controls the adjustment unit, to carry out first and shrinks in blank space, will first opposite side with Second opposite side is contracted to the edge of the space of a whole page element.
According to the eleventh aspect of the invention, height threshold and width threshold value have been pre-defined for title and text, it is high Degree and width are respectively greater than the height threshold and the space of a whole page element of the width threshold value is considered as text, are carrying out described the After one extension or first contraction, the processing unit judges the rectangle frame according to the testing result of the detection unit Height and width whether be greater than the height threshold and the width threshold value;If it is, described in the processing unit control Adjustment unit carries out the second extension and third extension;If it is not, then the processing unit controls the adjustment unit without institute State the second extension and third extension;Wherein, it is described second extension include by first opposite side in said first direction Extend to the edge of the space of a whole page element;The third extension includes extending to second opposite side in this second direction The edge of the space of a whole page element.
According to the twelfth aspect of the invention, in second extension, the detection unit obtains first opposite side With the spacing between the next row black pixel point of the space of a whole page element in said first direction, the processing unit should between Away from being compared with defined first spacing threshold, if the spacing is less than first spacing threshold, the adjustment is controlled First opposite side is extended a pixel wide by unit, and repeats above-mentioned comparison;If the spacing is greater than first spacing Threshold value then controls the adjustment unit and stops second extension.
According to the thirteenth aspect of the invention, in third extension, the detection unit obtains second opposite side With the spacing between the next row black pixel point of the space of a whole page element in this second direction, the processing unit should between Away from being compared with defined second spacing threshold, if the spacing is less than second spacing threshold, the adjustment is controlled Second opposite side is extended a pixel wide by unit, and repeats above-mentioned comparison;If the spacing is greater than second spacing Threshold value then controls the adjustment unit and stops the third extension.
According to the fourteenth aspect of the invention, it is described first extension, it is described first shrink, it is described second extension and it is described After third extension, the processing unit controls the adjustment unit will be described in first opposite side and second opposite side direction The pixel wide of the outside edges extension predetermined quantity of space of a whole page element.
Printed page analysis method and apparatus according to the present invention, it may not be necessary to the accurate location of specified space of a whole page element, so both The efficiency for improving specified space of a whole page element can also mitigate the eye fatigue degree of operator.
Detailed description of the invention
Attached drawing is used to be further described embodiments of the present invention together with verbal description.Wherein:
Fig. 1 shows the block diagram of printed page analysis device of the invention.
Fig. 2 shows the schematic diagrames for drawing rectangle frame in embodiment of the present invention on newspaper.
The rectangle frame that Fig. 3 shows Fig. 2 extends to the schematic diagram of space of a whole page element edges.
Fig. 4 shows the overview flow chart of printed page analysis method of the invention.
Fig. 5 shows the process of the extension process up and down of printed page analysis method of the invention.
Fig. 6 shows the process of the left and right extension process of printed page analysis method of the invention.
Specific embodiment
The embodiment that the invention will now be described in detail with reference to the accompanying drawings.In all the appended drawings, identical label indicates identical member Part, and omit its repeated explanation.
Regular publication, such as newspaper, space of a whole page element thereon is mostly rectangle, therefore, in text or image Rectangle frame is drawn on equal spaces of a whole page element region, and extends the four edges of rectangle frame to the edge of space of a whole page element to carry out version Surface analysis, this printed page analysis method efficiently solves the prior art, and that rectangle frame is drawn in number processing is difficult and not accurately Problem, improves the efficiency and accuracy of printed page analysis, and then improves the working efficiency and number processing of number processing business Quality.It should be understood that the one pair of them side of rectangle frame is parallel with an opposite side of space of a whole page element, another opposite side and space of a whole page member Another opposite side of element is parallel.For convenience, in the description with left and right and on get off to indicate these two pair side.It controls and is up and down Mutually for a user.
Illustrate printed page analysis method of the invention by taking rectangle frame as an example below.However, the present invention is not limited to rectangle frames, and It is that any other closed curve can be selected according to the shape of space of a whole page element.
In general, the space of a whole page element during printed page analysis includes text, picture and title, the space of a whole page according to the present invention Analysis method can draw a small square when the body part to such as newspaper draws rectangle frame in a part of text The four edges of the rectangle frame are extended to body part using the word space and line space of text and the mean size of word by shape frame Edge, can greatly improve in this way draw frame efficiency, can also mitigate significantly draw frame personnel eye fatigue degree.
When drawing rectangle frame to Picture section, small rectangle frame can be drawn, as long as framing picture various pieces, so that it may The rectangle frame is extended to the edge of picture automatically using connected domain.
When drawing rectangle frame to title division, title division can be passed through to draw, using projection automatically by rectangle frame Extend to the edge of title division.Sometimes when the surrounding margins such as title or text are larger, rectangle frame can be drawn greatly a bit with Title or text etc. are framed, if the four edges of rectangle frame are located at blank space at this time, title or text can be automatically contracted to Edge.The edge that the frame manually drawn can be extended to adaptively to each space of a whole page element in this way, is convenient for subsequent Space of a whole page element extraction and content recognition processing.
Throughout the specification, white gravoply, with black engraved characters is subject to all images, the image of black matrix wrongly written or mispronounced character is carried out instead first Color.In addition, introducing the extended method twice of rectangle frame in specification, the optimum position on side is finally obtained.For picture, Extended method is only performed once to be sufficient.
Fig. 1 shows the block diagram of printed page analysis device of the invention.
Printed page analysis device 10 of the invention includes input unit 101, display unit 102, detection unit 103, adjustment list First 104, extraction unit 105, processing unit 106.
When carrying out printed page analysis, user inputs image to be analyzed by input unit 101.Display unit 102 shows institute The image to be analyzed of input, here, image to be analyzed include multiple space of a whole page elements.User is where shown space of a whole page element Rectangle frame is drawn on region.Detection unit 103 detects the position of the four edges of rectangle frame on the image.106 basis of processing unit The testing result of detection unit 103 judge the four edges of rectangle frame be blank space or be pressed on picture or be pressed in text or On the text of title.
If detection unit 103 determines certain side of rectangle frame in blank space, processing unit 106 controls adjustment unit 104 are contracted to the side of rectangle frame at the edge of space of a whole page element.In the process, the pixel on 103 opposite side of detection unit clicks through Row scanning stops shrinking if occurring the pixel that gray value is 1 (black pixel point) on side.
If detection unit 103 determines that the side of rectangle frame is pressed on picture or is pressed on the text of text or title, Then processing unit 106 controls the edge that the side of rectangle frame is propagated outward into space of a whole page element by adjustment unit 104.
In the process, the pixel on 103 opposite side of detection unit is scanned, if gray value is 1 (black picture on side Vegetarian refreshments) pixel quantity be less than amount threshold, then stop extending.Then, the control of processing unit 106 adjustment unit 104 will The four edges of rectangle frame are adjusted to optimum position.M row or N column pixel are scanned on the outside of 103 opposite side of detection unit, find out first Optimum position of a least row or column of black pixel point number as side, wherein M and N is positive integer, it is preferred that 3≤M ≤ 5,3≤N≤5.
Then, processing unit 106 judges whether rectangle frame is greater than threshold value.When the width and height of rectangle frame are respectively greater than width Think that space of a whole page element is text when degree threshold value and height threshold, adjustment unit 104 carries out extension up and down to rectangle frame and left and right is expanded Exhibition, otherwise it is assumed that space of a whole page element is title, without extension, in order to text and title etc. are distinguished, because title is not required to It to carry out extending up and down again and left and right extends.
If processing unit 106 determines that rectangle frame is greater than threshold value, adjustment unit 104 executes extension up and down to rectangle frame.
Then, adjustment unit 104 executes left and right extension to rectangle frame.Expansion up and down can then be described in detail referring to figure 5 and figure 6 Exhibition and left and right extension.
Finally, adjustment unit 104 adjusts rectangle frame to optimum position.5 rows or 5 column pictures near 103 opposite side of detection unit Element is scanned, and finds out optimum position of first least row or column of black pixel point number as side.
Below with reference to Fig. 2-4 printed page analysis method that the present invention will be described in detail.
Fig. 2 shows the schematic diagrames for drawing rectangle frame in embodiment of the present invention on newspaper.Fig. 3 shows the square of Fig. 2 Shape frame extends to the schematic diagram of space of a whole page element edges.Fig. 4 shows the overview flow chart of printed page analysis method of the invention.
As shown in figure 4, inputting image to be processed (S400) first.Here, image to be processed includes multiple space of a whole page elements.So Afterwards, rectangle frame (S401) is drawn in the region where each space of a whole page element.
Next, the four edges for determining rectangle frame are in blank space or to be pressed on picture or be pressed in title or text On text (S402).If being determined as blank in step S402, side is contracted to the edge (S403) of space of a whole page element.If On the text for being judged to being pressed on picture or being pressed in title or text in step S402, then the side of rectangle frame is extended to The edge (S404) of space of a whole page element.
In step S402, the pixel on the four edges of rectangle frame is scanned, when black pixel point on certain side Number be greater than threshold number of pixels when, determine that the side is pressed on picture or is pressed on the text of title or text.Specifically, originally Invention detects the four edges of rectangle frame using the method for projection, and the side of left and right two throw up and down (i.e. to horizontal direction) Shadow, upper and lower two sides carry out left and right projection (i.e. to vertical direction) projection, if the sum of any a line projected pixel gray value It is 0, then it represents that the side is at blank position.If the sum of any a line projected pixel gray value is greater than defined gray scale threshold Value, then it represents that the side is pressed on picture or is pressed on the text of title or text.
In addition, using the method for projection, side is contracted to first grey scale pixel value when being shunk in step S403 The sum of the position that is not zero.When being extended in step s 404, also with the method for projection, side is extended into first picture The sum of plain gray value is less than the position of the gray threshold.
After step S404, the four edges of rectangle frame are adjusted to optimum position (S405).M row or N column on the outside of opposite side Pixel is scanned, and finds out optimum position of first least row or column of black pixel point number as side, wherein M and N are equal For positive integer, it is preferred that 3≤M≤5,3≤N≤5.
Next, process proceeds to step S406, judge whether the height of rectangle frame and width are greater than height threshold and width Spend threshold value.
Specifically, connected domain analysis is carried out to the black pixel point in rectangle frame, calculates connected domain in the rectangle frame The left and right average headway and upper and lower average headway of mean breadth and average height and connected domain, by 3 times of average connected domain width Add twice of connected domain or so average headway as the width threshold value, 3 times of average connected domain height is added into twice of connection Domain is between the upper and lower away from as the height threshold.
The purpose that above-mentioned judgement is carried out in step S406 is to discriminate between the type of space of a whole page element.
In the present invention, space of a whole page element includes title, text and picture.It is drawn for the space of a whole page element needs of these three types Different rectangle frames is made, it is specifically described below.
It, can be by rectangle when lemma is smaller and surrounding margins are larger when drawing rectangle frame in the region where title Frame is drawn larger to frame entire title, when lemma is big or surrounding margins are smaller, can pass through title to draw square Shape frame, as shown in the title of title and right upper portion at the top of Fig. 2.
When drawing rectangle frame in picture region, if picture is an entirety, appoint in picture region Place one rectangle frame of drafting of anticipating is ok, and if picture is a few partial subgraph pieces of separation, as long as guaranteeing separation Each section word picture have pixel in rectangle frame, as shown in the picture of the bottom Fig. 2.
When drawing rectangle frame in text region, it is assumed that include M row N column text in text, wherein M and N is big In the positive integer for being equal to 3, as long as then the size of rectangle frame is arranged greater than 3 rows 3, as shown in Figure 2.
Herein it is to be appreciated that Fig. 2 is to clearly demonstrate the case where drawing rectangle frame.When practical drafting rectangle frame, often A rectangle frame is drawn, it can all extend to the edge of space of a whole page element automatically, as shown in Figure 3.It is not in all rectangle frames in Fig. 2 The case where not extending.
That is, in step S406, if it is decided that result be it is yes, then illustrate space of a whole page element be text, if NO, Then illustrate that space of a whole page element is title.Title is not needed to be extended again.
If judgement result is yes in step S406, rectangle frame is executed and extends (step S407) up and down.It is specific next Say, using connected domain between the upper and lower away from and connected domain size, two sides up and down of rectangle frame are extended into the upper following of space of a whole page element Edge.
Carry out the extension up and down in the printed page analysis method that the present invention will be described in detail below with reference to Fig. 5.
It should be noted that being only respectively greater than height threshold and width threshold value in the height and width for determining rectangle frame Under the conditions of just execute up and down extension.Moreover, here when referring to two up and down of rectangle frame.
First, it is determined that when whether the distance between front to next line black picture element is 1 pixel (S501).If step Judgement result is yes in S501, then whether the connected domain where judging next line black pixel point is horizontal line (S502).
In step S502, judge connected domain whether be horizontal line method are as follows: the company where next line black pixel point The width that the height in logical domain is less than the connected domain where 1/5th and next line black pixel point of average connected domain height is big When 5 times of average connected domain width, then it is assumed that the connected domain is horizontal line.
If determine in step S502 result be it is no, when front extends to the outside a pixel (S503), then return Step S51 carries out next round judgement.
If judgement result is yes in step S502, stop extending (step S506).
On the other hand, if in step S501 determine result be it is no, judge whether next line connected domain average headway small In line space threshold value (S505).
In step S505, obtain when front to next line (up or down) black pixel point spacing, and with regulation Line space threshold value be compared.Specifically, the line space threshold value is set to: when upper and lower average headway is less than 20, being Upper and lower average headway is multiplied by 1.5, when upper and lower average headway is more than or equal to 20, adds 10 for upper and lower average headway.
If determining that result is no in step S505, then it is assumed that when front is located at the boundary of the space of a whole page element, (top is located at Coboundary is located at lower boundary below), stop extension (step S506).If judgement result is yes in step S505, under determining Whether a line connected domain size is less than row connected domain size threshold value (step S507).
In step s 507, count next line connected domain mean breadth, and with defined row connected domain size threshold value into Row compares.Specifically, connected domain size threshold value is set to connected domain mean breadth and adds 6, i.e. the mean breadth of connected domain is most Differ 5 pixels.
If determining that result is no (encountering title or horizontal line) in step S507, then it is assumed that when front is located at the space of a whole page element Boundary (top is located at coboundary, below be located at lower boundary), stop extension (step S506).If determining knot in step S507 Fruit be it is yes, then judge whether connected domain mean size is 0 (step S508).
In step S508, when up or down extending, if scanning to image up-and-down boundary find not yet it is black Colour vegetarian refreshments illustrates to extend to blank space when front, then stops extending (step S506), otherwise will move to next line company when front Then logical domain boundary carries out next round judgement (step S509).
Finally, the four edges of rectangle frame are adjusted to optimum position (S510) after step S506.Regulation on the outside of opposite side Capable or regulation column pixel is scanned, and finds out optimum position of first least row or column of black pixel point number as side, For example, the regulation row or regulation are classified as 5 rows or 5 column.
So far, the extension process up and down of printed page analysis method of the invention terminates.
Fig. 4 is returned, left and right extension (step S408) next is executed to rectangle frame.Specifically, connected domain or so is utilized The side of left and right two of rectangle frame is extended to the left and right edges of space of a whole page element by the size of spacing and the size of connected domain.
Carry out the left and right extension in the printed page analysis method that the present invention will be described in detail below with reference to Fig. 6.
It should be noted that being only respectively greater than height threshold and width threshold value in the height and width for determining rectangle frame Under the conditions of just execute left and right extension.Moreover, here at the left and right for referring to rectangle frame two.
First, it is determined that when whether the distance between front to next column black picture element is 1 pixel (step S600).If Judgement result is yes in step S600, then whether the connected domain where judging next column black picture element is vertical line (step S601).
In step s 601, judge connected domain whether be vertical line method are as follows: when the width of connected domain is less than average connection When the height of 1/5th and connected domain of field width degree is greater than 5 times of average connected domain height, then it is assumed that the connected domain is vertical line.
If judgement result is no in step S601, when front extends to the outside a pixel (step S602), process Return step S600 carries out next round judgement.
If judgement result is yes in step S601, stop extending (step S606).
On the other hand, if in step S600 determine result be it is no, judge whether next column connected domain average headway small In column pitch threshold value (step S603).
In step S603, obtain when front to next column (is turned left or turn right) spacing of black pixel point, and with regulation Column pitch threshold value be compared.Specifically, the column pitch threshold value is set to: when left and right average headway is less than 20, being Left and right average headway, when left and right average headway is more than or equal to 20, adds 10 multiplied by 1.5 for left and right average headway.
If the judgement result in step S603 is no, then it is assumed that when front is located at the boundary (left bit of the space of a whole page element In left margin, the right is located at right margin), stop extension (step S606).If the judgement result in step S603 be it is yes, sentence Determine whether next column connected domain mean size is less than column connected domain size threshold value (step S604).
In step s 604, count next column connected domain average height, and with defined column connected domain size threshold value into Row compares.Specifically, column connected domain size threshold value is set to connected domain average height and adds 6, i.e., the average height of connected domain is most Poor 5 pixels of multiphase.
If the judgement result in step S604 is no (encountering title or horizontal line), then it is assumed that when front is located at space of a whole page member The boundary (left side is located at left margin, and the right is located at right margin) of element stops extension (step S606).If sentencing in step S604 Determine result be it is yes, then judge next column up and down expanded height whether change (step S605).
In step s 605, extension up and down is carried out to next column connected domain, if the column connected domain height is greater than after extension Rectangle frame height (that is, variation) then stops left and right extension (step S606).If there is no changing after extension, Judge whether connected domain mean size is 0 (step S607).
In step S607, when leftward or rightward extension, if the right boundary of scanning to image find not yet it is black Colour vegetarian refreshments (connected domain mean size is 0), illustrates that the side extends to blank space, stops left and right extension (step S606), otherwise The side moves to next column connected domain boundary (step S608), then carries out next round judgement (step S600).
Finally, the four edges of rectangle frame are adjusted to optimum position (S609) after step S606.Regulation on the outside of opposite side Capable or regulation column pixel is scanned, and finds out optimum bit of first least row or column of black pixel point number as the side It sets, for example, the regulation row or regulation are classified as 5 rows or 5 column.
So far, the left and right extension process of printed page analysis method of the invention terminates.
It should be noted that the flow chart of Fig. 4 illustrates only the processing step of rectangle frame adjusting stage, by rectangle frame from Adaptation is adjusted to after the edge of space of a whole page element, also to extract space of a whole page element according to rectangle frame, although not showed that in Fig. 4, It is this is the common knowledge in printed page analysis field.
Printed page analysis method and apparatus of the invention only need user arbitrarily to draw one on needing the space of a whole page element analyzed A rectangle frame, rectangle frame will adaptively expand to the edge of the space of a whole page element, can greatly improve identification in this way and extract The efficiency of space of a whole page element can also mitigate the eye fatigue degree of operator significantly.
Specific embodiment is combined to carry out further in detail the purpose of the present invention, technical scheme and beneficial effects above Explanation.It should be understood that describing a specific embodiment of the invention merely for the sake of the purpose of illustration above, it is not intended to limit The system present invention.Any modification, equivalent substitution, improvement and etc. done all within the spirits and principles of the present invention, should be included in Within protection scope of the present invention.

Claims (8)

1.一种版面分析方法,包括以下步骤:1. A layout analysis method, comprising the following steps: 输入步骤,输入包括多个版面元素的待处理图像;inputting step, inputting the to-be-processed image including a plurality of layout elements; 绘制步骤,在每个版面元素所在的区域内绘制封闭曲线,其中,所述封闭曲线为矩形框,且该矩形框包括沿第一方向延伸的第一对边和沿第二方向延伸的第二对边;The drawing step is to draw a closed curve in the area where each layout element is located, wherein the closed curve is a rectangular frame, and the rectangular frame includes a first pair of sides extending along the first direction and a second pair extending along the second direction. opposite; 自适应调整步骤,将所述封闭曲线自适应调整至所述版面元素的边缘,且当所述封闭曲线为所述矩形框时,将所述第一对边和所述第二对边自适应调整至所述版面元素的边缘,并判断所述第一对边和所述第二对边是在空白处还是压住版面元素的文字,The adaptive adjustment step is to adaptively adjust the closed curve to the edge of the layout element, and when the closed curve is the rectangular frame, adaptively adjust the first opposite side and the second opposite side Adjust to the edge of the layout element, and determine whether the first opposite side and the second opposite side are in the blank space or pressing the text of the layout element, 若压住版面元素的文字,则进行第一扩展,将所述第一对边和所述第二对边扩展至所述版面元素的边缘;If the text of the layout element is pressed, a first expansion is performed, and the first opposite side and the second opposite side are extended to the edge of the layout element; 若在空白处,则执行第一收缩,将所述第一对边和所述第二对边收缩至所述版面元素的边缘;If it is in the blank space, perform first shrinking, and shrink the first opposite side and the second opposite side to the edge of the layout element; 其中,所述版面元素包括图片、标题和正文,针对标题和正文预先定义了高度阈值和宽度阈值,高度和宽度分别大于所述高度阈值和所述宽度阈值的版面元素被视为正文,Wherein, the layout element includes a picture, a title and a text, a height threshold and a width threshold are pre-defined for the title and the text, and a layout element whose height and width are respectively greater than the height threshold and the width threshold is regarded as the text, 在进行了第一扩展或第一收缩之后,判断所述矩形框的高度和宽度是否大于高度阈值和宽度阈值;After the first expansion or the first contraction is performed, determine whether the height and width of the rectangular frame are greater than the height threshold and the width threshold; 如果是,则判断所述版面元素为正文,进行第二扩展和第三扩展;If yes, then judge that the layout element is the text, and carry out the second expansion and the third expansion; 如果否,则判断所述版面元素为标题,不进行第二扩展和第三扩展,其中,所述第二扩展包括将所述第一对边在所述第一方向上扩展至所述版面元素的边缘;所述第三扩展包括将所述第二对边在所述第二方向上扩展至所述版面元素的边缘;If not, it is judged that the layout element is a title, and the second expansion and the third expansion are not performed, wherein the second expansion includes extending the first pair of edges to the layout element in the first direction the edge of the ; the third extension includes extending the second pair of edges to the edge of the layout element in the second direction; 提取步骤,根据自适应调整至所述版面元素的边缘的所述封闭曲线从所述待处理图像中提取每个版面元素。In the extraction step, each layout element is extracted from the to-be-processed image according to the closed curve adaptively adjusted to the edge of the layout element. 2.根据权利要求1所述的版面分析方法,其中,在所述第二扩展中,获取所述第一对边与所述版面元素在所述第一方向上的下一排黑色像素点之间的间距,将该间距与规定的第一间距阈值进行比较,如果该间距小于所述第一间距阈值,则将所述第一对边扩展一个像素宽度,并重复上述比较;如果该间距大于所述第一间距阈值,则停止所述第二扩展。2 . The layout analysis method according to claim 1 , wherein, in the second extension, a difference between the first pair of edges and the next row of black pixel points of the layout element in the first direction is obtained. 3 . If the distance is smaller than the first distance threshold, then the first pair of sides is expanded by one pixel width, and the above comparison is repeated; if the distance is greater than the first distance threshold, the second expansion is stopped. 3.根据权利要求2所述的版面分析方法,其中,在所述第三扩展中,获取所述第二对边与所述版面元素在所述第二方向上的下一排黑色像素点之间的间距,将该间距与规定的第二间距阈值进行比较,如果该间距小于所述第二间距阈值,则将所述第二对边扩展一个像素宽度,并重复上述比较;如果该间距大于所述第二间距阈值,则停止所述第三扩展。3 . The layout analysis method according to claim 2 , wherein, in the third extension, the difference between the second opposite side and the next row of black pixel points of the layout element in the second direction is obtained. 4 . If the distance is smaller than the second distance threshold, expand the second pair of sides by one pixel width, and repeat the above comparison; if the distance is greater than the second distance threshold, the third expansion is stopped. 4.根据权利要求1-3中任意一项所述的版面分析方法,其中,4. The layout analysis method according to any one of claims 1-3, wherein, 在所述第一扩展、所述第一收缩、所述第二扩展和所述第三扩展之后,将所述第一对边和所述第二对边朝向所述版面元素的边缘外部扩展预定数量的像素宽度。After the first expansion, the first contraction, the second expansion and the third expansion, the first pair of sides and the second pair of sides are expanded toward the outside of the edge of the layout element by a predetermined amount Amount of pixel width. 5.一种版面分析装置(10),包括:5. A layout analysis device (10), comprising: 输入单元(101),其用于输入包括多个版面元素的待处理图像;an input unit (101) for inputting an image to be processed including a plurality of layout elements; 显示单元(102),其显示所输入的待处理图像;a display unit (102) that displays the input image to be processed; 检测单元(103),当用户在每个版面元素所在区域上绘制封闭曲线时,所述检测单元(103)检测所述封闭曲线的位置,其中,所述封闭曲线为矩形框,该矩形框包括沿第一方向延伸的第一对边和沿第二方向延伸的第二对边,当所述封闭曲线为矩形框时,所述检测单元(103)用于检测所述第一对边和所述第二对边的位置;A detection unit (103), when the user draws a closed curve on the area where each layout element is located, the detection unit (103) detects the position of the closed curve, wherein the closed curve is a rectangular frame, and the rectangular frame includes The first pair of sides extending along the first direction and the second pair of sides extending along the second direction, when the closed curve is a rectangular frame, the detection unit (103) is configured to detect the first pair of sides and all the sides. the position of the second opposite side; 调整单元(104),其用于调整所述封闭曲线;an adjustment unit (104) for adjusting the closed curve; 提取单元(105),其用于根据所述封闭曲线从所述待处理图像中提取所述版面元素;以及an extraction unit (105) for extracting the layout element from the to-be-processed image according to the closed curve; and 处理单元(106),其根据所述检测单元(103)的检测结果控制所述调整单元(104)将所述封闭曲线调整到版面元素的边缘,并控制所述提取单元(105)提取每个版面元素,当所述封闭曲线为所述矩形框时,根据所述检测单元(103)的检测结果控制所述调整单元(104)将所述第一对边和所述第二对边调整到版面元素的边缘,以及判断所述第一对边和所述第二对边是在空白处还是压住版面元素的文字,A processing unit (106), which controls the adjustment unit (104) to adjust the closed curve to the edge of the layout element according to the detection result of the detection unit (103), and controls the extraction unit (105) to extract each The layout element, when the closed curve is the rectangular frame, the adjustment unit (104) is controlled according to the detection result of the detection unit (103) to adjust the first pair of sides and the second pair of sides to the edge of the layout element, and the text that determines whether the first opposite side and the second opposite side are in the blank space or pressing the layout element, 若压住所述版面元素的文字,则控制所述调整单元(104)进行第一扩展,将所述第一对边和所述第二对边扩展至所述版面元素的边缘;If the text of the layout element is pressed, the adjusting unit (104) is controlled to perform a first expansion, and the first opposite side and the second opposite side are extended to the edge of the layout element; 若在空白处,则控制所述调整单元(104)进行第一收缩,将所述第一对边和所述第二对边收缩至所述版面元素的边缘;If it is in a blank space, controlling the adjustment unit (104) to perform a first shrinking, and shrinking the first opposite side and the second opposite side to the edge of the layout element; 其中,所述版面元素包括图片、标题和正文,针对标题和正文预先定义了高度阈值和宽度阈值,高度和宽度分别大于所述高度阈值和所述宽度阈值的版面元素被视为正文,并在进行了所述第一扩展或所述第一收缩之后,还根据所述检测单元(103)的检测结果判断所述矩形框的高度和宽度是否大于所述高度阈值和所述宽度阈值;Wherein, the layout elements include pictures, titles, and text, for which a height threshold and a width threshold are pre-defined, and layout elements whose height and width are respectively greater than the height threshold and the width threshold are regarded as text, and are listed in the text. After the first expansion or the first contraction is performed, it is further determined whether the height and width of the rectangular frame are greater than the height threshold and the width threshold according to the detection result of the detection unit (103); 如果是,则控制所述调整单元(104)进行第二扩展和第三扩展;If yes, control the adjustment unit (104) to perform the second expansion and the third expansion; 如果否,则控制所述调整单元(104)不进行所述第二扩展和所述第三扩展;其中,所述第二扩展包括将所述第一对边在所述第一方向上扩展至所述版面元素的边缘;所述第三扩展包括将所述第二对边在所述第二方向上扩展至所述版面元素的边缘。If not, controlling the adjustment unit (104) not to perform the second extension and the third extension; wherein the second extension comprises extending the first pair of edges in the first direction to the edge of the layout element; the third extending includes extending the second opposite edge to the edge of the layout element in the second direction. 6.根据权利要求5所述的版面分析装置(10),其中,在所述第二扩展中,所述检测单元(103)获取所述第一对边与所述版面元素在所述第一方向上的下一排黑色像素点之间的间距,所述处理单元(106)将该间距与规定的第一间距阈值进行比较,如果该间距小于所述第一间距阈值,则控制所述调整单元(104)将所述第一对边扩展一个像素宽度,并重复上述比较;如果该间距大于所述第一间距阈值,则控制所述调整单元(104)停止所述第二扩展。6. The layout analysis device (10) according to claim 5, wherein, in the second extension, the detection unit (103) obtains the first pair of edges and the layout element in the first The distance between the next row of black pixels in the direction, the processing unit (106) compares the distance with a prescribed first distance threshold, and if the distance is smaller than the first distance threshold, controls the adjustment The unit (104) expands the first pair of sides by one pixel width, and repeats the above comparison; if the distance is greater than the first distance threshold, the adjustment unit (104) is controlled to stop the second expansion. 7.根据权利要求6所述的版面分析装置,其中,在所述第三扩展中,所述检测单元(103)获取所述第二对边与所述版面元素在所述第二方向上的下一排黑色像素点之间的间距,所述处理单元(106)将该间距与规定的第二间距阈值进行比较,如果该间距小于所述第二间距阈值,则控制所述调整单元(104)将所述第二对边扩展一个像素宽度,并重复上述比较;如果该间距大于所述第二间距阈值,则控制所述调整单元(104)停止所述第三扩展。7. The layout analysis apparatus according to claim 6, wherein, in the third extension, the detection unit (103) acquires the difference between the second opposite side and the layout element in the second direction The spacing between the black pixels in the next row, the processing unit (106) compares the spacing with a specified second spacing threshold, and if the spacing is smaller than the second spacing threshold, controls the adjustment unit (104) ) extends the second pair of sides by one pixel width, and repeats the above comparison; if the distance is greater than the second distance threshold, the adjustment unit (104) is controlled to stop the third expansion. 8.根据权利要求5、6或7所述的版面分析装置(10),其中,8. The layout analysis device (10) according to claim 5, 6 or 7, wherein, 在所述第一扩展、所述第一收缩、所述第二扩展和所述第三扩展之后,所述处理单元(106)控制所述调整单元(104)将所述第一对边和所述第二对边朝向所述版面元素的边缘外部扩展预定数量的像素宽度。After the first expansion, the first contraction, the second expansion and the third expansion, the processing unit (106) controls the adjustment unit (104) to The second pair of edges extends a predetermined number of pixels in width toward the outside of the edge of the layout element.
CN201510696674.4A 2015-10-23 2015-10-23 layout analysis method and device Active CN105373790B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510696674.4A CN105373790B (en) 2015-10-23 2015-10-23 layout analysis method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510696674.4A CN105373790B (en) 2015-10-23 2015-10-23 layout analysis method and device

Publications (2)

Publication Number Publication Date
CN105373790A CN105373790A (en) 2016-03-02
CN105373790B true CN105373790B (en) 2019-02-05

Family

ID=55375973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510696674.4A Active CN105373790B (en) 2015-10-23 2015-10-23 layout analysis method and device

Country Status (1)

Country Link
CN (1) CN105373790B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106227709B (en) * 2016-07-14 2019-03-29 北京小米移动软件有限公司 Filament method for drafting, device and terminal
CN106096592B (en) * 2016-07-22 2019-05-24 浙江大学 A kind of printed page analysis method of digital book
WO2019227300A1 (en) * 2018-05-29 2019-12-05 优视科技新加坡有限公司 Page element processing method and apparatus, and storage medium and electronic device/terminal/server
CN109214555B (en) * 2018-08-13 2023-06-27 中国平安人寿保险股份有限公司 Working area generation method, terminal equipment and medium
CN116453148A (en) * 2022-12-28 2023-07-18 杭州电子科技大学 A method for extracting features of newspaper layout

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750016A (en) * 2004-09-15 2006-03-22 北京中星微电子有限公司 Optical character identifying treating method for mobile terminal with camera
CN101770569A (en) * 2008-12-31 2010-07-07 汉王科技股份有限公司 Dish name recognition method based on OCR
CN101833545A (en) * 2009-03-11 2010-09-15 汉王科技股份有限公司 Method for indexing data in digital recourse processing process
CN103336961A (en) * 2013-07-22 2013-10-02 中国科学院自动化研究所 Interactive natural scene text detection method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103186911B (en) * 2011-12-28 2015-07-15 北大方正集团有限公司 Method and device for processing scanned book data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750016A (en) * 2004-09-15 2006-03-22 北京中星微电子有限公司 Optical character identifying treating method for mobile terminal with camera
CN101770569A (en) * 2008-12-31 2010-07-07 汉王科技股份有限公司 Dish name recognition method based on OCR
CN101833545A (en) * 2009-03-11 2010-09-15 汉王科技股份有限公司 Method for indexing data in digital recourse processing process
CN103336961A (en) * 2013-07-22 2013-10-02 中国科学院自动化研究所 Interactive natural scene text detection method

Also Published As

Publication number Publication date
CN105373790A (en) 2016-03-02

Similar Documents

Publication Publication Date Title
CN105373790B (en) layout analysis method and device
US8542926B2 (en) Script-agnostic text reflow for document images
KR101831783B1 (en) Apparatus for image and text recognition included in output printout and method thereof
US20070041642A1 (en) Post-ocr image segmentation into spatially separated text zones
CN110363102A (en) A kind of identification of objects process method and device of pdf document
US20110222776A1 (en) Form template definition method and form template definition apparatus
CN105046200B (en) Electronic paper marking method based on straight line detection
US12412413B2 (en) Image box filtering for optical character recognition
CN103530625A (en) Optical character recognition method based on digital image processing
CN114821620A (en) Text content extraction and identification method based on longitudinal combination of line text boxes
US8705862B2 (en) Image processing apparatus
CN106033534A (en) Electronic paper marking method based on linear detection
CN104268545B (en) Table area identification and content gridding method in a kind of electronics shelves layout files
CN113033559A (en) Text detection method and device based on target detection and storage medium
CN119032384A (en) System and method for detecting an object
Baloun et al. ChronSeg: Novel Dataset for Segmentation of Handwritten Historical Chronicles.
CN107798355A (en) A kind of method automatically analyzed based on file and picture format with judging
US9870632B2 (en) Information processing apparatus and non-transitory computer readable medium
US20170308745A1 (en) Techniques for restoring content from a torn document
US10789715B2 (en) Image processing device, image processing method, and information storage medium
CN108062548B (en) A Braille square adaptive positioning method and system
Kshetry Image preprocessing and modified adaptive thresholding for improving OCR
Babadi et al. Novel grid-based optical braille conversion: from scanning to wording
US9715624B1 (en) Document image segmentation based on pixel classification
CN107886808B (en) Braille square auxiliary labeling method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Layout analysis method and device

Granted publication date: 20190205

Pledgee: Zhongguancun Branch of Bank of Beijing Co.,Ltd.

Pledgor: BEIJING HANVON DIGITAL TECHNOLOGY Co.,Ltd.

Registration number: Y2025110000095

PE01 Entry into force of the registration of the contract for pledge of patent right