Revision history [back]

Gaining high frame rate from ELP camera (python)

I'm using an ELP USB camera that is supposedly rated at 100fps at VGA quality but I don't seem to be getting anywhere near that frame rate. I was wondering if anyone has used an ELP camera with openCV and managed to achieve a frame rate close to 100 fps? Or if anyone has any advice to help increase the frame rate?

I have already tested that the output is MJPEG at 640x420 and I am running cv2.VideoCapture in one thread and placing the frame on a queue. From the main thread I repeatedly ask for frames but only return when the results is not None. This gives a frame rate hovering around 30fps.

import cv2
import time
import numpy as np
from datetime import datetime
import time
from Queue import Queue

class WebcamVideoStream:

def __init__(self, src=0):
# initialize the video camera stream
self.stream = cv2.VideoCapture(src)
# initialize the variable used to indicate if the thread should
# be stopped
self.stopped = False
self.frame = None

def start(self):
global qt
self.stopped = False
qt = Queue(10)
return self

def update(self):
global qt
# keep looping infinitely until the thread is stopped
while True:
if self.stopped:
return
qt.put(self.frame)

global qt
if(not qt.empty()):
self.CurrFrame=qt.get()
if self.CurrFrame is not None:
return self.CurrFrame
if self.stopped:
return

def stop(self):
print('Stop')
# indicate that the thread should be stopped
self.stopped = True
return self

vs = WebcamVideoStream(src=-1).start()
time.sleep(1)

i = 0
t0 = time.time()
while i < 100:
while frame is None:
date_string = datetime.now().strftime("%Y-%m-%d-%H:%M:%S:%f")
i = i + 1

rate = 100/(time.time()-t0)
print(rate)

cv2.destroyAllWindows()
vs.stop()


Gaining high frame rate from ELP camera (python)

I'm using an ELP USB camera that is supposedly rated at 100fps at VGA quality but I don't seem to be getting anywhere near that frame rate. I was wondering if anyone has used an ELP camera with openCV and managed to achieve a frame rate close to 100 fps? Or if anyone has any advice to help increase the frame rate?

I have already tested that the output is MJPEG at 640x420 and I am running cv2.VideoCapture in one thread and placing the frame on a queue. From the main thread I repeatedly ask for frames but only return when the results is not None. This gives a frame rate hovering around 30fps.

import cv2
import time
import numpy as np
from datetime import datetime
import time
from Queue import Queue

class WebcamVideoStream:

def __init__(self, src=0):
# initialize the video camera stream
self.stream = cv2.VideoCapture(src)
# initialize the variable used to indicate if the thread should
# be stopped
self.stopped = False
self.frame = None

def start(self):
global qt
self.stopped = False
qt = Queue(10)
return self

def update(self):
global qt
# keep looping infinitely until the thread is stopped
while True:
if self.stopped:
return
qt.put(self.frame)

global qt
if(not qt.empty()):
self.CurrFrame=qt.get()
if self.CurrFrame is not None:
return self.CurrFrame
if self.stopped:
return

def stop(self):
print('Stop')
# indicate that the thread should be stopped
self.stopped = True
return self

vs = WebcamVideoStream(src=-1).start()
time.sleep(1)

i = 0
t0 = time.time()
while i < 100:
while frame is None:
date_string = datetime.now().strftime("%Y-%m-%d-%H:%M:%S:%f")
i = i + 1

rate = 100/(time.time()-t0)
print(rate)

cv2.destroyAllWindows()
vs.stop()


Gaining high frame rate from ELP camera (python)

I'm using an ELP USB camera that is supposedly rated at 100fps at VGA 640x480 quality but I don't seem to be getting anywhere near that frame rate. I was wondering if anyone has used an ELP camera with openCV and managed to achieve a frame rate close to 100 fps? Or if anyone has any advice to help increase the frame rate?

I have already tested that the output is MJPEG at 640x420 and I am running cv2.VideoCapture in one thread and placing the frame on a queue. From the main thread I repeatedly ask for frames but only return when the results is not None. This gives a frame rate hovering around 30fps.

import cv2
import time
import numpy as np
from datetime import datetime
import time
from Queue import Queue

class WebcamVideoStream:

def __init__(self, src=0):
# initialize the video camera stream
self.stream = cv2.VideoCapture(src)
# initialize the variable used to indicate if the thread should
# be stopped
self.stopped = False
self.frame = None

def start(self):
global qt
self.stopped = False
qt = Queue(10)
return self

def update(self):
global qt
# keep looping infinitely until the thread is stopped
while True:
if self.stopped:
return
qt.put(self.frame)

global qt
if(not qt.empty()):
self.CurrFrame=qt.get()
if self.CurrFrame is not None:
return self.CurrFrame
if self.stopped:
return

def stop(self):
print('Stop')
# indicate that the thread should be stopped
self.stopped = True
return self

vs = WebcamVideoStream(src=-1).start()
time.sleep(1)

i = 0
t0 = time.time()
while i < 100:
while frame is None:
i = i + 1

rate = 100/(time.time()-t0)
print(rate)

cv2.destroyAllWindows()
vs.stop()


Gaining high frame rate from ELP camera (python)

I'm using an ELP USB camera that is supposedly rated at 100fps at 640x480 quality but I don't seem to be getting anywhere near that frame rate. I was wondering if anyone has used an ELP camera with openCV and managed to achieve a frame rate close to 100 fps? Or if anyone has any advice to help increase the frame rate?rate? I am using Ubuntu 14.04 with openCV version 2.4.8.

I have already tested that the output is MJPEG at 640x420 and I am running cv2.VideoCapture in one thread and placing the frame on a queue. From the main thread I repeatedly ask for frames but only return when the results is not None. This gives a frame rate hovering around 30fps. One I have the image I am performing contour detection but essentially I would like to get the frame rate up as high as possible. Below is the code I'm using just to test the frame rate.

import cv2
import time
import numpy as np
from datetime import datetime
import time
from Queue import Queue

class WebcamVideoStream:

def __init__(self, src=0):
# initialize the video camera stream
self.stream = cv2.VideoCapture(src)
# initialize the variable used to indicate if the thread should
# be stopped
self.stopped = False
self.frame = None

def start(self):
global qt
self.stopped = False
qt = Queue(10)
return self

def update(self):
global qt
# keep looping infinitely until the thread is stopped
while True:
if self.stopped:
return
qt.put(self.frame)

global qt
if(not qt.empty()):
self.CurrFrame=qt.get()
if self.CurrFrame is not None:
return self.CurrFrame
if self.stopped:
return

def stop(self):
print('Stop')
# indicate that the thread should be stopped
self.stopped = True
return self

vs = WebcamVideoStream(src=-1).start()
time.sleep(1)

i = 0
t0 = time.time()
while i < 100:
while frame is None:
i = i + 1

rate = 100/(time.time()-t0)
print(rate)

cv2.destroyAllWindows()
vs.stop()


 5 No.5 Revision berak 32993 ●7 ●81 ●312

Gaining high frame rate from ELP camera (python)

I'm using an ELP USB camera that is supposedly rated at 100fps at 640x480 quality but I don't seem to be getting anywhere near that frame rate. I was wondering if anyone has used an ELP camera with openCV and managed to achieve a frame rate close to 100 fps? Or if anyone has any advice to help increase the frame rate? I am using Ubuntu 14.04 with openCV version 2.4.8.rate?

I have already tested that the output is MJPEG at 640x420 and I am running cv2.VideoCapture in one thread and placing the frame on a queue. From the main thread I repeatedly ask for frames but only return when the results is not None. This gives a frame rate hovering around 30fps. One I have the image I am performing contour detection but essentially I would like to get the frame rate up as high as possible. Below is the code I'm using just to test the frame rate.

import cv2
import time
import numpy as np
from datetime import datetime
import time
from Queue import Queue

class WebcamVideoStream:

def __init__(self, src=0):
# initialize the video camera stream
self.stream = cv2.VideoCapture(src)
# initialize the variable used to indicate if the thread should
# be stopped
self.stopped = False
self.frame = None

def start(self):
global qt
self.stopped = False
qt = Queue(10)
return self

def update(self):
global qt
# keep looping infinitely until the thread is stopped
while True:
if self.stopped:
return
qt.put(self.frame)

global qt
if(not qt.empty()):
self.CurrFrame=qt.get()
if self.CurrFrame is not None:
return self.CurrFrame
if self.stopped:
return

def stop(self):
print('Stop')
# indicate that the thread should be stopped
self.stopped = True
return self

vs = WebcamVideoStream(src=-1).start()
time.sleep(1)

i = 0
t0 = time.time()
while i < 100:
while frame is None:
i = i + 1

rate = 100/(time.time()-t0)
print(rate)

cv2.destroyAllWindows()
vs.stop()


Gaining high frame rate from ELP camera (python)

I'm using an ELP USB camera that is supposedly rated at 100fps at 640x480 quality but I don't seem to be getting anywhere near that frame rate. I was wondering if anyone has used an ELP camera with openCV and managed to achieve a frame rate close to 100 fps? Or if anyone has any advice to help increase the frame rate?rate? I am using Ubuntu 14.04 with openCV version 2.4.8.

I have already tested that the output is MJPEG at 640x420 and I am running cv2.VideoCapture in one thread and placing the frame on a queue. From the main thread I repeatedly ask for frames but only return when the results is not None. This gives a frame rate hovering around 30fps. One I have the image I am performing contour detection but essentially I would like to get the frame rate up as high as possible. Below is the code I'm using just to test the frame rate.

import cv2
import time
import numpy as np
from datetime import datetime
import time
from Queue import Queue

class WebcamVideoStream:

def __init__(self, src=0):
# initialize the video camera stream
self.stream = cv2.VideoCapture(src)
# initialize the variable used to indicate if the thread should
# be stopped
self.stopped = False
self.frame = None

def start(self):
global qt
self.stopped = False
qt = Queue(10)
return self

def update(self):
global qt
# keep looping infinitely until the thread is stopped
while True:
if self.stopped:
return
qt.put(self.frame)

global qt
if(not qt.empty()):
self.CurrFrame=qt.get()
if self.CurrFrame is not None:
return self.CurrFrame
if self.stopped:
return

def stop(self):
print('Stop')
# indicate that the thread should be stopped
self.stopped = True
return self

vs = WebcamVideoStream(src=-1).start()
time.sleep(1)

i = 0
t0 = time.time()
while i < 100:
while frame is None:
i = i + 1

rate = 100/(time.time()-t0)
print(rate)

cv2.destroyAllWindows()
vs.stop()