A lego piece detection algorithm written in python