Object counting camera

Have a good day all of you, I have a question for you, perhaps someone has the wisdom of how to carry out the following project. The camera or an extension could be used to count units in a focused area, eg count blue dots, red dots, etc.

Does anyone know if this can be possible via an extension or some method?

Example: How many celestial points are here.