A method for counting somatic cells or fat droplets in milk on-line during
milking by an automated or semi-automated milking system comprising the
steps of: flowing milk as milked by the milking system through a
measuring chamber (59); illuminating milk that flows through the
measuring chamber; and recording multiple two-dimensional digital images
of illuminated milk that flows through the measuring chamber, wherein the
images are recorded through a lens system (49) to preferably obtain a
spatial resolution better than about 5 microns in the images. Finally, a
somatic cell or fat droplet count score of the milk is determined from
the images by means of digital image processing, preferably including the
use of neural networks.