Pattern recognition is not something trivial -
Unless the course is about this, and in this case you must be learning about classifiers, machine learning and the specific algorithms, there is no point in trying to create this from scratch without using a library ("bookstore" as we Brazilians write) already do so, or at least have the foundations for it, such as tensorflow.
If you’re part of the discipline yourself, you should have a better idea of where you want to start or a little code you’ve already done.
A cool bookstore that supports uploading images, and many of the algorithms used in preprocessing and segmentation are leptonica - it is in C, but can be used from Python with "ctypes". (I did a wrapper using ctypes once but I haven’t kept up to date - should give some work to configure properly - https://github.com/jsbueno/pyleptonica (I just looked, it’s not even set to Python 3 - shame on me) - Anyway, regardless of whether it is possible to update this wrapper or make the calls with raw ctypes, the leptonica is a good start to finding the basic algorithms that will allow the classification of images - worth looking at the documentation of the original library.
https://github.com/DanBloomberg/leptonica
There’s something in PHP, I’m not sure if it’s what you need, but it’s already an idea. https://answall.com/questions/183508/como-contar-os-objetos-presentes-na-imagem-com-php/314037?r=SearchResults#314037
– MagicHat
It has nothing to do with technology (PHP) but your response to the jsbueno gave me an idea of the complexity of the theme and I will use a library already made, thank you.
– Carlos Mir de Souza