lecture9 - CSE 471 Media Processing and Multimedia...

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

View Full Document Right Arrow Icon
1 CSE 471 Media Processing and Multimedia Introduction to Image Processing Operations on images Image filtering
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 CSE 471 Media Processing and Multimedia Operations on Images Assuming BYTE monochrome image: for(int r=0; r<height; r++) { for(int c=0; c<width; c++) { ouimage[r][c] = inimage[r][c] / 2; } } halved. The Pixel Loop
Background image of page 2
3 CSE 471 Media Processing and Multimedia Contents of a Pixel Recall: Pixel value indicates brightness 0 = black, 255 = white (assuming BYTEs) To change brightness: Multiply by a constant “twice as bright”
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 CSE 471 Media Processing and Multimedia Caveats… What if I decide to double brightness? for(int r=0; r<height; r++) { for(int c=0; c<width; c++) { ouimage[r][c] = inimage[r][c] * 2; } } This code will cause problems. Why?
Background image of page 4
5 CSE 471 Media Processing and Multimedia Before and After…
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 CSE 471 Media Processing and Multimedia Range bounding… inline BYTE ByteRange(int p) { if(p < 0) return 0; if(p > 255) return 255; return BYTE(p); } for(int r=0; r<height; r++) { for(int c=0; c<width; c++) { ouimage[r][c] = ByteRange(int(inimage[r][c]) * 2); } } Sound Familiar?
Background image of page 6
7 CSE 471 Media Processing and Multimedia Speed does matter… for(int r=0; r<height; r++) { for(int c=0; c<width; c++) { if(inimage[r][c] > 127) ouimage[r][c] = 255; else outimage[r][c] = inimage[r][c] * 2; } }
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 CSE 471 Media Processing and Multimedia What about color Assumptions: Height by (3 * Width) array Colors ordered as R, G, B… May be different…
Background image of page 8
9 CSE 471 Media Processing and Multimedia Color image fill for(int r=0; r < height ; r++) { for(int c=0; c < width ; c++) { ouimage[r][c * 3] = 255; ouimage[r][c * 3 + 1] = 0; ouimage[r][c * 3 + 2] = 0; } } What color does this fill with?
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 CSE 471 Media Processing and Multimedia Color image processing example for(int r=0; r < height; r++) { for(int c=0; c < width; c++) { ouimage[r][c * 3] = inimage[r][c * 3 + 2]; ouimage[r][c * 3 + 1] = inimage[r][c * 3 + 1]; ouimage[r][c * 3 + 2] = inimage[r][c * 3]; } }
Background image of page 10
11 CSE 471 Media Processing and Multimedia Color image half intensity for(int r=0; r < height; r++) for(int c=0; c < width; c++) { ouimage[r][c * 3] = inimage[r][c * 3] / 2; ouimage[r][c * 3 + 1] = inimage[r][c * 3 + 1] / 2; ouimage[r][c * 3 + 2] = inimage[r][c * 3 + 2] / 2; }
Background image of page 11

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

View Full DocumentRight Arrow Icon
12 CSE 471 Media Processing and Multimedia Color image half intensity for(int r=0; r < height; for(int c=0; c < width * 3 ; c++) { ouimage[r][c] = inimage[r][c] / 2; } In many, many cases, you do the same operation on all three components!
Background image of page 12
13 CSE 471 Media Processing and Multimedia
Background image of page 13

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

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

This note was uploaded on 07/25/2008 for the course CSE 471 taught by Professor Owen during the Fall '07 term at Michigan State University.

Page1 / 43

lecture9 - CSE 471 Media Processing and Multimedia...

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

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