@defer.inlineCallbacks
def connect(self, _protocolFactory):
    if (self.camera is None):
        self.camera = (yield threads.deferToThread(cv2.VideoCapture, self.device_index))
        self.camera.set(3, self.img_width)
        self.camera.set(4, self.img_height)
    defer.returnValue(self)
@defer.inlineCallbacks
def connect(self, _protocolFactory):
    if (self.camera is None):
        self.camera = (yield threads.deferToThread(cv2.VideoCapture, self.device_index))
        self.camera.set(3, self.img_width)
        self.camera.set(4, self.img_height)
    defer.returnValue(self)