MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / add_resize

Function add_resize

ldm/modules/image_degradation/bsrgan.py:339–350  ·  view source on GitHub ↗
(img, sf=4)

Source from the content-addressed store, hash-verified

337
338
339def add_resize(img, sf=4):
340 rnum = np.random.rand()
341 if rnum > 0.8: # up
342 sf1 = random.uniform(1, 2)
343 elif rnum < 0.7: # down
344 sf1 = random.uniform(0.5 / sf, 1)
345 else:
346 sf1 = 1.0
347 img = cv2.resize(img, (int(sf1 * img.shape[1]), int(sf1 * img.shape[0])), interpolation=random.choice([1, 2, 3]))
348 img = np.clip(img, 0.0, 1.0)
349
350 return img
351
352
353# def add_Gaussian_noise(img, noise_level1=2, noise_level2=25):

Callers 1

degradation_bsrgan_plusFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected