Ask Your Question
0

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

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

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
0

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

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

Question Tools

1 follower

Stats

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

Seen: 333 times

Last updated: May 27 '20