The following problems appeared in the exercises in the **Coursera course Image Processing (by Northwestern University)**. The following descriptions of the problems are taken directly from the exercises’ descriptions.

The next figure shows the problem statement. Although it was originally implemented in *MATLAB*, in this article a *python* implementation is going to be described.

The following figure shows how the images get more and more **blurred** after the application of the **nxn LPF** as *n* increases.

The following figure shows how the quality of the transformed image decreases when compared to the original image, when an *nxn LPF* is applied and how the quality (measured in terms of *PSNR*) degrades as *n* (*LPF kernel* width) increases.

The following figure describes the problem:

The following steps are needed to be followed:

- Smooth the original image with a 3×3 LPF (box1)
*kernel*. - Downsample (choose pixels corresponding to every odd rows and columns)
- Upsample the image (double the width and height)
- Use the kernel and use it for convolution with the upsampled image to obtain the final image.

Although in the original implementation *MATLAB* was used, but the following results come from a *python* implementation.

As we go on increasing the kernel size, the quality fo the final image obtained by down/up sampling the original image decreases as *n* increases, as shown in the following figure.

The following figure describes the problem:

For example we are provided with the input image with known location of an object (**face marked with a rectangle**) as shown below.

Now we are provided with another image which is the **next frame** extracted from the same video but with the **face unmarked**) as shown below. The problem is that we have to locate the face in this next frame and mark it using simple **block matching** technique (and thereby estimate the motion).

As shown below, using just the **simple block matching**, we can mark the face in the very next frame.

Now let’s play with the following two videos. The first one is the video of some students working on a university corridor, as shown below (obtained from *youtube*), extract some consecutive frames, mark a face in one image and use that image to mark all thew faces om the remaining frames that are consecutive to each other, thereby mark the entire video and estimate the motion using the simple **block matching technique** only.

The following figure shows the *frame* with the **face marked**, now we shall use this image and **block matching** technique to* estimate the motion* of the student in the video, by marking his face in all the consecutive frames and reconstructing the video, as shown below..

The second video is the video of the *Google CEO Mr. Pichai* talking at Google I/O 2017, as shown below (obtained from *youtube*), again extract some *consecutive frames*, mark his face in *one* image and use that image to mark all the faces in the remaining frames that are *consecutive* to each other, thereby mark the entire video and *estimate the motion* using the simple **block matching technique** only.

The following figure shows the frame with the **face marked**, now we shall use this image and **block matching** technique to estimate the motion of the *Google CEO* in the video, by marking his face in all the consecutive frames and reconstructing the video, as shown below.

The most interesting thing above is that we have not used any sophisticated *image features* such as *HOG / **SIFT*, still it did a pretty descent job with simple *block matching*.

The following figure describes the problem:

The following figure shows the *original image*, the *noisy image* and images obtained after applying the *median filter of different sizes (*nxn*, for different values of *n):

As can be seen from the following figure, the *optimal median filter size* is *5×5*, which generates the highest quality output, when compared to the *original image*.

The following figure shows the description of the problem:

The following figure shows the theory behind the **inverse filters** in the **(frequency) spectral domain**.

The following are the steps for the *restoring* an image with **motion blurs** and noise-corruption using the **Inverse Filter**:

- Generate
*restoration filter*in the frequency domain (with) from**Fast Fourier Transform***frequency response*of*motion blur*and using the threshold**T**. - Get the
*spectrum*of*blurred*and*noisy-corrupted*image (the input to restoration). - Compute
*spectrum*of*restored image*by*convolving*the*restoration filter*with the*blurred noisy image*in the*frequency domain*. - Genrate the
*restored image*from its*spectrum (with*.**inverse Fourier Transform**)

The following figures show the **inverse filter** is applied with different threshold value *T* (starting from **0.1** to **0.9** in that order) to *restore* the noisy / blurred image.

The following figure shows how the *Restored PSNR* and the *ISNR* varies with different values if the threshold *T*.

© 2020 Data Science Central ® Powered by

Badges | Report an Issue | Privacy Policy | Terms of Service

**Most Popular Content on DSC**

To not miss this type of content in the future, subscribe to our newsletter.

- Book: Statistics -- New Foundations, Toolbox, and Machine Learning Recipes
- Book: Classification and Regression In a Weekend - With Python
- Book: Applied Stochastic Processes
- Long-range Correlations in Time Series: Modeling, Testing, Case Study
- How to Automatically Determine the Number of Clusters in your Data
- New Machine Learning Cheat Sheet | Old one
- Confidence Intervals Without Pain - With Resampling
- Advanced Machine Learning with Basic Excel
- New Perspectives on Statistical Distributions and Deep Learning
- Fascinating New Results in the Theory of Randomness
- Fast Combinatorial Feature Selection

**Other popular resources**

- Comprehensive Repository of Data Science and ML Resources
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- 100 Data Science Interview Questions and Answers
- Cheat Sheets | Curated Articles | Search | Jobs | Courses
- Post a Blog | Forum Questions | Books | Salaries | News

**Archives:** 2008-2014 |
2015-2016 |
2017-2019 |
Book 1 |
Book 2 |
More

**Most popular articles**

- Free Book and Resources for DSC Members
- New Perspectives on Statistical Distributions and Deep Learning
- Time series, Growth Modeling and Data Science Wizardy
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- Comprehensive Repository of Data Science and ML Resources
- Advanced Machine Learning with Basic Excel
- Difference between ML, Data Science, AI, Deep Learning, and Statistics
- Selected Business Analytics, Data Science and ML articles
- How to Automatically Determine the Number of Clusters in your Data
- Fascinating New Results in the Theory of Randomness
- Hire a Data Scientist | Search DSC | Find a Job
- Post a Blog | Forum Questions

## You need to be a member of Data Science Central to add comments!

Join Data Science Central