I have created a black image using np.zeros:
mask = np.zeros((800, 500, 3))
Now I want to edit this variable named mask turn it into an image I like. I know I can access pixel value like this:
for i in range(0,800):
for j in range(0,500):
mask[i,j]=[110,23,245]
but this isn't working all I get as an output is an white image:
If I only use a single value like this. It gives me an blue image:
But I didn't use 255, it shouldn't give me a full dark blue image like 255 pixel value:
for i in range(0,800):
for j in range(0,500):
mask[i,j]=[110,0,0]
I know I can copy image like this:
mask=image
but the thing which I am working on I have values of r,g,b colours in 3, two dimensional arrays, I need to convert them into an image. So I can't just copy paste.
mask[:, :] = (110,23,245)
as i have a whole 2d array containing of different pixel values so i dont see any other option than iterating ,can you suggest any better option ? – Shaharin Ahmed Jul 18 '20 at 05:48