# lecture9 - CSE 471 Media Processing and Multimedia...

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

1 CSE 471 Media Processing and Multimedia Introduction to Image Processing Operations on images Image filtering

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

View Full Document
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
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”

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

View Full Document
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?
5 CSE 471 Media Processing and Multimedia Before and After…

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

View Full Document
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?
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; } }

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

View Full Document
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…
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?

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

View Full Document
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]; } }
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; }

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

View Full Document
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!
13 CSE 471 Media Processing and Multimedia

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

View Full Document
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
Ask a homework question - tutors are online