+ All Categories
Home > Documents > Filtering the Images. Filtering images using low-pass filters Filtering images using a median...

Filtering the Images. Filtering images using low-pass filters Filtering images using a median...

Date post: 19-Jan-2018
Category:
Upload: dominick-ray
View: 242 times
Download: 0 times
Share this document with a friend
Description:
 Definition:-  A Filter. =>is an operation that amplifis certain bands of frequencies of an image while blocking (or reducing) other image frequency bands
26
CHAPTER 6 Filtering the Images
Transcript
Page 1: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

CHAPTER 6Filtering the

Images

Page 2: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

In this chapter, we will cover:

Filtering images using low-pass filters

Filtering images using a median filter

Applying directional filters to detect edges

Computing the Laplacian of an image

Page 3: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

Introduction

Definition:- A Filter.=>is an operation that

amplifis certain bands of frequencies of an image while blocking (or reducing) other image frequency bands

Page 4: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

==> is one of the fundamental tasks in signal and image processing

  Signals : stationary &non stationary

 

Page 5: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

Why using filter? It is a process aimed1- extracting certain aspects of an image

that are considered to convey importantinformation in the context of a given

application.2- Filtering removes noise in images,3- extracts interesting visual features4- allows image resampling, and so on

Page 6: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.
Page 7: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.
Page 8: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

When we look at an image, we observe how the different gray-level (or colors) are distributed over the image. Images differ from each others because they have a different gray-level distribution

Page 9: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

low pass filter One simple way to achieve this goal is to replace

each pixel by the average value of the pixels around.

The objective of the cv::blur function is to smooth an image by replacing each pixel by the average pixel value computed over a rectangular neighborhood. This low-pass filter is appliedas follows:

cv::blur(image,result,cv::Size(5,5)); This kind of fiter is also called a box fiter  low pass filter= box fiter  

Page 10: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.
Page 11: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

problem :-In some cases, it might be desirable to give more importance to the closer pixels in the

neighborhood of a pixel.   This can be achieved by using a weighted scheme that follows a

Gaussian function (a "bell-shaped" function). The

cv::GaussianBlur function applies such a fiter and it is called as follows:

cv::GaussianBlur(image,result,cv::Size(5,5),1.5);

Page 12: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.
Page 13: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

How does it work?

This is like multiplying each neighboring pixel by 1 over the total number

of pixels and summing all of these values.

Page 14: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

Median Filter

Linear & Non-linear

Page 15: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

Non-linear filters median filters are particularly useful to

combat salt-and-pepper noise

Page 16: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

How does it work? The call to the median filtering function is

done in a way similar to the other filters: cv::medianBlur(image,result,5);

Page 17: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

Computing the Laplacian of an image

The Laplacian is another high pass(high frequancy) it show the edges of image.

linear filter that is based on the computation of the imagederivatives. As it will be explained, it computes second-order derivatives to measure thecurvature of the image function.

Page 18: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

Relating edges and derivatives

One derivatives

Second derivatives

Page 19: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

How it in opencv? The Open CV function cv :: Laplacian

computes the Laplacian of an image. It is very similar to the cv::Sobel function. In fact, it uses the same basic function cv :: getDerivKernels in order to obtain its kernel matrix. The only difference is that there is no derivative order parameters since these ones are by defination second order derivatives. For this operator, we will create a simple class that will encapsulate some useful operations related to the Laplacian.

Page 20: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

The Code class LaplacianZC { private: // original image cv::Mat img; // 32-bit float image containing the Laplacian cv::Mat laplace; // Aperture size of the laplacian kernel int aperture; public: LaplacianZC() : aperture(3) {} // Set the aperture size of the kernel void setAperture(int a) { aperture= a; } // Compute the floating point Laplacian cv::Mat computeLaplacian(const cv::Mat& image) { // Compute Laplacian cv::Laplacian(image,laplace,CV_32F,aperture); // Keep local copy of the image (used for zero-crossings) img= image.clone(); return laplace; }

Page 21: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

Before code After code

Page 22: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

About The Sobel and Laplacian Edge Detectors

The function of The Sobel and Laplacian Edge Detectors is do edge detection.

But Laplacian Edge Detectors is more showing edge detection than Sobel .

It is similar in mask to Sobel that in Sobel the kernel (mask) is 3x3 but compute the Laplacian using larger kernels such as 7x7 kernel.

The disadvanteges is more sensitive to image noise because it show clearly the edges.

You need specific filter according to need of application

Page 23: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

The Sobel and Laplacian Edge Detectors

Page 24: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

How it work? In its simplest form, it can be

approximated by the following 3x3 kernel:

As for the Sobel operator, it is also possible to compute the Laplacian using larger kernels , and since this operator is even more sensitive to image noise.

Page 25: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

zero-crossing

Page 26: Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.

zero-crossing The zero crossing detector looks for

places in the Laplacian of an image where the value of the Laplacian passes through zero.

zero crossings also occur at any place where the image intensity gradient starts increasing or starts decreasing, and this may happen at places that are not obviously edges


Recommended