How do I use .NET to find the orange ball in an image?

I am getting images from a C328R camera attached to a small arduino robot. I want the robot to move to the orange ping pong balls and pick them up. I am using the C # code provided by funkotron76 at http://www.codeproject.com/KB/recipes/C328R.aspx .

Is there a library I can use to do this, or do I have to iterate over every pixel in the image looking for orange? If so, what kind of transfer would I have to compensate for with different lighting conditions?

I could probably check to figure out these numbers, but I hope someone out there knows the answers.

+2


a source to share


1 answer


Vision can be surprisingly difficult, especially if you are trying to tolerate different conditions. A few good things to explore include Blob Finding (finding adjacent pixels that meet certain criteria, usually a luminance threshold), Image segmentation (can you have multiple balls in an image?), And general theory on Hue (most vision algorithms work with grayscale or binary images , so you will first need to transform the image in such a way as to emphasize orange as the selection criteria.)



Since you seem to be tracking these objects in real time as you move towards them, you might also be interested in learning about tracking models such as the Kalman filter . It's too complicated for what you are doing, but it's interesting and the basic ideas are helpful. Since you probably know that the object should not move very quickly, you can use this fact to filter out false positives that might otherwise lead you to move away from the object. You can put together a simpler version of this kind of filtering by simply ignoring frames that are too far away from the previous received frame (with multiple boundary conditions to avoid getting stuck ignoring the object.)

+3


a source







All Articles