Given that this is a difficult task for a person, I expect that at present this cannot be done algorithmically. It is difficult to compete with a visual processing system that has been more than 200 million years in the specification refinement stage with coding errors punishable by death.