Image object recognition algorithm