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

Function add_blur

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

Source from the content-addressed store, hash-verified

323
324
325def add_blur(img, sf=4):
326 wd2 = 4.0 + sf
327 wd = 2.0 + 0.2 * sf
328 if random.random() < 0.5:
329 l1 = wd2 * random.random()
330 l2 = wd2 * random.random()
331 k = anisotropic_Gaussian(ksize=2 * random.randint(2, 11) + 3, theta=random.random() * np.pi, l1=l1, l2=l2)
332 else:
333 k = fspecial('gaussian', 2 * random.randint(2, 11) + 3, wd * random.random())
334 img = ndimage.filters.convolve(img, np.expand_dims(k, axis=2), mode='mirror')
335
336 return img
337
338
339def add_resize(img, sf=4):

Callers 3

degradation_bsrganFunction · 0.70
degradation_bsrgan_plusFunction · 0.70

Calls 2

anisotropic_GaussianFunction · 0.70
fspecialFunction · 0.70

Tested by

no test coverage detected