Skip to content

Commit af42579

Browse files
author
Maksim Iushchenko
committed
Control FPS manually instead of using CV2
1 parent e3b8843 commit af42579

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

capturing.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import cv2
88
import threading
99
import queue
10+
import time
1011

1112
logger = logging.getLogger('detect.capture')
1213

@@ -26,6 +27,10 @@ def run(self):
2627
logger.info("Camera thread has started...")
2728

2829
while not self.stop_event.is_set():
30+
31+
# Control FPS manually, because sometimes the FPS assignment performed by CV2 does not work
32+
time.sleep(1.0 / self.config['fps'])
33+
2934
read_ok, image = self.camera.read()
3035

3136
if not read_ok:
@@ -54,7 +59,8 @@ def cam_setup(self):
5459
# Initial camera configuration
5560
self.camera.set(3, self.config['resolution'][0])
5661
self.camera.set(4, self.config['resolution'][1])
57-
self.camera.set(5, self.config['fps'])
62+
# The microcontroller controlls cameras does not support FPS assignment
63+
#self.camera.set(5, self.config['fps'])
5864

5965
def quit(self):
6066
self.camera.release()

0 commit comments

Comments
 (0)