270 likes | 386 Views
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
E N D
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 end j+x x+2 j y+2 i i+y 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 end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=3 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=4 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=5 x+2 y+2 i=2 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=2 x+2 y+2 i=3 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=3 x+2 y+2 i=3 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=4 x+2 y+2 i=3 i+y
Linear Filtering: the algorithm for i=2:image_height-1 for j=2:image_width-1 end end j+x j=5 x+2 y+2 i=3 i+y
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 Original 3x3 filter 5x5 filter
Horizontal Sobel operator Abs(Gx) Threshold=30 5x5 Mean Filter Horizontal Sobel operator Abs(Gx) Threshold=30
Effect of Gaussian filtering Original 5x5 filter Horizontal Sobel Operator Abs(Gx) 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