Programming > posted

profileJohn farraj
h.w_12.docx

Project 1 ET 204 Fall 2016

Due Midnight 10/24/2016

The next few weeks of class will involve arrays and user defined functions in C. These computing tools are common in scientific computing and are used across many programming languages. In this project we will utilize arrays and functions to store variable values alioo0g with manipulating variable values to understand aspects of the data. One of the most common forms of data analysis in image analysis. There is an entire division of scientific computing devoted to image processing, de-blurring, signaling, etc. (Who would have thought mathematics would evolve into the world of photo filters). We will utilize MATLAB in this project to take an image and practice some simple image processing with my instructions below.

Part 1: In the project folder on the Blackboard site I have a stored JPEG image that we will use for this project we want to bring this image into MATLAB to do our manipulation. MATLAB can store the image as an array. Use the code below to bring in your photo. Be sure in your document to show the image and explain how it is being stored. Why do you think the image is being stored this way? Which lines of code are producing the images you see?

clear all;

close all;

clc;

 A=imread('project1.jpg'); 

Abw=rgb2gray(A);

subplot(2,2,1), image(A); set(gca,’Xtick’,[],’Ytick’,[])

subplot(2,2,3), imshow(Abw);

A2=double(A);

Part 2: Notice that the image is stored as a 3-D array. The third dimension is the color scale. All images have pixels and each pixel is defined by its red, green and blue amplification, just like a TV set. We are going to show an image of each of the color scales, red, green and blue. Use the code below to create the images and put these images into your document. Explain which plane of the third dimension each color lives on. Explain what the just_red, just_blue and just_green equation are doing.

clear all;

close all;

clc;

img = imread('project1.jpg');
figure, imshow(img)
red = img(:,:,1);
green = img(:,:,2);
blue = img(:,:,3);
a = zeros(size(img, 1), size(img, 2));
just_red = cat(3, red, a, a);
figure, imshow(just_red)
just_green = cat(3, a, green, a);
figure, imshow(just_green)
just_blue = cat(3, a, a, blue);
figure, imshow(just_blue)

Part 3: We are going to fuzy the image up and add Gaussian noise. This will create a blurred image Use the code in Part 1 and add these lines of script in what do you notice? How is the code doing this? Print out the figure containing the four images.

noise=randn(row,col,3);

noise2=randn(row,col);

u=uint8(A2+50*noise);

u2=uint8(Abw+50*noise2);

subplot(2,2,2), image(u); set(gca,’Xtick’,[],’Ytick’,[])

subplot(2,2,4), image(u2); set(gca,’Xtick’,[],’Ytick’,[])

*row, col should be the row and col values of your saved image.

Part 4: Finally what we are going to do is apply a fast Fourier transformation on the image. What this does is give sinusoidal amplitude to each pixel of the image and put the highest amplitudes to the center of the figure and the smallest amplitudes diverging from the center. Basically we are going from the normal pixel domain to the frequency domain. Run the code below to produce the FFT of our image. What do you notice about this image? Paste your images into your document.

clear all;

close all;

clc;

I=imread('project1.jpg);
F=fft2(double(I));
S=fftshift(F);
L=log2(S);
A=abs(L);
imagesc(A)