Noise and signals

Take a look at the first 147 signals in the sigavg directory, having filenames s001.jpg to s147.jpg.

You can download everything you need for this lab, including the signals, the Octave script files, and these html files, from the gzipped UNIX tarfile, lab1.tgz or as a Windows zip-file, lab1.zip.

You can expand this file using the command:

tar -xvzf lab1.tgz
(The tarfile was created by the command tar -cvzf lab1.tgz sigavg/s{1:147,3}.jpg sigavg/big*.jpg sigavg/*.m sigavg/*.htm)

These signals s001.jpg through s147.jpg are matrices (images) representing visual information content (pictures).

These are pictures of the entire downtown portion of the city of Toronto taken with a camera and a small battery powered flash unit.

Each exposure was taken with a 1/500 of a second shutter speed, because a picture taken with flash (rather than ambient light) was desired.

Clearly the flash unit is too weak to light up the entire city.

Therefore the pictures are very dark.

Try loading one of the images into Octave using the command

a=imread("s001.jpg","jpeg");
Display the image using the command:
image(a,1); % 1 is the zoom scale setting of the image display program
How many buildings do you see in the picture? The image is kind of dark so you might want to boost up the gain:
image(10*a,1);
How many buildings do you now see after boosting up the gain?

Load some of the other images, e.g.:

b=imread("s002.jpg","jpeg");
Is there any difference between these images.

What would you expect to find if the images were averaged together?

Average the images together into a variable "avg", and display the result. (You might find the script "sigavg.m" useful for this purpose.)

Try displaying the "avg" matrix:

image(10*avg,1);
and comment on how the average is different from the individual matrices such as "a".

How many buildings do you now see?

Try plotting some rows of "a" and corresponding rows of "avg":

plot(a(164,:));
plot(avg(164,:));
You can also plot columns of an array:
plot(a(:,250));
plot(avg(:,250));


Indexing into arrays (zooming in to crop a small array from a larger array)

Finally, here is a simple exercise that teaches how Octave indexes into arrays, and will also show an example of signals hidden in noise.

A larger version of the signal from image s001 exists in file big001clip20.jpg, and a larger version of the signal averaged one exists in file bigavgclip20.jpg.

For this exercise you are to magnify and zoom into a small portion of the image, using the following commands, noting the size of a and relative position of the cropped portion:

a=imread("big001clip20.jpg","jpeg");
acrop=a(1312-256+1:1312,200:200+256-1);
size(a)
size(acrop)
image(1/4*acrop,1); % note that default zoom is 4 and default gain is 4
                      % so we need to scale back the gain and zoom

Is there any text visible on the side of the building? If so, what does it say? Now try the same thing with the fullsize averaged image:

avg=imread("bigavgclip20.jpg","jpeg");
avgcrop=avg(1312-256+1:1312,200:200+256-1);
image(1/4*avgcrop,1);
Is there any text now visible on the side of the building? If so, what does it say?

In this lab, we have seen an example of signal averaging which is a temporal lowpass filter. The lowpass filter smooths the function over time, and therefore reduces high frequency noise. Later we will learn about moving average filters, and other kinds of lowpass filters, operating over time, etc..