MATLAB

All of the lab computers have MATLAB installed. You should also be able to run it remotely with ssh and X11 forwarding.

Loading and displaying images

You can use help COMMAND within MATLAB to get more details about any of these commands.

img = imread('FILENAME’) Read an image into a matrix.

imshow(img) Display an image.

imagesc(img) Display an image, scaling the colormap so that it covers the whole range of the data.

colormap gray Use a grayscale colormap for imagesc instead of the default blue-yellow one.

Manipulating images

single(img) Convert an image to single-precision floating-point.

filter2(FILTER, IMAGE) Convolve an image with a filter.

Frequency domain

freq = fft2(img) 2-D discrete Fourier transform.

freq(:, 20:620) = 0 Zero out a vertical slice of the frequency domain.

ifft2(freq) Inverse 2-D discrete Fourier transform.