简体   繁体   English

检测图像中的手绘电路组件,检测文本,建立连接树

[英]Detect hand-drawn circuit components in image, detect text, build connection tree

I want to know, how I should process hand drawn images of circuit diagrams, for the sake of digitizing the drawn circuit and eventually simulating it. 我想知道,为了数字化绘制的电路并最终对其进行仿真,应该如何处理电路图的手绘图像。

The input to my program would be a regular picture (smartphone etc..) and the finished output should be a simulation of all possible values in the circuit (not covered / required here) 我程序的输入将是一张普通图片(智能手机等。),完成的输出应是电路中所有可能值的仿真(此处未涵盖/要求)

Basically all I would need to be able to detect are electrical components with a fixed number of connections (2 connections eg R,L,C,Diode) and the lines connecting them. 基本上,我只需要能够检测到具有固定数量的连接(2个连接,例如R,L,C,Diode)的电气组件以及连接它们的线路即可。

I already have a pretrained neural network for detecting which type of component it is. 我已经有一个预训练的神经网络来检测它是哪种类型的组件。 The part where I struggle is, how do I get bounding boxes around the components so I can classify them with my NN? 我苦苦挣扎的部分是,如何获得组件周围的边界框,以便可以使用NN对它们进行分类? I tried several approaches using Contouring and Object detection using OpenCV (eg. FindContours , ConnectedComponentsWithStats ) but I cant seem to get it to detect only the components, and not the text or connecting lines between components. 我尝试了几种使用Contouring的方法以及使用OpenCV进行对象检测的方法(例如FindContoursConnectedComponentsWithStats ),但似乎无法检测到仅检测组件,而不能检测文本或组件之间的连接线。

Basically what I want is the following: 基本上我想要的是以下内容:

Given this Input Image (not hand-drawn for sake of readability) 给定此 输入图像(出于可读性 考虑, 不手工绘制)

I would like to know: 我想知道:

  • How many components are there? 有多少个组件?
  • Where are the bounding boxes of the components? 组件的边界框在哪里?

Basically These bounding boxes 基本上这些边界框

This is used to extract components and classify them with the model I already have. 这用于提取组件并将它们与我已经拥有的模型进行分类。

Furthermore, I would like to extract the Text closest to any component, so that I can read the values of each component. 此外,我想提取最接近任何组件的Text,以便读取每个组件的值。 I have already managed to do OCR with the help of tesseract-ocr , so if I can get bounding boxes around the text I can easily read the values. 我已经在tesseract-ocr的帮助下成功进行了OCR,因此,如果可以在文本周围找到边框,则可以轻松读取值。

Like this 像这样

But the part I struggle with the most, is finding out which component is connected to which other component, I am unsure how I should approach this. 但是我最苦恼的部分是找出哪个组件与另一个组件相连,我不确定该如何处理。 Its really hard to find something googling my problem, and not certain how I should describe this problem in general. 很难找到一些解决我的问题的方法,并且不确定我应该如何概括地描述这个问题。 But overall, I need enough information to be able to simulate the circuit with the Matrix-Simulations (basic DC-Analysis). 但是总的来说,我需要足够的信息以能够使用Matrix-Simulations(基本DC分析)对电路进行仿真。

I do not explicitly require code, I need general guidance to solving this problem. 我没有明确要求代码,我需要一般性指导来解决此问题。 Or maybe even links to research papers attacking similar problems. 甚至可能链接到研究类似问题的研究论文。

"Every problem is just a good dataset away from being demolished" source. “每个问题都是远离被拆除的一个好数据集”

There are several electronic symbols that you will need to detect. 您需要检测几个电子符号 A modern approach to classifying the symbols would be to use a neural network. 对符号进行分类的现代方法是使用神经网络。 To train this model, you will need to create a dataset of hand-drawn electronic symbols. 要训​​练此模型,您将需要创建手绘电子符号的数据集。 Classifying the electronic symbols will be similar to handwritten digit classification . 对电子符号进行分类将类似于手写数字分类

Before the symbols can be classified by a neural network model, the image will have to be segmented. 在通过神经网络模型对符号进行分类之前,必须先对图像进行分割。 Individual components (diode, capacitor, resistor, etc...) will need to be identified, and labeled with bounding boxes. 需要标识各个组件(二极管,电容器,电阻器等),并用边界框标记。

The complexity of this task depends on the quality of your source images. 此任务的复杂性取决于源图像的质量。 Images that are created using a scanner (instead of a camera) will be much easier to work with. 使用扫描仪(而不是相机)创建的图像将更易于使用。

This task can be accomplished with OpenCV and Python. 可以使用OpenCV和Python完成此任务。 This is a breakdown of the sub-tasks: 这是子任务的细分:

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

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