Ask Your Question

Issue with np.zeros() while trying to get a black background

asked 2020-05-27 03:00:58 -0500

Srav gravatar image

I am using img = np.zeros((512 , 512 , 3) , np.int8) to get a black ground but I am getting a Gray background instead

image description

When i removed np.uint8 and used the default np.float64 I am getting the black background

image description

Why is this happening?

Also when i printed img array in both cases i got the same zero array of shape (512 , 512 , 3)in both cases.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-05-27 07:26:56 -0500

supra56 gravatar image

If you used this np.int8, you will not get white background. Fortunately, better used np.uint8 or np.float64.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-05-27 03:00:58 -0500

Seen: 39 times

Last updated: May 27