Author Topic: LRGB vs ChannelCombination  (Read 8037 times)

Offline Luc Coiffier

  • Newcomer
  • Posts: 18
    • http://deepskystacker.free.fr
LRGB vs ChannelCombination
« on: 2006 December 02 14:20:04 »
Hi All,

My question is coming from a little experiment I did today while writing a little PixInsight tutorial for a french web community forum.

Basically I tried to explain how the combine the enhanced luminance back with my RGB channels.
Usually I am using the following method:
First create an image with flat colors. It is done using the PixelMath and the formula for each channel is
$target[(channel number)]/($target[0]+$target[1]+$target[2]).

Then I am using the LRGBCombination to combine my luminance with this flat colors image.
I need to create a flat color image before because if I am doing this on my original very dark image most of the colors are desaturated (grayed).

Today I tried a different method using ChannelCombination.
First I extracted the HSV from my original image (using ChannelExtraction) then I combine H and S with my luminance using ChannelCombination.
The result is ok, nice saturated colors.

Now if I am doing this with HSI or any of the CIE L* I am ending with desaturated colors.

Why so much difference?

Thanks,
Luc

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
LRGB vs ChannelCombination
« Reply #1 on: 2006 December 05 02:09:29 »
Hi Luc,

First of all, you have discovered a bug in the ChannelCombination process: the HSI space is not working correctly. Add one more to your personal account  :wink:

The problem is that very saturated colors become almost unsaturated when an image is recombined from its HSI components. I am still not sure if this problem is in PCL code (as I suspect) or in ChannelCombination. This bug has existed unadvertedly during more than one year, probably because HSI is seldomly used. I'll fix it as quickly as possible.

The rest of color spaces (RGB, CIE XYZ, CIE Lab, CIE Lch) and the HSV ordering system are all working flawlessly in both ChannelExtraction and ChannelCombination.

Come on now with your technique for LRGB combination. You are dividing each pixel sample of your color image by the sum R+G+B. As long as you have no black (or insignificant) pixel in your image --which would lead to a division by zero--, there is no problem with color balance in doing this, since you are dividing each channel by the same number.

Since you are using a DSLR, I assume that you are starting from RGB raw data instead of the separate R,G,B,L data set used in the typical CCD workflow.

As you are planning your processing (if I understand it well), your also have a luminance image and a RGB image, both of them linear, just as in the CCD workflow. However, your luminance is synthetic, that is, you have derived it from your raw RGB data. Then you want to process your luminance applying a nonlinear stretch, wavelets, etc. Finally, you want to recombine your processed luminance with the color data. The problem here is that you are combining a nonlinear luminance with a nonlinear chrominance, but the applied nonlinear functions are different (very different, probably).

My advice is to apply a nonlinear transform to the RGB data as a whole, instead of the divide operation that you are using. Basically, since you are starting from a RGB image, the best way to have both luminance and chrominance well balanced (which is essential) is to apply the same initial nonlinear stretch to the raw RGB image with HistogramTransform. See our last tutorial about ACDNR; there you have an example with a DSLR M45 image that has been processed from scratch.

Most tools in PixInsight allow you to process luminance and chrominance separately. For example, if you want to apply wavelets to the luminance, for structural enhancement purposes, then you have no need to extract the luminance and process it apart, since ATrousWaveletTransform does this automatically for you.

While processing a synthetic luminance separately can be a good strategy sometimes, if you start with raw RGB data, as in the DSLR and one-shot CCD worlds, you should always apply the same nonlinear transform to the linear raw data as a whole. This guarantees that you'll have luminance and chrominance synchronized in terms of the overall brightness/contrast ratio or, in other words, that you'll have enough chrominance to sustain the luminance.

Hope this clarifies. I'll publish a note here when the HSI bug gets fixed.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Luc Coiffier

  • Newcomer
  • Posts: 18
    • http://deepskystacker.free.fr
LRGB vs ChannelCombination
« Reply #2 on: 2006 December 07 10:23:42 »
Hi Juan,

Thanks for the answer. :D

In fact one of the reason I am trying to work on the luminance alone is that it is easier to see the small modifications created by each post-processing step on a monochrome image.

However since everything is saved as process icons it should be easy to apply all the processes on the color image before LRGBCombination.

I will try this next time.

Luc

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
LRGB vs ChannelCombination
« Reply #3 on: 2006 December 07 13:11:52 »
Hi Luc :)

Take a look into the display toolbar. There you may change the displayed channel to the CIE L one. :)
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Luc Coiffier

  • Newcomer
  • Posts: 18
    • http://deepskystacker.free.fr
LRGB vs ChannelCombination
« Reply #4 on: 2006 December 08 11:48:43 »
Hi Carlos :-)

Bloody hell ! I didn't know it was possible. :oops:
Silly me, I have been using PixInsight for (biiip) years...

Thanks a lot for the tip  :D

Luc