I have a database of hundreds of people's full body shots that I need to crop out of the image without the background. This is too much to do manually with Photoshop so I want to automate it. The shots are always full body, orientation and arm position may change slightly and the background will almost never be the same. Two examples: https://i.stack.imgur.com/pAvKt.jpg and https://i.stack.imgur.com/KgY8r.jpg
I want to be able to match it against a shape like the one in the third image in the gallery I linked above. The position of the woman in the example with the bent elbow is quite common, so I may have to use several predefined shapes to match against.
I took pattern recognition and image processing courses in university but I'm absolutely at a loss of how to make it work properly. I have tried edge detecting with sobel and then applying a custom algorithm to detect the human shape but it's crap. I have also tried template matching but that uses the "inside" of the person as well and is very sensitive.
Could someone please point me in the right direction? Techniques, libraries, etc... that I may use?