Finding horizontal count of items in an image
Using any image processing library, here is the simple step


Threshold invert  with high value will give you each object as a contour.
Now process each contour and find centre of mass.
Then sort contour by co-ordinates.