QVideo 4.1.0__tar.gz → 4.3.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.1.0 → qvideo-4.3.0}/PKG-INFO +2 -1
- {qvideo-4.1.0 → qvideo-4.3.0}/QVideo.egg-info/PKG-INFO +2 -1
- {qvideo-4.1.0 → qvideo-4.3.0}/QVideo.egg-info/SOURCES.txt +2 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/QVideo.egg-info/requires.txt +1 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Flir/_camera.py +1 -1
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/QCircularBuffer.py +4 -12
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/QDVRWidget.py +21 -5
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QFilterRack.py +1 -1
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QFilterStack.py +7 -3
- qvideo-4.3.0/lib/QFrameRelay.py +69 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QVideoScreen.py +4 -2
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QVideoSource.py +7 -3
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/__init__.py +4 -1
- {qvideo-4.1.0 → qvideo-4.3.0}/pyproject.toml +2 -1
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_circularbuffer.py +2 -25
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qdvrwidget.py +34 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qfilterstack.py +8 -0
- qvideo-4.3.0/tests/test_qframerelay.py +122 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qvideoscreen.py +40 -8
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qvideosource.py +12 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/LICENSE.md +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/QCamcorder.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/QVideo.egg-info/dependency_links.txt +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/QVideo.egg-info/top_level.txt +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/README.md +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/__main__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Basler/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Basler/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Basler/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Flir/QListFlirCameras.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Flir/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Flir/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Genicam/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Genicam/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Genicam/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/IDS/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/IDS/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/IDS/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/MV/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/MV/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/MV/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Noise/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Noise/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Noise/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/OpenCV/QListCVCameras.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/OpenCV/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/OpenCV/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/OpenCV/_devices.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/OpenCV/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Picamera/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Picamera/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Picamera/_imx500.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Picamera/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Vimbax/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Vimbax/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/Vimbax/_tree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/cameras/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/ROIdemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/circulardemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/compositedemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/demo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/filterdemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/filterrackdemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/histogramdemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/trackpydemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/uniformitydemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/demos/yolodemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/QCircularDVRWidget.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/QHDF5Reader.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/QHDF5Writer.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/QOpenCVReader.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/QOpenCVWriter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/dvr/icons_rc.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/_MedianBase.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/artistic.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/blob.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/circletransform.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/darkframe.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/dejitter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/dog.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/edge.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/exposure.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/flatfield.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/foreground.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/gamma.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/invert.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/laplacian.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/median.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/momean.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/momedian.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/normalize.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/rgb.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/roi.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/samplehold.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/smoothing.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/sobel.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/threshold.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/filters/unsharp.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QCamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QCameraTree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QFPSMeter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QHistogramWidget.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QListCameras.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QSnapshot.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QUniformityWidget.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QVideoFilter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QVideoReader.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/QVideoWriter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/_jupyter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/_qabc.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/chooser.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/clickable.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/errors.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/gentl.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/imageops.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/lib/videotypes.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/overlays/__init__.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/overlays/trackpy.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/overlays/yolo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/setup.cfg +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_artistic.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_blob.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_camera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_chooser.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_circletransform.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_circulardemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_circulardvrwidget.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_clickable.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_compositedemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_darkframe.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_dejitter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_demo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_dog.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_edge.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_exposure.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_filter_export.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_filterdemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_filterrackdemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_filters_gray.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_flatfield.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_foreground.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_gamma.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_gentl.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_histogramdemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_histogramwidget.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_icons_rc.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_imageops.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_invert.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_jupyter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_laplacian.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_median.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_momean.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_momedian.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_normalize.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_overlays_package.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qabc.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qbaslercamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qcamcorder.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qcamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qcameratree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qfilterrack.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qflircamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qfpsmeter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qgenicamcamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qgenicamtree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qhdf5reader.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qhdf5writer.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qidscamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qimxcamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qlistcameras.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qlistcvcameras.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qlistflircameras.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qmvcamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qnoisecamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qnoisetree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qopencvcamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qopencvdevices.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qopencvreader.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qopencvtree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qopencvwriter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qpicamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qpicameratree.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qsnapshot.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qt_binding.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qvideoreader.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qvideowriter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_qvimbaxcamera.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_resolutions.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_rgb.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_roi.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_roidemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_samplehold.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_smoothing.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_sobel.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_threshold.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_trackpy_overlay.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_trackpydemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_uniformitydemo.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_uniformitywidget.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_unsharp.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_vendor_trees.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_videofilter.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_videotypes.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_yolo_overlay.py +0 -0
- {qvideo-4.1.0 → qvideo-4.3.0}/tests/test_yolodemo.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: QVideo
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3.0
|
|
4
4
|
Summary: PyQt-based framework for integrating video cameras into research applications
|
|
5
5
|
Author-email: "David G. Grier" <david.grier@nyu.edu>
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -26,6 +26,7 @@ Requires-Dist: numpy
|
|
|
26
26
|
Requires-Dist: opencv-python
|
|
27
27
|
Requires-Dist: qtpy
|
|
28
28
|
Requires-Dist: pyqtgraph
|
|
29
|
+
Requires-Dist: psutil
|
|
29
30
|
Provides-Extra: pyqt5
|
|
30
31
|
Requires-Dist: PyQt5; extra == "pyqt5"
|
|
31
32
|
Requires-Dist: PyQt5-sip; extra == "pyqt5"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: QVideo
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3.0
|
|
4
4
|
Summary: PyQt-based framework for integrating video cameras into research applications
|
|
5
5
|
Author-email: "David G. Grier" <david.grier@nyu.edu>
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -26,6 +26,7 @@ Requires-Dist: numpy
|
|
|
26
26
|
Requires-Dist: opencv-python
|
|
27
27
|
Requires-Dist: qtpy
|
|
28
28
|
Requires-Dist: pyqtgraph
|
|
29
|
+
Requires-Dist: psutil
|
|
29
30
|
Provides-Extra: pyqt5
|
|
30
31
|
Requires-Dist: PyQt5; extra == "pyqt5"
|
|
31
32
|
Requires-Dist: PyQt5-sip; extra == "pyqt5"
|
|
@@ -95,6 +95,7 @@ lib/QCameraTree.py
|
|
|
95
95
|
lib/QFPSMeter.py
|
|
96
96
|
lib/QFilterRack.py
|
|
97
97
|
lib/QFilterStack.py
|
|
98
|
+
lib/QFrameRelay.py
|
|
98
99
|
lib/QHistogramWidget.py
|
|
99
100
|
lib/QListCameras.py
|
|
100
101
|
lib/QSnapshot.py
|
|
@@ -163,6 +164,7 @@ tests/test_qfilterrack.py
|
|
|
163
164
|
tests/test_qfilterstack.py
|
|
164
165
|
tests/test_qflircamera.py
|
|
165
166
|
tests/test_qfpsmeter.py
|
|
167
|
+
tests/test_qframerelay.py
|
|
166
168
|
tests/test_qgenicamcamera.py
|
|
167
169
|
tests/test_qgenicamtree.py
|
|
168
170
|
tests/test_qhdf5reader.py
|
|
@@ -34,7 +34,7 @@ class QFlirCamera(QGenicamCamera):
|
|
|
34
34
|
_producer_filenames = ('Spinnaker_GenTL.cti',)
|
|
35
35
|
_producerHint = ('Install the Spinnaker SDK and set GENICAM_GENTL64_PATH '
|
|
36
36
|
'to the directory containing Spinnaker_GenTL.cti '
|
|
37
|
-
'(typically /opt/spinnaker/lib/spinnaker-gentl).')
|
|
37
|
+
'(on Linux, typically /opt/spinnaker/lib/spinnaker-gentl).')
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
class QFlirSource(QGenicamSource):
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'''Ring buffer that accumulates timestamped frames for later saving.'''
|
|
2
|
-
import os
|
|
3
2
|
from collections import deque
|
|
4
3
|
from pathlib import Path
|
|
5
4
|
from time import time
|
|
6
5
|
from qtpy import QtCore
|
|
7
6
|
import numpy as np
|
|
7
|
+
import psutil
|
|
8
8
|
import logging
|
|
9
9
|
|
|
10
10
|
from QVideo.lib.videotypes import Image, FrameInfo
|
|
@@ -99,22 +99,14 @@ class QCircularBuffer(QtCore.QObject):
|
|
|
99
99
|
|
|
100
100
|
@staticmethod
|
|
101
101
|
def _totalRAM() -> int:
|
|
102
|
-
'''Return total physical RAM in bytes
|
|
103
|
-
|
|
104
|
-
import psutil
|
|
105
|
-
return psutil.virtual_memory().total
|
|
106
|
-
except ImportError:
|
|
107
|
-
pass
|
|
108
|
-
try:
|
|
109
|
-
return os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
|
|
110
|
-
except (AttributeError, ValueError):
|
|
111
|
-
return 0
|
|
102
|
+
'''Return total physical RAM in bytes.'''
|
|
103
|
+
return psutil.virtual_memory().total
|
|
112
104
|
|
|
113
105
|
def _checkMemory(self) -> None:
|
|
114
106
|
self._warned = True
|
|
115
107
|
estimated = self._buffer.maxlen * self._frameBytes
|
|
116
108
|
total = self._totalRAM()
|
|
117
|
-
if
|
|
109
|
+
if estimated > _MEMORY_WARN_FRACTION * total:
|
|
118
110
|
est_mb = estimated / 1024 ** 2
|
|
119
111
|
pct = 100 * estimated / total
|
|
120
112
|
total_gb = total / 1024 ** 3
|
|
@@ -3,6 +3,7 @@ from collections.abc import Callable
|
|
|
3
3
|
from qtpy import QtCore, QtGui, QtWidgets
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
import numpy as np
|
|
6
|
+
import psutil
|
|
6
7
|
from QVideo.lib import clickable, QVideoSource
|
|
7
8
|
from QVideo.lib.videotypes import Image, FrameInfo
|
|
8
9
|
from .QOpenCVWriter import QOpenCVWriter
|
|
@@ -64,6 +65,11 @@ class QDVRWidget(QtWidgets.QFrame):
|
|
|
64
65
|
lagLimit : float
|
|
65
66
|
How far [seconds] the writer may fall behind the newest captured
|
|
66
67
|
frame. Default: ``1.``.
|
|
68
|
+
maxMemory : float or None
|
|
69
|
+
Memory [bytes] that frames waiting for the writer may occupy.
|
|
70
|
+
The recording is treated as behind as soon as the backlog would
|
|
71
|
+
exceed it, whatever *lagLimit* says. ``None`` means 80% of the
|
|
72
|
+
memory available when recording starts. Default: ``None``.
|
|
67
73
|
*args :
|
|
68
74
|
Forwarded to :class:`~qtpy.QtWidgets.QFrame`.
|
|
69
75
|
**kwargs :
|
|
@@ -78,8 +84,9 @@ class QDVRWidget(QtWidgets.QFrame):
|
|
|
78
84
|
playing(bool)
|
|
79
85
|
Emitted when playback starts (``True``) or stops (``False``).
|
|
80
86
|
behind(float)
|
|
81
|
-
Emitted once each time the recording falls
|
|
82
|
-
seconds
|
|
87
|
+
Emitted once each time the recording falls behind the camera by
|
|
88
|
+
more than *lagLimit* seconds or *maxMemory* bytes, with the lag
|
|
89
|
+
in seconds.
|
|
83
90
|
stopped(str)
|
|
84
91
|
Emitted with the reason when the widget stops a recording by
|
|
85
92
|
itself, just before ``recording(False)``.
|
|
@@ -88,7 +95,8 @@ class QDVRWidget(QtWidgets.QFrame):
|
|
|
88
95
|
-----
|
|
89
96
|
Stopping waits for the writer to finish the frames already captured,
|
|
90
97
|
so no recorded frame is lost. With *stopWhenBehind* the wait is
|
|
91
|
-
bounded by *lagLimit* seconds of
|
|
98
|
+
bounded by the smaller of *lagLimit* seconds and *maxMemory* bytes of
|
|
99
|
+
data.
|
|
92
100
|
'''
|
|
93
101
|
|
|
94
102
|
#: Emitted for each frame during playback.
|
|
@@ -159,10 +167,13 @@ class QDVRWidget(QtWidgets.QFrame):
|
|
|
159
167
|
filename: str = '',
|
|
160
168
|
stopWhenBehind: bool = True,
|
|
161
169
|
lagLimit: float = 1.,
|
|
170
|
+
maxMemory: float | None = None,
|
|
162
171
|
**kwargs) -> None:
|
|
163
172
|
super().__init__(*args, **kwargs)
|
|
164
173
|
self.stopWhenBehind = stopWhenBehind
|
|
165
174
|
self.lagLimit = lagLimit
|
|
175
|
+
self.maxMemory = maxMemory
|
|
176
|
+
self._budget = float('inf')
|
|
166
177
|
self._source: QVideoSource | None = None
|
|
167
178
|
self._writer: object | None = None
|
|
168
179
|
self._player: QVideoSource | None = None
|
|
@@ -361,6 +372,8 @@ class QDVRWidget(QtWidgets.QFrame):
|
|
|
361
372
|
nframes=self.nframes.value(),
|
|
362
373
|
nskip=self.nskip.value())
|
|
363
374
|
self._late = False
|
|
375
|
+
self._budget = (self.maxMemory
|
|
376
|
+
or 0.8 * psutil.virtual_memory().available)
|
|
364
377
|
self._writer.frameNumber.connect(self.setFrameNumber)
|
|
365
378
|
self._writer.finished.connect(self.stop)
|
|
366
379
|
self._thread = QtCore.QThread()
|
|
@@ -460,13 +473,16 @@ class QDVRWidget(QtWidgets.QFrame):
|
|
|
460
473
|
|
|
461
474
|
The comparison uses the capture times, so it measures the backlog
|
|
462
475
|
even while the writer is stuck inside a single write, and it
|
|
463
|
-
ignores sources that capture slowly.
|
|
476
|
+
ignores sources that capture slowly. The memory budget is
|
|
477
|
+
converted to the time it takes the camera to fill it, so one
|
|
478
|
+
limit serves both.
|
|
464
479
|
'''
|
|
465
480
|
taken = self._writer and self._writer.received
|
|
466
481
|
if info is None or not taken:
|
|
467
482
|
return
|
|
468
483
|
lag = info.timestamp - taken.timestamp
|
|
469
|
-
|
|
484
|
+
fill = self._budget / (self.source.fps * frame.nbytes)
|
|
485
|
+
late = lag > min(self.lagLimit, fill)
|
|
470
486
|
if late and not self._late:
|
|
471
487
|
self.behind.emit(lag)
|
|
472
488
|
if self.stopWhenBehind:
|
|
@@ -447,7 +447,7 @@ class QFilterRack(QtWidgets.QWidget):
|
|
|
447
447
|
path, _ = QtWidgets.QFileDialog.getSaveFileName(
|
|
448
448
|
self, 'Export Pipeline', 'filter.py', 'Python files (*.py)')
|
|
449
449
|
if path:
|
|
450
|
-
with open(path, 'w') as fh:
|
|
450
|
+
with open(path, 'w', encoding='utf-8') as fh:
|
|
451
451
|
fh.write(self.exportPipeline())
|
|
452
452
|
|
|
453
453
|
def _removeSlot(self, slot: '_FilterSlot') -> None:
|
|
@@ -213,9 +213,13 @@ class QFilterStack(QtCore.QThread):
|
|
|
213
213
|
return frame
|
|
214
214
|
|
|
215
215
|
def __del__(self) -> None:
|
|
216
|
-
#
|
|
217
|
-
#
|
|
218
|
-
|
|
216
|
+
# The garbage collector may get here after Qt has deleted the C++
|
|
217
|
+
# object (or before it was built): then there is no thread to stop.
|
|
218
|
+
try:
|
|
219
|
+
running = self.isRunning()
|
|
220
|
+
except RuntimeError:
|
|
221
|
+
return
|
|
222
|
+
if running:
|
|
219
223
|
self.stop()
|
|
220
224
|
|
|
221
225
|
@QtCore.Slot()
|
|
@@ -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:
|
|
@@ -144,9 +144,13 @@ class QVideoSource(QtCore.QThread):
|
|
|
144
144
|
logger.debug('streaming finished')
|
|
145
145
|
|
|
146
146
|
def __del__(self) -> None:
|
|
147
|
-
#
|
|
148
|
-
#
|
|
149
|
-
|
|
147
|
+
# The garbage collector may get here after Qt has deleted the C++
|
|
148
|
+
# object (or before it was built): then there is no thread to stop.
|
|
149
|
+
try:
|
|
150
|
+
running = self.isRunning()
|
|
151
|
+
except RuntimeError:
|
|
152
|
+
return
|
|
153
|
+
if running:
|
|
150
154
|
self.stop()
|
|
151
155
|
self.wait()
|
|
152
156
|
|
|
@@ -19,6 +19,8 @@ QVideoScreen
|
|
|
19
19
|
Widget that displays frames emitted by a :class:`QVideoSource`.
|
|
20
20
|
VideoFilter
|
|
21
21
|
Base class for composable image-processing filters.
|
|
22
|
+
QFrameRelay
|
|
23
|
+
Latest-frame handoff from a capture thread to a GUI-thread consumer.
|
|
22
24
|
QVideoFilter
|
|
23
25
|
Qt widget wrapper around a :class:`VideoFilter`.
|
|
24
26
|
QFilterRack
|
|
@@ -45,6 +47,7 @@ from .QCameraTree import QCameraTree
|
|
|
45
47
|
from .QVideoScreen import QVideoScreen
|
|
46
48
|
from .QFilterRack import QFilterRack
|
|
47
49
|
from .QFilterStack import QFilterStack
|
|
50
|
+
from .QFrameRelay import QFrameRelay
|
|
48
51
|
from .QVideoFilter import VideoFilter, QVideoFilter
|
|
49
52
|
from .QVideoReader import QVideoReader
|
|
50
53
|
from .QVideoWriter import QVideoWriter
|
|
@@ -60,6 +63,6 @@ __all__ = '''Image
|
|
|
60
63
|
FrameInfo
|
|
61
64
|
clickable Camera choose_camera QListCameras
|
|
62
65
|
QCamera QCameraError QDriverError QDeviceError QVideoSource QCameraTree
|
|
63
|
-
QFilterRack QFilterStack
|
|
66
|
+
QFilterRack QFilterStack QFrameRelay
|
|
64
67
|
QVideoReader QVideoWriter QVideoScreen
|
|
65
68
|
QFPSMeter QHistogramWidget QUniformityWidget QSnapshot VideoFilter QVideoFilter'''.split()
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "QVideo"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.3.0"
|
|
8
8
|
description = "PyQt-based framework for integrating video cameras into research applications"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "GPL-3.0-or-later" }
|
|
@@ -34,6 +34,7 @@ dependencies = [
|
|
|
34
34
|
"opencv-python",
|
|
35
35
|
"qtpy",
|
|
36
36
|
"pyqtgraph",
|
|
37
|
+
"psutil",
|
|
37
38
|
]
|
|
38
39
|
|
|
39
40
|
[project.urls]
|
|
@@ -253,25 +253,13 @@ class TestTotalRAM(unittest.TestCase):
|
|
|
253
253
|
result = QCircularBuffer._totalRAM()
|
|
254
254
|
self.assertIsInstance(result, int)
|
|
255
255
|
|
|
256
|
-
def
|
|
256
|
+
def test_reads_total_from_psutil(self):
|
|
257
257
|
mock_psutil = MagicMock()
|
|
258
258
|
mock_psutil.virtual_memory.return_value.total = 16 * 1024 ** 3
|
|
259
|
-
with patch.
|
|
259
|
+
with patch.object(_module, 'psutil', mock_psutil):
|
|
260
260
|
result = QCircularBuffer._totalRAM()
|
|
261
261
|
self.assertEqual(result, 16 * 1024 ** 3)
|
|
262
262
|
|
|
263
|
-
def test_falls_back_to_sysconf(self):
|
|
264
|
-
with patch.dict('sys.modules', {'psutil': None}):
|
|
265
|
-
with patch.object(_module.os, 'sysconf', side_effect=[4096, 1024]):
|
|
266
|
-
result = QCircularBuffer._totalRAM()
|
|
267
|
-
self.assertEqual(result, 4096 * 1024)
|
|
268
|
-
|
|
269
|
-
def test_returns_zero_on_failure(self):
|
|
270
|
-
with patch.dict('sys.modules', {'psutil': None}):
|
|
271
|
-
with patch.object(_module.os, 'sysconf', side_effect=ValueError):
|
|
272
|
-
result = QCircularBuffer._totalRAM()
|
|
273
|
-
self.assertEqual(result, 0)
|
|
274
|
-
|
|
275
263
|
|
|
276
264
|
class TestMemoryWarning(unittest.TestCase):
|
|
277
265
|
|
|
@@ -317,17 +305,6 @@ class TestMemoryWarning(unittest.TestCase):
|
|
|
317
305
|
buf.duration = 2 # triggers _resize, resets _warned
|
|
318
306
|
self.assertFalse(buf._warned)
|
|
319
307
|
|
|
320
|
-
def test_no_warning_when_total_ram_unknown(self):
|
|
321
|
-
buf = QCircularBuffer(fps=10., duration=1)
|
|
322
|
-
with patch.object(buf, '_totalRAM', return_value=0):
|
|
323
|
-
try:
|
|
324
|
-
with self.assertLogs('QVideo.dvr.QCircularBuffer', level='WARNING'):
|
|
325
|
-
buf.append(self._big_frame())
|
|
326
|
-
warned = True
|
|
327
|
-
except AssertionError:
|
|
328
|
-
warned = False
|
|
329
|
-
self.assertFalse(warned)
|
|
330
|
-
|
|
331
308
|
|
|
332
309
|
if __name__ == '__main__':
|
|
333
310
|
unittest.main()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'''Unit tests for QDVRWidget.'''
|
|
2
2
|
import unittest
|
|
3
|
+
from types import SimpleNamespace
|
|
3
4
|
import numpy as np
|
|
4
5
|
from unittest.mock import patch, MagicMock
|
|
5
6
|
from QVideo.lib.videotypes import FrameInfo
|
|
@@ -259,6 +260,7 @@ class TestQDVRWidgetRecord(unittest.TestCase):
|
|
|
259
260
|
widget = make_widget()
|
|
260
261
|
self.assertTrue(widget.stopWhenBehind)
|
|
261
262
|
self.assertEqual(widget.lagLimit, 1.)
|
|
263
|
+
self.assertIsNone(widget.maxMemory)
|
|
262
264
|
|
|
263
265
|
def test_a_writer_keeping_up_is_left_alone(self):
|
|
264
266
|
widget, _ = self.watching()
|
|
@@ -319,6 +321,38 @@ class TestQDVRWidgetRecord(unittest.TestCase):
|
|
|
319
321
|
self.capture(widget, 12.)
|
|
320
322
|
self.assertTrue(widget.isRecording())
|
|
321
323
|
|
|
324
|
+
def test_a_small_memory_budget_stops_the_recording(self):
|
|
325
|
+
# 0.5 s of a 30 Hz source of 16-byte frames
|
|
326
|
+
widget, _ = self.watching(_budget=0.5 * 30 * _FRAME.nbytes)
|
|
327
|
+
with self.assertLogs('QVideo.dvr.QDVRWidget', 'ERROR'):
|
|
328
|
+
self.capture(widget, 10.6)
|
|
329
|
+
self.assertFalse(widget.isRecording())
|
|
330
|
+
|
|
331
|
+
def test_a_large_memory_budget_leaves_the_time_limit_in_charge(self):
|
|
332
|
+
widget, _ = self.watching(_budget=1e12)
|
|
333
|
+
self.capture(widget, 10.9)
|
|
334
|
+
self.assertTrue(widget.isRecording())
|
|
335
|
+
with self.assertLogs('QVideo.dvr.QDVRWidget', 'ERROR'):
|
|
336
|
+
self.capture(widget, 12.)
|
|
337
|
+
self.assertFalse(widget.isRecording())
|
|
338
|
+
|
|
339
|
+
def test_the_budget_defaults_to_most_of_the_available_memory(self):
|
|
340
|
+
widget, source = make_widget_with_source()
|
|
341
|
+
free = SimpleNamespace(available=1000)
|
|
342
|
+
with patch.dict(QDVRWidget.Writer, {'.avi': MockWriter}), \
|
|
343
|
+
patch.object(QtCore, 'QThread', return_value=MockThread()), \
|
|
344
|
+
patch('psutil.virtual_memory', return_value=free):
|
|
345
|
+
widget.record()
|
|
346
|
+
self.assertEqual(widget._budget, 800)
|
|
347
|
+
|
|
348
|
+
def test_max_memory_overrides_the_default_budget(self):
|
|
349
|
+
widget, source = make_widget_with_source()
|
|
350
|
+
widget.maxMemory = 123
|
|
351
|
+
with patch.dict(QDVRWidget.Writer, {'.avi': MockWriter}), \
|
|
352
|
+
patch.object(QtCore, 'QThread', return_value=MockThread()):
|
|
353
|
+
widget.record()
|
|
354
|
+
self.assertEqual(widget._budget, 123)
|
|
355
|
+
|
|
322
356
|
def test_a_writer_that_has_seen_nothing_is_not_late(self):
|
|
323
357
|
widget, writer = self.watching()
|
|
324
358
|
writer.received = None
|
|
@@ -5,6 +5,7 @@ import sys
|
|
|
5
5
|
import threading
|
|
6
6
|
import time
|
|
7
7
|
import unittest
|
|
8
|
+
from unittest.mock import patch
|
|
8
9
|
import numpy as np
|
|
9
10
|
from qtpy import QtCore, QtTest, QtWidgets
|
|
10
11
|
from QVideo.lib.QFilterStack import QFilterStack
|
|
@@ -406,6 +407,13 @@ print('survived')
|
|
|
406
407
|
|
|
407
408
|
class TestLifecycle(StackTestCase):
|
|
408
409
|
|
|
410
|
+
def test_finalizer_ignores_a_deleted_thread(self):
|
|
411
|
+
stack = self.make()
|
|
412
|
+
with patch.object(QFilterStack, 'isRunning',
|
|
413
|
+
side_effect=RuntimeError):
|
|
414
|
+
stack.__del__()
|
|
415
|
+
self.assertTrue(stack.isRunning())
|
|
416
|
+
|
|
409
417
|
def test_thread_is_running_after_creation(self):
|
|
410
418
|
self.make()
|
|
411
419
|
self.assertTrue(self.stack.isRunning())
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'''Unit tests for QFrameRelay.'''
|
|
2
|
+
import gc
|
|
3
|
+
import threading
|
|
4
|
+
import unittest
|
|
5
|
+
import numpy as np
|
|
6
|
+
from qtpy import QtCore, QtWidgets
|
|
7
|
+
from QVideo.lib.QFrameRelay import QFrameRelay
|
|
8
|
+
from QVideo.lib.videotypes import FrameInfo
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
app = QtWidgets.QApplication.instance() or QtWidgets.QApplication([])
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class _Source(QtCore.QObject):
|
|
15
|
+
newFrame = QtCore.Signal(np.ndarray, object)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class _PlainSource(QtCore.QObject):
|
|
19
|
+
newFrame = QtCore.Signal(np.ndarray)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def frame(n: int) -> np.ndarray:
|
|
23
|
+
return np.full((2, 2), n, dtype=np.uint8)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def emit_from_thread(source, indices):
|
|
27
|
+
'''Emit frames from a thread other than the one running the relay.'''
|
|
28
|
+
def run():
|
|
29
|
+
for n in indices:
|
|
30
|
+
source.newFrame.emit(frame(n), FrameInfo(n, float(n)))
|
|
31
|
+
thread = threading.Thread(target=run)
|
|
32
|
+
thread.start()
|
|
33
|
+
thread.join()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class RelayTestCase(unittest.TestCase):
|
|
37
|
+
|
|
38
|
+
def make(self, source=None):
|
|
39
|
+
self.source = source or _Source()
|
|
40
|
+
self.relay = QFrameRelay(self.source)
|
|
41
|
+
self.out = []
|
|
42
|
+
self.relay.newFrame.connect(
|
|
43
|
+
lambda image, info: self.out.append((int(image[0, 0]), info)))
|
|
44
|
+
return self.relay
|
|
45
|
+
|
|
46
|
+
def values(self):
|
|
47
|
+
return [value for value, _ in self.out]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class TestDelivery(RelayTestCase):
|
|
51
|
+
|
|
52
|
+
def test_a_frame_arrives(self):
|
|
53
|
+
self.make()
|
|
54
|
+
emit_from_thread(self.source, [1])
|
|
55
|
+
app.processEvents()
|
|
56
|
+
self.assertEqual(self.values(), [1])
|
|
57
|
+
|
|
58
|
+
def test_the_info_arrives_unchanged(self):
|
|
59
|
+
self.make()
|
|
60
|
+
emit_from_thread(self.source, [4])
|
|
61
|
+
app.processEvents()
|
|
62
|
+
self.assertEqual(self.out[0][1], FrameInfo(4, 4.))
|
|
63
|
+
|
|
64
|
+
def test_a_one_argument_source_gives_no_info(self):
|
|
65
|
+
source = _PlainSource()
|
|
66
|
+
self.make(source)
|
|
67
|
+
source.newFrame.emit(frame(1))
|
|
68
|
+
app.processEvents()
|
|
69
|
+
self.assertEqual(self.out, [(1, None)])
|
|
70
|
+
|
|
71
|
+
def test_frames_in_the_receiving_thread_arrive_at_once(self):
|
|
72
|
+
self.make()
|
|
73
|
+
self.source.newFrame.emit(frame(1), FrameInfo(1, 1.))
|
|
74
|
+
self.source.newFrame.emit(frame(2), FrameInfo(2, 2.))
|
|
75
|
+
self.assertEqual(self.values(), [1, 2])
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class TestLatestWins(RelayTestCase):
|
|
79
|
+
|
|
80
|
+
def test_a_busy_receiver_gets_only_the_newest_frame(self):
|
|
81
|
+
self.make()
|
|
82
|
+
emit_from_thread(self.source, range(50))
|
|
83
|
+
app.processEvents()
|
|
84
|
+
self.assertEqual(self.values(), [49])
|
|
85
|
+
|
|
86
|
+
def test_the_receiver_is_woken_once_while_it_is_busy(self):
|
|
87
|
+
self.make()
|
|
88
|
+
wakes = []
|
|
89
|
+
self.relay._wake.connect(lambda: wakes.append(1))
|
|
90
|
+
emit_from_thread(self.source, range(50))
|
|
91
|
+
app.processEvents()
|
|
92
|
+
self.assertEqual(len(wakes), 1)
|
|
93
|
+
|
|
94
|
+
def test_the_next_frame_is_delivered_after_a_pickup(self):
|
|
95
|
+
self.make()
|
|
96
|
+
emit_from_thread(self.source, range(5))
|
|
97
|
+
app.processEvents()
|
|
98
|
+
emit_from_thread(self.source, range(5, 10))
|
|
99
|
+
app.processEvents()
|
|
100
|
+
self.assertEqual(self.values(), [4, 9])
|
|
101
|
+
|
|
102
|
+
def test_nothing_is_delivered_twice(self):
|
|
103
|
+
self.make()
|
|
104
|
+
emit_from_thread(self.source, [1])
|
|
105
|
+
app.processEvents()
|
|
106
|
+
app.processEvents()
|
|
107
|
+
self.assertEqual(self.values(), [1])
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class TestLifetime(RelayTestCase):
|
|
111
|
+
|
|
112
|
+
def test_a_deleted_relay_receives_nothing_and_raises_nothing(self):
|
|
113
|
+
self.make()
|
|
114
|
+
del self.relay
|
|
115
|
+
gc.collect()
|
|
116
|
+
emit_from_thread(self.source, [1])
|
|
117
|
+
app.processEvents()
|
|
118
|
+
self.assertEqual(self.out, [])
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
if __name__ == '__main__':
|
|
122
|
+
unittest.main()
|