Pixel detection with camera and arduino


I want to make an agricultural robot that is able to detect black spots on a leaf (representing insects), so I would connect a camera (maybe an OV7670) to the arduino and if the arduino detects black spots, it would carry out a specific function. Is it possible to achieve this or is it too impractical to use this hardware for such application?

A photodiode would not be ideal because the black spots would be small enough for the sensor to not be able to detect it, but more likely for a camera to do so. Any suggestions that do not involve switching to Raspberry Pi is more than welcome.


How would your project know the difference between and insect and a fungus spot or a rust spot? Did you actually read the project using that camera and an Arduino? Where was ALL the processing done?


How does it detect a leaf to start with?

Raspberry Pi and AI image recognition.

Thanks for your responses. Quite a few of you deviated from my initial question. I’m not trying to detect insects specifically right now. I’m simulating those insects with black spots from a black marker drawn on a leaf or small paper. I don’t care if it detects a leaf or insects or fungus at the moment. All I wanted is information on a sensor that can detect small black spots. Don’t go beyond what I asked.


You are right about the responses. That means you, yourself, are going to have to experiment to find something that satisfies your requirements.


connect a camera (maybe an OV7670) to the arduino and if the arduino detects black spots

Standard Arduinos do not have enough memory to store a single image, let alone do image processing.

The first step in this process is to figure out how to solve the problem (which, you will discover, is not at all simple) using a capable system like a PC running MATLAB, ImageJ or TensorFlow (AI).

Realistically, begin your project from the other end. Learn how to identify a spot in a picture on your PC, using any picture file type you wish. Try to find a spot in a picture of your spotted paper using the PC. When you can reliably do that, use the same concepts, not the code, on your Arduino or whatever.