Skip to content

Commit 3752d1d

Browse files
authored
Merge pull request neozhaoliang#66 from SLBiuBiu/master
Reduce camera bandwidth
2 parents 64f87d0 + 7285946 commit 3752d1d

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

surround_view/capture_thread.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def connect_camera(self):
8888
width, height = self.resolution
8989
self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
9090
self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
91+
self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*"MJPG"))
9192
# some camera may become closed if the resolution is not supported
9293
if not self.cap.isOpened():
9394
qDebug("Resolution not supported by camera device: {}".format(self.resolution))
@@ -96,6 +97,7 @@ def connect_camera(self):
9697
else:
9798
width = int(self.cap.get(cv2.CAP_PROP_FRAME_WIDTH))
9899
height = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
100+
self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*"MJPG"))
99101
self.resolution = (width, height)
100102

101103
return True

test_cameras.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def init_caps(cam_list, resolution=(1280,720)):
5555
cap = cv2.VideoCapture(iCam)
5656
cap.set(3, resolution[0])
5757
cap.set(4, resolution[1])
58+
cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*"MJPG"))
5859
caps.append(cap)
5960

6061
return caps

0 commit comments

Comments
 (0)