コード例 #1
0
ファイル: test_pipeline.py プロジェクト: shin285/pipeline
 def test():
     pipeline = Pipeline()
     for x in pipeline.add(
             PipeBuilder().alias("multiplier").consumer(lambda m: time.sleep(2) or m * m).buffer_size(100).number_of_consumer(2)
     ).stream(['a']):
         pass
コード例 #2
0
"""
Created on Wed Sep  4 19:32:31 2019

@author: Luca Michael Reeb
"""

from pipeline import Pipeline
from ops.transform import *
from ops.parallel import *
from ops.masks import *
import numpy as np

pipe = Pipeline()
#pipe.add(ToGreyscale())

pipe.add(CropRectangle(64, 0, 512, 480))
pipe.add(FFT())
#pipe.add(TukeyWin(512, 480))

pipe_a = Pipeline()
pipe_a.add(AlignedEllipse((480, 512), 1 / 7, invert=True))
pipe_a.add(IFFT())

pipe_b = Pipeline()
pipe_b.add(AlignedAnnulus((480, 512), 1 / 20, 1 / 15, invert=True))
pipe_b.add(IFFT())
pipe_b.add(Clip(0, 255))

pipe_c = Pipeline()
pipe_c.add(Rectangle((480, 512), (240, 0), (480, 420)))
pipe_c.add(IFFT())
コード例 #3
0
 def test():
     pipeline = Pipeline()
     for x in pipeline.add(PipeBuilder().alias("multiplier").consumer(
             lambda m: time.sleep(2) or m * m).buffer_size(
                 100).number_of_consumer(2)).stream(['a']):
         pass
コード例 #4
0
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk  # noqa F402

if __name__ == "__main__":

    pipeline = Pipeline()
    size = (720, 480)
    #
    # Choose one of the producers.
    #
    # producer = CameraCapture(queue, resolution=(1280, 720))   # nofilter
    producer = CameraCapture(filter=grayscale, resolution=size)
    filter = CallableFilter("grayscale", "image", "image", grayscale)
    consumer = GtkImageSink()

    pipeline.add(producer)
    pipeline.add(filter)
    pipeline.add(consumer)
    out_pin = ("out", "image", 0)
    in_pin = ("in", "image", 0)
    pipeline.connect(producer, out_pin, in_pin, filter)
    pipeline.connect(filter, out_pin, in_pin, consumer)

    win = Gtk.Window()
    win.set_title("Video Capture")
    win.resize(producer.width, producer.height)
    win.add(consumer)
    win.show_all()
    win.connect('destroy', Gtk.main_quit)

    pipeline.start()