This project is devoted to the idea that there's no reason you *shouldn't* automatically follow bugs around with a macro camera. Another byproduct of the LadyBug project for motorized 2+3D scanning microscopy.
This video was made possible by two things. 1: A toggle save video feature, which I didn't have in the last video (hence filming my screen), and 2: Cake. Ants love cake, and giving the ant a little piece of something colorful means you can follow that instead of making your tracker insect-specific.
I am still trying to make the tracker more robust. I followed this guide by Adrian Rosebrock to implement a generic tracker than can except bounding box coordinates of what to keep an eye on. The idea is that you could use your neural network or whatever to identify the bug in just one frame, and then the tracker would handle subsequent frames (as opposed to looking for the bug in every single frame, as I'm doing with color in the video above).
But even if you give it the coordinates manually by clicking and dragging, the trackers are just too slow and dumb, and the ants are too small and fast. But I'm still trying on and off. In the meantime, enjoy the above ant footage, which I personally think is pretty cool by itself.
It's not working perfectly, but it is a bug tracker. It's kind of a minimum viable bug tracker. It consists of three things, really;
1: A USB microscope. This is what you will use to look at a bug. In my first video I'm alternately using one that costs a thousand dollars and one that costs a hundred dollars. But if you have one that costs 10 dollars, just use that. You also gotta find a way to stick it onto the printer --- I'm using a thing that's 3D-printed, big surprise.
2: A 3D printer. It's gonna move the microscope around. In this video it's a tronxy x1 style kind, but use whatever you got! It's GCode controlled, so you don't have to get a new control board or anything. Be advised that this one is Marlin based.
3: Magic machine vision to identify the bug and a control loop to make the printer move. This is where almost all of the work on the project is going to be.
In the video shown, the detector is looking for a blob of color --- literally, I took it from code for tracking a green ball. I turned the standalone code into a function that would accept color boundaries and a frame, and then return the frame but with a circle drawn on it the coordinates of the blob of color, if it was found.
This is obviously not super robust, so the next step is implementing a detector that's based on something more insect-specific --- still mulling over those options. But it's likely that it'll be the first thing I can find which actually works when I haphazardly glue it into my code.