Example #1
0

from collections import defaultdict
from collections import OrderedDict
import threading

import dlib

from vision import *
import ioutil
import camShift
from demo_config import Config
from concurrent_track import BatchTrackWorker, TrackerWorkerManager


LOG = ioutil.getLogger(__name__)


class FrameBuffer(object):
    def __init__(self, sz):
        self.buf_sz = sz
        self.buf = []

    def push(self, itm):
        ret = None
        LOG.debug('buf sz: {}'.format(len(self.buf)))
        if len(self.buf) == self.buf_sz:
            ret = self.buf.pop()
            LOG.debug('pop item: {}'.format(ret))
        self.buf.insert(0, itm)
        return ret
Example #2
0
 def __init__(self, server_ip=u"ws://localhost", server_port=9000):
     self.logger=ioutil.getLogger(__name__)
     self.logger.setLevel(logging.DEBUG)
     server_ip_port = server_ip + ':' +str(server_port)
     self.ws=create_connection(server_ip_port)