CN108776776B - Identification method for horizontal and vertical line segment in image - Google Patents
Identification method for horizontal and vertical line segment in image Download PDFInfo
- Publication number
- CN108776776B CN108776776B CN201810511667.6A CN201810511667A CN108776776B CN 108776776 B CN108776776 B CN 108776776B CN 201810511667 A CN201810511667 A CN 201810511667A CN 108776776 B CN108776776 B CN 108776776B
- Authority
- CN
- China
- Prior art keywords
- sliding
- line
- image
- line segment
- window
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/10—Terrestrial scenes
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
A method for identifying a horizontal vertical line segment in an image comprises the following steps: the specific process is as follows: designating an identification area in the image, setting a sliding identification window according to the width of a line segment to be identified, wherein the height of the sliding identification window is the same as the width of the line segment when a horizontal line segment is identified; when the vertical line segment is identified, the width of the sliding identification window is the same as the height of the line segment; sliding the sliding recognition window in the recognition area in the image to traverse each vertical line or horizontal line, and sliding the sliding recognition window from left to right in the recognition area in the image when the vertical line is recognized; and when the horizontal line is identified, the sliding identification window slides from top to bottom in the identification area in the image, and whether the line segment meeting the specified condition exists in the sliding identification window is judged. Compared with the prior art, the method has the advantage that the recognition rate is improved greatly due to the fact that morphological transformation does not exist.
Description
Technical Field
The invention relates to the field of image recognition, in particular to a recognition method for a horizontal vertical line segment in an image.
Background
In the field of image recognition, a Hough algorithm is generally used for the detection of straight lines.
The basic idea of the Hough algorithm and the improved algorithm is to use the duality of collinear points for detection, which is a representative of coordinate domain transformation. It considers that collinear points in image space correspond to intersecting lines in parameter space, and that straight lines intersecting at the same point in parameter space all have collinear points in image space.
The ability of Hough to detect straight lines includes: horizontal lines, vertical lines, diagonal lines, broken lines, etc. However, due to the characteristics of the Hough algorithm, the complexity of the use time and the complexity of the space are high, and the Hough algorithm is low in efficiency and high in space occupation, and the length information and the specific position of the line segment are lost in the conversion process.
Although the capacity of the Hough algorithm is large, it is not optimal in terms of the effect of detecting specific horizontal and vertical lines. A new algorithm is proposed herein for the detection of horizontal and vertical lines.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method for identifying a horizontal vertical line segment in an image.
The technical scheme of the invention is as follows:
a method for identifying a horizontal vertical line segment in an image comprises the following steps: the specific process is as follows: designating an identification area in the image, setting a sliding identification window according to the width of a line segment to be identified, wherein the height of the sliding identification window is the same as the width of the line segment when a horizontal line segment is identified; when the vertical line segment is identified, the width of the sliding identification window is the same as the height of the line segment; sliding the sliding recognition window in the recognition area in the image to traverse each vertical line or horizontal line, and sliding the sliding recognition window from left to right in the recognition area in the image when the vertical line is recognized; and when the horizontal line is identified, the sliding identification window slides from top to bottom in the identification area in the image, and whether the line segment meeting the specified condition exists in the sliding identification window is judged.
Further: the specified conditions comprise a color array, a color error, a line segment width and a line segment minimum length.
A method of identifying a horizontal vertical segment in an image as claimed in claim 1, characterized by: in the identification process, a recursive nesting mode is adopted to search in the image, and the method is divided into three layers: image internal traversal, sliding recognition window internal traversal and line internal traversal.
Further: the in-image traversal process is to slide the sliding recognition window in the recognition area in the image to traverse each vertical line or horizontal line.
Further: the traversing process in the sliding recognition window is that in the sliding recognition window, a set of segment intervals meeting the color condition and the minimum length condition is searched in each segment in the window sequentially from left to right when horizontal lines are recognized or from top to bottom when vertical lines are recognized, the segment intervals are defined as that each segment in the interval meets the color condition and the minimum length condition, the interval width is the same as the sliding recognition window width when vertical lines are recognized, and the interval height is the same as the sliding recognition window height when horizontal lines are recognized.
Further: the in-line traversal process is to sequentially search each line segment meeting the color requirement from top to bottom when horizontal lines are identified or vertical lines are identified according to each line segment in the sliding identification window from left to right, then make length judgment on each line segment, and only reserve the line segments meeting the minimum length.
Further: the sliding distance of the sliding recognition window at each time is one line in the image, and one line is the width of one pixel.
Compared with the prior art, the invention has the technical effects that:
1) since morphological transformation does not exist, the speed of recognition is improved greatly;
2) because the input conditions are strictly judged, the accuracy is higher;
3) a "different color mixing" line segment can be identified.
Drawings
FIG. 1 is an illustration of identification samples of the present invention.
FIG. 2 is a table of parameters identifying FIG. 1.
FIG. 3 is a schematic diagram of the algorithm of the present invention.
Fig. 4 is a schematic view of a vertical line segment disassembled.
Fig. 5 is a schematic view of horizontal line segment disassembly.
Fig. 6 is a schematic diagram illustrating sliding of the sliding recognition window during vertical line recognition.
Fig. 7 is a schematic diagram illustrating sliding of the sliding recognition window during horizontal line recognition.
Fig. 8 is a schematic diagram of traversal recognition in a sliding recognition window.
Fig. 9 is a schematic diagram of traversal recognition within a line.
Detailed Description
The basic idea of the algorithm is that the size of a sliding recognition window is set by designating the width of a line segment to be recognized as the width of the line segment, the sliding recognition window slides in a recognition area in an image to traverse each vertical line or horizontal line, and for recognizing the vertical line, the sliding recognition window slides from left to right in the recognition area in the image; and for recognizing horizontal lines, the sliding recognition window slides from top to bottom in the recognition area in the image. And judging whether a line segment meeting specified conditions exists in the sliding identification window, wherein the specified conditions comprise a color array, a color error, a line segment width and a line segment minimum length.
In the identification process, an identification algorithm is searched in an image in a recursive nesting mode and is divided into three layers: image internal traversal, sliding recognition window internal traversal and line internal traversal. As shown in fig. 3.
1) In-image traversal
First, an image is understood as a line segment of one bar. For horizontal segment identification, a horizontal segment is understood, while for vertical segment identification, a vertical segment is understood. As shown in fig. 4-5.
Next, a rectangular frame having a parameter "line segment width" as a size is set as a "sliding recognition window", the "height" of the window is set as the "line segment width" for horizontal line segment recognition, and the "width" of the window is set as the "line segment width" for vertical line segment recognition.
Then, a sliding recognition window is placed at the recognition area of the image, sliding from top to bottom when recognizing horizontal lines or from left to right when recognizing vertical lines, as shown in fig. 6-7.
The distance of each slide is one line in the image, i.e. the width of one pixel. And judging and searching whether a line segment meeting the requirement exists in the sliding identification window every time. The decision and search method will be described in the following "traversal within a sliding recognition window".
2) Traversal within a sliding recognition window
In the sliding identification window, a set of line segment intervals meeting the color condition and the minimum length condition is searched in each line segment in the window sequentially from left to right when horizontal lines are identified or from top to bottom when vertical lines are identified. The detailed description and method of the two conditions, the color condition and the minimum length condition, will be shown in the following "traversal within a line". By "traversal within a line", the result is: on each line, there is "0 segment or a plurality of segments" satisfying "color range" and having a length not less than "minimum length". As shown in fig. 8.
In the example of fig. 8, the size of the sliding recognition window is 3 pixels, 3 lines in the window respectively include 2, and 1 line segments satisfying the condition by traversing within the lines, and according to the position coordinates of these line segments, the interval coordinates where each line segment in a certain coordinate range meets the color condition and the minimum length condition are found, and the interval height when a horizontal line is recognized is the same as the sliding recognition window height, and the interval width when a vertical line is recognized is the same as the sliding recognition window width, where the interval abscissa range when the horizontal line is determined is the minimum length of the required line segment, the interval ordinate range when the vertical line is determined is the minimum length of the required line segment, and the interval of the coordinate range is the finally found line segment interval satisfying the "width condition". The thick line segment formed between the line segments is the target line segment to be searched, the coordinate information of the segment is read, the position information of the segment in the whole image is recorded, and the position information is returned to the caller.
While the 2 line segments at the left position in fig. 8 have the length satisfying the requirement, the segment interval requirement of "3 continuous line segments" cannot be formed, and finally the requirement cannot be satisfied.
3) Traversal within a line
In the "traversal within line" stage, for each line, the horizontal line looks for each "line segment" meeting the color requirement from left to right or the vertical line from top to bottom in turn. For example, for the first line in fig. 5, there may be multiple line segments that meet the color requirement, as shown in fig. 9.
In fig. 9, there are 4 line segments that meet the color requirement. Then, length judgment is carried out on each line segment, and only judgment meeting the minimum length is reserved. In fig. 9, only the lengths of the left two line segments are satisfactory, and the right two line segments are ignored because of their shorter lengths.
After the three-level traversal search, whether line segments meeting the specified requirements exist or not can be found, and the positions of the line segments can be found.
The method is used for identifying horizontal line segments and vertical line segments from the image, and does not include oblique lines.
For a given image, the specified parameters include: the 'region of interest' as the identification area, the line segment color array, the color error range, the line segment width and the line segment minimum length. By the method, the coordinates of the two end points of the line segment can be obtained, namely the coordinates of the line segment interval in traversal in the sliding recognition window. The use of the algorithm is briefly described below by way of example in fig. 1.
In fig. 1, a "dialog box" is floating, and the present algorithm may be used if the location and size of the dialog box is to be identified. The recognition dialog box actually recognizes the positions of its upper and lower horizontal line segments and left and right vertical line segments.
By analyzing the image, two characteristics can be observed at the boundary of the dialog box: 1. the same color, i.e., aqua, is present at the peripheral border of the dialog box. 2. The 1 pixel outside the dialog box border is a pure black line wrap. From which the call book can be obtained
The input parameters of the algorithm are shown in fig. 2.
After the algorithm is used, the positions of four line segments are obtained, and a rectangular area enclosed by the four line segments is the position of the dialog box.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various changes and modifications can be made without departing from the overall concept of the present invention, and these should also be considered as the protection scope of the present invention.
Claims (3)
1. A method for identifying a horizontal vertical line segment in an image is characterized by comprising the following steps: the specific process is as follows: designating an identification area in the image, setting a sliding identification window according to the width of a line segment to be identified, wherein the height of the sliding identification window is the same as the width of the line segment when a horizontal line segment is identified; when the vertical line segment is identified, the width of the sliding identification window is the same as that of the line segment; sliding the sliding recognition window in the recognition area in the image to traverse each vertical line or horizontal line, and sliding the sliding recognition window from left to right in the recognition area in the image when the vertical line is recognized; and for the sliding recognition window sliding from top to bottom in the recognition area in the image when the horizontal line is recognized, judging whether a line segment meeting the specified condition exists in the sliding recognition window, searching in the image by adopting a recursive nesting mode in the recognition process, and respectively dividing into three layers: traversing in the image, traversing in a sliding recognition window and traversing in a line;
the in-image traversal process is to place a sliding recognition window in a recognition area in the image to slide to traverse each vertical line or horizontal line;
the traversing process in the sliding recognition window is that in the sliding recognition window, a set of segment intervals meeting the color condition and the minimum length condition is searched in each segment in the window sequentially from left to right when horizontal lines are recognized or from top to bottom when vertical lines are recognized, and the segment intervals are defined as that each segment in the interval meets the color condition and the minimum length condition, the interval width is the same as the sliding recognition window width when vertical lines are recognized, and the interval height is the same as the sliding recognition window height when horizontal lines are recognized;
the in-line traversal process is to sequentially search each line segment meeting the color requirement from top to bottom when horizontal lines are identified or vertical lines are identified according to each line segment in the sliding identification window from left to right, then make length judgment on each line segment, and only reserve the line segments meeting the minimum length.
2. A method of identifying a horizontal vertical segment in an image as claimed in claim 1, characterized by: the specified conditions comprise a color array, a color error, a line segment width and a line segment minimum length.
3. A method of identifying a horizontal vertical segment in an image as claimed in claim 1, characterized by: the sliding distance of the sliding recognition window at each time is one line in the image, and one line is the width of one pixel.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810511667.6A CN108776776B (en) | 2018-05-25 | 2018-05-25 | Identification method for horizontal and vertical line segment in image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810511667.6A CN108776776B (en) | 2018-05-25 | 2018-05-25 | Identification method for horizontal and vertical line segment in image |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108776776A CN108776776A (en) | 2018-11-09 |
CN108776776B true CN108776776B (en) | 2021-11-02 |
Family
ID=64027550
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810511667.6A Active CN108776776B (en) | 2018-05-25 | 2018-05-25 | Identification method for horizontal and vertical line segment in image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108776776B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8254694B2 (en) * | 2009-06-08 | 2012-08-28 | Xerox Corporation | Thin line detection in scanned image data |
CN104182731A (en) * | 2014-08-12 | 2014-12-03 | 中国科学技术大学 | A grid-shaped radar detection method based on cross detection |
CN106203397A (en) * | 2016-07-26 | 2016-12-07 | 江苏鸿信***集成有限公司 | Differentiate and localization method based on the form of tabular analysis technology in image |
CN107679520A (en) * | 2017-10-30 | 2018-02-09 | 湖南大学 | A kind of lane line visible detection method suitable for complex condition |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100464346C (en) * | 2006-04-29 | 2009-02-25 | 北大方正集团有限公司 | Digital correction method for geometric distortion of form image |
CN101676930A (en) * | 2008-09-17 | 2010-03-24 | 北大方正集团有限公司 | Method and device for recognizing table cells in scanned image |
CN103258198B (en) * | 2013-04-26 | 2015-12-23 | 四川大学 | Character extracting method in a kind of form document image |
US9235755B2 (en) * | 2013-08-15 | 2016-01-12 | Konica Minolta Laboratory U.S.A., Inc. | Removal of underlines and table lines in document images while preserving intersecting character strokes |
CN106803061A (en) * | 2016-12-14 | 2017-06-06 | 广州大学 | A kind of simple and fast method for detecting lane lines based on dynamic area-of-interest |
-
2018
- 2018-05-25 CN CN201810511667.6A patent/CN108776776B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8254694B2 (en) * | 2009-06-08 | 2012-08-28 | Xerox Corporation | Thin line detection in scanned image data |
CN104182731A (en) * | 2014-08-12 | 2014-12-03 | 中国科学技术大学 | A grid-shaped radar detection method based on cross detection |
CN106203397A (en) * | 2016-07-26 | 2016-12-07 | 江苏鸿信***集成有限公司 | Differentiate and localization method based on the form of tabular analysis technology in image |
CN107679520A (en) * | 2017-10-30 | 2018-02-09 | 湖南大学 | A kind of lane line visible detection method suitable for complex condition |
Non-Patent Citations (4)
Title |
---|
"Rule Line Detection and Removal in Handwritten Text Images";Syed Imtiaz 等;《2014 Fifth International Conference on Signal and Image Processing》;20140331;第310-315页 * |
"主动立体视觉关键技术及其应用研究";余洪山;《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》;20041215;第2004年卷(第4期);I138-965 * |
"实时图像处理中的垂直和水平直线检测算法";鲍苏苏 等;《合肥工业大学学报》;20030831;第26卷(第4期);第550-552页 * |
"直线提取算法研究";王旭;《中国优秀硕士学位论文全文数据库信息科技辑》;20160315;第2016年卷(第3期);I138-5754 * |
Also Published As
Publication number | Publication date |
---|---|
CN108776776A (en) | 2018-11-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110084095B (en) | Lane line detection method, lane line detection apparatus, and computer storage medium | |
US20190188528A1 (en) | Text detection method and apparatus, and storage medium | |
US10430681B2 (en) | Character segmentation and recognition method | |
CN107045634B (en) | Text positioning method based on maximum stable extremum region and stroke width | |
KR101403876B1 (en) | Method and Apparatus for Vehicle License Plate Recognition | |
US10354111B2 (en) | Primary localization method and system for QR codes | |
CN104376318B (en) | Underscore and form line in removing file and picture while retaining and intersecting stroke | |
CN104298982A (en) | Text recognition method and device | |
CN101676930A (en) | Method and device for recognizing table cells in scanned image | |
WO2017016448A1 (en) | Qr code feature detection method and system | |
CN110738106A (en) | optical remote sensing image ship detection method based on FPGA | |
CN110516673B (en) | Yi-nationality ancient book character detection method based on connected component and regression type character segmentation | |
Liang et al. | A new wavelet-Laplacian method for arbitrarily-oriented character segmentation in video text lines | |
Liu et al. | A novel multi-oriented chinese text extraction approach from videos | |
CN104036514A (en) | Circle detection method based on histogram peak value search | |
CN108776776B (en) | Identification method for horizontal and vertical line segment in image | |
CN111127480B (en) | Image processing method and device, electronic equipment and storage medium | |
CN111325199B (en) | Text inclination angle detection method and device | |
CN103985135B (en) | A kind of license plate locating method based on difference edge image | |
CN115880228A (en) | Multi-defect merging method and device, computer equipment and storage medium | |
CN115063817A (en) | Form identification method and system based on morphological detection and storage medium | |
CN111639506B (en) | Positioning method and device for bar codes in image and code scanning equipment | |
CN114612923A (en) | House type graph wall processing method, system, medium and equipment based on target detection | |
CN114282559A (en) | Optical code positioning method and device and image sensor chip | |
CN110059572B (en) | Document image Chinese keyword detection method and system based on single character matching |
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 |