QVideo 4.6.0__tar.gz → 4.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qvideo-4.6.0 → qvideo-4.7.0}/PKG-INFO +1 -1
- {qvideo-4.6.0 → qvideo-4.7.0}/QCamcorder.py +12 -7
- {qvideo-4.6.0 → qvideo-4.7.0}/QVideo.egg-info/PKG-INFO +1 -1
- {qvideo-4.6.0 → qvideo-4.7.0}/QVideo.egg-info/SOURCES.txt +1 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Genicam/_camera.py +25 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/OpenCV/_camera.py +5 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/demos/ROIdemo.py +10 -8
- qvideo-4.7.0/demos/__init__.py +113 -0
- qvideo-4.7.0/demos/circulardemo.py +41 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/demos/combineddemo.py +16 -32
- qvideo-4.7.0/demos/compositedemo.py +69 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/demos/demo.py +16 -9
- {qvideo-4.6.0 → qvideo-4.7.0}/demos/filterdemo.py +24 -14
- {qvideo-4.6.0 → qvideo-4.7.0}/demos/filterrackdemo.py +33 -37
- qvideo-4.7.0/demos/histogramdemo.py +39 -0
- qvideo-4.7.0/demos/trackpydemo.py +45 -0
- qvideo-4.7.0/demos/uniformitydemo.py +39 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/demos/yolodemo.py +22 -9
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QCamera.py +16 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QVideoReader.py +5 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QVideoScreen.py +18 -5
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QVideoSource.py +7 -2
- {qvideo-4.6.0 → qvideo-4.7.0}/pyproject.toml +1 -1
- qvideo-4.7.0/tests/test_demo_recipes.py +71 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_mainwindow.py +52 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qcamera.py +24 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qgenicamcamera.py +47 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qvideoreader.py +4 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qvideoscreen.py +4 -3
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qvideosource.py +4 -2
- qvideo-4.6.0/demos/__init__.py +0 -123
- qvideo-4.6.0/demos/circulardemo.py +0 -42
- qvideo-4.6.0/demos/compositedemo.py +0 -69
- qvideo-4.6.0/demos/histogramdemo.py +0 -41
- qvideo-4.6.0/demos/trackpydemo.py +0 -43
- qvideo-4.6.0/demos/uniformitydemo.py +0 -43
- {qvideo-4.6.0 → qvideo-4.7.0}/LICENSE.md +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/QVideo.egg-info/dependency_links.txt +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/QVideo.egg-info/requires.txt +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/QVideo.egg-info/top_level.txt +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/README.md +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/__main__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Basler/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Basler/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Basler/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Flir/QListFlirCameras.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Flir/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Flir/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Flir/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Genicam/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Genicam/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/IDS/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/IDS/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/IDS/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/MV/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/MV/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/MV/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Noise/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Noise/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Noise/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/OpenCV/QListCVCameras.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/OpenCV/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/OpenCV/_devices.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/OpenCV/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Picamera/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Picamera/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Picamera/_imx500.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Picamera/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Vimbax/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Vimbax/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/Vimbax/_tree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/cameras/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/QCircularBuffer.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/QCircularDVRWidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/QDVRWidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/QHDF5Reader.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/QHDF5Writer.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/QOpenCVReader.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/QOpenCVWriter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/dvr/icons_rc.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/_MedianBase.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/artistic.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/blob.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/circletransform.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/darkframe.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/dejitter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/dog.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/edge.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/exposure.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/flatfield.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/foreground.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/gamma.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/invert.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/laplacian.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/median.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/momean.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/momedian.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/normalize.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/rgb.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/roi.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/samplehold.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/smoothing.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/sobel.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/threshold.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/filters/unsharp.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QCameraTree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QFilterPipeline.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QFilterRack.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QFilterRackWidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QFrameRelay.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QHistogramWidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QListCameras.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QSnapshot.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QUniformityWidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QVideoFilter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/QVideoWriter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/_jupyter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/_launch.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/_qabc.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/chooser.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/clickable.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/errors.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/gentl.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/imageops.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/lib/videotypes.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/overlays/__init__.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/overlays/trackpy.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/overlays/yolo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/setup.cfg +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_artistic.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_blob.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_camera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_chooser.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_circletransform.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_circularbuffer.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_circulardemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_circulardvrwidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_clickable.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_combineddemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_compositedemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_darkframe.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_dejitter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_demo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_docs_quickstart.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_dog.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_edge.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_exposure.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_filter_export.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_filterdemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_filterrackdemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_filters_gray.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_flatfield.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_foreground.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_gamma.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_gentl.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_histogramdemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_histogramwidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_icons_rc.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_imageops.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_invert.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_jupyter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_laplacian.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_launch.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_median.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_momean.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_momedian.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_normalize.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_overlays_package.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qabc.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qbaslercamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qcamcorder.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qcameratree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qdvrwidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qfilterpipeline.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qfilterrack.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qfilterrackwidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qflircamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qframerelay.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qgenicamtree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qhdf5reader.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qhdf5writer.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qidscamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qimxcamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qlistcameras.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qlistcvcameras.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qlistflircameras.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qmvcamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qnoisecamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qnoisetree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qopencvcamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qopencvdevices.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qopencvreader.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qopencvtree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qopencvwriter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qpicamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qpicameratree.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qsnapshot.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qt_binding.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qvideowriter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_qvimbaxcamera.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_resolutions.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_rgb.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_roi.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_roidemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_samplehold.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_smoothing.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_sobel.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_threshold.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_trackpy_overlay.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_trackpydemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_uniformitydemo.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_uniformitywidget.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_unsharp.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_vendor_trees.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_videofilter.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_videotypes.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_yolo_overlay.py +0 -0
- {qvideo-4.6.0 → qvideo-4.7.0}/tests/test_yolodemo.py +0 -0
|
@@ -49,6 +49,11 @@ class QCamcorder(QtWidgets.QWidget):
|
|
|
49
49
|
starts playback the screen is switched to the playback stream and the
|
|
50
50
|
camera controls are disabled until playback ends.
|
|
51
51
|
|
|
52
|
+
A subclass adds an idea by overriding :meth:`_setupUi`: it calls
|
|
53
|
+
``super()._setupUi()`` first, then builds its widgets, connects them
|
|
54
|
+
and adds them to the panel of controls, ``self._controls``. See
|
|
55
|
+
:mod:`QVideo.demos` for examples.
|
|
56
|
+
|
|
52
57
|
The widget emits :attr:`message` to warn when a recording starts to fall
|
|
53
58
|
behind the camera and to say why when the DVR stops one. The host
|
|
54
59
|
decides where to show it, for instance in the status bar of its main
|
|
@@ -88,19 +93,19 @@ class QCamcorder(QtWidgets.QWidget):
|
|
|
88
93
|
self._setupUi()
|
|
89
94
|
self._snapshot = QSnapshot(self)
|
|
90
95
|
self._connectSignals()
|
|
91
|
-
self.screen.source = self.source
|
|
92
|
-
self.dvr.source = self.source
|
|
93
96
|
|
|
94
97
|
def _setupUi(self) -> None:
|
|
95
98
|
self.screen = QVideoScreen(self)
|
|
96
99
|
self.dvr = QDVRWidget(self)
|
|
100
|
+
self.screen.source = self.source
|
|
101
|
+
self.dvr.source = self.source
|
|
97
102
|
|
|
98
103
|
self.controls = QtWidgets.QWidget(self)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
self._controls = QtWidgets.QVBoxLayout(self.controls)
|
|
105
|
+
self._controls.setContentsMargins(*_MARGINS)
|
|
106
|
+
self._controls.setSpacing(_SPACING)
|
|
107
|
+
self._controls.addWidget(self.dvr)
|
|
108
|
+
self._controls.addWidget(self.cameraWidget)
|
|
104
109
|
|
|
105
110
|
layout = QtWidgets.QHBoxLayout(self)
|
|
106
111
|
layout.setContentsMargins(*_MARGINS)
|
|
@@ -72,6 +72,12 @@ class QGenicamCamera(QCamera):
|
|
|
72
72
|
_producerHint: str = ''
|
|
73
73
|
_ALIASES = frozenset(('width', 'height', 'fps'))
|
|
74
74
|
|
|
75
|
+
#: Nodes that report the frame rate that the camera delivers, in order
|
|
76
|
+
#: of preference: the standard name, then names of older firmware.
|
|
77
|
+
_ACTUAL_FPS_NODES = ('AcquisitionResultingFrameRate',
|
|
78
|
+
'ResultingFrameRateAbs',
|
|
79
|
+
'ResultingFrameRate')
|
|
80
|
+
|
|
75
81
|
def __init__(self, *args, cameraID: int = 0, **kwargs) -> None:
|
|
76
82
|
super().__init__(*args, **kwargs)
|
|
77
83
|
self._cameraID = cameraID
|
|
@@ -223,6 +229,25 @@ class QGenicamCamera(QCamera):
|
|
|
223
229
|
logger.warning(f'camera read failed: {e}')
|
|
224
230
|
return frame is not None, frame
|
|
225
231
|
|
|
232
|
+
@property
|
|
233
|
+
def actualFps(self) -> float:
|
|
234
|
+
'''Frame rate that the camera reports it delivers.
|
|
235
|
+
|
|
236
|
+
The first of :attr:`_ACTUAL_FPS_NODES` that the camera has and
|
|
237
|
+
that reads as a positive number; otherwise ``fps``, the rate that
|
|
238
|
+
was asked for.
|
|
239
|
+
'''
|
|
240
|
+
for name in self._ACTUAL_FPS_NODES:
|
|
241
|
+
if name in self._properties:
|
|
242
|
+
try:
|
|
243
|
+
value = float(self._properties[name]['getter']())
|
|
244
|
+
except Exception as ex:
|
|
245
|
+
logger.debug(f'cannot read {name}: {ex}')
|
|
246
|
+
continue
|
|
247
|
+
if value > 0.:
|
|
248
|
+
return value
|
|
249
|
+
return self.fps
|
|
250
|
+
|
|
226
251
|
@property
|
|
227
252
|
def settings(self) -> QCamera.Settings:
|
|
228
253
|
'''All registered property values, excluding standard-name aliases.
|
|
@@ -55,6 +55,11 @@ class QOpenCVCamera(QCamera):
|
|
|
55
55
|
- **Explicit** (*width* and *height* both given): applies the
|
|
56
56
|
requested dimensions and *fps* directly.
|
|
57
57
|
|
|
58
|
+
OpenCV reports one frame rate, ``fps``, and the camera has no other, so
|
|
59
|
+
:attr:`~QVideo.lib.QCamera.QCamera.actualFps` is the rate that the
|
|
60
|
+
driver reports. QVideo does not second-guess it: a camera that reports
|
|
61
|
+
a rate it does not deliver is not suitable for serious work.
|
|
62
|
+
|
|
58
63
|
``width`` and ``height`` are registered as writable properties.
|
|
59
64
|
Changes are applied to the open device via OpenCV's V4L2 backend, which
|
|
60
65
|
handles the required ``VIDIOC_STREAMOFF`` / ``VIDIOC_S_FMT`` /
|
|
@@ -67,12 +67,17 @@ class ROIFilter(pg.RectROI):
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
class ROIDemo(QCamcorder):
|
|
70
|
-
'''
|
|
70
|
+
'''A camcorder that records only the region inside a draggable ROI.
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
Data flow::
|
|
73
|
+
|
|
74
|
+
camera -> screen (+ ROI rectangle)
|
|
75
|
+
'----> ROI crop -> recorder, while recording
|
|
76
|
+
|
|
77
|
+
Extends :class:`~QVideo.QCamcorder.QCamcorder` with a resizable
|
|
78
|
+
:class:`ROIFilter` drawn on the video screen. While recording, the
|
|
79
|
+
ROI is locked and camera frames are cropped to it before the DVR saves
|
|
80
|
+
them.
|
|
76
81
|
|
|
77
82
|
Parameters
|
|
78
83
|
----------
|
|
@@ -125,9 +130,6 @@ class ROIDemo(QCamcorder):
|
|
|
125
130
|
removable=False)
|
|
126
131
|
self.screen.view.addItem(self.roi)
|
|
127
132
|
self.dvr.filename = str(Path.home() / 'roidemo.avi')
|
|
128
|
-
|
|
129
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
130
|
-
super().__init__(*args, **kwargs)
|
|
131
133
|
self.dvr.source = self.roi
|
|
132
134
|
|
|
133
135
|
def _connectSignals(self) -> None:
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'''Runnable demo applications built on the QVideo framework.
|
|
2
|
+
|
|
3
|
+
Each demo composes a :class:`~QVideo.lib.QCameraTree.QCameraTree` with one
|
|
4
|
+
or more QVideo widgets into a standalone window. All demos use
|
|
5
|
+
:func:`~QVideo.lib.chooser.choose_camera` to present a camera-selection
|
|
6
|
+
dialog at startup, so no camera-specific code is needed in the demo itself.
|
|
7
|
+
|
|
8
|
+
Recipes
|
|
9
|
+
-------
|
|
10
|
+
Each demo adds one idea to the demo before it. A demo overrides
|
|
11
|
+
``_setupUi()``, calls ``super()._setupUi()`` first, and then builds its
|
|
12
|
+
widget, connects it and adds it to the panel of controls,
|
|
13
|
+
``self._controls``. Its class docstring starts with a summary and a
|
|
14
|
+
``Data flow`` sketch of where the frames go. Read them in this order:
|
|
15
|
+
|
|
16
|
+
demo
|
|
17
|
+
Live video beside the controls of the camera that makes it. The
|
|
18
|
+
starting point for building a custom camera application.
|
|
19
|
+
|
|
20
|
+
histogramdemo
|
|
21
|
+
A live intensity histogram, whose draggable level handles set the
|
|
22
|
+
display range of the screen.
|
|
23
|
+
|
|
24
|
+
uniformitydemo
|
|
25
|
+
Mean intensity as a function of x and y, to find non-uniform
|
|
26
|
+
illumination.
|
|
27
|
+
|
|
28
|
+
circulardemo
|
|
29
|
+
A circular-buffer recorder that always holds the last few seconds and
|
|
30
|
+
writes them to disk on request. It listens to the camera, not to the
|
|
31
|
+
screen.
|
|
32
|
+
|
|
33
|
+
filterdemo
|
|
34
|
+
A fixed :class:`~QVideo.lib.QFilterRack.QFilterRack` of filters that
|
|
35
|
+
runs on a worker thread, so that a slow filter leaves the interface
|
|
36
|
+
responsive.
|
|
37
|
+
|
|
38
|
+
trackpydemo
|
|
39
|
+
Particle positions found by trackpy, drawn over the live video.
|
|
40
|
+
|
|
41
|
+
yolodemo
|
|
42
|
+
The same recipe with YOLO object detection.
|
|
43
|
+
|
|
44
|
+
filterrackdemo
|
|
45
|
+
A :class:`~QVideo.QCamcorder.QCamcorder` whose frames pass through an
|
|
46
|
+
editable rack, with three recording modes: raw, filtered and displayed.
|
|
47
|
+
|
|
48
|
+
compositedemo
|
|
49
|
+
A :class:`~QVideo.QCamcorder.QCamcorder` with a trackpy overlay and a
|
|
50
|
+
checkbox that records the rendered scene, markers included.
|
|
51
|
+
|
|
52
|
+
combineddemo
|
|
53
|
+
Filters, an overlay and composite recording together, as application
|
|
54
|
+
code: a recipe for combining the ideas above.
|
|
55
|
+
|
|
56
|
+
ROIdemo
|
|
57
|
+
A :class:`~QVideo.QCamcorder.QCamcorder` with a draggable region of
|
|
58
|
+
interest; only the pixels inside it are recorded.
|
|
59
|
+
|
|
60
|
+
Running
|
|
61
|
+
-------
|
|
62
|
+
Each demo can be launched directly::
|
|
63
|
+
|
|
64
|
+
python -m QVideo.demos.demo
|
|
65
|
+
python -m QVideo.demos.filterdemo
|
|
66
|
+
python -m QVideo.demos.filterrackdemo
|
|
67
|
+
python -m QVideo.demos.histogramdemo
|
|
68
|
+
python -m QVideo.demos.uniformitydemo
|
|
69
|
+
python -m QVideo.demos.circulardemo
|
|
70
|
+
python -m QVideo.demos.ROIdemo
|
|
71
|
+
python -m QVideo.demos.trackpydemo
|
|
72
|
+
python -m QVideo.demos.yolodemo
|
|
73
|
+
python -m QVideo.demos.compositedemo
|
|
74
|
+
python -m QVideo.demos.combineddemo
|
|
75
|
+
|
|
76
|
+
Camera selection
|
|
77
|
+
----------------
|
|
78
|
+
All demos accept the same command-line flags to select a camera backend.
|
|
79
|
+
If no flag is given, a noise camera is used as a fallback.
|
|
80
|
+
|
|
81
|
+
.. code-block:: text
|
|
82
|
+
|
|
83
|
+
-b [cameraID] Basler camera (requires pylon SDK)
|
|
84
|
+
-c [cameraID] OpenCV camera
|
|
85
|
+
-f [cameraID] FLIR camera (requires Spinnaker SDK)
|
|
86
|
+
-i [cameraID] IDS Imaging camera (requires IDS peak SDK)
|
|
87
|
+
-m [cameraID] MATRIX VISION mvGenTLProducer (universal GenICam, not FLIR)
|
|
88
|
+
-p [cameraID] Raspberry Pi camera module (requires picamera2)
|
|
89
|
+
-v [cameraID] Allied Vision VimbaX camera
|
|
90
|
+
-h Show help and exit
|
|
91
|
+
|
|
92
|
+
``cameraID`` is an optional integer index (default ``0``) used when
|
|
93
|
+
multiple cameras of the same type are connected. The flags are mutually
|
|
94
|
+
exclusive — only one backend can be selected at a time.
|
|
95
|
+
|
|
96
|
+
Example::
|
|
97
|
+
|
|
98
|
+
python -m QVideo.demos.demo -f # first FLIR camera
|
|
99
|
+
python -m QVideo.demos.filterdemo -c 1 # second OpenCV camera
|
|
100
|
+
'''
|
|
101
|
+
|
|
102
|
+
from .demo import Demo
|
|
103
|
+
from .filterdemo import FilterDemo
|
|
104
|
+
from .filterrackdemo import FilterRackDemo
|
|
105
|
+
from .histogramdemo import HistogramDemo
|
|
106
|
+
from .uniformitydemo import UniformityDemo
|
|
107
|
+
from .circulardemo import CircularDemo
|
|
108
|
+
from .ROIdemo import ROIFilter, ROIDemo
|
|
109
|
+
from .trackpydemo import TrackpyDemo
|
|
110
|
+
from .yolodemo import YoloDemo
|
|
111
|
+
from .compositedemo import CompositeDemo
|
|
112
|
+
from .combineddemo import CombinedDemo
|
|
113
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
'''Demo: a circular-buffer DVR beside the video.
|
|
3
|
+
|
|
4
|
+
Run directly::
|
|
5
|
+
|
|
6
|
+
python -m QVideo.demos.circulardemo
|
|
7
|
+
'''
|
|
8
|
+
|
|
9
|
+
from QVideo.demos.demo import Demo
|
|
10
|
+
from QVideo.lib import launch
|
|
11
|
+
from QVideo.dvr import QCircularDVRWidget
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
__all__ = ['CircularDemo']
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CircularDemo(Demo):
|
|
18
|
+
|
|
19
|
+
'''A recorder that always holds the last few seconds of video.
|
|
20
|
+
|
|
21
|
+
Data flow::
|
|
22
|
+
|
|
23
|
+
camera -> screen
|
|
24
|
+
'----> circular buffer -> file, when you click Save
|
|
25
|
+
|
|
26
|
+
The recipe is one widget that listens to the camera, not to the screen,
|
|
27
|
+
so it keeps every frame at the camera's full rate:
|
|
28
|
+
:class:`~QVideo.dvr.QCircularDVRWidget.QCircularDVRWidget`. The buffer
|
|
29
|
+
fills continuously, and **Save** writes the last N seconds to disk
|
|
30
|
+
without a prior *record*. See :class:`~QVideo.demos.demo.Demo` for the
|
|
31
|
+
parameters.
|
|
32
|
+
'''
|
|
33
|
+
|
|
34
|
+
def _setupUi(self) -> None:
|
|
35
|
+
super()._setupUi()
|
|
36
|
+
self.dvr = QCircularDVRWidget(self.cameraTree.source)
|
|
37
|
+
self._controls.addWidget(self.dvr)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if __name__ == '__main__': # pragma: no cover
|
|
41
|
+
launch(CircularDemo, 'Circular Buffer Demo')
|
|
@@ -7,28 +7,19 @@ Run directly::
|
|
|
7
7
|
python -m QVideo.demos.combineddemo
|
|
8
8
|
|
|
9
9
|
This demo is a recipe for an application that uses several extensions at
|
|
10
|
-
once. It adds one extension at a time to the demo before it
|
|
11
|
-
step is a short method of its own:
|
|
10
|
+
once. It adds one extension at a time to the demo before it:
|
|
12
11
|
|
|
13
12
|
1. :class:`~QVideo.QCamcorder.QCamcorder` supplies the screen, the camera
|
|
14
13
|
controls and the recorder.
|
|
15
14
|
2. :class:`~QVideo.demos.filterrackdemo.FilterRackDemo` adds a filter
|
|
16
15
|
pipeline: ``camera -> pipeline -> screen``.
|
|
17
|
-
3. :meth:`CombinedDemo.
|
|
16
|
+
3. :meth:`CombinedDemo._setupUi` adds the trackpy overlay. It
|
|
18
17
|
detects particles in the frames of the pipeline, so it sees what the
|
|
19
18
|
screen shows.
|
|
20
|
-
4.
|
|
19
|
+
4. The same method adds a recording mode that
|
|
21
20
|
saves the rendered scene: the filtered video with the particle
|
|
22
21
|
markers drawn on it.
|
|
23
22
|
|
|
24
|
-
Data flow::
|
|
25
|
-
|
|
26
|
-
camera -> filter pipeline -> screen (+ trackpy markers)
|
|
27
|
-
| |
|
|
28
|
-
| +--> recorder, in Display or Composite mode
|
|
29
|
-
+--> trackpy detection
|
|
30
|
-
+--> recorder, in Filtered mode
|
|
31
|
-
|
|
32
23
|
Extensions that depend on each other, as the overlay depends on the
|
|
33
24
|
pipeline here, are combined by application code like this and not by the
|
|
34
25
|
framework, because only the application knows which stream each one needs.
|
|
@@ -36,7 +27,7 @@ framework, because only the application knows which stream each one needs.
|
|
|
36
27
|
|
|
37
28
|
from qtpy import QtWidgets
|
|
38
29
|
from QVideo.demos.filterrackdemo import FilterRackDemo
|
|
39
|
-
from QVideo.lib import
|
|
30
|
+
from QVideo.lib import launch
|
|
40
31
|
from QVideo.overlays import QTrackpyWidget
|
|
41
32
|
|
|
42
33
|
|
|
@@ -47,36 +38,29 @@ class CombinedDemo(FilterRackDemo):
|
|
|
47
38
|
'''Camcorder with a filter rack, a trackpy overlay and four recording
|
|
48
39
|
modes.
|
|
49
40
|
|
|
41
|
+
Data flow::
|
|
42
|
+
|
|
43
|
+
camera -> filter pipeline -> screen (+ trackpy markers)
|
|
44
|
+
| |
|
|
45
|
+
| +--> recorder, in Display or Composite
|
|
46
|
+
+--> trackpy detection
|
|
47
|
+
+--> recorder, in Filtered mode
|
|
48
|
+
|
|
50
49
|
Extends :class:`~QVideo.demos.filterrackdemo.FilterRackDemo` with a
|
|
51
50
|
:class:`~QVideo.overlays.trackpy.QTrackpyWidget` that locates
|
|
52
51
|
particles in the filtered video, and a **Composite** recording mode
|
|
53
52
|
in which the recorder saves the rendered scene (filtered video plus
|
|
54
53
|
particle markers).
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
----------
|
|
58
|
-
cameraWidget : QCameraTree
|
|
59
|
-
Camera control tree providing the video source.
|
|
60
|
-
**kwargs :
|
|
61
|
-
Additional keyword arguments forwarded to
|
|
62
|
-
:class:`~QVideo.demos.filterrackdemo.FilterRackDemo`.
|
|
55
|
+
See :class:`~QVideo.QCamcorder.QCamcorder` for the parameters.
|
|
63
56
|
'''
|
|
64
57
|
|
|
65
|
-
def
|
|
66
|
-
super().
|
|
67
|
-
self._setupOverlay()
|
|
68
|
-
self._setupCompositeMode()
|
|
69
|
-
|
|
70
|
-
def _setupOverlay(self) -> None:
|
|
71
|
-
'''Detect particles in the filtered stream and mark them on the
|
|
72
|
-
screen.'''
|
|
58
|
+
def _setupUi(self) -> None:
|
|
59
|
+
super()._setupUi()
|
|
73
60
|
self.trackpy = QTrackpyWidget(self)
|
|
74
61
|
self.trackpy.source = self.rack.pipeline
|
|
75
62
|
self.screen.addOverlay(self.trackpy.overlay)
|
|
76
|
-
self.
|
|
77
|
-
|
|
78
|
-
def _setupCompositeMode(self) -> None:
|
|
79
|
-
'''Add the recording mode that saves the rendered scene.'''
|
|
63
|
+
self._controls.addWidget(self.trackpy)
|
|
80
64
|
self._modeComposite = QtWidgets.QRadioButton('Composite')
|
|
81
65
|
self._modeBox.layout().addWidget(self._modeComposite)
|
|
82
66
|
self._modeGroup.addButton(self._modeComposite)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
'''Camcorder demo with a trackpy overlay and composite recording.
|
|
3
|
+
|
|
4
|
+
Run directly::
|
|
5
|
+
|
|
6
|
+
python -m QVideo.demos.compositedemo
|
|
7
|
+
|
|
8
|
+
When the "Composite" checkbox is checked, the DVR records the rendered
|
|
9
|
+
scene (the video frame plus the trackpy particle markers) instead of the
|
|
10
|
+
raw camera frames.
|
|
11
|
+
'''
|
|
12
|
+
|
|
13
|
+
from qtpy import QtCore, QtWidgets
|
|
14
|
+
from QVideo.QCamcorder import QCamcorder
|
|
15
|
+
from QVideo.lib import launch
|
|
16
|
+
from QVideo.overlays import QTrackpyWidget
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
__all__ = ['CompositeDemo']
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CompositeDemo(QCamcorder):
|
|
23
|
+
|
|
24
|
+
'''A camcorder that can record what the screen shows, markers included.
|
|
25
|
+
|
|
26
|
+
Data flow::
|
|
27
|
+
|
|
28
|
+
camera -> screen (+ trackpy markers)
|
|
29
|
+
| '--> recorder, when Composite is checked
|
|
30
|
+
'----> trackpy detection
|
|
31
|
+
'----> recorder, when it is not
|
|
32
|
+
|
|
33
|
+
Two extensions of :class:`~QVideo.QCamcorder.QCamcorder`, both in
|
|
34
|
+
:meth:`_setupUi`: a trackpy overlay that detects particles and marks
|
|
35
|
+
them on the screen, and a checkbox that switches the recorder from the
|
|
36
|
+
camera to the screen, whose ``composite`` flag makes it render the
|
|
37
|
+
markers into the frames it emits. See
|
|
38
|
+
:class:`~QVideo.QCamcorder.QCamcorder` for the parameters.
|
|
39
|
+
'''
|
|
40
|
+
|
|
41
|
+
def _setupUi(self) -> None:
|
|
42
|
+
super()._setupUi()
|
|
43
|
+
self.trackpy = QTrackpyWidget(self)
|
|
44
|
+
self.trackpy.source = self.source
|
|
45
|
+
self.screen.addOverlay(self.trackpy.overlay)
|
|
46
|
+
self._compositeCheck = QtWidgets.QCheckBox('Composite')
|
|
47
|
+
self._controls.addWidget(self.trackpy)
|
|
48
|
+
self._controls.addWidget(self._compositeCheck)
|
|
49
|
+
|
|
50
|
+
def _connectSignals(self) -> None:
|
|
51
|
+
super()._connectSignals()
|
|
52
|
+
self._compositeCheck.toggled.connect(self._onCompositeToggled)
|
|
53
|
+
|
|
54
|
+
@QtCore.Slot(bool)
|
|
55
|
+
def _onCompositeToggled(self, checked: bool) -> None:
|
|
56
|
+
'''Switch between raw and composite recording.
|
|
57
|
+
|
|
58
|
+
Parameters
|
|
59
|
+
----------
|
|
60
|
+
checked : bool
|
|
61
|
+
``True`` to record the rendered scene (video + overlay);
|
|
62
|
+
``False`` to record raw camera frames.
|
|
63
|
+
'''
|
|
64
|
+
self.screen.composite = checked
|
|
65
|
+
self.dvr.source = self.screen if checked else self.source
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == '__main__': # pragma: no cover
|
|
69
|
+
launch(CompositeDemo, 'Composite Demo')
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
'''Minimal demo: live video screen alongside a camera control tree.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
This is the starting point for every recipe in this package.
|
|
5
|
+
Run it directly::
|
|
5
6
|
|
|
6
7
|
python -m QVideo.demos.demo
|
|
7
8
|
'''
|
|
@@ -14,8 +15,19 @@ __all__ = ['Demo']
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class Demo(QtWidgets.QWidget):
|
|
17
|
-
'''
|
|
18
|
-
|
|
18
|
+
'''Live video beside the controls of the camera that makes it.
|
|
19
|
+
|
|
20
|
+
Data flow::
|
|
21
|
+
|
|
22
|
+
camera -> screen
|
|
23
|
+
|
|
24
|
+
A recipe extends this class by one idea. It overrides :meth:`_setupUi`
|
|
25
|
+
and calls ``super()._setupUi()`` first, which makes the screen and the
|
|
26
|
+
panel of controls. It then builds its widget, connects it to the
|
|
27
|
+
camera's source (``self.cameraTree.source``) or to :attr:`screen`, and
|
|
28
|
+
adds it to the panel, ``self._controls``. See
|
|
29
|
+
:class:`~QVideo.demos.histogramdemo.HistogramDemo` for the smallest
|
|
30
|
+
example.
|
|
19
31
|
|
|
20
32
|
Parameters
|
|
21
33
|
----------
|
|
@@ -23,19 +35,14 @@ class Demo(QtWidgets.QWidget):
|
|
|
23
35
|
The camera control tree widget to display alongside the video feed.
|
|
24
36
|
**kwargs :
|
|
25
37
|
Additional keyword arguments forwarded to :class:`QWidget`.
|
|
26
|
-
|
|
27
|
-
Notes
|
|
28
|
-
-----
|
|
29
|
-
Sets up a horizontal layout containing a video screen on the left
|
|
30
|
-
and a camera control tree on the right.
|
|
31
38
|
'''
|
|
32
39
|
|
|
33
40
|
def __init__(self, cameraTree: QCameraTree, **kwargs) -> None:
|
|
34
41
|
super().__init__(**kwargs)
|
|
35
42
|
self.screen = QVideoScreen()
|
|
36
43
|
self.cameraTree = cameraTree
|
|
37
|
-
self._setupUi()
|
|
38
44
|
self.screen.source = self.cameraTree.source
|
|
45
|
+
self._setupUi()
|
|
39
46
|
|
|
40
47
|
def _setupUi(self) -> None:
|
|
41
48
|
layout = QtWidgets.QHBoxLayout(self)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
'''Demo
|
|
2
|
+
'''Demo: image filters between the camera and the screen.
|
|
3
3
|
|
|
4
4
|
Run directly::
|
|
5
5
|
|
|
@@ -14,15 +14,20 @@ __all__ = ['FilterDemo']
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class FilterDemo(Demo):
|
|
17
|
-
'''Extends :class:`~QVideo.demos.demo.Demo` with image filters.
|
|
18
17
|
|
|
19
|
-
The
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
'''The camera's frames, filtered before they are displayed.
|
|
19
|
+
|
|
20
|
+
Data flow::
|
|
21
|
+
|
|
22
|
+
camera -> filter pipeline -> screen
|
|
23
|
+
|
|
24
|
+
The recipe is a :class:`~QVideo.lib.QFilterRack.QFilterRack`, a panel of
|
|
25
|
+
filters that owns the worker thread running them. The screen displays
|
|
26
|
+
the rack's ``pipeline`` instead of the camera, so a slow filter leaves
|
|
27
|
+
the interface responsive. Each filter can be switched on and off and
|
|
28
|
+
adjusted alongside the live feed. See
|
|
29
|
+
:mod:`~QVideo.demos.filterrackdemo` for a rack that can be edited while
|
|
30
|
+
the program runs.
|
|
26
31
|
|
|
27
32
|
Parameters
|
|
28
33
|
----------
|
|
@@ -33,20 +38,25 @@ class FilterDemo(Demo):
|
|
|
33
38
|
``'Smoothing'`` or ``'Canny'`` (see
|
|
34
39
|
:meth:`~QVideo.lib.QFilterRack.QFilterRack.availableFilters`).
|
|
35
40
|
**kwargs :
|
|
36
|
-
Additional keyword arguments forwarded to
|
|
41
|
+
Additional keyword arguments forwarded to
|
|
42
|
+
:class:`~QVideo.demos.demo.Demo`.
|
|
37
43
|
'''
|
|
38
44
|
|
|
39
45
|
def __init__(self,
|
|
40
46
|
cameraTree: QCameraTree,
|
|
41
47
|
filters: list[str],
|
|
42
48
|
**kwargs) -> None:
|
|
49
|
+
self._filters = filters # _setupUi runs inside super().__init__
|
|
43
50
|
super().__init__(cameraTree, **kwargs)
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
|
|
52
|
+
def _setupUi(self) -> None:
|
|
53
|
+
super()._setupUi()
|
|
54
|
+
self.rack = QFilterRack(self, editable=False,
|
|
55
|
+
source=self.cameraTree.source)
|
|
56
|
+
for name in self._filters:
|
|
57
|
+
self.rack.addByName(name)
|
|
46
58
|
self.screen.source = self.rack.pipeline
|
|
47
59
|
self._controls.addWidget(self.rack)
|
|
48
|
-
for name in filters:
|
|
49
|
-
self.rack.addByName(name)
|
|
50
60
|
|
|
51
61
|
|
|
52
62
|
if __name__ == '__main__': # pragma: no cover
|