introduction to programming in matlab

5
Introduction to Programming in MATLAB Intro. MATLAB Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD is licensed under a Creative Commons Attribution- NonCommercial - ShareAlike 3.0 Unported License . Based on a work at www.peerinstruction4cs.org . 1

Upload: nellie

Post on 23-Feb-2016

72 views

Category:

Documents


0 download

DESCRIPTION

Introduction to Programming in MATLAB. Intro. MATLAB Peer Instruction Lecture Slides by  Dr. Cynthia Lee, UCSD  is licensed under a  Creative Commons Attribution- NonCommercial - ShareAlike 3.0 Unported License . Based on a work at  www.peerinstruction4cs.org . - PowerPoint PPT Presentation

TRANSCRIPT

Page 2: Introduction  to Programming in MATLAB

2

>> im = imread('rainbow.jpg');>> part = im(1:floor(end/2),1:end,:);>> imshow(part)

a)

b)

c)

d)

e) None/other/error

Which image results from the following code segment:

Page 3: Introduction  to Programming in MATLAB

3

>> im = imread('rainbow.jpg');>> part = im(1:floor(end/2),floor(end/2)+1:end,:);>> imshow(part)

a)

b)

c)

d)

e) None/other/error

Which image results from the following code segment:

Page 4: Introduction  to Programming in MATLAB

4

RGB color reference

a)

b)

c)

d)

e) None/other/error

Which image results from the following code segment:

>> im = imread('rainbow.jpg');>> im(1:floor(end/2),1:floor(end/2),1) = 0;>> imshow(im)

Page 5: Introduction  to Programming in MATLAB

5

Which code segment takes the image on the left and transforms it to the image on the right?

>> im = imread('rainbow.jpg');>> z = zeros(size(im(:,:,1)));>> cat(3,im(:,:,1),z,z);>> imshow(ans)

>> im = imread('rainbow.jpg');>> z = zeros(size(im(:,:,1)));>> cat(3,z,im(:,:,2),z);>> imshow(ans)

>> im = imread('rainbow.jpg');>> z = zeros(size(im(:,:,1)));>> cat(3,z,z,im(:,:,3));>> imshow(ans)

a)

b)

c)

d) None/other/error

RGB color reference