{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

L16post - Previous Lecture Working with images Todays...

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

View Full Document Right Arrow Icon
Previous Lecture: Working with images Today’s Lecture: More on manipulating images “Noise” filtering Edge finding Announcements: Project 4 due tonight at 11pm
Background image of page 1

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

View Full Document Right Arrow Icon
October 22, 2009 Lecture 16 4 An image as an array: values in [0..255] 150 149 152 153 152 155 151 150 153 154 153 156 153 151 155 156 155 158 154 153 156 157 156 159 156 154 158 159 158 161 157 156 159 160 159 162 0 = black 255 = white These are integer values Type: uint8
Background image of page 2
October 22, 2009 Lecture 16 6 Vectorized code to create a mirror image A = imread(’LawSchool.jpg’) [nr,nc,np] = size(A); for c= 1:nc B(:,c,1) = A(:,nc+1-c,1) B(:,c,2) = A(:,nc+1-c,2) B(:,c,3) = A(:,nc+1-c,3) end imwrite(B,'LawSchoolMirror.jpg') Can i mp ro v e efficiency by initializing B to be a 3 -d array of the app rop riate size
Background image of page 3

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

View Full Document Right Arrow Icon
October 22, 2009 Lecture 16 7 Example: produce a negative
Background image of page 4
October 22, 2009 Lecture 16 8 Problem: produce a negative “Negative” is what we say, but all color values are positive numbers! Think in terms of the extremes, 0 and 255. Then the “negative” just means the opposite side . So 0 is the opposite of 255 ; 1 254 ; 5 250 ; 30 225 ; x 255-x
Background image of page 5

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

View Full Document Right Arrow Icon
October 22, 2009 Lecture 16 9 function newIm = toNegative(im) % newIm is the negative of image data im % im, newIm are 3-d arrays; each component is uint8 [nr,nc,np]= size(im); % dimensions of im newIm= zeros(nr,nc); % initialize newIm newIm= uint8(newIm); % Type for image color values for r= 1:nr for c= 1:nc for p= 1:np newIm(r,c,p)= ___________________; end end end
Background image of page 6
October 22, 2009 Lecture 16 10 function newIm = toNegative(im) % newIm is the negative of image im % im, newIm are 3-d arrays; each component is uint8 [nr,nc,np]= size(im); % dimensions of im newIm= zeros(nr,nc,np); % initialize newIm newIm= uint8(newIm); % Type for image color values for r= 1:nr for c= 1:nc for p= 1:np newIm(r,c,p)= 255 - im(r,c,p); end end end
Background image of page 7

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

View Full Document Right Arrow Icon
October 22, 2009 Lecture 16 11 150 149 152 153 152 155 151 150 153 154 153 156 153 2 3 156 155 158 154 2 1 157 156 159 156 154 158 159 158 161 157 156 159 160 159 162 Dirt in the image! Note how the “dirty pixels” look out of place
Background image of page 8
October 22, 2009 Lecture 16 12 Clean up “noise” — median filtering
Background image of page 9

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

View Full Document Right Arrow Icon
October 22, 2009 Lecture 16 13 150 149 152 153 152 155 151 150 153 154 153 156 153 ? ? 156 155 158 154 ? ? 157 156 159 156 154 158 159 158 161 157 156 159 160 159 162 Assign “typical” neighborhood gray values to “dirty pixels” What to do with the dirty pixels?
Background image of page 10
October 22, 2009 Lecture 16 14 What are “ typical neighborhood gray values”?
Background image of page 11

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

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}