Closed sschmaus closed 2 years ago
Issue is in sciimg submodule in rgbimage.rs, line 330, which only ever grabs band 0 from the flat. I'll fix that by adding a check for additional bands (not assuming three channel RGB or single channel monochrome)
For reference: https://github.com/kmgill/sciimg
Fixed with update to sciimg. Update to Cargo.toml for updated sciimg version number. Reference: https://github.com/kmgill/sciimg/commit/25cf445f4532e0439c174083b21b8b9cccc00537
Expected Behavior
Calibrating a HELI_RTE image should perform a flatfield calibration that removes the color gradient in the original images. I modelled the RTE flat V3 with slightly different gradients per channel, so the apparent color cast can be corrected.
This is how it should look like (per channel calculation of![HSF_0418_0703689905_000ECM_N0270001HELI00000_000085J01-rjcal_Gimp](https://user-images.githubusercontent.com/32999741/165858697-1fd2a0ad-3d7a-435c-a631-cfd01d7cb168.jpg)
RTE_IMAGE*mean(RTE_FLAT)/RTE_FLAT
)Actual Behavior
Currently MRU appears to calibrate all channels with the same flat values. It appears to use either just one of the flatframe RGB channels or a greyscale version of the flatframe. Therefore the luminance gradient is corrected, but a color gradient remains.
This calibration has worked correctly in the past, I first noticed this issue with versions after the switch to sciimg.
This is the output from MRU:![HSF_0418_0703689905_000ECM_N0270001HELI00000_000085J01-rjcal_MRU](https://user-images.githubusercontent.com/32999741/165858281-e10537ce-9712-4951-bf3f-8b31e072f31a.jpg)
Steps to Reproduce the Problem
m20_hrte_calibrate -i *.png
Possible Solution
Perform the flatfield correction on every channel individually and with the corresponding flatframe channel. i.e: R:
RTE_IMAGE_R*mean(RTE_FLAT_R)/RTE_FLAT_R
G:RTE_IMAGE_G*mean(RTE_FLAT_G)/RTE_FLAT_G
B:RTE_IMAGE_B*mean(RTE_FLAT_B)/RTE_FLAT_B
Specifications
Subsystem: native
also tested with a slightly older version of MRU in WSL2/Ubuntu 20.04 on Windows