Fundamentals of Image Processing demystified!

Image Processing does sound so cool, isn't it!? But are your signal processing fundamentals strong enough? After all image is also a 2D signal. Image processing can be implemented using various platforms like MATLAB, Python etc, but your expertise doesn't lie in that, what matters is your understanding of the subjects and the clarity of fundamentals which helps a very simple algorithm to be build for any complex problem. So, here I'm not really concerned with explaining what image processing is but I'll make sure I discuss certain concepts that will make learning image processing easy.
Certain key terms that you should be thorough with are:

  • Frequency
  • Signal
  • System
  • Convolution
  • Correlation
  • Transform
  • Digital Filters
Ask yourself what do you understand by all the above terms. Just keep your answer in mind and read through the following explanation to form a better understanding.


Frequency: You are hearing PM Narendra Modi giving a speech and in another channel a cricket commentary. This goes unsaid that you may find the speech to be easier to comprehend with every word being distinctly heard while the commentary to be little difficult to understand. Clearly what makes these two sounds different is their frequencies. Hence, frequency is nothing but the rate of change of a signal. A signal with low frequency contains a lot of information and is said to be slow changing signal while a signal with high frequency might be a little irritating at times to our ears as it is fast changing and so is treated as noise. Same goes when saying babies sleep listening to lullaby rather than a rap song.
Slow changing signal is thus of interest to us but is there any problem you can think of it? Yes, being slow changing it carries very less energy and so would die out soon without reaching a great distance. Well, this can be tackled by either amplifying the signal or doing a frequency modulation. Frequency modulation is nothing but passing the low frequency signal with a high frequency signal that can take it to a greater distance. Like you take your lunch box and eat the food inside that and not the box, right :P
So, frequency plays an important role because looking at the frequency you can understand if that signal is of interest to you or not.
To give an idea of one application, there is an image with a tumor cell that needs to be detected. So, all throughout the image you may find uniformity or the neighboring pixel values changing by a small amount (slow changing) but when a tumor cell is encountered, because it is captured differently than normal cells around it there is a sudden change in pixel value creating a high frequency region. Hence the algorithm will narrow down to just finding the high frequency regions.

Signal: Everyone knows what a signal is. Going by the technical definition it is just a function of one or more independent variable, independent variable like time you can say. It is important to know the characteristics of the signal in order to process it. And it would have different characteristics in time and frequency domains. It is also important to know what type of signal is it like casual, LTI or what. Taking me as an example, in my blog site I'll be talking about technical stuffs but if you find me on Instagram or Twitter you can find me talking about various other stuffs like travel photography, social causes etc. So taking this blog site as one domain, you will get only a little idea about me but if you change the domain you can find my more characteristics. Same goes with any signal, you will have to deal with both time and frequency domain to deduce more characteristics in order to understand the signal better for processing.

System: Anything you see is a system be it a mobile phone, a human body or any device. It is not at all important what happens inside the system but what is important is to have an understanding of the system. By saying understanding I mean you should know what a system does when you give a certain input. You'll attend a call by pressing green and reject using red so this is what is understanding, what happens inside is of no concern to us. Also it is very very necessary to know for what inputs the system will undergo instability. Essentially there are three things that you need to bother about any system, they are: Dynamics of the system i.e. the way system changes with time, Transfer function of the system that actually gives a relation between input and output and finally the stability of the system.

All the signal processing is done in the computer. Real life signal being analog in nature needs to be first converted to digital for giving it as input to the computer. Knowing what analog to digital conversion and vice-versa is thus essential. Any analog signal is first sampled or discretised in time. At this step following the sampling theorem is important (fs>2fm) because when you do the reverse to obtain analog from digital if initially sampling wasn't done properly then here you'll lose or overlap the information called aliasing effect. After sampling you know it is quantisation where selecting the no. of quantisation levels is important and is given by 2^n where n is the no. of bits.

Convolution: This is the best part. It is actually the origin of every digital signal processing algorithm. First giving the mathematical understanding:
So, 'x' basically denotes any signal along with noise and 'h' is the impulse response of the system. Filter can be the system, and actually convolution is a filtering process. How do you view it is this way: you want to approach your senior for some guidance but you don't know that person so first you'll talk to others who know him and form a reference response and by taking the reference being impulse it becomes the impulse response. After that you'll approach and finally form a complete response taking your as well as reference into consideration. You being the 'x' input and that senior being the system with the reference response 'h' and finally your output response is a convolution giving 'y' as resultant response. This is an explanation for 1D convolution. Now as we observed we need to do flip, shift, multiply, add all in one cycle which gets tedious so in such situation you change the domain and do a simple multiplication which gives the same result, this is actually a property of convolution.

Correlation: This gives degree of similarity between two signals in the form of percentage. There are two types of correlation: Auto correlation and Cross correlation. Auto correlation gives the similarity between a signal and the same signal after a certain period of time. Therefore allows to predict ahead of time. (note: convolution was back in time) Cross correlation gives degree of similarity between any two signals. Giving few application specific examples: There is a patient under observation whose ECG is taken every hour and compared with previous to draw similarity and predict future response that would help detect any heart problem. Speaker recognition also is based on this concept, where my speech is compared with my own saved speech and similarity is drawn. Same way in bio-metrics, degree of similarity between the fingerprints are found, this threshold is set like in highly secure places the degree of similarity required might be 90% and so on.

There are two more concepts, Transforms and Digital Filters that I'm yet to cover which I'm keeping for the next blog as I don't want to unnecessarily make this blog very long. If you want to dig more into these concepts sure do, there is hell lot to explore. Everything I have written can be explained by maths and formulas which I have avoided here.



1 comment:

My first Code-along workshop

I had one of the most satisfying Saturday last weekend and that feeling is the reason I'm writing a blog after almost a year. I often...