Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
def main():
    inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE)
    inp.setchannels(CHANNELS)
    inp.setrate(RATE)
    inp.setformat(alsaaudio.PCM_FORMAT_S16_LE)
    inp.setperiodsize(CHUNK)

    out = alsaaudio.PCM(alsaaudio.PCM_PLAYBACK)
    out.setchannels(CHANNELS)
    out.setrate(RATE)
    out.setformat(alsaaudio.PCM_FORMAT_S16_LE)
    out.setperiodsize(CHUNK + 1000)
    transformer = Transformer(pitch.pitch_up)

    while True:
        l, data = inp.read()
        if data:
            transformed = transformer.transform(data)
            out.write(transformed)
Exemplo n.º 3
0
def main():
    inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE)
    inp.setchannels(CHANNELS)
    inp.setrate(RATE)
    inp.setformat(alsaaudio.PCM_FORMAT_S16_LE)
    inp.setperiodsize(CHUNK)

    out = alsaaudio.PCM(alsaaudio.PCM_PLAYBACK)
    out.setchannels(CHANNELS)
    out.setrate(RATE)
    out.setformat(alsaaudio.PCM_FORMAT_S16_LE)
    out.setperiodsize(CHUNK + 1000)
    transformer = Transformer(pitch.pitch_up)

    while True:
        l, data = inp.read()
        if data:
            transformed = transformer.transform(data)
            out.write(transformed)
Exemplo n.º 4
0
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()