Closed Short-bus closed 4 months ago
Added option to the camera menu to select which image types should be saved. That makes sure you can only select valid combinations of image types to save. It then selects the appropriate driver and commands to support the chosen driver and image types. This is safer than manually editing the parameter file, it reduces the risks of incompatible values being selected.
2024-04 Development branch now merged. First version of a solution for FITS files now available.
Several astro packages and utilities work with raw image data stored in .fits format. raspistill (+pidng), and libcamera (via pidng) can export raw data in .dng format, but not as .fits files.
The picamera2 library allows the raw matrix data to be exported from the camera. Can that data be saved as a .fits file?
The astropy library includes the pyfits module, this allows numpy arrays (and more) to be written to .fits files.
To maintain compatibility with the current architecture of the pi-lomar project it would be nice to offer a 'command line' way to capture an image and produce the .fits file. Something similar to ...
libcamera-still --output {&output} --timeout 1 --nopreview --quality 100 --width {&width} --height {&height} --denoise off --analoggain 16.0 --shutter {&shutter}
I am testing a python script 'pilomarfits.py' for the next release which can be called in a similar way, using similar syntax but which will produce a basic .fits file and an unprocessed .jpg file as output.
python3 pilomarfits.py --output {&output} --quality 100 --width {&width} --height {&height} --shutter {&shutter} --tuning-file imx477_noir.json
This accepts the same command line options as the libcamera utilities so that pilomar.py can switch between the two solutions more easily. In the first version this will only implement the minimum command line options needed to produce an unprocessed .fits copy of the bayer data and an unprocessed .jpg file of the image in color. The .jpg files are 'unprocessed' in that they have no automatic exposure or white balance calculation, they are just simple debayered copies of the raw data.
If successful, pi-lomar can then use whichever driver you need.
This solution will not allow .fits exports on earlier O/S builds, it will need to be Bookworm or above. pilomarfits.py uses OpenCV to perform colour image functions and saving, so could be expanded further to save in some other formats if needed in the future too.