最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Detect simple curves and lines in the grayscale image - Stack Overflow

programmeradmin3浏览0评论

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. bee 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.

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. bee 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.

Share Improve this question asked Apr 30, 2014 at 8:13 setecsetec 16.1k3 gold badges38 silver badges51 bronze badges 6
  • @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 Commented Apr 30, 2014 at 8: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 Commented Apr 30, 2014 at 8:29
  • 1 Hough Transform may work for some of your shapes. (Straight lines and ellipses at least) – fabian Commented Apr 30, 2014 at 9:10
  • 2 Can you post an example image? – nojka_kruva Commented Apr 30, 2014 at 14:43
  • 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 Commented Apr 30, 2014 at 21:40
 |  Show 1 more ment

1 Answer 1

Reset to default 6

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 ment.

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:

  • Hough transform in java
  • Hough transform in javascript
  • Harris corner detection in java
  • Harris corner detection in javascript

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.

发布评论

评论列表(0)

  1. 暂无评论