Detecting "greenness" of surroundings

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.

can't grass/weeds grow on the hill?

It hasn't on mine.

Does the hill go up or drop down?
You could put a bumper to stop on hill up, or a leading wheel that can drop on hill down.
Or both. Good for detecting house & sidewalk curb too.

The Pixy camera can be trained to detect and report variously colored blobs, and works with an Arduino.

It's got more than the hill to detect though. We've got cats, which it has to avoid. As well as rocks and trees in the yard.

Front bumper will work for rocks & trees.
We have 3 cats, they manage to disappear when I get the mower, I doubt your automated mower will have a chance to get close.

If you come up with a mower that can detect and avoid cats, please post the code and complete description.

I would like my mower to aggressively go after the gophers and moles in my yard.

Cats aren't green. Simple.

Here's where the issue lies

Along the side of my yard, there are a bunch of dead bushes. They aren't strong enough to trigger a bumper. But the bot could get stuck in it.

Seems like you could use a weaker spring on the bumper.

You can shine a RED LED on the ground, Green would appear very dark

black cats are dark too .... umm.. need to rethink...

How would I detect the darkness anyway?

darkness is the absence of light, a phototransistor would work

Check this out:

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:

As you can see - I had an interest in it...


If it had grass on it, you'd call it a "knoll"