A method for recognizing horizontal and vertical line segments in an image is described in detail as follows: a sliding recognition window is set up according to the width of the line segments to be recognized in the specified recognition area of the image. When recognizing horizontal line segments, the height of the sliding recognition window is the same as the width of the line segments; and when recognizing vertical line segments, the sliding recognition window is used to identify vertical line segments. The width of the sliding recognition window is the same as the height of the line segment; sliding the sliding recognition window in the recognition area of the image to traverse each vertical line or horizontal line; sliding recognition window slides from left to right in the recognition area of the image when recognizing the vertical line; and sliding recognition window slides from left to right in the recognition area of the image when recognizing the horizontal line. Slide up and down and identify whether there are line segments that meet the specified conditions in the sliding recognition window. Compared with the prior art, the recognition rate of the present invention is greatly improved because there is no morphological transformation.
【技术实现步骤摘要】
一种针对图像中水平垂直线段的识别方法
本专利技术涉及图像识别领域,具体涉及一种针对图像中水平垂直线段的识别方法。
技术介绍
在图像识别领域,针对直线的检测,通常使用Hough(霍夫)算法。Hough算法及其改进算法的基本思想是利用共线点的对偶性来做检测,是坐标域变换的代表。它认为图像空间中共线的点在参数空间里对应着相交的线,并且,在参数空间里,相交在同一点的直线,其在图像空间里,都有共线的点相对应。Hough检测直线的能力包括:水平线、垂直线、斜线、间断线等。但由于Hough算法的特点,使用时间复杂度和空间复杂度都很高,与之对应的是算法低效和空间占用高,并且在变换过程中丢失了线段的长度信息和具体位置。虽然Hough算法的能力较大,但在检测具体的水平线和垂直线的效果上,不是最优的。本文针对水平线和垂直线的检测提出了一种新的算法。
技术实现思路
为解决上述问题,本专利技术提供一种针对图像中水平垂直线段的识别方法。本专利技术的技术方案具体为:一种针对图像中水平垂直线段的识别方法:具体过程如下:指定图像中的识别区,根据所需识别的线段宽度设置滑动识别窗口,在识别水平线段时,滑动识别窗口的高度与线段的宽度相同;而在识别垂直线段时,滑动识别窗口的宽度与线段的高度相同;将滑动识别窗口放在图像中的识别区中滑动以遍历每条垂直线或水平线,对于识别垂直线时滑动识别窗口在图像中的识别区中从左至右滑动;而对于识别水平线时滑动识别窗口在图像中的识别区中从上至下滑动,在滑动识别窗口中判别是否存在符合指定条件的线段。进一步的:所述的指定条件包括颜色数组、颜色误差、线段宽度、线段最小长度。如权利 ...
【技术保护点】
1.一种针对图像中水平垂直线段的识别方法,其特征在于:具体过程如下:指定图像中的识别区,根据所需识别的线段宽度设置滑动识别窗口,在识别水平线段时,滑动识别窗口的高度与线段的宽度相同;而在识别垂直线段时,滑动识别窗口的宽度与线段的高度相同;将滑动识别窗口放在图像中的识别区中滑动以遍历每条垂直线或水平线,对于识别垂直线时滑动识别窗口在图像中的识别区中从左至右滑动;而对于识别水平线时滑动识别窗口在图像中的识别区中从上至下滑动,在滑动识别窗口中判别是否存在符合指定条件的线段。
【技术特征摘要】
1.一种针对图像中水平垂直线段的识别方法,其特征在于:具体过程如下:指定图像中的识别区,根据所需识别的线段宽度设置滑动识别窗口,在识别水平线段时,滑动识别窗口的高度与线段的宽度相同;而在识别垂直线段时,滑动识别窗口的宽度与线段的高度相同;将滑动识别窗口放在图像中的识别区中滑动以遍历每条垂直线或水平线,对于识别垂直线时滑动识别窗口在图像中的识别区中从左至右滑动;而对于识别水平线时滑动识别窗口在图像中的识别区中从上至下滑动,在滑动识别窗口中判别是否存在符合指定条件的线段。2.如权利要求1所述的一种针对图像中水平垂直线段的识别方法,其特征在于:所述的指定条件包括颜色数组、颜色误差、线段宽度、线段最小长度。3.如权利要求1所述的一种针对图像中水平垂直线段的识别方法,其特征在于:识别过程中采用递归嵌套的方式在图像中寻找,分别分为三个层次:图像内遍历、滑动识别窗口内遍历、线条内遍历。4.如权利要求3所述的一种针对图像中水平垂直线段的识别方法,其特征在于:所述的图像内遍历过...
【专利技术属性】
技术研发人员:陈宇,杨清祥,白鸿钧,丁洋,刘远锋,苏慧祥,
申请(专利权)人:河南思维轨道交通技术研究院有限公司,
类型:发明
国别省市:河南,41
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。