I hope I am posting this in the right place. I am absolutely new to CV so I am not even sure where to start and I suspect what I want to do has already been done, probably many times, and I see no point in reinventing the wheel if I don't have to. I have done a couple of searches but have not found what I am looking for. (Or maybe I found it but in my ignorance didn't recognize it?)
The project:
I have an ESP32_Cam and have been toying with the idea of using it to determine the relative direction (e.g. X,Y coordinates or similar) of the largest/closest moving object. Then use that info to move a set of eyes that way (maybe digital display or servos to move physicals eyes...have not decided yet). It seems like it might be fairly easy to implement with the right library, but like I said I am not even sure where to start.
I would prefer to write it in C++ (arduino IDE) but would use MicroPython if necessary.
That requires a "camera model" which includes the characteristics of the lens (focal length, e.g. wide angle versus telephoto, etc.) and "camera calibration" to reduce distortions.
If you are considering using OpenCV, start with the documentation and introductory tutorials.
Rather than an ESP32, you will have a much better experience using a laptop with a camera, running a modern operating system. Plenty of tutorials are available.
What N. has put together, in fact, is not a full port of the entire OpenCV library bundle — an impossibility, given the relatively meagre resources available on an ESP32 compared to the devices that would normally host OpenCV — but a cut-down version, forked from the original
Other sources use the ESP32_CAM as an image server and do the job on a PC with sufficient resources.
A different approach would be to use a Raspberry Pi (3+ or 4 are usually sufficient for OpenCV). I used a Pi 3 in the past with quite good results (target tracking, filtering etc.) with OpenCV and Python.
Yet another option is to use a 3D camera, like those from Luxonis. I'm quite happy with the Oak-D-Lite, which is inexpensive.
Since all the image calculations happen on the camera processor, a very small and cheap RPi, like the Pi Zero W (or Zero 2 W) is all you need. Both run the full Linux OS, with full OpenCV, and can also be connected to an inexpensive camera module with much higher quality than that on the ESP32-CAM.
Thanks that is useful.
I was considering using the esp32_cam as I like the small form factor and I have been trying to find some use for the one I have. But I should have a Pi3 with a camera in a box someplace (used it for an automated greenhouse project years ago) and it may be a much better platform for this.
This is just a project I have been tinkering with to use stuff I already have on hand. It's not worth spending any $ on. But thanks for the suggestion.
The ESP32_cam gave me the idea to try this but it is just something to tinker with. The suggestion by ec2021 about using a Pi is a direction I could go (because I already have one someplace) but this is not worth investing any more hardware than that.
But i appreciate the suggestion.
That's fine. To get directions to object in the image, the first step is to calibrate the camera. That is, find scale factors that relate a point on an image in memory to a direction in reality, relative to the direction the camera is pointing.