An arrangement for determining positions of the teats of an animal is provided in a milking system comprising a robot arm for automatically attaching teat cups to the teats of an animal when being located in a position to be milked, and a control device for controlling the movement of the robot arm based on determined positions of the teats of the animal. The arrangement comprises a camera pair directed towards the teats of the animal for repeatedly recording pairs of images, and an image processing device for repeatedly detecting the teats of the animal and determining their positions by a stereoscopic calculation method based on the repeatedly recorded pairs of images, wherein the cameras of the camera pair are arranged vertically one above the other, and the image processing device is provided, for each teat and for each pair of images, to define the position of the lower tip of the teat in the pair of images as conjugate points, and to find the conjugate points along a substantially vertical epipolar line.