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

Function add_resize

ldm/modules/image_degradation/bsrgan_light.py:342–353  ·  view source on GitHub ↗
(img, sf=4)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected