 Hello guys, I am Sujar and I am a TA for signal systems. I am Aditya and I am also a TA for signals and systems part 2. Today's topic is a moire patterns and effect of aliasing in two dimension. So we have all learnt about aliasing in one dimension and how imposter terms come into the picture if we sample a signal at a rate which is less than the Nyquist rate. So today we will see what happens when we do that in two dimension. First of all let's just revise the one dimensional case. Consider a situation where you have two sine waves, one is at 500 hertz and the other is at 1500 hertz. You get the same thing in the negative side because the signal is assumed to be real. Now ideally we would have to sample this at 1500 into 2 that is 3000. We would need to sample this at greater than 3000 hertz. But supposing we sample it at just 1010 hertz. So then we get carbon copies which are shifted by integral multiples of 1010 hertz. So 1010 hertz each frequency is shifted by this. So 500 goes to 500 minus 1010 hertz which is here and this comes here 1500 hertz manifests itself at 490. So supposing we would put a low pass filter at 500 we would have two frequencies which are very close to each other. So 1500 sine wave is manifesting itself as the 490 hertz sine wave and what happens when you add two sine waves of very close frequencies you get something called as beats. So we will show you a demonstration of what beats is. So let's see how beats are formed graphically. So we have written a code to demonstrate how beats are formed graphically. For this demonstration we are using two sine waves of frequency 1000 hertz and 1000 5 hertz. So according to the mathematics there is a difference between the two sine waves is 5 hertz and the beat frequency will be 2.5 hertz. Let's see how the sine wave of 1000 hertz frequency looked like. So this is a sine wave of frequency 1000 hertz. Now let's move on to sine wave with frequency 1000 5 hertz. You won't be able to tell the difference between the two sine waves because the frequency difference is very less. Now let's see what happens when we add both the sine waves. The sine wave of 1000 hertz and sine wave of 1000 5 hertz. The difference of frequency is 5 hertz. So you can see there is an envelope and inside that there is a high frequency sine wave. You won't be able to see the high frequency sine wave. So we will zoom it for you. So as you see inside the envelope you have a high frequency sine wave. The frequency of this sine wave would be around 1000 hertz. So this is how beats is formed and we have seen it graphically. Now let us see how beats are formed mathematically. Let us take two cos waves of frequency omega 1 and omega 2 where omega 1 is 1000 hertz and omega 2 is 1001 hertz. So what we get is cos of omega 1t plus cos of omega 2t. This is 2 cos of omega 1 minus omega 2 by 2 times t into cos of omega 1 plus omega 2 by 2 times t. So this omega 1 minus omega 2 by 2 is just 0.5 hertz whereas this is nearly equal to 1000 hertz. So we can see that a very fast sinusoid is being modulated by a very slow envelope. The envelopes frequency is 0.5 and the inner oscillations are taking place at 1000 hertz. So this is how beats are formed. So now let us hear how beats actually sound. So on our phones we have a couple of apps which can play the pure sine wave of the specified frequency. So first I will be playing pure sine wave of frequency 1384 hertz. So this is how it sounds. Now I will be playing the sine wave of 1393 hertz. This is how it sounds. Both of them sound quite similar but let us see how they sound when they are played together. So we see that the frequency are not too far. So we are not able to perceive each frequency differently but we will see how we can perceive beats when we are playing these two sounds together. So in my phone I am playing both the frequencies together. So this is how it sounds. So hopefully you are able to listen to the beats. Here the frequencies were 9 hertz apart. So the beat frequency according to the mathematics we have just done is 4.5 hertz and the frequency inside the envelope will be approximately 1384 hertz. So now we have completely seen how beat formation occurs in real life. This is as a cause of aliasing. Due to aliasing higher frequencies manifest themselves as lower frequencies and if they come very close to each other beat formation occurs and give rise to these effects as we have shown. Now that we have looked at examples of one-dimensional aliasing we will move on to two-dimensional aliasing. Before that we will see what Moewe patterns are. So Aditi is holding a transparent sheet. So Aditi is holding a transparent sheet with black stripes printed on it which are very close to one another. Now let us see what happens when we bring both together. So as you can see the blades of the windmill are rotating but in the original image it was just stationary. So this is an example of Moewe pattern. Now let us take another example. Again we have the same transparent sheet with black stripes over it and we have a different pattern this time. So when Aditi moves the transparent sheet over the pattern we see that there are few people climbing up the stairs. So this is again an example of Moewe pattern. The Moewe patterns that we just saw they are one of the causes is aliasing in two dimensions. But to analyze it mathematically in the frequency domain is not as easy as in the one-dimensional case. So let us just get a qualitative picture of how Moewe patterns are caused due to aliasing. So before getting on to the explanations we will show some other examples. Now let us see an image of a checkered shirt. You see that in this smaller image you see a lot of patterns. This is a Moewe pattern but when I enlarge this image you see the patterns are not actually existing. This is an example of aliasing in two-dimension and how it causes Moewe patterns. Now let us look at a simple explanation about aliasing in two-dimension. So let us start by understanding what frequency means in the images. So we have an image here. So let the size of image be n cross n and we have two directions basically. One is let us take this as the x direction and other is y direction. So as we see we have two directions but in time signal we have only one direction. This is the value of function at that time but here we have two directions. We have two variables. So image is basically a function of two variables. It was very easy to comprehend what frequency is in time domain but it is little difficult to comprehend what frequency means in spatial domain. In fact we have two frequencies for depicting a picture in a frequency domain. So let us see what do we mean by frequency. Now let us take this image and let us draw a pattern like this. So this is a black line, the same pattern which we had used to see the example of Moewe pattern. So as you can see as we progress in the direction of x, so this direction as we progress from left to right we see that we actually come across certain white region then a black region then white region then black region and let us take that this spacing is del x and it is uniform even if the image shows that they are not non-uniform. Let us assume for some time that it is uniform. So when we draw a line or slice the image in one direction we will see that this black pattern is repeating at certain intervals basically it is periodic. So if we move from left to right we actually encounter a periodic signal. So this is what we mean by the frequency in x direction. So x direction has some frequency which is determined by delta x. Now let us look at what do we mean by frequency in y direction. So let us take another image again this is n cross n and again we have the same directions but now we take a slightly different pattern. Instead of vertical lines we have the horizontal lines and it continues. Now if we take a slice in the y direction we will encounter these black points and again let us assume that this is equidistant we will again encounter these black points over the line at equidistant lengths. So this is again an example of periodic signal. So these black dots are appearing at periodic intervals. So this depicts a frequency in y direction. So basically we now have a frequency in both directions one is we can call it as omega x which is the frequency in x direction which basically is the frequency of this vertical stripe and we have a frequency in the y direction which is the frequency denoted by this horizontal lines. So now that we have seen what frequency means in the x and the y direction of an image we will try to understand more of what these frequency actually mean practically. So if we have a constant image suppose an image intensity is constant over an interval. So there would not be any changes or we would not get a periodic points at the slices which we have made. So that is basically a zero frequency it is basically dc there is no change over a slice so the frequency in that x or the y direction will be zero. So for any constant image it will only contain a dc term. Now let us see what do we mean by high frequency in an image. So high frequency is basically that there is a drastic change in intensity within a short interval. So the pattern which Aditi showed had white and black which were very close to one another so we can show it again. So this transparent sheet of paper actually has a black and transparent stripes very close to one another. So this is basically a very high frequency image and you may not be able to see it but the stripes here the black stripes here are actually vertical. So when you take a slice like this as I have shown in the demonstration so as we take a slice here we will encounter the black points quite often and at a very small interval. So the frequency is really high so this is basically an example of high frequency in the x direction since we have taken x direction as this. In fact we can find a high and low frequencies in right in this frame. So if you look at the screen behind us you can see that there are constant patches of nearly constant color and there are white lines here. So these patches of constant color correspond to low frequencies low spatial frequencies and the place where it suddenly switches that is this white line it corresponds to a high frequency. So discontinuities or edges they correspond to high frequencies in the spatial domain. Now that we have seen what spatial frequency means we will see an example of Mojave pattern in a simple image. Now let us take an example of a simple image. So this is a zoom portion of an image basically a part of an image you see white dots in black background. So when you take an x slice of this image you see this white dots appearing at a regular interval and the interval is really short. So the frequency in the x direction is really high. Similarly if you take a y slice you again see that the white dots appear at a regular interval and again the interval is very short. So we have a higher frequency in the y direction also. Now let us see what happens when we reset back to the original view. Now you see that there are patterns over this image which were actually not present. This is due to aliasing in two dimension and this is an example of Mojave pattern due to aliasing. Okay so now that we have understood how aliasing affects an image and leads to formation of Moire patterns let us revisit the earlier Moire pattern that we showed. On his left hand Sujath has the pattern of black stripes on a transparent background. This is actually a sampler because the transparent parts allow the image behind it to be perceived but the black portions block it completely. In his other hand he has the pattern which we showed you earlier. Actually this is a very high frequency images because the lines are very closely spaced. If the sampling frequency of the sampler is too low then we won't be able to reconstruct the original image as it is. So that is what is being exploited in this Moire pattern. We can see the image of many men standing on the stairs which you could not see in the original image. So this is how aliasing has led to the formation of Moire patterns. So aliasing causes the high frequency image to be actually seen as a low frequency image because we are sampling at a very low rate. But when I move the sampler over the high frequency image we see that the people are moving up and down the stairs. We haven't discussed about the reason behind this. We encourage you to find out the reason and post it on the forums. In this video we have explored aliasing in one dimension, aliasing in two dimension and how it leads to the formation of Moire patterns. Moire patterns can be unnecessary or they can be useful as well. For example in the checkered shirts you saw unwanted patterns appearing on the man's shirt. But in the second example of the animation Moire patterns are used to make creative animations. Another place where Moire patterns are used are in the back of currency notes. Most currency notes have very closely spaced lines behind them. So if a person would try to scan or photocopy them it would most likely lead to the formation of Moire patterns and this would immediately tell us whether the note is real or fake. So I would encourage all of you to try this and post it on the discussion forums. Hope this demonstration will help you appreciate aliasing better. We will see you in another video. Thank you. Thank you.