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

Function random_crop

ldm/modules/image_degradation/bsrgan_light.py:430–438  ·  view source on GitHub ↗
(lq, hq, sf=4, lq_patchsize=64)

Source from the content-addressed store, hash-verified

428
429
430def random_crop(lq, hq, sf=4, lq_patchsize=64):
431 h, w = lq.shape[:2]
432 rnd_h = random.randint(0, h - lq_patchsize)
433 rnd_w = random.randint(0, w - lq_patchsize)
434 lq = lq[rnd_h:rnd_h + lq_patchsize, rnd_w:rnd_w + lq_patchsize, :]
435
436 rnd_h_H, rnd_w_H = int(rnd_h * sf), int(rnd_w * sf)
437 hq = hq[rnd_h_H:rnd_h_H + lq_patchsize * sf, rnd_w_H:rnd_w_H + lq_patchsize * sf, :]
438 return lq, hq
439
440
441def degradation_bsrgan(img, sf=4, lq_patchsize=72, isp_model=None):

Callers 1

degradation_bsrganFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected