I'm trying to create like a bitmap for an image of a letter but I'm not having the desired result. It's been a few days that I started working with images. I tried to read the image, create a numpy array of it and save the content in a file. I wrote the code bellow:
import numpy as np
from skimage import io
from skimage.transform import resize
image = io.imread(image_path, as_grey=True)
image = resize(image, (28, 28), mode='nearest')
array = np.array(image)
np.savetxt("file.txt", array, fmt="%d")
I'm trying to use images like in this link bellow:
I was trying to create an array of 0's and 1's. Where the 0's represent the white pixels and the 1's represent the black pixels. Then when I save the result in a file I can see the letter format.
Can anyone guide me on how to get this result?
Thank you.