Replacing the minimal point search with a method which tries to find the first point in which the difference between its color value and the average color values of all the points beneath, is greater than a given threshold.
Results are added for the demonstration