Interesting question, it would be nice to know at times for non-photographic reasons, e.g. you're out in a boat and want to know how far land is away?

You would need to know three things to figure this out:

a. What's the vertical height angle of the lens you are using, see

Focal Length: Optical: Glossary: Learn: Digital Photography Review
b. What's the vertical height of a known object in your viewfinder. For example, if there were a person standing next to the heron, you could guess an average height of 5 1/2 feet. If you knew the approximate height of a full grown heron, one could use that.

c. If you had a 100% viewfinder, you would need to estimate the approximate percentage of the vertical height occcupied by the subject in the viewfinder. For non-100% VF, one would have to throw in a correction factor.

From trigonometry, you could then calculate the distance to the object. One's estimate of the percentage of the vertical height of the heron in the viewfinder, would probably severely compromise the calculated distance.

Actually, the suggestion of using other specialized equipment to estimate distance would be a more practical approach.