查找图像中的单色,水平空间 [英] Find single color, horizontal spaces in image

查看:65
本文介绍了查找图像中的单色,水平空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,可能有一个表格,其中的行成行.我怎样才能找到所有穿过桌子的直线,水平线?例如. (红线是找到的线):

For example, there might be a table with text in rows. How could I find all straight, horizontal lines going through the table? E.g. (red lines are the found lines):

推荐答案

只需for this question,要检测horizontal linesmorph-op就足够了.

Just for this question, to detect the horizontal lines, the morph-op is enough.

import cv2 
img = cv2.imread("test.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
kernel = np.ones((1,100), np.uint8)
morphed = cv2.morphologyEx(gray, cv2.MORPH_CLOSE, kernel)
cv2.imshow("res", morphed);cv2.waitKey();cv2.destroyAllWindows()

更新,类似的问题:

(1)在图像中查找单色水平空间

(2) OpenCV/cv2:删除水平下划线

这篇关于查找图像中的单色,水平空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆