Exemplo n.º 1
0
def process_frame(frame_id, frame_data):
    # this function simulates the processing of the frame.
    # I used a longer sleep thinking that it takes longer
    # and therefore the reason of parallel processing.

    frame_pano = fish2pano_lut(frame)
    print("... got frame {}".format(frame_id))
    return frame_pano
Exemplo n.º 2
0
    def run(self):
        while True:
            frame_num, frame = self.task_queue.get()               # consumer go gets the tasks and does it

            #Do computations on image, 1-2sec
            frame_pano = fish2pano_lut(frame)

            # put the results in queue
            self.result_queue.put(frame_pano)
        return
Exemplo n.º 3
0
import glob
import os
import cv2
from fish2pano_cv2_rgb import fish2pano_lut

img_path = '/Users/gzhou/TL_documents/python/video-conf/161025-stereo-align/test2/'

#os.path.exists(img_path)

img_list = []
for filename in glob.glob(img_path+'*.png'):
    img = cv2.imread(filename)
    img_list.append(img)

    #img =
    img_pano = fish2pano_lut(img)
    filename_new = os.path.basename(filename)[:-4]+'-pano.png'
    cv2.imwrite(img_path+filename_new, img_pano)
Exemplo n.º 4
0
        #other initialization stuff

    def run(self):
        while True:
            frame_num, frame = self.task_queue.get()               # consumer go gets the tasks and does it

            #Do computations on image, 1-2sec
            frame_pano = fish2pano_lut(frame)

            # put the results in queue
            self.result_queue.put(frame_pano)
        return

pool = multiprocessing.Pool()

for (frame_pano, frame) in pool.imap(fish2pano_lut(frame), frame)
    cv2.imshow('preview', frame_pano)

# Tasks queue with size 1 - only want one image queued for processing.
# Queue size should therefore match number of processes !!!!!


tasks = multiprocessing.Queue(1)
results = multiprocessing.Queue(20)
consumer = Consumer(tasks, results)
consumer.start()


#Creating window and starting video capturer from camera
# take input frames, and store the into a buffer
# in a parallel process, fetch videos every x second...  package and send over down the pipe.