图像处理/超轻OCR [英] Image processing / super light OCR

查看:148
本文介绍了图像处理/超轻OCR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有55000张图片文件(JPG和TIFF格式),这些图片来自一本书。

I have 55 000 image files (in both JPG and TIFF format) which are pictures from a book.

每页的结构如下:


一些文字

some text

---(水平线)---

--- (horizontal line) ---

一个数字

一些文字

---(水平()

另一个数字

一些文字

任何给定页面上都可以有0到4条水平线。

There can be from zero to 4 horizontal lines on any given page.

我需要查找数字是多少,就在水平线以下。

I need to find what the number is, just below the horizontal line.

但是,数字严格遵循,从第一页开始,所以为了找到数字,我不需要读它:我可以检测到水平线的存在,这比试图OCR页面检测数字更容易和更安全。

BUT, numbers strictly follow each other, starting at one on page one, so in order to find the number, I don't need to read it: I could just detect the presence of horizontal lines, which should be both easier and safer than trying to OCR the page to detect the numbers.

算法将是,基本上:

for each image
  count horizontal lines
  print image name, number of horizontal lines
  next image

问题是:什么是最好的图像库/语言来做计算水平线部分?

The question is: what would be the best image library/language to do the "count horizontal lines" part?

推荐答案

可能是检测线条的最简单方法是使用 Hough变换 OpenCV (包含多种语言的包装)。

Probably the easiest way to detect your lines is using the Hough transform in OpenCV (which has wrappers for many languages).

OpenCV Hough变换将检测图像中的所有线并返回它们的角度和开始/停止坐标。你应该只保留角度接近水平和足够长度的那些。

The OpenCV Hough tranform will detect all lines in the image and return their angles and start/stop coordinates. You should only keep the ones whose angles are close to horizontal and of adequate length.

O'Reilly的学习OpenCV 详细解释函数的输入和输出(第156页)。

O'Reilly's Learning OpenCV explains in detail the function's input and output (p.156).

这篇关于图像处理/超轻OCR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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