954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

detect shapes from a web cam

Hi i need that when i put something like a ball in front of my webcam a square is putten around that ball and keep following it if i moved the ball i currently have no idea on how i can do this so any help whould be appreciated thank you all

shandoosheri
Light Poster
42 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

Easiest way I can think of would be to crank the contrast up internally, then go by color on this high contrast image to look for edges (of a ball, in this case). For just a rectangle this can be a relatively fast calculation:

-Find the leftmost pixel of color that you are looking for (red ball perhaps)
-Scan to the right (not necessarily pixel by pixel, an approximation algorithm can improve efficiency here) until there is no longer that color
-Find the top most point of that color, scan down till you find the bottom most point like you did scanning to the right
-You now have the boundary for your shape in the image
-Note that the higher the contrast, the easier the edge detection will be. This high contrast image, however, should be stored internally and the coordinates of the boundaries sent off to render the rectangle to the actual image.

People make millions off of software like this so don't expect it to be easy. This type of technology can get A LOT more sophisticated - so much so that operating systems like windows start to become a bad platform for development due to insufficient clock speeds. This is why things such as Microsoft Kinect use embedded systems for these calculations.

skatamatic
Posting Shark
959 posts since Nov 2007
Reputation Points: 403
Solved Threads: 129
 

thank for your reply anyway i found this http://www.aforgenet.com/articles/shape_checker/ which does exactly what i want

shandoosheri
Light Poster
42 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: