OpenCV中的连接字符分割 [英] Connected Character segmentation in OpenCV

查看:130
本文介绍了OpenCV中的连接字符分割的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

了解下图所示的组合字符的分割方法是什么好方法,

  • 字符具有此字体,但是字体大小根据图像大小而变化
  • 仅连接图像中孤立的字符组

此外,如何检测在给定的边界框中是否有2个或多个连接的字母?

我尝试检查width> height以检测连接的字符,但不适用于图像中的蓝色组.

我还尝试了基于以下内容的细分方法: 第3.4条 用于分隔字符,但效果不佳.

解决方案

IDEA :如果您已经拥有一个好的ocr,则可以尝试应用ocr所有这些连接的组件(或轮廓).如果ocr无法检测到字母;比没有1个字母,有2个或更多.

想法:检查凸性这些连接的组件的缺陷,最接近的缺陷点就是桥所在的位置.

IDEA :使用宽度和宽度较小的内核;侵蚀+膨胀的高度很高(形态学开口)

想法:获取图像的y导数.剩下的最小轮廓(或线条)将成为您的桥梁.标记它们并从原始图像中删除那些像素.

IDEA :搜索问题的方法:从字母表(和该字体)中提取2个字母,用某种工具将它们水平连接,然后使用自相关.

祝你好运.

What is a good method to segment characters that are united as in the following figure, knowing that:

  • characters have this font, but the font size varies based on the image size
  • only isolated groups of characters from the image are connected

Also, how can i detect if in a given bounding box, there are 2 or more letters which are connected?

I tried with checking for width > height for detecting connected characters but it doesn't work for the blue groups in the image.

I also tried a segmentation method based on: Article section 3.4 for separating characters but got poor results.

解决方案

IDEA: if you have a good ocr already, you can try to apply ocr all these connected components (or contours). If ocr cant detect a letter; than there is not 1 letter, there are 2 or more.

IDEA: check convexity defects of these connected components, the closest defect points are where the bridges are.

IDEA: use a kernel having small width & big height for erosion+dilation (morphological opening)

IDEA: take y-derivative of the image. The smallest contours (or lines) left will be your bridges. Mark them and erase those pixels from the original image.

IDEA: search problem approach: Take 2 letters from alphabet (and this font), connect them horizontally with some tool and use matchShapes method (moment match) of opencv to find if that shape matches with your connected component. Or try to implement autocorrelation.

good luck.

这篇关于OpenCV中的连接字符分割的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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