14-440-127+Lecture+04+Notes+Exam+Review

14-440-127+Lecture+04+Notes+Exam+Review - 14:440:127...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 14:440:127 Introduction to Computers for Engineers Notes for Lecture 4- Exam 1 Review Rutgers University, Fall 2009 Instructor- Blase E. Ur 1 Images Key Idea 1: A grayscale image is a 2-D matrix where each matrix element represents the intensity (whiteness) of that pixel. Using image , black is 0, white is 64, and everything in between is a shade of gray. Using imagesc , the smallest number is black, the largest number is white, and everything in between is scaled accordingly. Using either function to display the image, make sure to say colormap gray ; Key Idea 2: x = imread(marksanchez.jpg) reads the image marksanchez.jpg into the matrix x. Key Idea 3: Color images are 3 dimensional matrices, which have rows, column, and layers (1 = red, 2 = green, 3 = blue. RGB, get it?). The values for each pixel range from 0 to 1. Key Idea 4: For a color image, the following code applies a motion blur and displays the blurred image. If you replace motion with gaussian, you get a gaussian blur. Replace it with sobel, and you find the edges of an image. originalcolor = imread(color.jpg); h2 = fspecial(motion); newcolor = imfilter(originalcolor,h2); imagesc(newcolor) 2 Sound System (gonna bring me back up) Key Idea 1: Sound is represented as a vector of sound wave amplitudes. These amplitudes are sampled every specified period i.e. 44.1khz (44,100 times a second) for most audio cds. Key Idea 2: [y f] = wavread(soulja.wav); reads in a wav file. y is the vector of amplitudes. f is the sampling rate (a single number). Key Idea 3: To play sound, create an audioplayer object i.e. p = audioplayer(SOMEVECTOR, THESAMPLINGRATE) and then say play(p) or stop(p) Key Idea 4: You can filter i.e. high pass (only high sounds can pass through the filter) or low pass (only low, bassy sounds can pass through the filter) as follows. This is a high pass filter 1 with a 1000 hz cut-off frequency.: [y f] = wavread(soulja.wav); [b a] = butter(10,1000/(f/2),high); y2 = filtfilt(b,a,y); p = audioplayer(y2,f); play(p) %% wait a bit stop(p) 3 Review- Basics of Matlab Key Idea 1: The names of m-files and of variables cannot contain spaces, must start with a letter, and can only contain letters, numbers, and the underscore. Key Idea 2: The clear command erases the contents of all variables that are currently set. In contrast, the clc command gets rid of all outputs on the screen, but doesnt change any variables. Key Idea 3: The first place Matlab looks for an m-file that you refer to is in your current directory . The next place it will look is going down the list of directories in your path . On the exam, youll probably want to set the current directory to be the Windows Desktop....
View Full Document

Page1 / 8

14-440-127+Lecture+04+Notes+Exam+Review - 14:440:127...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online