Skip to content

Instantly share code, notes, and snippets.

@atarabi
Last active January 9, 2016 16:07
Show Gist options
  • Save atarabi/e9594d94059cf2b68390 to your computer and use it in GitHub Desktop.
Save atarabi/e9594d94059cf2b68390 to your computer and use it in GitHub Desktop.
import numpy as np
import cv2
def ParamsSetup():
params = (
('FFT Division', 'float', {'value': 12.0, 'minvalue': 1.0, 'maxvalue': 1000.0}),
)
return {'params': params, 'mode': 'RGB'}
def SmartRender(in_data, params, input_):
gray = cv2.cvtColor(input_, cv2.COLOR_RGB2GRAY)
fft = np.fft.fft2(gray)
fft = np.log(np.fft.fftshift(np.abs(fft)) + 1.0)
fft_division = max(1.0, params['FFT Division'])
fft /= fft_division
return fft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment