Image Filtering

The package ImageFiltering.jl makes it easy to apply arbitrary filters to images.

Gaussian Blurs

Let's start by downloading a radio image of Hercules A:

using AstroImages
using ImageFiltering

fname = download(
    "http://www.astro.uvic.ca/~wthompson/astroimages/fits/herca/herca_radio.fits",
    "herca-radio.fits"
)

herca = load("herca-radio.fits")

Let's now apply a Gaussian blur (aka a low pass filter) using the imfilter function:

herca_blur_20 = imfilter(herca, Kernel.gaussian(20.0))

The image has been smoothed out by convolving it with a wide Gaussian.

Let's now do the opposite and perform a high-pass filter. This will bring out faint variations in structure. We can do this by subtracting a blurred image from the original:

herca_blur_4 = imfilter(herca, Kernel.gaussian(4.0))
herca_highpass = herca .- herca_blur_4

We now see lots of faint structure inside the jets!

Finally, let's adjust how the image is displayed and apply a non-linear stretch:

imview(
    herca_highpass,
    cmap=:seaborn_rocket_gradient,
    clims=(-50,1500),
    stretch=asinhstretch
)