python图片表格提取算法_从扫描的文档opencv python中提取行表

1586010002-jmsa.png

I want to extract the information from a scanned table and store it a csv. Right now my table extraction algorithm does the following steps.

Apply skew correction

Apply a gaussian filter for denoising.

Do a binarization using Otsu thresholding

Do a morphological opening.

Canny egde detection

Do a hough transform to obtain lines of table.

Remove duplicate lines( same lines in the range of 10 pixels)

filter the horizontal and vertical lines using slope of line(slope should be less than +/-5 degree for horizontal and normal of verticals).

This algorithm is working fine for digital born pdfs and most of the scanned documents. But, Some of the documents have a noisy table and thus its not identifying the lines correctly.

Here is a sample image in which my algorithm fails.

f8GOA.jpg

These are the operations I am doing on this table.

1.Gaussian blur

OJzYY.jpg

2.Otsu thresholding

hBUnZ.jpg

3.Morphological opening

q8UBQ.jpg

4.Canny edge detection

eyewa.jpg

5.filtered lines,as you can see the lines are clearly not identified

correctly.

8UI60.jpg

Can anyone please suggest better method for extracting horizontal and vertical lines from this kind of less quality scans.

Thanks in advance!!

解决方案

Here,We are doing morphological transformations using a vertical kernel to detect vetical lines and horizontal kernel to detect horizontal lines and then combining them to get all the required lines.

Vertical lines

SyrqQ.jpg

Horizontal lines

wOwD0.jpg

required output

ClniP.jpg

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值