Exercises 06 Noise and Filter PDF
Exercises 06 Noise and Filter PDF
[email protected] 1/5
Image processing and analysis with ImageJ – Exercises - Topic 06 – Noise and Filter
d) Open the plant-noise image. Open the convolution tool and load the Gaussian.txt into it.
Run the convolution filter on the image.
Exercise 6.4 – Edge enhancing convolution filter - Sobel and Prewitt filter
Other kernels can be used to create edge enhancing filters.
a) The Prewitt filter is defined by the kernels:
−1 0 1 1 1 1
k x =−1 0 1 and k y = 0 0 0 . If Dx and Dy are the results of the convolution
−1 0 1 −1 −1 −1
of kx and ky with the input image then you have to calculate √ D2x +D 2y to apply the Prewitt
filter. Apply the Prewitt filter to the image rectangle.tif. Create a composite image of the
input image and the result (Image>Color>Merge Channels) Hints:
• convert the image to 32-bit first, make a copy and use the convolution-tool with the two
kernels
• you find the square and square-root operations under Process>Math
• Use the image calculator (Process>Image Calculator...) to add two images
b) Apply the Prewitt filter to the image roots.tif. Don't forget to convert it to 32-bits. Create an
overlay of the input image and the filtered image.
c) Another edge enhancing filter is the Sobel filter. It works in the same way but with the
kernels:
−1 0 1 1 2 1
k x =−2 0 2 and k y = 0 0 0 . Apply the Sobel-filter to the image
−1 0 1 −1 −2 −1
rectangle.tif and compare the result with the result of the command Process>Find Edges
d) High-pass or Uni Crisp filter can be used to apply a sharpening effect to an image. Convolve
−1 −1 −1
the image ophrys.tif with the kernel −1 12 −1 and compare the result with the result
−1 −1 −1
of the command Process>Sharpen.
e) A Laplacian of Gaussian (LoG) filter also called Mexican Hat Filter applies a gaussian
smoothing filter and an edge enhancing filter in one step. It can be used to detect spots.
Possible discrete approximations for the laplacian kernel are:
0 −1 0 −1 −1 −1
−1 4 −1 or −1 8 −1 . You can apply a LoG filter by first applying a
0 −1 0 −1 −1 −1
gaussian filter and then convolving with one of the above kernels. However the gaussian and
laplacian can be combined in one single kernel. Install the LoG plugin from
http://bigwww.epfl.ch/sage/soft/LoG3D/. Try to threshold the bright spots on the image.
Run the LoG plugin on the image. While applying it create the kernel as an image and have
a look at it. Try thresholding the spots after application of the filter.
[email protected] 2/5
Image processing and analysis with ImageJ – Exercises - Topic 06 – Noise and Filter
[email protected] 3/5
Image processing and analysis with ImageJ – Exercises - Topic 06 – Noise and Filter
[email protected] 4/5
Image processing and analysis with ImageJ – Exercises - Topic 06 – Noise and Filter
can efficiently be calculated. So we can use it to more efficiently apply convolution filters that do
not have a simple kernel in the spacial-domain.
Possible applications are:
• low-pass filter – smoothing – noise suppression
• high-pass filter – edge detection
• band-pass filter – detect structures with a given frequency
• correlation, template matching, stitching
• deconvolution (inverse filtering) (see 4.5 d) and e))
ImageJ allows to apply a Fourier transform under Process>FFT>FFT. As a result the
powerspectrum is displayed. This is a special image on which you can define a filter by making
regions white or black. Frequencies under the white mask will be passed, those under the black
mask will be suppressed when you calculate the inverse transformation (Process>FFT>Inverse
FFT).
a) Open the image pierre.tif. Calculate the Fourier transform. Do you see the two clusters on in
the upper left half and one in the lower right? Draw a white mask on them and calculate the
inverse transform. Is there an object in the image that corresponds to the frequencies that
passed?
b) Use the Fourier transform to suppress the noise in the image plant-noise.tif. Which
frequencies do you have to suppress?
c) Use the Fourier transform to detect the edges in the image ophrys.tif. Which frequencies do
you have to suppress?
d) The image lines.tif consists of vertical white lines that have a width of one pixel and a
distance of 4 pixel. How will the powerspectrum of the Fourier transform of the image look
like? Verify your answer by creating it.
e) Load the image text.tif and the image template.tif. Use the command correlate from
Process>FFT>FD Math to calculate the correlation between the text and the template.
Transform the resulting (spacial) image to 8-bit, move the minimum threshold value so the
right until only single points remain and apply the threshold. Now use Process>Find
Maxima to create a point selection from the points and transfer the point selection onto the
text image, to see which points gave the maximum response to the template.