Hi Juan,
When I complete my deBayer routine, I (obviously) end up with an RGB tri-colour image.
The last thing I do (at the moment) before saving to disk, is to issue a <rescale()> command.
However, if I then open that image in PI, and the open a Histogram process, I find that I can ALWAYS, ALWAYS, throw a 'clip to shadows' and 'clip to highlights' command at the image, and I will ALWAYS get an 'expansion' of the R, G and B histo-curves to fit the full 0 to 1 range.
It do this, manually, by clicking on the appropriate buttons within the Histo dialog, whilst looking at the RGB/K panel. The results that I then see if I examine the individual R, G or B panels are exactly the same as had I clicked the 'clip to min' and 'clip to max' buttons on each individual colour panel. They are also exactly the same as had I looked at the Image Statistics window for the image, and 'copied and pasted' the Min and Max values over, for each colour plane.
Certainly, some of the Max/Min values might actually already be AT either '0.0', or '1.0' - but they will not ALL be thus.
I have proved, empirically, that my best deBayer results come from this Histo Expansion, followed by a PixelMath step that aligns all the R, G and B 'median' to the 'highest' median of the trio, followed by an empirically derived 'Hue' Curve derived on the camera that actually gathered the data in the first place.
Certainly, with these three steps, I can recreate almost PERFECT colours from a 'daylight-exposed' image - and I am trying to establish whether this approach is valid for astro-imaging as well (it seems a reasonably hypothesis to me anyway, as I cannot see how the camera would know WHERE the incoming photons were coming from, all it can do is count such photons as they arrive, withing the constraints of the exposure time)
So, what I need to be able to do is to determine the Min and Max values for each colour plane, and to pass these values to the H array for the Histo process.
I do NOT believe that 'rescale()' is the answer to this problem.
In any case, I would also like to know how to access 'any' of the parameters available from the 'ImageStatistics' property - I am sure that this ability may well be of use in other applications that I have in mind.
Cheers,