Skip to content

Commit fee4aec

Browse files
committed
fix for issue #6
1 parent 6ef4821 commit fee4aec

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

MLHelper/noise/_image.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
import cv2
44

55

6+
def overwrite_black_areas_from_im1_with_im2(im1, im2):
7+
"""
8+
overwrites black (=0) areas in image1 with information from image2
9+
:param im1: image /np.ndarray
10+
:param im2: image /np.ndarray
11+
:return:
12+
"""
13+
idx = np.where(im1 == 0)
14+
im1[idx] = im2[idx]
15+
16+
return im1
17+
18+
619
def motionblur_img(im: np.ndarray, tr_x: float, tr_y: float, k=None):
720
"""
821
motion blur's an image using image translating, blending and gaussian blurring
@@ -13,11 +26,6 @@ def motionblur_img(im: np.ndarray, tr_x: float, tr_y: float, k=None):
1326
:param k: gaussian noise kernel (optional; if None a random kernel will be computed)
1427
:return: blurred image
1528
"""
16-
def overwrite_black_areas_from_im1_with_im2(im1, im2):
17-
idx = np.where(im1 == 0)
18-
im1[idx] = im2[idx]
19-
20-
return im1
2129

2230
# extract height and width
2331
h, w = im.shape[0:2]

0 commit comments

Comments
 (0)