1

I have obtained boolean matrix from sauvola thresholding using scikit image library now I want to do further processing like blob detection on image. How to convert map boolean matrix to grayscale binary image in python. Followed this link https://stackoverflow.com/a/47667753/9155046 but the output image need to be mapped to grayscale.

  • 1
    Welcome to StackOverflow! Please read the info about [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and [how to give a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). This will make it much easier for others to help you. – Aditi Feb 12 '18 at 09:49
  • You could probably do something like this, `(img*255).astype(np.uint8)`, assuming `img` is a 2D numpy array of booleans. – eugenhu Feb 12 '18 at 09:57
  • I have already converted the matrix to np.uint8 and i used plt.imsave('Sauvola',np.uint8(sauvola_binary)*255,cmap = 'gray',format = 'png') to save the image and check if the output is as expected.But i want to convert this matrix to binary grayscaled image to perform further blob detection or contour finding – Shubham Jain Feb 12 '18 at 10:06
  • Show code and you will probably get your answer – Itay Livni Mar 10 '18 at 03:35

0 Answers0