2

I am trying to learn about simple shape detection for a project I'm working on.

I have an image that is made of only black and white pixels and I need to detect shapes within the image, such as squares and ellipses. I also need to find the bounding boxes of the shapes.

I have been searching online and reading articles but I can't find any good explanations of where to start.

I am also looking for some partial/complete code examples preferably in Java or C++.

Thanks!

Sarathi
  • 1,023
  • 1
  • 14
  • 22
  • 1
    The code in [Smoothing a jagged path](http://stackoverflow.com/questions/7218309/smoothing-a-jagged-path) represents a 'partial code example' in that it will provide an outline of the black (or white - let's not be prejudiced) pixels. What you do with the outline, is the next (challenging) bit.. – Andrew Thompson Nov 09 '11 at 03:14
  • The general problem is not trivial at all. You should specify some restrictions. See for example http://i.stack.imgur.com/7ZOB1.png – Dr. belisarius Nov 09 '11 at 14:48

2 Answers2

3

There's a few different ways of doing edge detection, one of the ways is called Canny Edge Detection. Check out this website which has a Java implementation of the algorithm that has been released to the public domain.

Deco
  • 3,261
  • 17
  • 25
1

I'm not aware of a library or toolkit that makes this kind of operation trivial but if you really want to understand how this kind of logic works, start here http://opencv.willowgarage.com/wiki/

Carth
  • 2,303
  • 1
  • 17
  • 26