###前提・実現したいこと
python2で画像を拡大・縮小するプログラムを作っています。
###発生している問題・エラーメッセージ
AttributeError Traceback (most recent call last) <ipython-input-4-2a16aa5ddbd0> in <module>() 5 6 # 読み込んだ画像の高さと幅を取得 ----> 7 height = img.shape[0] 8 width = img.shape[1] 9 AttributeError: 'NoneType' object has no attribute 'shape'
###該当のソースコード
python
1import cv2 2 3# 画像の読み込み 4img = cv2.imread("face.jpg", 1) 5 6# 読み込んだ画像の高さと幅を取得 7height = img.shape[0] 8width = img.shape[1] 9 10resized_img = cv2.resize(img,(width/2, height/2)) 11 12cv2.imshow("img", resized_img) 13cv2.waitKey(0) 14cv2.destroyAllWindows()``` 15 16###試したこと 17openCV2.3内のフォルダにshapesというデータがあったのでソース内のshapeをshapesに変えてもだめでした。 18###補足情報(言語/FW/ツール等のバージョンなど) 19より詳細な情報
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/11/24 10:36
2017/11/24 10:47
2017/11/28 04:15 編集
2017/11/28 14:34 編集
2017/11/29 04:48