Skip to content

Commit 8b0f01f

Browse files
authored
Merge pull request #3749 from jtpedersen/qtdragon_without_opencv
Enable loading of Qt Dragon without opencv installed
2 parents 250549e + cc719b8 commit 8b0f01f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/python/qtvcp/widgets/camview_widget.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, parent=None):
6262
self.grabbed = None
6363
self.frame = None
6464
self._camNum = 0
65-
self.api = CV.CAP_ANY
65+
self.api = DEFAULT_API
6666
self.resolution=None
6767
self.diameter = 20
6868
self.rotation = 0
@@ -430,6 +430,8 @@ def saveImage(self):
430430

431431
# if data is a string or int, search for name/int in library and use it.
432432
def setAPI(self, data):
433+
if not LIB_GOOD:
434+
return
433435
camera_backends = CV.videoio_registry.getCameraBackends()
434436

435437
if isinstance(data,str):
@@ -495,7 +497,7 @@ def reset_camnum(self):
495497
camera_number = QtCore.pyqtProperty(int, get_camnum, set_camnum, reset_camnum)
496498

497499
class WebcamVideoStream:
498-
def __init__(self, src=0, api=CV.CAP_ANY, res=None):
500+
def __init__(self, src=0, api=DEFAULT_API, res=None):
499501
self.possible_resolutions = []
500502
# initialize the video camera stream and read the first frame
501503
# from the stream

0 commit comments

Comments
 (0)