Calculate colour threshold of the image