QVideo 4.2.0__tar.gz → 4.4.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.2.0 → qvideo-4.4.0}/PKG-INFO +1 -1
- {qvideo-4.2.0 → qvideo-4.4.0}/QCamcorder.py +3 -12
- {qvideo-4.2.0 → qvideo-4.4.0}/QVideo.egg-info/PKG-INFO +1 -1
- {qvideo-4.2.0 → qvideo-4.4.0}/QVideo.egg-info/SOURCES.txt +7 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/ROIdemo.py +2 -16
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/__init__.py +8 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/circulardemo.py +2 -18
- qvideo-4.4.0/demos/combineddemo.py +97 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/compositedemo.py +2 -23
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/demo.py +2 -18
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/filterdemo.py +4 -20
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/filterrackdemo.py +2 -18
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/histogramdemo.py +2 -18
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/trackpydemo.py +2 -23
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/uniformitydemo.py +2 -18
- {qvideo-4.2.0 → qvideo-4.4.0}/demos/yolodemo.py +2 -23
- qvideo-4.4.0/lib/QFrameRelay.py +69 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QVideoScreen.py +4 -2
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/__init__.py +6 -2
- qvideo-4.4.0/lib/_launch.py +50 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/pyproject.toml +1 -1
- qvideo-4.4.0/tests/test_combineddemo.py +94 -0
- qvideo-4.4.0/tests/test_docs_quickstart.py +53 -0
- qvideo-4.4.0/tests/test_launch.py +97 -0
- qvideo-4.4.0/tests/test_qframerelay.py +122 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qvideoscreen.py +40 -8
- {qvideo-4.2.0 → qvideo-4.4.0}/LICENSE.md +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/QVideo.egg-info/dependency_links.txt +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/QVideo.egg-info/requires.txt +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/QVideo.egg-info/top_level.txt +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/README.md +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/__main__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Basler/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Basler/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Basler/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Flir/QListFlirCameras.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Flir/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Flir/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Flir/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Genicam/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Genicam/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Genicam/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/IDS/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/IDS/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/IDS/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/MV/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/MV/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/MV/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Noise/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Noise/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Noise/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/OpenCV/QListCVCameras.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/OpenCV/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/OpenCV/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/OpenCV/_devices.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/OpenCV/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Picamera/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Picamera/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Picamera/_imx500.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Picamera/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Vimbax/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Vimbax/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/Vimbax/_tree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/cameras/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/QCircularBuffer.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/QCircularDVRWidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/QDVRWidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/QHDF5Reader.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/QHDF5Writer.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/QOpenCVReader.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/QOpenCVWriter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/dvr/icons_rc.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/_MedianBase.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/artistic.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/blob.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/circletransform.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/darkframe.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/dejitter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/dog.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/edge.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/exposure.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/flatfield.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/foreground.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/gamma.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/invert.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/laplacian.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/median.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/momean.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/momedian.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/normalize.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/rgb.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/roi.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/samplehold.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/smoothing.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/sobel.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/threshold.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/filters/unsharp.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QCamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QCameraTree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QFPSMeter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QFilterRack.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QFilterStack.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QHistogramWidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QListCameras.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QSnapshot.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QUniformityWidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QVideoFilter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QVideoReader.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QVideoSource.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/QVideoWriter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/_jupyter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/_qabc.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/chooser.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/clickable.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/errors.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/gentl.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/imageops.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/lib/videotypes.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/overlays/__init__.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/overlays/trackpy.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/overlays/yolo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/setup.cfg +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_artistic.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_blob.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_camera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_chooser.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_circletransform.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_circularbuffer.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_circulardemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_circulardvrwidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_clickable.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_compositedemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_darkframe.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_dejitter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_demo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_dog.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_edge.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_exposure.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_filter_export.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_filterdemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_filterrackdemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_filters_gray.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_flatfield.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_foreground.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_gamma.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_gentl.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_histogramdemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_histogramwidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_icons_rc.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_imageops.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_invert.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_jupyter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_laplacian.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_median.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_momean.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_momedian.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_normalize.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_overlays_package.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qabc.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qbaslercamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qcamcorder.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qcamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qcameratree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qdvrwidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qfilterrack.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qfilterstack.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qflircamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qfpsmeter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qgenicamcamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qgenicamtree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qhdf5reader.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qhdf5writer.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qidscamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qimxcamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qlistcameras.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qlistcvcameras.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qlistflircameras.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qmvcamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qnoisecamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qnoisetree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qopencvcamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qopencvdevices.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qopencvreader.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qopencvtree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qopencvwriter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qpicamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qpicameratree.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qsnapshot.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qt_binding.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qvideoreader.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qvideosource.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qvideowriter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_qvimbaxcamera.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_resolutions.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_rgb.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_roi.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_roidemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_samplehold.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_smoothing.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_sobel.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_threshold.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_trackpy_overlay.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_trackpydemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_uniformitydemo.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_uniformitywidget.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_unsharp.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_vendor_trees.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_videofilter.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_videotypes.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_yolo_overlay.py +0 -0
- {qvideo-4.2.0 → qvideo-4.4.0}/tests/test_yolodemo.py +0 -0
|
@@ -24,7 +24,8 @@ If no flag is given, a noise camera is used as a fallback.
|
|
|
24
24
|
'''
|
|
25
25
|
|
|
26
26
|
from qtpy import QtCore, QtWidgets, QtGui
|
|
27
|
-
from QVideo.lib import QCameraTree, QVideoSource, QVideoScreen, QSnapshot
|
|
27
|
+
from QVideo.lib import (QCameraTree, QVideoSource, QVideoScreen, QSnapshot,
|
|
28
|
+
launch)
|
|
28
29
|
from QVideo.dvr import QDVRWidget
|
|
29
30
|
|
|
30
31
|
|
|
@@ -128,17 +129,7 @@ class QCamcorder(QtWidgets.QWidget):
|
|
|
128
129
|
|
|
129
130
|
def main() -> None: # pragma: no cover
|
|
130
131
|
'''Launch the camcorder with an interactively chosen camera.'''
|
|
131
|
-
|
|
132
|
-
from QVideo.lib import choose_camera
|
|
133
|
-
|
|
134
|
-
app = pg.mkQApp('QCamcorder')
|
|
135
|
-
camera = choose_camera()
|
|
136
|
-
widget = QCamcorder(camera.start())
|
|
137
|
-
QtWidgets.QShortcut(
|
|
138
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
139
|
-
).activated.connect(app.quit)
|
|
140
|
-
widget.show()
|
|
141
|
-
pg.exec()
|
|
132
|
+
launch(QCamcorder, 'QCamcorder')
|
|
142
133
|
|
|
143
134
|
|
|
144
135
|
if __name__ == '__main__':
|
|
@@ -47,6 +47,7 @@ cameras/Vimbax/_tree.py
|
|
|
47
47
|
demos/ROIdemo.py
|
|
48
48
|
demos/__init__.py
|
|
49
49
|
demos/circulardemo.py
|
|
50
|
+
demos/combineddemo.py
|
|
50
51
|
demos/compositedemo.py
|
|
51
52
|
demos/demo.py
|
|
52
53
|
demos/filterdemo.py
|
|
@@ -95,6 +96,7 @@ lib/QCameraTree.py
|
|
|
95
96
|
lib/QFPSMeter.py
|
|
96
97
|
lib/QFilterRack.py
|
|
97
98
|
lib/QFilterStack.py
|
|
99
|
+
lib/QFrameRelay.py
|
|
98
100
|
lib/QHistogramWidget.py
|
|
99
101
|
lib/QListCameras.py
|
|
100
102
|
lib/QSnapshot.py
|
|
@@ -107,6 +109,7 @@ lib/QVideoWriter.py
|
|
|
107
109
|
lib/__init__.py
|
|
108
110
|
lib/_camera.py
|
|
109
111
|
lib/_jupyter.py
|
|
112
|
+
lib/_launch.py
|
|
110
113
|
lib/_qabc.py
|
|
111
114
|
lib/chooser.py
|
|
112
115
|
lib/clickable.py
|
|
@@ -126,10 +129,12 @@ tests/test_circularbuffer.py
|
|
|
126
129
|
tests/test_circulardemo.py
|
|
127
130
|
tests/test_circulardvrwidget.py
|
|
128
131
|
tests/test_clickable.py
|
|
132
|
+
tests/test_combineddemo.py
|
|
129
133
|
tests/test_compositedemo.py
|
|
130
134
|
tests/test_darkframe.py
|
|
131
135
|
tests/test_dejitter.py
|
|
132
136
|
tests/test_demo.py
|
|
137
|
+
tests/test_docs_quickstart.py
|
|
133
138
|
tests/test_dog.py
|
|
134
139
|
tests/test_edge.py
|
|
135
140
|
tests/test_exposure.py
|
|
@@ -148,6 +153,7 @@ tests/test_imageops.py
|
|
|
148
153
|
tests/test_invert.py
|
|
149
154
|
tests/test_jupyter.py
|
|
150
155
|
tests/test_laplacian.py
|
|
156
|
+
tests/test_launch.py
|
|
151
157
|
tests/test_median.py
|
|
152
158
|
tests/test_momean.py
|
|
153
159
|
tests/test_momedian.py
|
|
@@ -163,6 +169,7 @@ tests/test_qfilterrack.py
|
|
|
163
169
|
tests/test_qfilterstack.py
|
|
164
170
|
tests/test_qflircamera.py
|
|
165
171
|
tests/test_qfpsmeter.py
|
|
172
|
+
tests/test_qframerelay.py
|
|
166
173
|
tests/test_qgenicamcamera.py
|
|
167
174
|
tests/test_qgenicamtree.py
|
|
168
175
|
tests/test_qhdf5reader.py
|
|
@@ -11,6 +11,7 @@ import pyqtgraph as pg
|
|
|
11
11
|
import numpy as np
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from QVideo.QCamcorder import QCamcorder
|
|
14
|
+
from QVideo.lib import launch
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
__all__ = ['ROIFilter', 'ROIDemo']
|
|
@@ -153,20 +154,5 @@ class ROIDemo(QCamcorder):
|
|
|
153
154
|
self.source.newFrame.disconnect(self.roi.crop)
|
|
154
155
|
|
|
155
156
|
|
|
156
|
-
def main() -> None: # pragma: no cover
|
|
157
|
-
'''Launch the ROI demo with an interactively chosen camera.'''
|
|
158
|
-
from QVideo.lib import choose_camera
|
|
159
|
-
|
|
160
|
-
from qtpy import QtGui, QtWidgets
|
|
161
|
-
app = pg.mkQApp('ROI Demo')
|
|
162
|
-
camera = choose_camera().start()
|
|
163
|
-
widget = ROIDemo(camera)
|
|
164
|
-
QtWidgets.QShortcut(
|
|
165
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
166
|
-
).activated.connect(app.quit)
|
|
167
|
-
widget.show()
|
|
168
|
-
pg.exec()
|
|
169
|
-
|
|
170
|
-
|
|
171
157
|
if __name__ == '__main__': # pragma: no cover
|
|
172
|
-
|
|
158
|
+
launch(ROIDemo, 'ROI Demo')
|
|
@@ -62,6 +62,12 @@ compositedemo
|
|
|
62
62
|
and a "Composite" checkbox. When checked, the DVR records the rendered
|
|
63
63
|
scene (video + overlay markers) instead of raw camera frames.
|
|
64
64
|
|
|
65
|
+
combineddemo
|
|
66
|
+
Extends :mod:`filterrackdemo` with a trackpy overlay that locates
|
|
67
|
+
particles in the filtered video, and a fourth recording mode that saves
|
|
68
|
+
the rendered scene. It is a recipe for an application that combines
|
|
69
|
+
filters, an overlay and composite recording.
|
|
70
|
+
|
|
65
71
|
Running
|
|
66
72
|
-------
|
|
67
73
|
Each demo can be launched directly::
|
|
@@ -76,6 +82,7 @@ Each demo can be launched directly::
|
|
|
76
82
|
python -m QVideo.demos.trackpydemo
|
|
77
83
|
python -m QVideo.demos.yolodemo
|
|
78
84
|
python -m QVideo.demos.compositedemo
|
|
85
|
+
python -m QVideo.demos.combineddemo
|
|
79
86
|
|
|
80
87
|
Camera selection
|
|
81
88
|
----------------
|
|
@@ -113,4 +120,5 @@ from .ROIdemo import ROIFilter, ROIDemo
|
|
|
113
120
|
from .trackpydemo import TrackpyDemo
|
|
114
121
|
from .yolodemo import YoloDemo
|
|
115
122
|
from .compositedemo import CompositeDemo
|
|
123
|
+
from .combineddemo import CombinedDemo
|
|
116
124
|
|
|
@@ -7,7 +7,7 @@ Run directly::
|
|
|
7
7
|
'''
|
|
8
8
|
|
|
9
9
|
from QVideo.demos.demo import Demo
|
|
10
|
-
from QVideo.lib import QCameraTree
|
|
10
|
+
from QVideo.lib import QCameraTree, launch
|
|
11
11
|
from QVideo.dvr import QCircularDVRWidget
|
|
12
12
|
|
|
13
13
|
|
|
@@ -38,21 +38,5 @@ class CircularDemo(Demo):
|
|
|
38
38
|
self._controls.addWidget(self.dvr)
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def main() -> None: # pragma: no cover
|
|
42
|
-
'''Launch the circular buffer demo with an interactively chosen camera.'''
|
|
43
|
-
import pyqtgraph as pg
|
|
44
|
-
from QVideo.lib import choose_camera
|
|
45
|
-
|
|
46
|
-
from qtpy import QtGui, QtWidgets
|
|
47
|
-
app = pg.mkQApp('Circular Buffer Demo')
|
|
48
|
-
camera = choose_camera().start()
|
|
49
|
-
widget = CircularDemo(camera)
|
|
50
|
-
QtWidgets.QShortcut(
|
|
51
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
52
|
-
).activated.connect(app.quit)
|
|
53
|
-
widget.show()
|
|
54
|
-
pg.exec()
|
|
55
|
-
|
|
56
|
-
|
|
57
41
|
if __name__ == '__main__': # pragma: no cover
|
|
58
|
-
|
|
42
|
+
launch(CircularDemo, 'Circular Buffer Demo')
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
'''Camcorder that combines filters, a detection overlay and composite
|
|
3
|
+
recording.
|
|
4
|
+
|
|
5
|
+
Run directly::
|
|
6
|
+
|
|
7
|
+
python -m QVideo.demos.combineddemo
|
|
8
|
+
|
|
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, and each
|
|
11
|
+
step is a short method of its own:
|
|
12
|
+
|
|
13
|
+
1. :class:`~QVideo.QCamcorder.QCamcorder` supplies the screen, the camera
|
|
14
|
+
controls and the recorder.
|
|
15
|
+
2. :class:`~QVideo.demos.filterrackdemo.FilterRackDemo` adds a filter
|
|
16
|
+
stack: ``camera -> stack -> screen``.
|
|
17
|
+
3. :meth:`CombinedDemo._setupOverlay` adds the trackpy overlay. It
|
|
18
|
+
detects particles in the frames of the stack, so it sees what the
|
|
19
|
+
screen shows.
|
|
20
|
+
4. :meth:`CombinedDemo._setupCompositeMode` adds a recording mode that
|
|
21
|
+
saves the rendered scene: the filtered video with the particle
|
|
22
|
+
markers drawn on it.
|
|
23
|
+
|
|
24
|
+
Data flow::
|
|
25
|
+
|
|
26
|
+
camera -> filter stack -> screen (+ trackpy markers)
|
|
27
|
+
| |
|
|
28
|
+
| +--> recorder, in Display or Composite mode
|
|
29
|
+
+--> trackpy detection
|
|
30
|
+
+--> recorder, in Filtered mode
|
|
31
|
+
|
|
32
|
+
Extensions that depend on each other, as the overlay depends on the
|
|
33
|
+
stack here, are combined by application code like this and not by the
|
|
34
|
+
framework, because only the application knows which stream each one needs.
|
|
35
|
+
'''
|
|
36
|
+
|
|
37
|
+
from qtpy import QtWidgets
|
|
38
|
+
from QVideo.demos.filterrackdemo import FilterRackDemo
|
|
39
|
+
from QVideo.lib import QCameraTree, launch
|
|
40
|
+
from QVideo.overlays import QTrackpyWidget
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
__all__ = ['CombinedDemo']
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CombinedDemo(FilterRackDemo):
|
|
47
|
+
'''Camcorder with a filter rack, a trackpy overlay and four recording
|
|
48
|
+
modes.
|
|
49
|
+
|
|
50
|
+
Extends :class:`~QVideo.demos.filterrackdemo.FilterRackDemo` with a
|
|
51
|
+
:class:`~QVideo.overlays.trackpy.QTrackpyWidget` that locates
|
|
52
|
+
particles in the filtered video, and a **Composite** recording mode
|
|
53
|
+
in which the recorder saves the rendered scene (filtered video plus
|
|
54
|
+
particle markers).
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
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`.
|
|
63
|
+
'''
|
|
64
|
+
|
|
65
|
+
def __init__(self, cameraWidget: QCameraTree, **kwargs) -> None:
|
|
66
|
+
super().__init__(cameraWidget, **kwargs)
|
|
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.'''
|
|
73
|
+
self.trackpy = QTrackpyWidget(self)
|
|
74
|
+
self.trackpy.source = self.stack
|
|
75
|
+
self.screen.addOverlay(self.trackpy.overlay)
|
|
76
|
+
self.controls.layout().addWidget(self.trackpy)
|
|
77
|
+
|
|
78
|
+
def _setupCompositeMode(self) -> None:
|
|
79
|
+
'''Add the recording mode that saves the rendered scene.'''
|
|
80
|
+
self._modeComposite = QtWidgets.QRadioButton('Composite')
|
|
81
|
+
self._modeBox.layout().addWidget(self._modeComposite)
|
|
82
|
+
self._modeGroup.addButton(self._modeComposite)
|
|
83
|
+
|
|
84
|
+
def _onModeToggled(self,
|
|
85
|
+
button: QtWidgets.QAbstractButton,
|
|
86
|
+
checked: bool) -> None:
|
|
87
|
+
'''Record the rendered scene in Composite mode, and the usual
|
|
88
|
+
stream in the other modes.'''
|
|
89
|
+
if checked:
|
|
90
|
+
self.screen.composite = button is self._modeComposite
|
|
91
|
+
super()._onModeToggled(button, checked)
|
|
92
|
+
if checked and button is self._modeComposite:
|
|
93
|
+
self.dvr.source = self.screen
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if __name__ == '__main__': # pragma: no cover
|
|
97
|
+
launch(CombinedDemo, 'Combined Demo')
|
|
@@ -12,7 +12,7 @@ camera frames.
|
|
|
12
12
|
|
|
13
13
|
from qtpy import QtCore, QtWidgets
|
|
14
14
|
from QVideo.QCamcorder import QCamcorder
|
|
15
|
-
from QVideo.lib import QCameraTree
|
|
15
|
+
from QVideo.lib import QCameraTree, launch
|
|
16
16
|
from QVideo.overlays import QTrackpyWidget
|
|
17
17
|
|
|
18
18
|
|
|
@@ -65,26 +65,5 @@ class CompositeDemo(QCamcorder):
|
|
|
65
65
|
self.dvr.source = self.screen if checked else self.source
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
def main() -> None: # pragma: no cover
|
|
69
|
-
'''Launch the composite demo with an interactively chosen camera.'''
|
|
70
|
-
import sys
|
|
71
|
-
import pyqtgraph as pg
|
|
72
|
-
from QVideo.lib import choose_camera
|
|
73
|
-
|
|
74
|
-
from qtpy import QtGui
|
|
75
|
-
app = pg.mkQApp()
|
|
76
|
-
camera = choose_camera().start()
|
|
77
|
-
try:
|
|
78
|
-
widget = CompositeDemo(camera)
|
|
79
|
-
except ImportError as e:
|
|
80
|
-
print(f'Error: {e}', file=sys.stderr)
|
|
81
|
-
sys.exit(1)
|
|
82
|
-
QtWidgets.QShortcut(
|
|
83
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
84
|
-
).activated.connect(app.quit)
|
|
85
|
-
widget.show()
|
|
86
|
-
pg.exec()
|
|
87
|
-
|
|
88
|
-
|
|
89
68
|
if __name__ == '__main__': # pragma: no cover
|
|
90
|
-
|
|
69
|
+
launch(CompositeDemo, 'Composite Demo')
|
|
@@ -7,7 +7,7 @@ Run directly::
|
|
|
7
7
|
'''
|
|
8
8
|
|
|
9
9
|
from qtpy import QtWidgets
|
|
10
|
-
from QVideo.lib import QVideoScreen, QCameraTree
|
|
10
|
+
from QVideo.lib import QVideoScreen, QCameraTree, launch
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
__all__ = ['Demo']
|
|
@@ -47,21 +47,5 @@ class Demo(QtWidgets.QWidget):
|
|
|
47
47
|
self._controls.addWidget(self.cameraTree)
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
def main() -> None: # pragma: no cover
|
|
51
|
-
'''Launch the demo with an interactively chosen camera.'''
|
|
52
|
-
import pyqtgraph as pg
|
|
53
|
-
from QVideo.lib import choose_camera
|
|
54
|
-
|
|
55
|
-
from qtpy import QtGui, QtWidgets
|
|
56
|
-
app = pg.mkQApp('QVideo Demo')
|
|
57
|
-
camera = choose_camera().start()
|
|
58
|
-
widget = Demo(camera)
|
|
59
|
-
QtWidgets.QShortcut(
|
|
60
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
61
|
-
).activated.connect(app.quit)
|
|
62
|
-
widget.show()
|
|
63
|
-
pg.exec()
|
|
64
|
-
|
|
65
|
-
|
|
66
50
|
if __name__ == '__main__': # pragma: no cover
|
|
67
|
-
|
|
51
|
+
launch(Demo, 'QVideo Demo')
|
|
@@ -8,7 +8,7 @@ Run directly::
|
|
|
8
8
|
|
|
9
9
|
from qtpy import QtGui
|
|
10
10
|
from QVideo.demos.demo import Demo
|
|
11
|
-
from QVideo.lib import QCameraTree, QFilterRack, QFilterStack
|
|
11
|
+
from QVideo.lib import QCameraTree, QFilterRack, QFilterStack, launch
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
__all__ = ['FilterDemo']
|
|
@@ -55,23 +55,7 @@ class FilterDemo(Demo):
|
|
|
55
55
|
super().closeEvent(event)
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
def main() -> None: # pragma: no cover
|
|
59
|
-
'''Launch the filter demo with an interactively chosen camera.'''
|
|
60
|
-
import pyqtgraph as pg
|
|
61
|
-
from QVideo.lib import choose_camera
|
|
62
|
-
|
|
63
|
-
from qtpy import QtGui, QtWidgets
|
|
64
|
-
app = pg.mkQApp('Filter Demo')
|
|
65
|
-
camera = choose_camera().start()
|
|
66
|
-
filters = ['Color Channel', 'Smoothing', 'Sample and Hold',
|
|
67
|
-
'Threshold', 'Blob', 'Canny']
|
|
68
|
-
widget = FilterDemo(camera, filters)
|
|
69
|
-
QtWidgets.QShortcut(
|
|
70
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
71
|
-
).activated.connect(app.quit)
|
|
72
|
-
widget.show()
|
|
73
|
-
pg.exec()
|
|
74
|
-
|
|
75
|
-
|
|
76
58
|
if __name__ == '__main__': # pragma: no cover
|
|
77
|
-
|
|
59
|
+
launch(FilterDemo, 'Filter Demo',
|
|
60
|
+
filters=['Color Channel', 'Smoothing', 'Sample and Hold',
|
|
61
|
+
'Threshold', 'Blob', 'Canny'])
|
|
@@ -31,7 +31,7 @@ see each frame exactly once.
|
|
|
31
31
|
|
|
32
32
|
from qtpy import QtCore, QtGui, QtWidgets
|
|
33
33
|
from QVideo.QCamcorder import QCamcorder
|
|
34
|
-
from QVideo.lib import QCameraTree, QFilterRack, QFilterStack
|
|
34
|
+
from QVideo.lib import QCameraTree, QFilterRack, QFilterStack, launch
|
|
35
35
|
from QVideo.filters import QSmoothingFilter, QThresholdFilter
|
|
36
36
|
|
|
37
37
|
|
|
@@ -137,21 +137,5 @@ class FilterRackDemo(QCamcorder):
|
|
|
137
137
|
self.dvr.source = self.screen
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
def main() -> None: # pragma: no cover
|
|
141
|
-
'''Launch the filter rack demo with an interactively chosen camera.'''
|
|
142
|
-
import pyqtgraph as pg
|
|
143
|
-
from QVideo.lib import choose_camera
|
|
144
|
-
|
|
145
|
-
from qtpy import QtGui
|
|
146
|
-
app = pg.mkQApp('Filter Rack Demo')
|
|
147
|
-
camera = choose_camera().start()
|
|
148
|
-
widget = FilterRackDemo(camera)
|
|
149
|
-
QtWidgets.QShortcut(
|
|
150
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
151
|
-
).activated.connect(app.quit)
|
|
152
|
-
widget.show()
|
|
153
|
-
pg.exec()
|
|
154
|
-
|
|
155
|
-
|
|
156
140
|
if __name__ == '__main__': # pragma: no cover
|
|
157
|
-
|
|
141
|
+
launch(FilterRackDemo, 'Filter Rack Demo')
|
|
@@ -7,7 +7,7 @@ Run directly::
|
|
|
7
7
|
'''
|
|
8
8
|
|
|
9
9
|
from QVideo.demos.demo import Demo
|
|
10
|
-
from QVideo.lib import QCameraTree, QHistogramWidget
|
|
10
|
+
from QVideo.lib import QCameraTree, QHistogramWidget, launch
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
__all__ = ['HistogramDemo']
|
|
@@ -37,21 +37,5 @@ class HistogramDemo(Demo):
|
|
|
37
37
|
self._controls.addWidget(self.histogram)
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def main() -> None: # pragma: no cover
|
|
41
|
-
'''Launch the histogram demo with an interactively chosen camera.'''
|
|
42
|
-
import pyqtgraph as pg
|
|
43
|
-
from QVideo.lib import choose_camera
|
|
44
|
-
|
|
45
|
-
from qtpy import QtGui, QtWidgets
|
|
46
|
-
app = pg.mkQApp('Histogram Demo')
|
|
47
|
-
camera = choose_camera().start()
|
|
48
|
-
widget = HistogramDemo(camera)
|
|
49
|
-
QtWidgets.QShortcut(
|
|
50
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
51
|
-
).activated.connect(app.quit)
|
|
52
|
-
widget.show()
|
|
53
|
-
pg.exec()
|
|
54
|
-
|
|
55
|
-
|
|
56
40
|
if __name__ == '__main__': # pragma: no cover
|
|
57
|
-
|
|
41
|
+
launch(HistogramDemo, 'Histogram Demo')
|
|
@@ -9,7 +9,7 @@ See :mod:`QVideo.overlays.trackpy` for literature references.
|
|
|
9
9
|
'''
|
|
10
10
|
|
|
11
11
|
from QVideo.demos.demo import Demo
|
|
12
|
-
from QVideo.lib import QCameraTree
|
|
12
|
+
from QVideo.lib import QCameraTree, launch
|
|
13
13
|
from QVideo.overlays import QTrackpyWidget
|
|
14
14
|
|
|
15
15
|
|
|
@@ -39,26 +39,5 @@ class TrackpyDemo(Demo):
|
|
|
39
39
|
self._controls.addWidget(self.trackpy)
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
def main() -> None: # pragma: no cover
|
|
43
|
-
'''Launch the trackpy demo with an interactively chosen camera.'''
|
|
44
|
-
import sys
|
|
45
|
-
import pyqtgraph as pg
|
|
46
|
-
from QVideo.lib import choose_camera
|
|
47
|
-
|
|
48
|
-
from qtpy import QtGui, QtWidgets
|
|
49
|
-
app = pg.mkQApp()
|
|
50
|
-
camera = choose_camera().start()
|
|
51
|
-
try:
|
|
52
|
-
widget = TrackpyDemo(camera)
|
|
53
|
-
except ImportError as e:
|
|
54
|
-
print(f'Error: {e}', file=sys.stderr)
|
|
55
|
-
sys.exit(1)
|
|
56
|
-
QtWidgets.QShortcut(
|
|
57
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
58
|
-
).activated.connect(app.quit)
|
|
59
|
-
widget.show()
|
|
60
|
-
pg.exec()
|
|
61
|
-
|
|
62
|
-
|
|
63
42
|
if __name__ == '__main__': # pragma: no cover
|
|
64
|
-
|
|
43
|
+
launch(TrackpyDemo, 'Trackpy Demo')
|
|
@@ -7,7 +7,7 @@ Run directly::
|
|
|
7
7
|
'''
|
|
8
8
|
|
|
9
9
|
from QVideo.demos.demo import Demo
|
|
10
|
-
from QVideo.lib import QCameraTree, QUniformityWidget
|
|
10
|
+
from QVideo.lib import QCameraTree, QUniformityWidget, launch
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
__all__ = ['UniformityDemo']
|
|
@@ -39,21 +39,5 @@ class UniformityDemo(Demo):
|
|
|
39
39
|
self._controls.addWidget(self.uniformity)
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
def main() -> None: # pragma: no cover
|
|
43
|
-
'''Launch the uniformity demo with an interactively chosen camera.'''
|
|
44
|
-
import pyqtgraph as pg
|
|
45
|
-
from QVideo.lib import choose_camera
|
|
46
|
-
|
|
47
|
-
from qtpy import QtGui, QtWidgets
|
|
48
|
-
app = pg.mkQApp('Uniformity Demo')
|
|
49
|
-
camera = choose_camera().start()
|
|
50
|
-
widget = UniformityDemo(camera)
|
|
51
|
-
QtWidgets.QShortcut(
|
|
52
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
53
|
-
).activated.connect(app.quit)
|
|
54
|
-
widget.show()
|
|
55
|
-
pg.exec()
|
|
56
|
-
|
|
57
|
-
|
|
58
42
|
if __name__ == '__main__': # pragma: no cover
|
|
59
|
-
|
|
43
|
+
launch(UniformityDemo, 'Uniformity Demo')
|
|
@@ -9,7 +9,7 @@ See :mod:`QVideo.overlays.yolo` for literature references.
|
|
|
9
9
|
'''
|
|
10
10
|
|
|
11
11
|
from QVideo.demos.demo import Demo
|
|
12
|
-
from QVideo.lib import QCameraTree
|
|
12
|
+
from QVideo.lib import QCameraTree, launch
|
|
13
13
|
from QVideo.overlays import QYoloWidget
|
|
14
14
|
|
|
15
15
|
|
|
@@ -45,26 +45,5 @@ class YoloDemo(Demo):
|
|
|
45
45
|
self._controls.addWidget(self.yolo)
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
def main() -> None: # pragma: no cover
|
|
49
|
-
'''Launch the YOLO demo with an interactively chosen camera.'''
|
|
50
|
-
import sys
|
|
51
|
-
import pyqtgraph as pg
|
|
52
|
-
from QVideo.lib import choose_camera
|
|
53
|
-
|
|
54
|
-
from qtpy import QtGui, QtWidgets
|
|
55
|
-
app = pg.mkQApp()
|
|
56
|
-
camera = choose_camera().start()
|
|
57
|
-
try:
|
|
58
|
-
widget = YoloDemo(camera)
|
|
59
|
-
except ImportError as e:
|
|
60
|
-
print(f'Error: {e}', file=sys.stderr)
|
|
61
|
-
sys.exit(1)
|
|
62
|
-
QtWidgets.QShortcut(
|
|
63
|
-
QtGui.QKeySequence('Ctrl+Q'), widget
|
|
64
|
-
).activated.connect(app.quit)
|
|
65
|
-
widget.show()
|
|
66
|
-
pg.exec()
|
|
67
|
-
|
|
68
|
-
|
|
69
48
|
if __name__ == '__main__': # pragma: no cover
|
|
70
|
-
|
|
49
|
+
launch(YoloDemo, 'YOLO Demo')
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'''Latest-frame handoff from a capture thread to the thread of a consumer.'''
|
|
2
|
+
import numpy as np
|
|
3
|
+
from qtpy import QtCore
|
|
4
|
+
from QVideo.lib.videotypes import Image, FrameInfo
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
__all__ = ['QFrameRelay']
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class QFrameRelay(QtCore.QObject):
|
|
11
|
+
|
|
12
|
+
'''Pass the newest frame of a source to the thread this object lives in.
|
|
13
|
+
|
|
14
|
+
A queued connection delivers every frame, so while the receiving thread
|
|
15
|
+
is busy (a modal dialog, a window drag, heavy painting) the frames wait
|
|
16
|
+
in its event queue without limit: three seconds of a 200 fps, 2048 x 2048
|
|
17
|
+
camera hold 1.5 GB. The relay keeps one frame instead. A frame that
|
|
18
|
+
arrives before the previous one was taken replaces it, and the receiving
|
|
19
|
+
thread is woken at most once, so its event queue stays short and it
|
|
20
|
+
always gets the latest frame.
|
|
21
|
+
|
|
22
|
+
Use it for consumers that only show or sample the stream. A consumer
|
|
23
|
+
that needs every frame, such as a recorder, connects to the source.
|
|
24
|
+
|
|
25
|
+
The relay is the receiver of ``source.newFrame`` through a direct
|
|
26
|
+
connection, so it runs in the capture thread and never blocks it. It
|
|
27
|
+
lives in the thread that created it; frames with the same
|
|
28
|
+
:class:`~QVideo.lib.videotypes.FrameInfo` the source emitted arrive in
|
|
29
|
+
that thread. A consumer behind a relay sees gaps in ``info.index`` where
|
|
30
|
+
frames were replaced.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
source : QVideoSource
|
|
35
|
+
Provider of ``newFrame(ndarray, FrameInfo)``, or of
|
|
36
|
+
``newFrame(ndarray)``.
|
|
37
|
+
|
|
38
|
+
Signals
|
|
39
|
+
-------
|
|
40
|
+
newFrame(ndarray, FrameInfo)
|
|
41
|
+
The newest frame since the previous emission.
|
|
42
|
+
'''
|
|
43
|
+
|
|
44
|
+
newFrame = QtCore.Signal(np.ndarray, object)
|
|
45
|
+
_wake = QtCore.Signal()
|
|
46
|
+
|
|
47
|
+
def __init__(self, source) -> None:
|
|
48
|
+
super().__init__()
|
|
49
|
+
self._mutex = QtCore.QMutex()
|
|
50
|
+
self._latest: tuple[Image, FrameInfo | None] | None = None
|
|
51
|
+
self._wake.connect(self._deliver)
|
|
52
|
+
source.newFrame.connect(self._offer, QtCore.Qt.DirectConnection)
|
|
53
|
+
|
|
54
|
+
@QtCore.Slot(np.ndarray)
|
|
55
|
+
@QtCore.Slot(np.ndarray, object)
|
|
56
|
+
def _offer(self, frame: Image, info: FrameInfo | None = None) -> None:
|
|
57
|
+
'''Keep *frame*; runs in the thread that emitted ``newFrame``.'''
|
|
58
|
+
with QtCore.QMutexLocker(self._mutex):
|
|
59
|
+
idle, self._latest = self._latest is None, (frame, info)
|
|
60
|
+
if idle:
|
|
61
|
+
self._wake.emit()
|
|
62
|
+
|
|
63
|
+
@QtCore.Slot()
|
|
64
|
+
def _deliver(self) -> None:
|
|
65
|
+
'''Pass the kept frame on; runs in the thread of the relay.'''
|
|
66
|
+
with QtCore.QMutexLocker(self._mutex):
|
|
67
|
+
frame, info = self._latest
|
|
68
|
+
self._latest = None
|
|
69
|
+
self.newFrame.emit(frame, info)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'''Live video display widget with mouse-aware graphical overlay support.'''
|
|
2
2
|
from qtpy import QtCore, QtGui, QtWidgets
|
|
3
3
|
from QVideo.lib.QVideoSource import QVideoSource
|
|
4
|
+
from QVideo.lib.QFrameRelay import QFrameRelay
|
|
4
5
|
from QVideo.lib.videotypes import FrameInfo
|
|
5
6
|
from QVideo.lib.videotypes import Image
|
|
6
7
|
import numpy as np
|
|
@@ -112,14 +113,15 @@ class QVideoScreen(GraphicsLayoutWidget):
|
|
|
112
113
|
def source(self, source: QVideoSource | None) -> None:
|
|
113
114
|
if self._source is not None:
|
|
114
115
|
self._source.shapeChanged.disconnect(self.updateShape)
|
|
115
|
-
self._source.newFrame.disconnect(self.setImage)
|
|
116
116
|
self._source = source
|
|
117
|
+
self._relay = None
|
|
117
118
|
if source is None:
|
|
118
119
|
return
|
|
119
120
|
if source.shape is not None:
|
|
120
121
|
self.updateShape(source.shape)
|
|
121
122
|
self._source.shapeChanged.connect(self.updateShape)
|
|
122
|
-
self.
|
|
123
|
+
self._relay = QFrameRelay(source)
|
|
124
|
+
self._relay.newFrame.connect(self.setImage)
|
|
123
125
|
|
|
124
126
|
@property
|
|
125
127
|
def framerate(self) -> int | None:
|