algorithm used for white detection