모양이 이미지 (1120,1472,4)이고,이를 3000, 3000, 4) 내가 작성한 코드는 이와 같습니다.ValueError : 모양 (1120,1472,4)에서 입력 배열을 모양 (3000,3000)으로 브로드 캐스팅 할 수 없습니다.
pad_shape = (3000, 3000)
i = np.array('test.tif')
result = np.zeros(pad_shape,dtype=int)
result[:i.shape[0], :i.shape[1]] = i
print(result)
여기가
ValueError: could not broadcast input array from shape (1120, 1472, 4) into shape (3000, 3000)
1120 * 1472! = 3000 * 3000, "모양 변경"이란 무엇입니까? 새로운 어레이에는 더 많은 요소가있을 것입니다. –
이것은 단순한 오타입니다. pad_shape에서 4를 놓친 경우 –