I guess there are
programs that can determine it ( not algorithms ).
The only thing a camera/computer can see is an amount of pixels with different colors within a frame. You can make an algorithm that recognizes some patterns in the image, like an edge: Scanning the image horizontally and finding a sudden color change along a vertical line, it has found a vertical edge. In this way you can convert the image into a cartoon:
There are a lot of ways to recognize a figure as a person. One way is to Fourier transform the
outline of the figure, regarding the edges as a series of complex coordinates. The Fourier transform is a "finger print" of a person. Adding a tail to the right figure, the Fourier transform will change and become a finger print of a dog. The "smart" charasteristic is, that if you cancel the 1. harmonic of the right figure, you can rotate him and let him crawl uphill or downhill: He will still be recognized as a person because the angle doesn't matter when the 1. harmonic is missing.
So the idea is to sketch a lot of persons/dogs in various positions, make "finger prints" and tell the computer: this is a person and this is a dog. When the computer has such a look-up-table of finger prints and sees a person or dog, it can distinguish a dog/person by closest match.
To distisguish left/right arm is more complicated: Am I seeing the front or the back of a person?