Author Topic: Adding Ha to RGB  (Read 10166 times)

Offline swag72

  • Member
  • *
  • Posts: 56
Adding Ha to RGB
« on: 2012 January 21 08:50:28 »
I have recently combined some Ha data of IC2162 with RGB data of the same image. It's quite a large nebula that shows quite a bit of detail in my very rough Ha process here


IC2162 Ha by swag72, on Flickr

However, once I combined the Ha with the RGB using Harry's tutorial and pixelmath, I found that I lost a lot of the detail as it was mapped into the red channel.


IC2162 in HaRGB Sh2-254/55/56/57 by swag72, on Flickr

Is there something I have done wrong within that? Can you guys see anything or suggest anything as to why the detail has been lost? For example in PixelMath I put *1 (or maybe *2) in the formula for adding the Ha. Should I have used a larger number and would that have washed out the data a little?

I hope someone can shed some light on this and make some suggestions as to what I may have done wrong. I did wonder about whether the Ha data should have been processed first to get the detail out before adding it, but then it wouldn't be a linear image, so that wouldn't work.

Offline marekc

  • PixInsight Addict
  • ***
  • Posts: 177
Re: Adding Ha to RGB
« Reply #1 on: 2012 January 21 12:19:49 »
Although this won't help with the basic issue (overall loss of detail), here's one thing that occurred to me:

You're partially right that processing the Ha image can take it out of the `linear realm'. But that mostly applies to stretching the image's histogram, such as with HistogramTransformation. There are some forms of processing that will keep the image linear. The two main ones (AFAIK) are noise reduction and deconvolution. There have been some good posts recently by Juan and Harry, explaining how to do noise reduction with ATWT and its new successor, MultiscaleMedianTransform. There's also a good `tutorial' on Deconvolution (by Juan) in a thread about `Deconv Deringing Wrecks Images?'. (Just search the PI Forum for the word `wrecks' and you'll probably find it.) The new DynamicPSF tool is very handy for making a good PSF to feed into Deconvolution.

So, some noise reduction and deconvolution could be used to sharpen up your Ha image (or any of your color channels) while still in a linear state. That probably won't solve the whole problem, but it might help a bit.

Offline swag72

  • Member
  • *
  • Posts: 56
Re: Adding Ha to RGB
« Reply #2 on: 2012 January 21 13:11:55 »
Thanks for taking the time to reply. I did try some deconvolution in the linear mode, following a tutorial on the main PI forum, but clearly didn't help much. I found the sharpening in the non linear mode to be much more effective. Will hunt out the tutorial you mention (no luck with 'wrecks' search so far!)

Is there really no way to combine the channels once they are non linear? Maybe I'll have to do that in PS.

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Adding Ha to RGB
« Reply #3 on: 2012 January 21 13:44:44 »
http://pixinsight.com/forum/index.php?topic=2727.0

you can combine channels whether they are linear or not, does not really matter; that's up to you.

Offline swag72

  • Member
  • *
  • Posts: 56
Re: Adding Ha to RGB
« Reply #4 on: 2012 January 21 13:57:32 »
Thanks for the tutorial link - Will read that.

How do you combine non linear images? The tutorials I have watched of Harry's do it all with linear data. Is the process any different?

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Adding Ha to RGB
« Reply #5 on: 2012 January 21 17:12:05 »
you can use pixelmath, for instance... if you have 3 greyscale images corresponding to the R,G and B channels, all you need to do is uncheck the 'use a single expression for rgb' box, and then put the names of each image in the R, G and B expressions in pixelmath, then set pixelmath to target a new image, and apply.

Offline swag72

  • Member
  • *
  • Posts: 56
Re: Adding Ha to RGB
« Reply #6 on: 2012 January 22 00:18:48 »
I am really very new to Pixelmath - Can you explain or point me to some reading regarding the expressions?

I can untick the box you mention, but then I don't understand what needs to be put in the box that does the business.

Sorry to be a pain.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Adding Ha to RGB
« Reply #7 on: 2012 January 22 03:58:51 »
Hi Sara

Some centuries ago I wrote a PixelMath tutorial:

http://pixinsight.com/tutorials/PixelMath/en.html

which is now pretty obsolete but may be useful to get your feet wet with this tool.

Using PixelMath is much simpler than it may seem at first glance. The first important thing to remember is that each image has a unique identifier (read: a name) in PixInsight. By default an identifier based on the image's file name is assigned when you open a file, but you can change it to something more manageable by double clicking on the main view's selector (a view selector is the vertical tab at the left side of the image window). For example, let's say you assign the following identifiers to your red, green, blue and hydrogen alpha images, respectively:

R
G
B
Ha

Then the following PixelMath expressions would allow you to mix one half of the Ha image with the R channel:

Code: [Select]
(R + Ha)/2
G
B

As Rob has said you have to disable the "Use a single RGB/K expression" option of PixelMath to enable the three expression slots. You should also disable "Rescale result" in this case to preserve the original channel data. To execute this PixelMath expression you have several options. The simplest one is to create a duplicate of one of the images, convert it to the RGB color space (Image > Color Spaces > Convert to RGB Color), and apply the PM instance to it. A better option is setting the following options in the Destination section of PM:

Create new image: enabled
Image width: <as target>
Image height: <as target >
Color space: RGB color
Sample format: 32-bit floating point

and then apply PM to one of the images (no matter which one; the target image is only used to acquire the width and height in pixels in this case).

Mixing red and Ha by equal parts usually yields quite poor results. Let's say you want to create your red channel as a 25% of red and the rest of Ha, which seems more reasonable. These expressions do the trick:

Code: [Select]
0.25*R + 0.75*Ha
G
B

As you see, the PixelMath language is very similar to common algebraic notation. You can refer to the 'target image', that is to the image to which you apply PM, as $T (or equivalently $target). $M (or $mask) stands for the active mask image of the target image. Most of the time PixelMath is used in 'single expression' mode, that is defining a single expression that is applied to all nominal channels of the image, but in these cases we need separate expressions to control how each channel is generated.

Now that you know how to use PixelMath to blend your Ha with your red channel data, you know how to implement the worst way to carry out this task :) Why is this the wrong way? Because a plain mix of red and Ha data leads to two important problems: star images are damaged or lost (because stars are much smaller and dimmer in the Ha image), and the signal-to-noise ratio of the resulting image is severely degraded.

A somewhat better result can be obtained with a maximum operator applied to the red and Ha images. In PixelMath terms:

Code: [Select]
max( R, Ha )
G
B

which requires that both R and Ha images be statistically compatible. You can achieve this with the LinearFit tool: just select one of the images as reference and apply LinearFit to the other image. The maximum operation solves the problem with the stars, but it doesn't fix the noise transference problem. Now that you have more information on this topic, you may be interested in the correct way to merge Ha and red data:

http://pixinsight.com/tutorials/narrowband/theory/en.html

Hope this helps.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline swag72

  • Member
  • *
  • Posts: 56
Re: Adding Ha to RGB
« Reply #8 on: 2012 January 22 04:18:22 »
Brilliant Juan - There's a lot of info there and I will read through it slowly with Pixelmath open!! The tutorial will be a useful read too. Many thanks for your help.