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

Function classical_degradation

ldm/modules/image_degradation/bsrgan.py:284–296  ·  view source on GitHub ↗

blur + downsampling Args: x: HxWxC image, [0, 1]/[0, 255] k: hxw, double sf: down-scale factor Return: downsampled LR image

(x, k, sf=3)

Source from the content-addressed store, hash-verified

282
283
284def classical_degradation(x, k, sf=3):
285 ''' blur + downsampling
286 Args:
287 x: HxWxC image, [0, 1]/[0, 255]
288 k: hxw, double
289 sf: down-scale factor
290 Return:
291 downsampled LR image
292 '''
293 x = ndimage.filters.convolve(x, np.expand_dims(k, axis=2), mode='wrap')
294 # x = filters.correlate(x, np.expand_dims(np.flip(k), axis=2))
295 st = 0
296 return x[st::sf, st::sf, ...]
297
298
299def add_sharpening(img, weight=0.5, radius=50, threshold=10):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected