Answers for "py draw matrix of black square and white circle"

0

py draw matrix of black square and white circle

>>> face.tofile('face.raw') # Create raw file
>>> face_from_raw = np.fromfile('face.raw', dtype=np.uint8)
>>> face_from_raw.shape
(2359296,)
>>> face_from_raw.shape = (768, 1024, 3)
Posted by: Guest on August-08-2021
0

py draw matrix of black square and white circle

>>> face_memmap = np.memmap('face.raw', dtype=np.uint8, shape=(768, 1024, 3))
Posted by: Guest on August-08-2021
0

py draw matrix of black square and white circle

>>> from scipy import misc
>>> import imageio
>>> face = misc.face()
>>> imageio.imsave('face.png', face) # First we need to create the PNG file

>>> face = imageio.imread('face.png')
>>> type(face)      
<class 'imageio.core.util.Array'>
>>> face.shape, face.dtype
((768, 1024, 3), dtype('uint8'))
Posted by: Guest on August-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language