Numpy: 3차원의 경우 (width, height, channel)
- Sequence of channel: R→G→B
image = np.array(image) # 가로(width), 세로(height)
print(f"numpy-image: {image.shape}") # numpy-image: (10, 8, 3)
CV2: 3차원의 경우 (width, height, channel)
- Sequence of channel: B→G→R
image = cv2.imread("1.jpg", 1)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image = cv2.resize(image, dsize=(8, 10), interpolation=cv2.INTER_AREA)
print(f"cv2-Image: {image.shape}") # cv2-Image: (10, 8, 3)
PIL: 3차원의 경우 (height, width, channel)
- Sequence of channel: R→G→B
image = Image.open('./1.jpg')
image = image.resize((8, 10)) # 세로(height), 가로(width)
print(f"PIL-image: {image.size}") # PIL-image: (8, 10)