From 799874a3d233965cac2936e042af50f0ae536377 Mon Sep 17 00:00:00 2001 From: ZhidanLiu Date: Fri, 5 Nov 2021 16:55:23 +0800 Subject: [PATCH] fix bug of using cv2.addWeighted in natural_noise.py --- mindarmour/natural_robustness/natural_noise.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mindarmour/natural_robustness/natural_noise.py b/mindarmour/natural_robustness/natural_noise.py index ae1f783..541b261 100644 --- a/mindarmour/natural_robustness/natural_noise.py +++ b/mindarmour/natural_robustness/natural_noise.py @@ -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