/signal-image-processing-tutorial

Tutorial/demo for simple signal and image processing with Matlab

Primary LanguageMATLABMIT LicenseMIT

Signal and image processing - simple Matlab tutorial

Overview:


Description

This is a very short and simple demo/tutorial for signal and image processing with Matlab without using specific high-level libraries

Signal processing:

Execute script signal_filter.m

  • We start from a clean sinusoid
  • Add some Gaussian noise and few other sinusoids ad different frequencies to mess the signal up a little bit.
  • Perform a low pass filtering
  • Perform a moving average filtering
  • Finally perform a moving average filtering on the previously low-pass filtered signal
  • plot the signals to see the results

Image processing:

Execute script image_filter.m

  • Read the input image lena_noise.png -> it is a grayscale image with Gaussian noise
  • Create kernels/filters:
    • Laplacian filtering: edges enphasizing
    • Directional filtering
    • High-pass filtering: sharpening
  • Perform convolution between the image and the filters
  • Show the better-looking output image

More in depth explanation

More in depth signal processing:

Low-pass filter:

LTI filter --> system equation:

For filters, it is useful to design in the frequency domain --> Z Transform

Transfer function H(z): a filter's behavior can be entirely described by its transfer function


In Matlab we have a signal with white noise and some high frequency disturbing components, so I used butter to get the transfer function of a low-pass filter to cut off those waves

Output:



The i-th value of the output needs the previous output values, how many depends on the degree of the transfer function.
In out case the degree is 8, so I forced the first 7 values of the output to zero.
Collateral effect: this introduced a slight phase shifting

Moving average:

We have a window of dimension d, make it slide through the signal and every point of it is approximated to the average of the adjacent d values.
It’s important to choose a correct window dimension:


More in depth image processing:

Image filtering: create a kernel/filter and make it slide on the image performing convolutions



In our case, the input image is blurred and we apply:

  • Laplacian filter for edge enphasizing
  • Directional filter
  • High-pass filter for sharpening

Results:

Signal processing:

Image processing: