numpy array to image
numpy array to image¶ In [1]: import numpy as np from PIL import Image # Generate a random integer between 0 and 255 arr = np.random.randint(0,255, size=(34, 44), dtype=np.uint8) arr Out[1]: array([[ 32, 201, 105, ..., 28, 29, 98], [207, 219, 114, ..., 117, 201, 237], [ 70, 89, 43, ..., 177, 221, 146], ..., [153, 251, 47, ..., 78, 115, 159], [184, 160, 229, ..., 98, 0, 248], [124, 203, 101, ...,..
2023. 8. 3.
넘파이 어레이 크기 확인 shape
넘파이 어레이 크기 확인 shape shape 함수를 통해 어레이의 크기를 확인할 수 있습니다. >>> import numpy as np >>> arr = np.array([1,2,3,4,5]) >>> arr.shape (5,) >>> arr3 = np.array([[1,2,3,4], [5,6,7,8], [9,0,9,8]]) >>> arr3.shape (3, 4)
2023. 8. 3.