由于以下错误,我正在尝试添加频道
ValueError:无法将输入数组从形状 (48,48) 广播到形状 (48,48,1)
代码:
img = cv2.imread(f,0)
resized = cv2.resize(img, (48,48), interpolation = cv2.INTER_AREA)
print(resized.shape)
(48, 48)
Run Code Online (Sandbox Code Playgroud)
但我需要像 (48,48,1) 这样的通道图像。
我该如何解决这个问题?