Mathematical representation of the two thresholds is as follows: For any pixel, if (Hue is between 4 43, Saturation is between 50 250 and Luminance is between 60 - 230 ) // Calculate the position of the threshold line at that specific hue value S = (4.83) *Hue -53.1 //check whether the pixel is within the threshold if (Saturation > S1 ) Pixel = Citrus //Pixel was inside threshold and marked as 255 // else Pixel = Background //Pixel was outside threshold and marked as 0 // else Pixel = Background //Pixel was outside threshold and marked as 0 //