I have a black and white image that I am loading into python. If I use pillow or cv2 I get two different answers for the dimension of the NumPy array that is created. I understand that channel ordering (RGB vs BGR) is different from openCV and pillow but I don't think that's what's going on here
Is my image 2 dimensions as pillow represents it. Does this mean that openCV duplicates the values into a 3D array?
import cv2
from PIL import Image
import numpy as np
path = 'path/to/file.png'
#using pillow
img = Image.open(path)
img.size #(500,500)
img.mode # L
arr = np.array(img)
arr.shape #(500,500)
#using cv2
image = cv2.imread(path)
image.shape #(500,500,3)
If I run file in a bash terminal
$ file 'path/to/image.png'
path/to/image: PNG image data, 500 x 500, 8-bit grayscale, non-interlaced
//doing? Are they supposed to be comments? - Mercury