A system including a 3D camera, memory, and a processor. The processor is configured to obtain the 3D image, identify one or more regions within the 3D image comprising depth values greater than a depth value threshold, and apply the thigh gap detection rule set to identify a thigh gap region. The processor is further configured to demarcate an access region within the thigh gap region, demarcate a teat detection region, partition the 3D image within the teat detection region to generate a plurality of image depth planes, and examine each of the plurality of image depth planes. The processor is further configured to identify one or more teat candidates within the image depth plane, apply the teat detection rule set to the one or more teat candidates to identify one or more teats, and determine position information for the one or more teats.