commit 21eaa5e1eaab5a420330bcc760f7f8b00e72b844
parent 6fe5826cd5e5699ad91bef3059400633c619fe41
Author: Marcel <MTRNord@users.noreply.github.com>
Date: Fri, 7 Oct 2016 21:18:46 +0200
Update download-image-by-link.py
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/scripts/download-image-by-link.py b/scripts/download-image-by-link.py
@@ -19,9 +19,12 @@ def store_raw_images():
i
urllib.urlretrieve(i, "neg/"+str(pic_num)+".jpg")
img = cv2.imread("neg/"+str(pic_num)+".jpg",cv2.IMREAD_GRAYSCALE)
- # should be larger than samples / pos pic (so we can place our image on it)
- resized_image = cv2.resize(img, (100, 100))
- cv2.imwrite("neg/"+str(pic_num)+".jpg",resized_image)
+ if img is not None:
+ # should be larger than samples / pos pic (so we can place our image on it)
+ resized_image = cv2.resize(img, (100, 100))
+ cv2.imwrite("neg/"+str(pic_num)+".jpg",resized_image)
+ else:
+ print "invalid img"
pic_num += 1
except Exception as e: