Ask Your Question

interstar's profile - activity

2019-11-08 22:58:56 -0600 received badge  Famous Question (source)
2019-01-12 09:13:28 -0600 received badge  Notable Question (source)
2018-02-12 04:34:09 -0600 received badge  Popular Question (source)
2016-09-09 16:26:07 -0600 received badge  Student (source)
2016-09-09 10:57:26 -0600 commented answer Visually anayzing network diagrams.

Hi pklab.

Wow! Thank you so much. That is a fantastically comprehensive answer.

I'll need to dive in to grok it fully (and I'll be trying to translate it into Python) but it's amazing.

Where I'm eventually going with this is I have a simple data-flow programming language (connecting processing nodes via queues) that I want to turn the diagrams directly into. I'll keep you posted on the updates of when this will be available (it will all be on GitHub.) The language is written in Clojure, but I'm prototyping the OpenCV analysis in Python at the moment.

Many many thanks again.

Phil

2016-09-07 08:27:57 -0600 received badge  Enthusiast
2016-09-06 10:07:45 -0600 commented answer Visually anayzing network diagrams.

Thanks. I'll take a look

2016-09-05 13:20:26 -0600 asked a question Visually anayzing network diagrams.

I'm trying to build a system which can recognise simple networks of connected nodes from hand drawings

eg. Simple network

I'm particularly interested in getting the edges between the nodes. But I'm finding it surprisingly difficult to get a good analysis. My processing pipeline is currently like this :

  • blur the image
  • invert
  • adaptive gaussian threshold
  • look for contours
  • find bounding ellipses for contours
  • filter to get just contours whose major axis is more than 3 or 4 times the minor axis, and whose overall size is larger than average (I'm guessing these match the edges rather than the nodes)
  • find the foci of these ellipses (to get the end points of the edges)

The results really aren't good. Some edges still aren't picked up. The contours tend to pick up much too much detail eg. I might get a couple of parallel contours for the same edge. The bounding ellipse is often bigger than the contours and the foci aren't at the ends of the lines.

So ... am I approaching this all wrong? Is there a better family of algorithms for extracting this kind of information? Does anyone know of good research on this problem?

cheers

Phil

2016-09-02 07:31:18 -0600 received badge  Editor (source)
2016-09-02 07:29:42 -0600 commented answer Another "new style getargs format but argument is not a tuple" question.

Yes. That's what was happening. I was generating the points as tuples but processing them in another function that turned them back into lists along the way. Cheers.

2016-09-02 07:25:27 -0600 commented answer Another "new style getargs format but argument is not a tuple" question.

That's funny. If I put it your example directly it works fine. In my code, I AM generating my two focus points as tuples, but they must be getting converted to a list somewhere along the line. Thanks.

2016-09-01 17:36:10 -0600 asked a question Another "new style getargs format but argument is not a tuple" question.

For me, I'm getting it with

blank = cv2.line(blank,focus1,focus2,(255,0,0),5)

I know this is something to do with a mismatch of types with the underlying library. But what should I be using exactly? I've tried with focus1 and focus2 being both lists (defined with square-brackets) and tuples (defined with just commas). Both seem to trigger the same error.

I'm in Python 2.7 and opencv 2.4.9.1

Update: for anyone else struggling with this. I was mystified because I WAS generating the points as tuples (and so thought this wasn't the problem). But I found somewhere else in my code which was processing them and turning them back into lists on the way to the draw function.

Something to watch out for if you hit this problem.

2016-08-31 22:33:08 -0600 received badge  Scholar (source)
2016-08-31 22:33:07 -0600 received badge  Supporter (source)
2016-08-30 23:34:50 -0600 asked a question Python cv2.drawContours returns None

I'm following a simple tutorial example. But this call to drawContours is returning None.

contours,hierarchy = cv2.findContours(th3,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
img2 = cv2.drawContours(img, contours, -1, (0,255,0), 3)

I'm not getting an error. The contours and hierarchy arrays look plausibly full of points. (th3 is a thresholded version of img) But img2 is None

Anyone got any ideas?

(BTW : I'm using opencv 2.4.9.1)