code for thresholding camara image