Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top