I'm working on an autonomous lawnmower for my backyard. The end of the grass is a hill, however, so I need it to detect when the grass ends. I have decided to detect the "greenness" of an image from a camera so that when the image isn't green enough, it will keep turning until it is.
I wrote some code in OpenCV that loops through every pixel of an image, checks if it's green, and if it is, it adds it to a total. If the total # of green pixels is 60% of the number of pixels in the image, it's green enough to pass.
Obviously, I can't strap my desktop to a tiny robot, and I don't want to use an RPi because of corruption issues. So I'd like to do something with an Arduino.
Resolution doesn't matter at all. In fact, a res of 1x1 would work just as well and would be more efficient. So yeah, I need to do some basic image processing with an Arduino nano.
I looked into using a color sensor, but I need something with a bigger range so I can scan in front of the robot.
It is possible to build a sensor to detect this - basically, it will tell you where grass is, versus no grass (or dead grass/dirt I guess) - in fact, a guy here on the forums did this for a lawnmowing robot: