Here, I have a high resolution image. The image is nearly 2,000 pixels wide and around 1600 pixels tall. Let's say I wanted to produce a smaller version of this image, perhaps a thumbnail image. We want to reduce its size. So perhaps, the simplest way to go about doing this is to just select every nth pixel in each row and in each column and I could do that very simply with this MATLAB command here.
I'm going to take every 7th pixel in the horizontal direction and every 7th pixel in the vertical direction and the result is a much smaller image. This image is only 260 something pixels wide and 220 something pixels tall. This is a process that's known as Image Decimation, very very simple to compute but you'll notice that there are some artifacts in this image.
The tiled roof that we see very clearly in the left hand image has resulted in a very strange pattern in the right hand image. We can see that that regular texture of the tiled roof has disappeared and been replaced by some rather obvious lines which don't actually exist in the input image.
So, this is an artifact that's being introduced into the output image by the process of decimation and the root cause of this is a phenomenon known as aliasing.
The simplest way to think about aliasing is in terms of a 1-dimensional image intensity profile. So, let's imagine that we've drawn a line across an image and this is the intensity profile and it varies between plus and minus 1 in this particular case and the horizontal axis is scaled in terms of units of pixels.
So, we can see some quite high frequency variation of the image intensity as we move across the profile. Now, let's imagine that I sample this profile at every 2nd pixel. So, as a sample at pixel 0, a sample of pixel 2, at pixel 4 and so on. Now, given that I have made the sample shown here by the black dots, I could also consider that the blue curve that's shown here is equally good explanation of the values that I've measured at these 6 sample points. This is all based on a really important theorem from signal processing called the Nyquist sampling theorem.
In this particular case, our sampling interval is 2 pixels. We've chosen our samples to be every 2nd pixel and that means that any signal that's got a period less than twice that. So, any signal with a period that's less than four pixels will be aliased. It will be confused with a low frequency signal after we have sampled.
The way to eliminate this alias in problem is to remove the high frequency components from the image and we've talked before about how we can use a Gaussian curve to blur an image and perhaps, it's been unintuitive why we would ever want to blur an image. We go to so much trouble to make our images sharp and crisp and nice to look at, but convolving with the Gaussian kernel we'll remove these problematic high frequency components.
So in order to properly sub-sample an image, what we need to do is to apply a Gaussian kernels and then, sub-sample or decimate. These 2 steps are done together in the toolbox function iscale.
So, the iscale function, we pass in our high resolution input image and we pass in the scale factor. In this case, I want the image to be 1/7th the size of the input image.
The result will be the low resolution image shown here on the right. Notice now that those artifacts due to aliasing have been eliminated.
Image warping allows us to shrink (or expand) an image by any scale factor, as well as to translate and rotate it. Let’s look at how image warping works.
This content assumes an understanding of high school level mathematics; for example, trigonometry, algebra, calculus, physics (optics) and experience with MATLAB command line and programming, for example workspace, variables, arrays, types, functions and classes.