@@ -14,6 +14,7 @@ def __init__(self,
1414 drop_if_full = True ,
1515 api_preference = cv2 .CAP_GSTREAMER ,
1616 resolution = None ,
17+ use_gst = True ,
1718 parent = None ):
1819 """
1920 device_id: device number of the camera.
@@ -26,6 +27,7 @@ def __init__(self,
2627 super (CaptureThread , self ).__init__ (parent )
2728 self .device_id = device_id
2829 self .flip_method = flip_method
30+ self .use_gst = use_gst
2931 self .drop_if_full = drop_if_full
3032 self .api_preference = api_preference
3133 self .resolution = resolution
@@ -71,8 +73,11 @@ def run(self):
7173 qDebug ("Stopping capture thread..." )
7274
7375 def connect_camera (self ):
74- options = gstreamer_pipeline (cam_id = self .device_id , flip_method = self .flip_method )
75- self .cap .open (options , self .api_preference )
76+ if self .use_gst :
77+ options = gstreamer_pipeline (cam_id = self .device_id , flip_method = self .flip_method )
78+ self .cap .open (options , self .api_preference )
79+ else :
80+ self .cap .open (self .device_id )
7681 # return false if failed to open camera
7782 if not self .cap .isOpened ():
7883 qDebug ("Cannot open camera {}" .format (self .device_id ))
0 commit comments