7

I've an image with a bunch of simple grayscale primitive geometry (curves, 'saw'-lines, ellipses, triangles, stars) drawn by lines of width about 8-10 pixels.

How to perform statistical analysis of the image? I need at least following two parameters:

  1. Number of sharp angles
  2. Number of curves.

I've tried doing it myself by extracting contours, shrinking till they have edges connected (i.e. become curves) and analysing them by differential functions, but it takes too much time for big images.

A suppose there is some kind of algorithm of curve/angle/angle sharpness detection?

What i need is either an open-source framework (java/javascript prefferably) to do such stuff or at least name of algorithm to detect curves/'saw' lines.

setec
  • 13,254
  • 3
  • 30
  • 49
  • @Cerbrurs, I've 10 years of professional experience as Java/JavaEE and Web developer (js/typescript) and use both of languages. Do not assume that if person places 'java/javascript' in one line of text, he don't know difference between them :). I mentioned this languages here just to make it clear what 3rd party frameworks I'm looking for. If it's javascript I'd use node.js to process image, if it's java, i'd use jetty/tomcat, it doesn't matter really. All i need is the math method. – setec Apr 30 '14 at 08:24
  • Ah, I see :-) In that case, aside from throwing the term "Edge detection" at you, I can't help you at all, I'm afraid. Image processing isn't my strong suit at all ;-) – Cerbrus Apr 30 '14 at 08:29
  • 1
    [Hough Transform](http://en.wikipedia.org/wiki/Hough_transform) may work for some of your shapes. (Straight lines and ellipses at least) – fabian Apr 30 '14 at 09:10
  • 2
    Can you post an example image? – nojka_kruva Apr 30 '14 at 14:43
  • segmentate image to set of smaller ones and handle each separately that should speed things up a bit – Spektre Apr 30 '14 at 16:42
  • 1
    Harris corner detector can be useful to find the sharp corners. But different approaches suits different kind of image structures. For example one important choice is if more convenient to first identify blobs, edges or corners.. .and this really depends on the structure of your images. So I agree with Victor May. – Diego Mazzaro Apr 30 '14 at 21:40

1 Answers1

5

The Hough transform may be helpful to you in identifying curves. If you only need to count, it should work just fine. It can be generalized to detect any geometric shape that can be described using parameters, or any shape whatsoever using template matching. However, that can be expensive.

For sharp corners, you can use Harris corner detection as mentioned by @Diego in the above comment.

Definitely also check out jfeaturelib, it's helpful in extracting features from images (although if you just want to count/detect them it might be a little heavy-duty for your purposes).

Below are some implementations that may help you on your way:

You also might want to check out ImageJ by the NIH, there are quite a few Java plugins that may be helpful to you. It's used by many biologists (like me!) to detect image features and has hundreds of plugins for almost any conceivable purpose.

There are also many helpful questions on SO.

Community
  • 1
  • 1
Luigi
  • 3,950
  • 6
  • 34
  • 55