同じ型・構成の変数が代入できないです。
path = Path(__file__).parent path /= "../img_folder/test.png" img = cv2.imread(path) append_img = cv2.imread("photo1.png") index_height = append_img.shape[0] index_width = append_img.shape[1] cv2.rectangle(img, (100, 100), (100, 100), (255, 0, 0), -1) img[index_height, index_width, :] = append_img
とコードを書きましたが、ValueError: could not broadcast input array from shape (450,1000,3) into shape (3)とエラーが出ました。
print(img)とすると(2000, 1000, 3)と、print(append_img)とすると(450, 1000, 3) と出力され、
print(type(img))&print(type(append_img))とすると<class 'numpy.ndarray'>と出力されました。
なのでなぜ同じ型・構成の変数が代入できないのかわかりません。
どう直せば良いのでしょうか?
回答1件
あなたの回答
tips
プレビュー