I have a list 'L'. I want to use this list of numbers to create a map for an image. So I first create a matrix "n" similar to the size of the input Image - 2084, 2084
L = [234, 78, 56, 98, 555, 876, 998 ...]
n = np.zeros((2084, 2084), dtype = "uint8")
This gives me an matrix of size - 2084 x 2084. Now I flatten it to create an array out of it.
j = n.flatten()
As I want to create a gray scale image of this and replace the positions in this Image which are given in the List "L" to white. I replace the 0's in the array to 255
for i in L:
j[i] = 255
After this I reshape the array to the matrix form.
o = np.reshape(j, (2084, 2084))
But when I try to open this o using matplotlib i only get the black image with no white pixel which should have been there because of the value 255 in the matrix.
plt.imshow(o, cmap="gray", vmin=0, vmax=255)
I would like to use the numbers in the List to map their values as locations in the image and change the colour of that location to white.
I can be wrong in understanding some fundamentals here with regards to image, but some help here would be appreciated