python code for threshhold segmentation stuffs