Adjective-Object / first-order-motion-tk

MIT License
1 stars 1 forks source link

Camera Preview drops frames while running #12

Open Adjective-Object opened 3 years ago

Adjective-Object commented 3 years ago

This is a minor issue, but the camera preview drops frames while the character portrait is being animated.

I think this is because the camera read() and conversion to/from images are all happening on the main thread. Thankfully (probably due to a quirk of how tkinter's loop works), this does not seem to impact the output framerate, but it would be nice if it also ran smoothly.

Rather than move the read / etc to its own process, I think I might be able to just cut down on the main thread work, since the camera is already being read and cropped each time we request a frame to be animated. Maybe a wrapper for the camera source that tracks the last prepared frame, and only updates after a certain interval makes sense?

Ideally we would only update it if a new frame is ready from the camera, but I don't know if the opencv camera interface supports that.