worksheet for lab: week 02 --------------------------- login, mount your filespaces (i think you & your partner's spaces can be mounted at the same time?). download this week's files. begin by opening maple. warm-up ------- open "w2fourier.mws", activate cursor on the red word "restart" & hit return, one command at a time. you will have reproduced the demo from lecture yesterday. find the line which changes the number of summed terms & take some error data by increasing the work by factors of two. do you see a pattern? (*) start over with a piecewise polynomial (continuous, no jumps/discontinuities) of your own design. take error data (3-4 significant digits). you can make a log-log plot in maple or matlab to obtain a power law later. you may also check to see what other groups obtained with different test functions. but the plots are amazing, no? do you see why this is a test of fourier's grand idea? close maple. smile. study #1 -------- open matlab. run "w2convert", it will automatically process the image file "triangle.jpeg". open the script for editing & look for the commented out command after "this sample line". activating this command will "crop" the image to a 192x192 square image. fourier processing likes to have image dimensions which are even & are a nice product of small primes (192 = 2^6 * 3). your lab TA should explain matlab's array indexing notations which make cropping a snap. run the second script "w2fft", it will produce a figure showing |A(k,l)| the magnitude of the complex fourier coefficients as a color plot (dark means big value, yellow means small -- on a logarithmic scale). your goal for this & the next study is to learn that the fourier coefficients embody the same information as the image, but encoded in a different way. print both the triangle image & its fourier plot. take your ruler & protractor and measure the obvious angles in the figures relative to the x- and k-axes. there should be an obvious correlation. (*) find more images & test to see if your conjecture still holds. (this last step can wait till after you learn to mask -- this is needed for the next study). study #2 -------- each value of a fourier coefficient corresponds to one term of the complex fourier series. setting some of the coefficients to zero & summing (reconstituting) is the same as taking a partial sum of the series. you can learn about how these coefficients hold information about the image by looking at a lot of these partial sums, which we will call a "partial image". rerun "w2convert" and "w2fft" for the triangle image. then run "w2ifft" (inverse fourier transform). it is the demo in class where i did a partial sum over all k,l where (k^2 + l^2) < 20. this means only 3% of the fourier information is being used. in the script "w2ifft", there is another partial image that can be implemented by setting "maskno = 2;" and rerunning "w2ifft". this time, only the largest fourier coefficients are kept (cool!). partial images are made by constructing a "mask" matrix. a matrix of 1's and 0's where 1's appear for coefficients which are to kept and 0's for those to be ignored. elementwise multiplication -> mask.*imfour will "zero out" the ignored coefficients in the image reconstitution. logic operations: <, <=, >, >=, ==, ~=, in addition to the & (and), | (or), ~ (not) return the values of 0/1 depending on whether the result is false/true. this is the easiest way to make a mask matrix. "km" & "lm" are arrays the same size as the fourier coefficients "imfour" -- and you need to understand how to manipulate these to design your own masks. your mission here is to carry out a SYSTEMATIC exploration of some type of masking strategy using images of your own choosing. (use google's image search.) you needn't reinvent jpeg compression, your report grade will be based upon how well-thought out your study is, not on it's patentability for image processing.