Author Topic: High-Pass Filter in PixInsight  (Read 9952 times)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
High-Pass Filter in PixInsight
« on: 2010 October 08 07:14:50 »
Hi everybody,

A number of users have recently asked how a high-pass filter can be implemented or applied in PixInsight. The answer is straightforward: use ATrousWaveletTransform as a low-pass filter and PixelMath to subtract low-frequency components. The screenshot below shows an example.


In this screenshot we have:

- test - This is the original image.

- low_pass - The low-frequency components. This is the result of applying the ATrousWaveletTransform instance shown, which simply removes the first five wavelet layers.

- high_pass - The high-pass filtered image. This is the result of subtracting low_pass from the original image. The subtraction has been performed with PixelMath.

You can vary the degree of high-pass filtering by varying the number of wavelet layers removed and the scaling function in ATW. Obviously, you can also apply the PixelMath instance through a mask (a luminance mask for example) to restrict high-pass filtering to high-SNR areas.

For programming-oriented people, I leave a JavaScript implementation of this high-pass filter as an exercise. It should not require more than 8 - 10 relevant lines of source code.

Now, before someone asks for this to be implemented as a dedicated tool, the question is: why? Why do you need such a rough tool in PixInsight, if you have a sophisticated wavelets processing tool (ATW)? What I have described above is a naive implementation of a high-pass filter (which is identical to the high-pass filter so famous in other applications). Besides being much less versatile and efficient than wavelets, such a naive implementation has an important drawback: ringing. The Gibbs phenomenon will cause dark rings to appear around all jump discontinuities in the image, such as stars. Our ATW tool has an efficient deringing feature that can prevent these problems very easily.

Anyway, now you know how to do it in PixInsight. Another exercise that we can bring up is how to implement a band-pass filter in PixInsight? :)
  
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: High-Pass Filter in PixInsight
« Reply #1 on: 2010 October 08 08:06:15 »
Juan,

I see you separeted the high frequency component. What do you after this?
The high freq. image is not that pretty or enhanced.

Max


Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: High-Pass Filter in PixInsight
« Reply #2 on: 2010 October 08 09:07:26 »
Any algorithm that performs a low-pass filter may be used to extract the high frecuency components. For example, Blur, GaussianBlur (the later I would recomend most, since it generates less ringing artefacts).
If you are interested in "rotational features", the Larson-Sekanina has a high pass mode that yields pure high pass filter, at 100% amount.
Regards,

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

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: High-Pass Filter in PixInsight
« Reply #3 on: 2010 October 08 09:09:33 »
Hi,

I wish to add that, contrarily to what some people think, the HDR Wavelet algorithm doesn't performs the same task to the image as a high pass filter. Local contrast in any high pass filter is dependent on local illumination level; HDRWT is independent of this. This is why HDRWT performs a dynamic range compression, while high pass filter doesn't. Take this example of this M42 image:



A high pass filter leads to this image:



Here we are not recovering local contrast in the nebula core. This is recovered with the HDRWT algorithm:




Max, with this image you can enhance small scales and the join it again with the original image. You can use this high pass filtering, but you will go much better with the small formulas I teached at the Adler, as you will get more homogeneous contras over the whole image.


Best regards,
Vicent.

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: High-Pass Filter in PixInsight
« Reply #4 on: 2010 October 08 19:28:00 »
In PS the method is a follows:

Make a new layer and apply the HP filter to it.

The layer is combined with overlay

(Hard light, vivid light and soft light  work too.)

So I think we are missing right the Pixel math formula to combine the images

Max



Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: High-Pass Filter in PixInsight
« Reply #5 on: 2010 October 08 19:54:20 »
This works

iif( IMG1 > 0.5, ~(~(2*(IMG1 - 0.5)) * ~IMG2), 2*IMG1*IMG2 )

Max