in this code the method described in the article was used. Good results were achieved but the threshold value for hue is different than the one used in the article. This may be due because hue is not defined between [0,pi]. The upper end is actually greater than pi, even tought this cocndition is (teoretically) covered.