{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

L15post

# L15post - Previous Lecture Transition probabilityan example...

This preview shows pages 1–11. Sign up to view the full content.

Previous Lecture: Transition probability—an example on matrices Contour plot Today’s Lecture: Working with images Announcements: Section this week in the UP B7 lab Project 4 due 10/22 (Thursday)

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

View Full Document
October 20, 2009 Lecture 15 4 A picture as a matrix 1458-by-2084 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
October 20, 2009 Lecture 15 5 Images can be encoded in different ways Common formats include JPEG: Joint Photographic Experts Group GIF: Graphics Interchange Format Data are compressed We will work with jpeg files: imread : read a .jpg file and convert it to a “normal numeric” array that we can work with imwrite : write an array into a .jpg file (compressed data)

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

View Full Document
October 20, 2009 Lecture 15 6 Grayness: a value 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
October 20, 2009 Lecture 15 7 Let’s put a picture in a frame Things to do: 1. Read bwduck.jpg from memory and convert it into an array 2. Show the original picture 3. Assign a gray value (frame color) to the “edge pixels” 4. Show the manipulated picture

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

View Full Document
October 20, 2009 Lecture 15 8 Reading a jpeg file and displaying the image % Read jpg image and convert to % an array P P = imread (‘bwduck.jpg'); % Show the data in 3-d array P as % an image imshow (P)
October 20, 2009 Lecture 15 9 % Frame a grayscale picture P= imread (’bwduck.jpg’); imshow (P) % Change the ”frame” color imshow (P)

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

View Full Document
October 20, 2009 Lecture 15 10 % Frame a grayscale picture P= imread (’bwduck.jpg’); imshow (P) % Change the ”frame” color width= 50; frameColor= 200; % light gray imshow (P)
October 20, 2009 Lecture 15 11 % Frame a grayscale picture P= imread (’bwduck.jpg’); imshow (P) % Change the ”frame” color width= 50; frameColor= 200; % light gray [nr,nc]= size (P); for r= 1:nr for c= 1:nc % At pixel (r,c) end end imshow (P)

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

View Full Document
October 20, 2009 Lecture 15 12 % Frame a grayscale picture
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}