Skip to content

Commit 4d388fc

Browse files
committed
qtvcp -camview widget: add a debug for camera resolution report
1 parent 308d9d1 commit 4d388fc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/python/qtvcp/widgets/camview_widget.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
STATUS = Status()
3535
INFO = Info()
3636
LOG = logger.getLogger(__name__)
37+
#LOG.setLevel(logger.DEBUG) # One of DEBUG, INFO, WARNING, ERROR, CRITICAL
3738

3839
# Suppress cryptic messages when checking for useable ports
3940
os.environ["OPENCV_LOG_LEVEL"]="FATAL"
@@ -326,6 +327,7 @@ def showEvent(self, event):
326327
try:
327328
self.video = WebcamVideoStream(src=self._camNum)
328329
if not self.video.isOpened():
330+
329331
p = self.video.list_ports()[1]
330332
self.text = 'Error with video {}\nAvailable ports:\n{}'.format(self._camNum, p)
331333
else:
@@ -450,7 +452,6 @@ def reset_camnum(self):
450452

451453
class WebcamVideoStream:
452454
def __init__(self, src=0, api=DEFAULT_API):
453-
454455
# initialize the video camera stream and read the first frame
455456
# from the stream
456457
self.stream = self.openStream(src, api)
@@ -464,6 +465,10 @@ def __init__(self, src=0, api=DEFAULT_API):
464465
if plist != []:
465466
self.stream = self.openStream(plist[0], api)
466467

468+
width = int(self.stream.get(CV.CAP_PROP_FRAME_WIDTH))
469+
height = int(self.stream.get(CV.CAP_PROP_FRAME_HEIGHT))
470+
LOG.debug(f"Current camera resolution: {width}x{height}")
471+
467472
# initialize the variable used to indicate if the thread should
468473
# be stopped
469474
self.stopped = False

0 commit comments

Comments
 (0)