Coder Social home page Coder Social logo

Comments (3)

FoamyGuy avatar FoamyGuy commented on June 3, 2024

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.

justmobilize avatar justmobilize commented on June 3, 2024

Oh that sounds awesome

from adafruit_circuitpython_pycamera.

FoamyGuy avatar FoamyGuy commented on June 3, 2024

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.

Preview with overlay:
IMG_20240220_093729735_HDR_1

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.