def binarise_image(image): if len(image.shape) == 2: bin_image = image else: gimage = grey_scale(image) bin_image = gimage > 10 #print bin_image, 'inside conditional' #print bin_image, 'outside conditional' return bin_image.astype(int)