Giving OpenMV machine vision camera a try.
Install OpenMV IDE (ver 1.9 or newer) and setup the camera following official online instructions.
This code requires at least OpenMV firmware version 2.9.
Open main.py into the OpenMV IDE and either run from there or upload to the camera (Tools > Save open script to OpenMV cam)
MIT