-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlay feature and example #28
Conversation
I don't think I recall seeing before the way this library contains I initially added displayio to the mock docs in the conf file (unsuccessfully with improper syntax). But noticed the way this was working afterward and removed the one in conf.py and added mocked out classes for the rest of the things used by the new functionality. I am not certain if I've made the mocked ones correctly though. |
Theoretically many or all of the new imports could be made conditional upon whether the user is using the overlay feature. But since overlay is a property that can be set at any time it would require waiting until the user sets it the first time to import those libraries and pylint doesn't like doing imports from places other than the top of the code. I think it might be worth it to do it that way and add the pylint exception because then it keeps these libraries from being hard requirements that must be installed in order for PyCamera to be importable. Right now the required external libraries are listed in optional-requirements.txt, but upon thinking about it more while writing this comment I'm realizing that the way the code is now those requirements are not actually optional. I think it would fail to import if they were missing. We will need to either do the imports outside the top level as described above, or move those reqs to requirements.txt instead of optional-requirements.txt. I lean towards making the import conditional upon the first usage of overlay to save disk space and RAM for anyone not actually using the overlay feature. I'll make a new commit with that change. That being said I don't have a super strong opinion if anyone else believes non-optional is better I can swap to that. |
The latest commit adds a second version of the overlay example. In the original version a single overlay file is hardcoded and must be changed by the user if they want to change overlays. In the new version I envision adding x,y offsets for the overlay and using the D-Pad buttons to control it's placement. Currently it's hardcoded to 0,0 so it works with full sized frame overlays and similar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't test but I love the idea
Updating https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver to 1.3.0 from 1.2.12: > Merge pull request adafruit/Adafruit_CircuitPython_BitmapSaver#34 from FoamyGuy/support_colorconverter Updating https://github.com/adafruit/Adafruit_CircuitPython_PyCamera to 1.1.0 from 1.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_PyCamera#28 from FoamyGuy/overlays > Merge pull request adafruit/Adafruit_CircuitPython_PyCamera#30 from adafruit/ipcam-was-unuseful-name Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
This adds support for
overlay
andoverlay_transparency_color
properties which can be used to specify a .bmp file to use as an overlay or frame for the image. The overlay will be shown on the preview if set, and a new function.blit_overlay_into_last_capture()
can be used to create and save a combined version of the most recent photo and save it on the SDCard.This functionality requires: adafruit/Adafruit_CircuitPython_BitmapSaver#34
pre-commit made a few code format tweaks to the basic_camera example code.py which were unrelated to the rest of this PR. Though the new overlay example is built from the basic camera one, and only differs by a few lines.
resolves: #27
There are two basic 320x240 overlay .bmp images included that I used during development and testing of this feature.
In order to be used an overlay images should be .bmp format and contain 24 bit RGB888 Colorspace.