MCPcopy Create free account
hub / github.com/IceClear/StableSR / imgrad_fft

Function imgrad_fft

scripts/util_image.py:519–535  ·  view source on GitHub ↗

Calculate image gradient. Input: im: h x w x c numpy array

(im)

Source from the content-addressed store, hash-verified

517 return {'gradx': gradx, 'grady': grady, 'grad':grad}
518
519def imgrad_fft(im):
520 '''
521 Calculate image gradient.
522 Input:
523 im: h x w x c numpy array
524 '''
525 wx = np.rot90(np.array([[0, 0, 0],
526 [-1, 1, 0],
527 [0, 0, 0]], dtype=np.float32), k=2)
528 gradx = convfft(im, wx)
529 wy = np.rot90(np.array([[0, -1, 0],
530 [0, 1, 0],
531 [0, 0, 0]], dtype=np.float32), k=2)
532 grady = convfft(im, wy)
533 grad = np.concatenate((gradx, grady), axis=2)
534
535 return {'gradx': gradx, 'grady': grady, 'grad':grad}
536
537def convfft(im, weight):
538 '''

Callers 1

util_image.pyFile · 0.85

Calls 1

convfftFunction · 0.85

Tested by

no test coverage detected