Skip to content

Commit

Permalink
Fix AverageBlur dropping single channels
Browse files Browse the repository at this point in the history
  • Loading branch information
aleju committed Oct 14, 2017
1 parent d7ca45d commit e945e93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion imgaug/augmenters/blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,13 @@ def _augment_images(self, images, random_state, parents, hooks):
)
for i in sm.xrange(nb_images):
kh, kw = samples[0][i], samples[1][i]
#print(images.shape, result.shape, result[i].shape)
if kh > 1 or kw > 1:
result[i] = cv2.blur(result[i], (kh, kw))
image_aug = cv2.blur(result[i], (kh, kw))
# cv2.blur() removes channel axis for single-channel images
if image_aug.ndim == 2:
image_aug = image_aug[..., np.newaxis]
result[i] = image_aug
return result

def _augment_keypoints(self, keypoints_on_images, random_state, parents, hooks):
Expand Down

0 comments on commit e945e93

Please sign in to comment.