1
說我有一個尺寸爲40 x 39的圖像。我需要向圖像添加一行,以便最終圖像的尺寸爲40 x 40。我怎樣才能做到這一點水平和垂直?將行添加到OpenCV中的圖像Python
我試過,
img = cv2.imread('image.jpg')
blank_image = np.zeros((1, 40, 3), np.float32)
img = np.concatenate((img, blank_image), axis=1)
但是這給了我這個錯誤,
ValueError: all the input arrays must have same number of dimensions
由於它的工作!由於元組是不可變的,所以不得不稍微編輯代碼。 – sope
對!我會糾正答案 –