waveform80 / picamera

A pure Python interface to the Raspberry Pi camera module
https://picamera.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.57k stars 358 forks source link

make PiBayerArray usable without camera hardware #445

Open rwb27 opened 6 years ago

rwb27 commented 6 years ago

PiBayerArray is a nice way to recover the raw image data from a JPEG image saved with the pi camera. I use it when I need access to the raw image data on-the-fly, but it would be nice if my post-acquisition analysis code could use it too. When running on a Pi it's fine, as the picamera library is installed - but it would be great if I could install it on my PC as well.

I currently do this using a hacked version of array.py, with a stub version of the mmal objects module. If it was possible to simply pinch e.g.pi_bayer_array.py from this repository, it seems to me that might be useful.

I suspect this could be achieved by a slight reorganisation of code (e.g. refactoring to move the PiBayerArray code to its own module). Would a pull request make sense? If not, I'll probably bodge something together for my own purposes, perhaps with a script that will pull changes from picamera to make it more easily maintainable.

When writing code that talks to hardware I've often found it convenient to allow it to install on platforms where that hardware is never present, so it can run as a stub to allow testing/debugging/analysis using the bits of the code that don't actually depend on the hardware. However, it may be that this is not done, by choice or convention, for this project and in any case it would amount to more work than it's probably worth in this case...

jason-curtis commented 5 years ago

Hey @rwb27, my team just released a fork which accomplishes this. Check out https://github.com/OsmoSystems/picamraw/

rwb27 commented 5 years ago

thanks - that's helpful :)