def run_show_primitives(): """Demonstrates the FT images of primitive forms""" transformers = [ Transformer('round.jpg'), Transformer('square.png'), Transformer('triangle.png') ] for trans in transformers: trans.plot() trans.transform().shift() trans.plot_fft('Shifted FT of') Transformer.show_all() transformers.clear() del transformers gc.collect()
def run_filter(self): """Runs the filter class work demonstration""" name = self.box.get() try: fraction = float(self.fracbox.get()) fl1 = fl.Filter(name, fraction) fl1.plot(name) fl1.low_pass_filter() fl2 = fl.Filter(name, fraction) fl2.high_pass_filter() Transformer.show_all() del fl1, fl2, name gc.collect() except Exception as er: print(er)
def run_comp(): """Demonstrates the FT images of complex forms""" tr = Transformer('vase.jpg') tr2 = Transformer('face.jpg') tr.plot('Original vase') tr2.plot('Original face') tr.transform() tr.plot_fft('FT') tr2.transform() tr2.plot_fft('FT') tr.shift() tr.plot_fft('Shifted FT') tr2.shift() tr2.plot_fft('Shifted FT') Transformer.show_all() del tr, tr2 gc.collect()
from transform import Transformer if __name__ == '__main__': shapes = ['round.jpg', 'square.png', 'triangle.png'] for sh in shapes: trans = Transformer(sh) trans.transform() trans.plot_fft('FT of') trans.shift() trans.plot_fft('Shifted FT of') Transformer.show_all() tr = Transformer('vase.jpg') tr2 = Transformer('face.jpg') tr.plot('Original vase') tr2.plot('Original face') tr.transform() tr.plot_fft('FT') tr2.transform() tr2.plot_fft('FT') tr.shift() tr.plot_fft('Shifted FT') tr2.shift() tr2.plot_fft('Shifted FT') Transformer.show_all()