Webcam with OpenCV using a Donkey#147
Open
iliketocode2 wants to merge 25 commits intoinvent-framework:mainfrom
Open
Webcam with OpenCV using a Donkey#147iliketocode2 wants to merge 25 commits intoinvent-framework:mainfrom
iliketocode2 wants to merge 25 commits intoinvent-framework:mainfrom
Conversation
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.
Important
TODO: needs to integrate the new donkey plugin logic? This would require a rewrite of the "test page"-- open_cv_playground. Since branch
donkey-independenceis a branch off of this branch, I would recommend making future changes there for ease of merge.Implementation
What was changed
src/invent/ui/widgets/webcam.py"stacked"|"side-by-side"). In side-by-side mode the live camera feed and the capture/result panel sit in a horizontal row at equal sizeshow_image(data_url)which is a public method that pushes any image into the preview panel. This allows the processed OpenCV result to replace the captured photo in placefind_capture,remove_capture,clear_captures,photo_bytes,trigger) from the older implementation of the webcam and also I removed some of the unused imports (IntegerProperty,base64, theicon()classmethod)src/invent/themes/default.cssdisplay: contentsby default so the stacked layout costs nothingexamples/open_cv_playground/main.py**opencv_webcamnow usespreview_layout="side-by-side"andmode="photo".Imageoutput widget. The right-hand panel in the webcam serves as the single display area: it shows the captured photo immediately after the shutter is pressed, thenopencv_webcam.show_image(processed_data_url)replaces it with the processed result when Run Code completes.Testing
The styles all work great in light & dark modes, and also the side-by-side camera stacks on mobile screens!
Why this should not be merged yet
There is a new page:
open_cv_playgroundwith an associatedmain.py,index.html, andconfig.jsonfile. These are simply to show off and test the current webcam with openCV so they should be removed from this PR before merging. I am submitting this for now to get another set of eyes on the Donkey and OpenCV logic.