Ask Your Question

Can I use OpenCV to detect weeds in a paddock?

asked 2017-05-02 04:46:57 -0600

agriadam gravatar image

I am reasonably new to OpenCV and am looking to start a new project, and just wanted get some expert guidance and to know if I am barking up the right tree.

I want to build a system that can detect the colour of the actively growing green weeds on either a red road, or in a paddock with white/silver stubble background. So I just need to check for green on a video input, and trigger a solenoid to spray the weed with herbicide when green is detected. Currently on the farm I work on (about 20,000 acres) we just blanket spray the whole paddock for weeds, so just spraying the actual weeds could yield significant chemical savings (cost and environmental)

Can anyone tell me if this possible with current OpenCV algorithms? Is it possible at a fast enough rate to make it worthwhile (20km/h ish at 50-100cm above the ground)? Is it possible on cheapish hardware ie, a raspberryPi/Odroid XU4/Nvidia TX2 and camera?

I was thinking of having a stand alone computer, camera and solenoid for each spray nozzles or maybe 3 nozzles/solenoids per module, and detect which third of the image the weed is in and trigger the corresponding solenoid+spray nozzle.

Currently there is a system for sale ( which I believes uses infrared/NDVI to detect the chlorophyll in the weeds. This system would cost us about $320,000 for a 36 meter wide setup, so it aint cheap. I was thinking each spray module could be built for a few hundred dollars at most. With a module retrofitted to a 36 meter spray boom, that would still end up a bit cheaper.

I plan on making this completely open source, and modular. I just wanted to check with the experts to see if this is a feasible project before I dive in too deep. I planned on doing simple colour detection to begin with, and build on the system or add features from there.

I hope that makes sense, and I hope I'm asking in the right place. I really just want to know if its possible for now, and if it would be worthwhile pursuing. Any input/questions, yes/no, criticism/encouragement is welcome.

Thanks Adam

edit retag flag offensive close merge delete


It seems that RaspberryPi is perfectly fits to your aims

pi-null-mezon gravatar imagepi-null-mezon ( 2017-05-03 08:56:24 -0600 )edit

Thanks pi-null-mezon I have a RPi 2 and camera, and a noIR camera lying around, so I might have a fiddle around. I might even order an RPi3, but im not sure I will need to extra horsepower for now

agriadam gravatar imageagriadam ( 2017-05-08 07:51:21 -0600 )edit

Hello Adam,

I have been thinking about weed detection myself and was wondering if you had made any progress? I own a vineyard and am developing an autonomous rover to drive around and spray weeds. Adding an automatic spot spraying function would be great as well.

Hope you've made some progress.



Tractor Pilot gravatar imageTractor Pilot ( 2017-09-20 07:06:38 -0600 )edit

Hi, I'm working on a similar project. I'm testing my algorithm recognition and seems to work well. Do you made any progress on this? Maybe we can share information.

skabo gravatar imageskabo ( 2018-11-15 14:01:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-05-02 18:46:41 -0600

Tetragramm gravatar image

Simple color detection can be done on just about any hardware you can buy. I don't have any low-end hardware around to give you a quick benchmark with, but the algorithms are not complicated at all. The trick is tuning your filters (color and size and shape) so that you get few enough false negatives that you're not just spraying everything, and not so many that you miss weeds.

I think it's certainly feasible, although whether your method works depends on what the scene really looks like. I assume you can add a light so you don't have to worry about sunset or night changing the color of things.

It sounds like an interesting project.

edit flag offensive delete link more


Thanks Tetragramm, I wont need to display anything, except during testing, so all the work should be in the calculations. I have since done a bit of research and I was thinking of doing an inRange to detect the presence of weeds, then doing a countNonZero to count the number of pixels. If this count gets over a certain threshold It will trigger the relay hat on the raspberryPi, spraying the weed.

Hopefully it will work. I have a RaspberryPi 2 with camera, and also a NoIR camera lying around so I can do some tests with that if I can sling the right code.

Thanks again

agriadam gravatar imageagriadam ( 2017-05-08 07:48:00 -0600 )edit

Question Tools



Asked: 2017-05-02 04:46:57 -0600

Seen: 1,223 times

Last updated: May 02 '17