Shape Detection and Recognition

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 2K views
ecastro
Messages
249
Reaction score
8
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.
 
Physics news on Phys.org
ecastro said:
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.

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:
h6ss said:
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.

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.

h6ss said:
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.

I am not really familiar with neural networks and I'm planning to work these things out from scratch.
 
ecastro said:
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'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.

ecastro said:
I am not really familiar with neural networks and I'm planning to work these things out from scratch.

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.
 
  • Like
Likes   Reactions: ecastro
Thanks a lot for these references!