The present invention provides a method of determining a position of an animal part in an animal space in at least one direction. The method comprises: obtaining a two-dimensional image containing depth information (SEN) preprocessing the image according to a first preprocessing mode (PP1), to thereby provide a first preprocessed image, preprocessing the image according to a second preprocessing mode (PP2), to thereby provide a second preprocessed image, comparing (COM) the first preprocessed image and the second preprocessed image to obtain at least one image difference, if the at least one image difference is below or equal to a respective predetermined threshold, processing the first preprocessed image according to a first position determining mode (PR1), and if the at least one image difference is above the predetermined threshold, processing the second preprocessed image according to a second position determining mode (PR2), to thereby provide the position of the animal part. In case there are available a fast but not very accurate processing mode, and a slower but more accurate mode, this allows to suitably select one of these modes.