Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Shape Detection and Recognition

  1. Aug 15, 2015 #1
    How can I detect shapes in an image using an algorithm? I have heard of using edge detection and from there the shapes can be identified, but how? Also, edge detection only is effective if the shape has a high difference of contrast from its surrounding area, what would be an effective technique if the shape and its surrounding area almost have the same contrast (but, of course, the shape is still visible)?

    P. S. This is my first time tackling this problem, any hints or references to get me started and understand more of this field?

    Thank you in advance.
  2. jcsd
  3. Aug 15, 2015 #2


    User Avatar
    Science Advisor
    Gold Member

  4. Aug 15, 2015 #3
    I agree that contrast is probably the best information to rely on when detecting simple edges since they're often associated with abrupt variance of lightning. Algorithms can be designed to be sensitive to certain levels of contrast and thus yield outputs accordingly, deciding for example if certain areas of an image contain edges. This technique is usually robust to illumination changes, so surrounding areas with almost similar contrast shouldn't cause you major problems detecting various types of edges.

    For shape recognition, artificial neural networks are usually designed for such needs because of their capacity to learn on exemples. They extract information from training samples and create adapted algorithms to solve problems that are usually more complex. A well-trained neural network designed for shape recognition should have a solid adaptive learning ability, invariant in terms of image scaling, rotation and translation. I can think of many ways neural networks can be designed to recognize shapes : edge matching, using the internal angles, using feature detection, etc. Perhaps fuzzy sets could also be used to improve the neural network's ability to generalize inputs.

    That's definitely a path you should look into, there's good documentation available on the subject.
    Last edited: Aug 15, 2015
  5. Aug 17, 2015 #4
    Will it be effective if I first convert the image into a binary image to detect edges? I have seen that this kind of conversion has some kind of threshold to classify the pixels to have 0 or 1 as their value.

    I am not really familiar with neural networks and I'm planning to work these things out from scratch.
  6. Aug 17, 2015 #5
    I'm sure there would be many different ways to proceed. One I can think of is modelling the image with a function and describing edges using partial derivatives. A point which lie on the edge can be detected by finding local maxima or minima of the first derivative and by detecting the zero-crossing of the second derivative. I've heard about other methods using the gradient vector. There are many, you just need to find what's best according to your knowledge and your needs.

    A good read on the subject would be William K. Pratt's book Introduction to Digital Image Processing.

    That's excellent, it's a very interesting subject! I highly suggest starting with Anoop Madhusudanan's work at Code Project (http://www.codeproject.com/Articles/14342/Designing-And-Implementing-A-Neural-Network-Librar). You're taken through the fundamentals and then taught in a very intuitive way how to program the networks. It's a fantastic introductory document about neural networks, especially for the people that are more programming-oriented.

    There are other excellent books on the subject, like James Anderson's An Introduction To Neural Networks and Laurene Fausett's Fundamentals of Neural Networks. I think a good starting point would also be Wikipedia, of course.
  7. Aug 24, 2015 #6
    Thanks a lot for these references!
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Shape Detection Recognition Date
Matlab Fourier transform of a 2D shape Mar 21, 2016
Speech recognition robot project Oct 22, 2010
Matlab drawing out of shape Apr 26, 2010
Maple 13: Increase resolution of 3D shapes Jan 30, 2010