Lecture 10: Modifying Images - University of...
Transcript of Lecture 10: Modifying Images - University of...
Lecture 10: Modifying Images
The Digital World of MultimediaProf. Mari Ostendorf
EE299 Lecture 1030 Jan 2008
AnnouncementsHW3 due Friday in classGuest lecture Friday Feb 1 (EEB 403)
A cultural history of JPEG… Dr. Joan MitchellAnother lecture by Dr. Mitchell on Thurs
Patenting a wet suit… Thurs 1/31 10:30 EEB 125Lab3: Read the lab *before* lab
EE299 Lecture 1030 Jan 2008
Goals for TodayReview of frequency content of imagesSampling and aliasing for imagesAnalogies in sound vs. image processingImage filtering
EE299 Lecture 1030 Jan 2008
Simple Cosines in Space
EE299 Lecture 1030 Jan 2008
2D Frequency Content of Images
DCT = Discrete Cosine Transform
EE299 Lecture 1030 Jan 2008
Display Artifacts of the DCT (and DFT)
F=100300ppi
F=160480ppi
F=200600ppi
EE299 Lecture 1030 Jan 2008
Aliasing for Images
F=50 for cosine, 300ppi original
EE299 Lecture 1030 Jan 2008
Aliasing for Images (cont)Highest frequencies in center aliasingRegion of aliasing grows with downsampling
This is aliasing, not zooming in.
EE299 Lecture 1030 Jan 2008
Another Aliasing Example
For more interesting examples, see Orsak et al. pp. 133-134
EE299 Lecture 1030 Jan 2008
Sound vs. Image SP AnalogiesSound
Time-scalingAmplitude scaling: change loudnessEchoTime reverseFilter:
LPF: smoothing, sounds more muffledHPF: detect onsets, sounds more tinny
ImageExpand/shrink imageAmplitude scaling: change brightnessDouble exposureImage flipFilter
LPF: blurring, speckle removalHPF: deblurring, edge detection
EE299 Lecture 1030 Jan 2008
Resizing ImagesShrinking:
Grayscale: replace KxK block with single pixel with average gray level of the K2 pixels in the originalColor: Repeat for each color plane
Enlarging:Grayscale: insert interpolated pixel valuesColor: repeat for each color plane, as in shrinking
EE299 Lecture 1030 Jan 2008
+90
-90
Amplitude Scaling for Images
EE299 Lecture 1030 Jan 2008
Review: Grayscale vs. ColorGray: MxN matrix Color: MxNx3
B/W intensity:• 0 = black• 1 = white
X(i,j)=0.4
X(i,j,2)=0.6 X(i,j,3)=1.0
R/G/B intensity:• [0,1]=[none, full]• (0,0,0)=black• (1,1,1)=white
X(i,j,1)=0.75
8 bits/pixel 256 gray levels
8 bits/color-pixel 2563 colors,
24 bits/pixel
EE299 Lecture 1030 Jan 2008
Color Digital ImagesComponent colors
EE299 Lecture 1030 Jan 2008
Adjusting Amplitude in Color Images
par=min(255,par+100);
par(:,:,2)=min(255,par(:,:,2)+100);
More of all colors more white
More green
EE299 Lecture 1030 Jan 2008
Changing Color Images (cont.)
Turning off a color:X(:,:,1)=0;
EE299 Lecture 1030 Jan 2008
Swapping Color Planes
Swap:G RB GR B
original
EE299 Lecture 1030 Jan 2008
Reminder of Time Signal Filtering
original
low pass filtered(15 sample average)
high pass filtered(avg of 5 samples – avg of next 5 samples)
EE299 Lecture 1030 Jan 2008
Image Filtering
original
2D low pass filtered(average over 15x15 block) 2D high pass filtered1D high pass filtered
Using the same filters as in the previous slide, but in 2D, e.g.
filt2d=filt*filt’
EE299 Lecture 1030 Jan 2008
More Filtering Examples
original 2D low pass filtered 2D high pass filtered
EE299 Lecture 1030 Jan 2008
Another Example
filteredoriginal
What type of filter was used?
EE299 Lecture 1030 Jan 2008
Modifying Color Images
original
Blur only the green plane
Blur everything
Each color plane can be manipulated as a grayscale image, e.g. filtered, contrast enhanced, etc.
EE299 Lecture 1030 Jan 2008
NEW TOPIC: COMPRESSIONWhat is compression?
Representing an signal (sound file, image or video) with fewer total bits
Why bother?Storage: You can fit more songs & videos on your IPODCommunication: It takes less time to download stuff; real-time video conferencing
EE299 Lecture 1030 Jan 2008
Types of CompressionLossless
Represent the sound/image/video with fewer bits without changing the signal *at all* (you can perfectly reconstruct the original)How? (like the 20 questions game)
Map the different levels to a variable-length code, using short codes for more frequent things
LossyRepresent the sound/image/video with fewer bits with some changes from the originalHow?
Throw out the stuff that people don’t pay attention to