Added backgroound removing and shape detection.