简体   繁体   English

分析手绘流程图

[英]Analyzing a hand-drawn flowchart diagram

I'm trying to detect objects and text in a hand-drawn diagram. 我正在尝试检测手绘图中的对象和文本。

My goal is to be able to "parse" something like this into an object structure for further processing. 我的目标是能够“解析”像这样为对象结构做进一步处理。 My first aim is to detect text, lines and boxes (arrows etc... are not important (for now ;)) 我的首要目标是检测文本,线条和框(箭头等……不重要(目前;))

I can do Dilatation, Erosion, Otsu thresholding, Invert etc and easily get to something like this 我可以进行膨胀,侵蚀,Otsu阈值化,反转等操作,并且很容易达到这样的效果

What I need some guidance for are the next steps. 我需要一些指导的是后续步骤。 I've have several ideas: 我有几个想法:

  1. Contour Analysis 轮廓分析
  2. OCR using UNIPEN 使用UNIPEN的OCR
  3. Edge detection 边缘检测

Contour Analysis 轮廓分析

I've been reading about "Contour Analysis for Image Recognition in C#" on CodeProject which could be a great way to recognize boxes etc. but my issue is that the boxes are connected and therefore do not form separate objects to match with a template. 我一直在阅读CodeProject上的“ C#中用于图像识别的轮廓分析”,这可能是识别盒子等的好方法。但是我的问题是,盒子是连接的,因此不能形成与模板匹配的单独对象。 Therefore I need some advises IF this is a feasible way to go. 因此,如果这是可行的方法,我需要一些建议。

OCR using UNIPEN 使用UNIPEN的OCR

I would like to use UNIPEN (see "Large pattern recognition system using multi neural networks" on CodeProject) to recognize handwritten letters and then "remove" them from the image leaving only the boxes and lines. 我想使用UNIPEN(请参见CodeProject上的“使用多神经网络的大型模式识别系统”)识别手写字母,然后从图像中“删除”它们,仅留下方框和线条。

Edge detection Another way could be to detect all lines and corners and in that way infer the boxes and lines that the image consist of. 边缘检测另一种方法可能是检测所有线条和拐角,然后推断图像所组成的盒子和线条。 In that case ideas on how to straighten the lines and find the 90 degree corners would be helpful. 在这种情况下,有关如何拉直直线并找到90度角的想法将很有帮助。

Generally, I think I just need some pointers on which strategy to apply, not code samples (though it would be great ;)) 通常,我认为我只需要一些关于要应用哪种策略的指针,而不是代码示例(尽管会很棒;))

I will try to answer about the contour analysis and the lines between them. 我将尝试回答有关轮廓分析及其之间的界线的问题。

If you need to turn the interconnected boxes into separate objects, that can be achieved easily enough: 如果需要将互连的盒子变成单独的对象,可以很容易地实现:

  1. close the gaps in the box edges with morphological closing 用形态学闭合来闭合盒子边缘的间隙
  2. perform connected components labeling and look for compact objects (eg objects whose area is close to the area of their bounding box) 执行连接的组件标签并查找紧凑的对象(例如,面积接近其边界框区域的对象)

You will get the insides of the boxes. 您将获得盒子的内部。 These can be elliptical or rectangular or any shape you may find in common diagrams, the contour analysis can tell you which. 这些可以是椭圆形或矩形,也可以是您在普通图中发现的任何形状,轮廓分析可以告诉您哪种形状。 A problem may arise for enclosed background areas (eg the space between the ABC links in your example diagram). 封闭的背景区域(例如,示例图中ABC链接之间的空间)可能会出现问题。 You might eliminate these on the criterion that their bounding box overlaps with multiple other objects' bounding boxes. 您可以根据它们的边界框与其他多个对象的边界框重叠的标准来消除它们。

Now find line segments with HoughLinesP. 现在使用HoughLinesP查找线段。 If a segment finishes or starts within a certain distance of the edge of one of the objects, you can assume it is connected to that object. 如果线段在某个对象的边缘的一定距离内完成或开始,则可以假定它已连接到该对象。

As an added touch you could try to detect arrow ends on either side by checking the width profile of the line segments in a neighbourhood of their endpoints. 作为补充,您可以尝试通过检查线段端点附近的线宽来检测两侧的箭头末端。

It is an interesting problem, I will try to remember it and give it to my students to grit their teeth on. 这是一个有趣的问题,我会尽力记住它,并将其交给我的学生,以磨砺自己的牙齿。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM