Comments (3)
Neat idea!
I haven't messed with any camera stuff much but I think this should be achievable.
Some thoughts about how for me to come back to:
The frame(s) image files can have "greenscreen" section for the center. It can be layered on top of the camera preview in displayio with ondiskbitmap or imageload Bitmap and the greenscreen color made transparent so it won't be drawn and the camera preview should show through.
For saving the images with the frame in them. It could possibly use adafruit_bitmapsaver to save a "screenshot" of the preview screen which will include the frame. Or if it's easier I think bitmaptools.blit()
can be used to paste the frame Bitmap on top of a camera image Bitmap and the skip_index
argument will allow it to skip the specified greenscreen color / section.
from adafruit_circuitpython_pycamera.
Oh that sounds awesome
from adafruit_circuitpython_pycamera.
This turned out to be a little trickier than I made it sound, and I hit some unrelated hurdles along the way but I've gotten both previewing and saving with the overlay functional now. PR with library modifications and new example coming shortly.
Final image with overlay (github doesn't allow .bmp files it seems):
img0032_modified.bmp.zip
There are a few things to note about it:
- The .jpeg photos are still taken and originals are left untouched on the SDCard
- The final output is .bmp not .jpeg so the filesize ends up a fair bit larger than the jpeg version of the photo
- Saving the final .bmp uses a modified adafruit_bitmapsaver
- Currently in order to combine the photo with the overlay both must be loaded into memory as Bitmap objects which are relatively large. I was able to use 640x480 size successfully but I believe that may be the largest one that can work, I do still need to test the next one up to confirm though.
- It takes a noticeable amount of time to do decode the taken jpeg, then combine it with the overlay, and finally write it back out as a .bmp file. Smaller sized photos result in lower wait times. I haven't measured the time specifically but 640x480 was at least 45-60 seconds or more. 320x240 sized photo is around 30 seconds or a little less. I have not profiled it to figure out which steps take the most time, perhaps there are ways to be more efficient than my current code.
- The overlay .bmp file can be on the CIRCUITPY drive or the SDCard. But with size 640x480 the .bmp is too large to fit on CIRCUITPY with the other necessary libraries and code so anyone wanting to take 640x480 sized photos must store the overlay file on the SDCard.
from adafruit_circuitpython_pycamera.
Related Issues (13)
- horizontally flipped preview/image HOT 4
- Dependency Issue for adafruit_pycamera? Missing 'adafruit_lis3dh' HOT 4
- a way to clear out nvm text when running new code HOT 1
- Turn off debug output
- Add custom file name to capture_jpeg()
- pycam.right.fell triggered by left button on MEMENTO HOT 1
- framing masks HOT 4
- create /sd directory on CIRCUITPY drive
- Where is "font_free_mono_bold_24"? HOT 3
- Add function to return last file name written
- Fancy camera image file timestamps are all 1999-12-31
- Creating a PyCamera instance breaks WiFi HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_circuitpython_pycamera.