Using a set formula to measure distance in a photo but the answers are coming out much smaller than expected?

I am using the formula

distance to object (mm) =

focal length (mm) * real height of the object (mm) * image height (pixels)
---------------------------------------------------------------------------
object height (pixels) * sensor height (mm)


to get the distance of an object from the camera (in this case deer) in a trail camera photo. My answers don't seem to correspond to what the real life distance of the deer to the camera would be and I'm just wondering if anyone knows if I'm missing something within the formula? Also my sensor height is the size of the sensor itself not the height from the ground, is it correct to use this?

For example I'm using the following information for one photo:

Focal length 3.1mm

Real height of the object 700 mm

Image height 1944 pixels

Object height 303 pixels

Sensor height 20.32 mm

and I got the answer 685.156 (mm I'm presuming).

Thanks very much :)

Sensor height refers to the vertical size of the sensor in mm.

It seems like either your focal length or sensor height are wrong. Probably the sensor height.

A 20mm tall sensor is about the size used in the Canon 1D series profession DSLR, for which no 3.1mm lens has ever been released!

Assuming the stated focal length of 3.1mm is correct you can work out the sensor height if you know the 35mm equivalent focal length (which is often specified in reviews and on the manufacturer's website as if it was the real focal length, should be something like 24-105mm):

sensor height =

real focal length * 24
-----------------------
equivalent focal length


Again all units should be mm (or should match at the very least).

If the sensor size is a factor of 10 out, then your distance will be 6.9 meters, which sounds more reasonable!