groupgets / pylepton

Quick and dirty pure python library for interfacing with FLIR lepton
MIT License
208 stars 94 forks source link

Added some new programs - snapshot and livefeed #6

Closed Cullpepper closed 7 years ago

Cullpepper commented 7 years ago

pylepton_snapshot displays a single from from the lepton and saves a copy of the same image. pylepton_livefeed displays a live feed window from the lepton.

kekiefer commented 7 years ago

Thanks for the PR! I don't have my Pi set up to give this a try, but it looks great.

I wonder how the frame rate is on pylepton_livefeed? If you think the frame rate could be better, it might make sense to hold on to a reference of the Lepton object, and also pre-allocate a single buffer to pass to capture each time (something like _,nr = l.capture(lepton_buf) -- note that you should check nr for duplicate frames). These were both things I had to do in the overlay program to help it keep sync with the Lepton, and consequently achieved the full rate of the imager.

Just a thought though, I'm happy to merge this if you're happy with the way this works now.

Cullpepper commented 7 years ago

Ah... those are all good suggestions. Please hold on merging - I'll try to improve it a bit. The frame rate isn't bad, the bigger constraint seems to be how fast the window manager can refresh when the output is scaled up. (Hope that makes sense, I'm brand-new to python.) Although in truth, I need to test it with a different setup, I'm doing all of this on a headless Rpi through remote desktop, so I don't entirely trust what I'm seeing for output...

kekiefer commented 7 years ago

It's possible that the image processing will take long enough to throw you out of sync with the Lepton unless you grab images on a worker thread or something, but it's worth a try the easier way first.

Cullpepper commented 7 years ago

I just wanted to say thank you for the tips - your suggestions just cut my processor load in half (big deal on the RPI!)