Write binary numpy array of zeros and ones to file using cv2 or Pillow
Since you are writing pixels with values (0, 0, 0) or (1, 1, 1) to the image you are seeing an image that is entirely black and almost-black, so it looks black.
You can multiply your array by 255 to get an array of { (0, 0, 0), (255, 255, 255) } which would be black and white. When you read the image you can convert back to 0s and 1s.
Is it possible to write binary numpy array containing 0 and 1 to file using opencv (cv2) or Pillow? I was using scipy.misc.imsave and it worked well, but i read it's depreciated so i wanted to switch to other modules, but when trying to write such an array i see only black image. I need to have 0/1 values, and not 0/255 for further processing.