Browse Source

fix bug of using cv2.addWeighted in natural_noise.py

pull/283/head
ZhidanLiu 3 years ago
parent
commit
799874a3d2
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      mindarmour/natural_robustness/natural_noise.py

+ 2
- 3
mindarmour/natural_robustness/natural_noise.py View File

@@ -738,7 +738,7 @@ class BackShadow:
file_path = os.path.join(self.template_path, np.random.choice(file))
shadow = cv2.imread(file_path)
shadow = cv2.resize(shadow, (image.shape[1], image.shape[0]))
dst = cv2.addWeighted(image, 1 - self.shade, shadow, self.shade, beta=0)
dst = cv2.addWeighted(image, 1 - self.shade, shadow, self.shade, 0)
return dst
@@ -905,7 +905,6 @@ class BackgroundWord:
numpy.ndarray, curved image.
"""
image = check_numpy_param('image', image)
beta = 0
width, height = image.shape[:2]
x = np.random.randint(0, int(width / 5))
y = np.random.randint(0, int(height / 5))
@@ -913,5 +912,5 @@ class BackgroundWord:
affine = cv2.warpAffine(image.copy(), matrix, (height, width))
back = image.copy()
back[x:, y:] = affine[x:, y:]
dst = cv2.addWeighted(image, 1 - self.shade, back, self.shade, beta)
dst = cv2.addWeighted(image, 1 - self.shade, back, self.shade, 0)
return dst

Loading…
Cancel
Save