Noise Filtering & Edge Detection Jeremy Wyatt
Filtering Last time we saw that we could detect edges by calculating the intensity change (gradient) across the image We saw that we could implement this using the idea of filtering
Linear filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i j NB We count from the upper left,and in MATLAB we start at 1
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=3
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=4
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=2 j=5
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=3 j=2
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=3 j=3
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=3 j=4
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end i+y j+x y+2 x+2 i=3 j=5
Noise filtering We can use convolution to remove noise as we mentioned, e.g. mean filter This is a linear filter The most widely used is Gaussian filtering
Effect of mean filtering Original3x3 filter5x5 filter
Horizontal Sobel operator Abs(G x ) Threshold=30 5x5 Mean Filter Horizontal Sobel operator Abs(G x ) Threshold=30
Effect of Gaussian filtering Original5x5 filterHorizontal Sobel Operator Abs(G x ) Threshold = 30
Sequenced filters We can replace a 2d Gaussian filter with 2, 1d Gaussian filters in sequence
Gaussian edge detection We can take the first derivative of the masks and then convolve with those Then we can combine the resulting images using the formula for magnitude However when thresholded we can see that this loses edge information How can we keep this?
Second order operators Thresholding the first derivative of the smoothed signal thickens the edges and also we lose some useful edges One solution is therefore to take the second derivative instead A basic second order mask is the Laplacian
Reading RC Jain, Chapter 4