A method determining a position of an animal part in an animal space in at least one direction, including: obtaining a two-dimensional image containing depth information; preprocessing the image according to first and second preprocessing modes, to provide respective first and second preprocessed images; comparing 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, 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, to provide the position of the animal part. If a fast but not very accurate processing mode, and a slower but more accurate mode, are available, the method can suitably select one of these modes.