From what I know, to distinguish distance you will need to use two cameras. Otherwise, if you want to use 1 camera, you may use techniques such as this, (but the objects must be touching the floor and you must be able to see the base of each object):
Find all the objects you are interested in, in the scene. The lowest point on each object is the point it touches the ground. The lower point is the closer object and the higher point is the further object. This is regardless of the size of the object.
Note that is will not work if
1) You can not see the base of the objects
2) The objects are not touching the ground
3) The camera is parallel to the ground.
I may post up a video later on when I have time. Let me know if you need more help.