Commit 05cbdcd9c4f28988688583d2214689297afba6f2
1 parent
76a8de15
Exists in
master
and in
1 other branch
staged.
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
mdata/crop.py
@@ -33,7 +33,7 @@ def crop_Test(): | @@ -33,7 +33,7 @@ def crop_Test(): | ||
33 | try: | 33 | try: |
34 | img = cv2.imread(image, cv2.CV_LOAD_IMAGE_UNCHANGED) | 34 | img = cv2.imread(image, cv2.CV_LOAD_IMAGE_UNCHANGED) |
35 | h, w = img.shape[:2] | 35 | h, w = img.shape[:2] |
36 | - left, upper = np.random.randint(w - 300), np.random.randint(h - 300) | 36 | + left, upper = random.randint(0, w - 300), random.randint(0, h - 300) |
37 | img_crop = img[upper:upper + 300, left:left + 300] | 37 | img_crop = img[upper:upper + 300, left:left + 300] |
38 | cv2.imwrite(os.path.join(base_dir, category + '_crop_cv', name),img_crop) | 38 | cv2.imwrite(os.path.join(base_dir, category + '_crop_cv', name),img_crop) |
39 | except Exception as e: | 39 | except Exception as e: |