Repository navigation
Build the OpenCV plugin on the camera base class - #16
Merged
Merged
Conversation
The driver (OpenCVCamera) follows the CameraDriverBase interface of pymodaq_plugins_utils; the plugin is a CameraBase with the properties of the camera as settings. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before:
DAQ_2DViewer_OpenCVread one frame pergrab_datacall, so there was no thread of its own, no ROI, no binning, no FPS and no averaging in the plugin (the viewer averaged).'win' in platformalso selected the Windows backend on macOS (darwincontainswin), and the settings list included the DC1394 mode registers.After: the plugin is a
CameraBaseofpymodaq_plugins_utils, like the other camera plugins (the cookbook camera ofpymodaq_plugins_mockexamplesis the reference). It has the live and snap modes in a thread of its own, averaging, the ROI drawn in the viewer, binning and FPS. The OpenCV part moved to a driver,hardware/opencv_camera.py(OpenCVCamera), that follows theCameraDriverBaseinterface:wait_for_framereads the next frame, and the ROI and the binning (mean of the pixels) are applied on each image since a webcam has none. The windows backend is chosen withsys.platform.startswith('win').What changes for users:
Colorssetting is replaced by theColor Conversionof the base class (defaultRGB2GRAY, like the formergray;Nonegives the red, green and blue channels). Experiments that setcolorsneedcolor_conversioninstead.Cam. Settings, with brightness, gain... as before (modes of the DC1394 registers are no longer listed). Changing the frame width or height there resets the ROI and updates the axes.How: new
tests/test_opencv_camera.py(25 tests). The driver is run on a video file by the real OpenCV (frames are RGB, colours checked) and on a fake ofcv2.VideoCapturefor what a file cannot do (properties, failing reads, a change of the frame size); the plugin is run through the harness ofpymodaq.utils.plugin_testingon the fake: snap, channels, averaging, ROI, binning, live, ROI change during live, change of frame size, close.check_pluginreports no error and no TODO. No real webcam was available: please try it on a laptop (live view, ROI from the viewer, binning, Open Settings on Windows).This needs
pymodaq_plugins_utils>=5.3.1(the camera base class), which is not released yet, so the checks of this pull request fail at the install until it is. Independent of #15 (alignment with the template).Generated by Claude Code