I've been trying to make a butter passing bot, like the one from rick and morty. https://www.youtube.com/watch?v=X7HmltUWXgs I can do pretty much everything on there, but I need someone to help with the camera on the front. I need a low cost system that will look for the butter and tell my motors to go to it.
-
\$\begingroup\$ you may find something here opencv.org \$\endgroup\$– jsotolaNov 5, 2017 at 1:41
-
\$\begingroup\$ "I need a low cost system that will look for the butter and tell my motors to go to it." - I wish I could express a huge problem sounding like a walk in the park like you. \$\endgroup\$– Harry SvenssonNov 5, 2017 at 7:38
-
\$\begingroup\$ Using a neural network wouldn't be too bad either, just saying. \$\endgroup\$– Harry SvenssonNov 6, 2017 at 14:39
1 Answer
Since you're new to computer vision, I'd suggest the below algorithm based on color segmentation. It will be pretty fast using OpenCV in Python on a Raspberry Pi.
1) Read in the live video one frame at a time (you can find lots of OpenCV tutorials where people do this)
2) Classify pixels as buttery yellow or not. The easiest way is probably to convert the image to HSV color space, and use a simple threshold on the H and S. (This way you gain a little robustness to changes in lighting)
3) Find the median x and y of the buttery yellow pixels
4) Convert the x to an angle, and have your robot turn there. (Basically just establish the left and right angles of your camera and hard-code those in.)
There are lots of other possible ways too, like the SURF algorithm to recognize a specific butter dish, or a QR code on the butter dish. But the above is probably the best place to start.
I recommend you just install OpenCV on your PC, take a picture of your stick of butter, and try things out! (By the way, StackOverflow has a "computer vision" tag; you probably want to post further questions there.)