From 90125f5bedeb977606554e351dd52d06c5643494 Mon Sep 17 00:00:00 2001 From: James Betker Date: Tue, 2 Jun 2020 08:40:52 -0600 Subject: [PATCH] Allow blurring to be specified --- codes/data/LQGT_dataset.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/codes/data/LQGT_dataset.py b/codes/data/LQGT_dataset.py index 47a2859d..944c1a83 100644 --- a/codes/data/LQGT_dataset.py +++ b/codes/data/LQGT_dataset.py @@ -153,11 +153,12 @@ class LQGTDataset(data.Dataset): if self.opt['use_blurring']: # Pick randomly between gaussian, motion, or no blur. blur_det = random.randint(0, 100) + blur_magnitude = 3 if 'blur_magnitude' not in self.opt.keys() else self.opt['blur_magnitude'] if blur_det < 40: - blur_sig = int(random.randrange(0, 3)) - img_LQ = cv2.GaussianBlur(img_LQ, (3, 3), blur_sig) + blur_sig = int(random.randrange(0, blur_magnitude)) + img_LQ = cv2.GaussianBlur(img_LQ, (blur_magnitude, blur_magnitude), blur_sig) elif blur_det < 70: - img_LQ = self.motion_blur(img_LQ, random.randrange(1, 8), random.randint(0, 360)) + img_LQ = self.motion_blur(img_LQ, random.randrange(1, blur_magnitude * 3), random.randint(0, 360)) if self.opt['color']: # change color space if necessary