def __init__(self, ports, isCircle, firstCamera, delay):
		#self.name = "controller"
		# Boolean to clean up program at quit.
		self.isRunning = True

		# Make queues for communicating with other threads.
		self.writerQ = Queue.Queue(maxsize=0)
		self.trackerQ = Queue.Queue(maxsize=0)

		self.trackerDelay = delay

		# Create a lock for safely using the callback function.
		self.lock = threading.RLock()
		self.threadLock = threading.RLock()

		# Indicates whether the cameras should wrap around at list end.
		self.is360 = isCircle
		# Save the list of usb ports the cameras are attached to. This must
		# be hard-coded and input to the Controller constuctor.
		self.portList = ports
		self.numCameras = len(self.portList)

		self.currentDev = 0 # For initialization.
		self.currentPort = None  # For initialization.
		# Set the correct values for the currentPort.
		if len(self.portList) > 0:
			self.currentPort = self.portList[firstCamera]
			#print "current port: " + str(self.currentPort)
			self.currentDev = devmap.getdevnum(self.currentPort)

		# Create the VideoCapture object.
		self.cap = cv2.VideoCapture(self.currentDev)
		self.cap.set(3,640)
		self.cap.set(4,480)
Exemple #2
0
    def __init__(self, ports, isCircle, firstCamera, delay):
        #self.name = "controller"
        # Boolean to clean up program at quit.
        self.isRunning = True

        # Make queues for communicating with other threads.
        self.writerQ = Queue.Queue(maxsize=0)
        self.trackerQ = Queue.Queue(maxsize=0)

        self.trackerDelay = delay

        # Create a lock for safely using the callback function.
        self.lock = threading.RLock()
        self.threadLock = threading.RLock()

        # Indicates whether the cameras should wrap around at list end.
        self.is360 = isCircle
        # Save the list of usb ports the cameras are attached to. This must
        # be hard-coded and input to the Controller constuctor.
        self.portList = ports
        self.numCameras = len(self.portList)

        self.currentDev = 0  # For initialization.
        self.currentPort = None  # For initialization.
        # Set the correct values for the currentPort.
        if len(self.portList) > 0:
            self.currentPort = self.portList[firstCamera]
            #print "current port: " + str(self.currentPort)
            self.currentDev = devmap.getdevnum(self.currentPort)

        # Create the VideoCapture object.
        self.cap = cv2.VideoCapture(self.currentDev)
        self.cap.set(3, 640)
        self.cap.set(4, 480)
	def getCameraLeft(self):
		nextPort = self.currentPort 
		currentIndex = self.portList.index(self.currentPort)
		#print "currentIndex = " + str(currentIndex)
		if currentIndex < self.numCameras - 1: # Check if camera is on end.
			nextPort = self.portList[currentIndex + 1]
		elif self.is360 == True and currentIndex == self.numCameras - 1:
			nextPort = self.portList[0] # Wrap around.
		#print "nextport = " + str(nextPort)
		self.currentPort = nextPort
		return devmap.getdevnum(nextPort)
	def getCameraRight(self):
		nextPort = self.currentPort
		currentIndex = self.portList.index(self.currentPort)
		#print "currentIndex = " + str(currentIndex)
		if currentIndex > 0:  # Check if the camera is on the far right.
			nextPort = self.portList[currentIndex - 1]
		elif self.is360 == True and currentIndex == 0:
			nextPort = self.portList[-1]  # Wrap around.
		#print "nextport = " + str(nextPort)
		self.currentPort = nextPort
		return devmap.getdevnum(nextPort) 
Exemple #5
0
 def getCameraLeft(self):
     nextPort = self.currentPort
     currentIndex = self.portList.index(self.currentPort)
     #print "currentIndex = " + str(currentIndex)
     if currentIndex < self.numCameras - 1:  # Check if camera is on end.
         nextPort = self.portList[currentIndex + 1]
     elif self.is360 == True and currentIndex == self.numCameras - 1:
         nextPort = self.portList[0]  # Wrap around.
     #print "nextport = " + str(nextPort)
     self.currentPort = nextPort
     return devmap.getdevnum(nextPort)
Exemple #6
0
 def getCameraRight(self):
     nextPort = self.currentPort
     currentIndex = self.portList.index(self.currentPort)
     #print "currentIndex = " + str(currentIndex)
     if currentIndex > 0:  # Check if the camera is on the far right.
         nextPort = self.portList[currentIndex - 1]
     elif self.is360 == True and currentIndex == 0:
         nextPort = self.portList[-1]  # Wrap around.
     #print "nextport = " + str(nextPort)
     self.currentPort = nextPort
     return devmap.getdevnum(nextPort)