EE465 Midterm Review Mar. 23, 2010
MATLAB-based Midterm Exam Research-oriented learning Just like MATH, MATLAB is another tool (use it wisely) All Roads Lead to Rome The principle of finding out the answers is applicable to other engineering disciplines I hope it will be a FUN experience
Logistics Part I (10 6=60 points) –Test correct understanding of basic DIP concepts and flexible use of MATLAB tools Part II (10 6=60 points) –Test correct understanding of basic DIP algorithms and their MATLAB implementations Part III (20 3=60 points) –Test advanced problem solving skills under MATLAB
Part I Image-related basics –Spatial resolution, bit-depth resolution, color channels, basic matrix-related operations under MATLAB Image acquisition –sampling and quantization, CCD vs CMOS, Bayer pattern, color demosaicing Image perception –Brightness vs. lightness, optical illusions
EE465: Introduction to Digital Image Processing 5 Bit-depth Resolution If you want to hide something into an image, which bitplane is appropriate?
EE465: Introduction to Digital Image Processing 6 Block-based Processing Are you good at the puzzle?
EE465: Introduction to Digital Image Processing 7 Sampling and Quantization(1D)
EE465: Introduction to Digital Image Processing 8 2D Sampling and Quantization
EE465: Introduction to Digital Image Processing 9 3D Visualization of an Image Which Matlab function does 3D visualization?
Color Imaging: Bayer Pattern EE465: Introduction to Digital Image Processing 10 US3,971,065 $38,990 $309 Why do we want Bayer pattern and why green is more densely sampled?
Demosaicing (CFA Interpolation) EE465: Introduction to Digital Image Processing 11
EE465: Introduction to Digital Image Processing 12 Another Lightness Illusion You will verify that A and B have exactly the same value in CA3.
EE465: Introduction to Digital Image Processing 13 Optical Illusions
$ Which of the following statement is NOT true? –A) Fourier transform of a Guassian function is still Gaussian –B) Histogram equalization is a nonlinear operation –C) Median filtering is NOT translation invariant –D) The total number of green pixels in a Bayer pattern is twice as many as that of red or blue ones
$ Which of the following pair of matlab codes is NOT equivalent to each other? –A) y=imnoise(x,’gaussian’,0,0.1) vs. y=x+randn(size(x))*0.1 –B) imshow(x/255,[]) vs. imshow(x/1000,[]); % x is an image in double format –C) imresize(x,2) vs. interp2(x,2) –D) for i=1:length(x);if x(i)>128; x(i)=1;else x(i)=0; end;end; vs. x=(x>128);
Part II Image-related algorithms –Interpolation (imresize, interp2, griddata) Replication, bilinear, bicubic, spline, advanced* (ESI, NEDI) –Denoising (imnoise, medfilt2, filter2, imfilter) Salt & pepper vs. Gaussian vs. periodic, Hammer- Nail match –Deblurring (please see deblurring.zip) Why do we need FT? How to avoid divided-by- zero? –Edge detection (edge, bwareaopen*, belabel*) How to calculate the area and length of some object?
EE465: Introduction to Digital Image Processing 17 Resolution Enhancement based on Pixel Repetition abcdabcd a ab b c cd d zero-order first-order a (a+b)/2b (a+c)/2 (a+b+c+d)/4(b+d)/2 c (c+d)/2d
EE465: Introduction to Digital Image Processing 18 Bilinear Interpolation of Image X(m,n) row m row m+1 Col n Col n+1 X(m,n+1) X(m+1,n+1)X(m+1,n) Y a1-a b 1-b Q: what is the interpolated value at Y? Ans.: (1-a)(1-b)X(m,n)+(1-a)bX(m+1,n) +a(1-b)X(m,n+1)+abX(m+1,n+1)
EE465: Introduction to Digital Image Processing 19 Bicubic Interpolation* Which matlab function implements bicubic interpolation?
EE465: Introduction to Digital Image Processing 20 Edge-Sensitive Interpolation Step 1: interpolate the missing pixels along the diagonal black or white? Step 2: interpolate the other half missing pixels a b cd Since |a-c|=|b-d| x x has equal probability of being black or white a b c d Since |a-c|>|b-d| x=(b+d)/2=black x Please refer to esi1.m and esi2.m in interp.zip
EE465: Introduction to Digital Image Processing 21 Point Operations Overview Point operations are zero-memory operations where a given gray level x [0,L] is mapped to another gray level y [0,L] according to a transformation L L x y L=255: for grayscale images
EE465: Introduction to Digital Image Processing 22 Histogram Equalization Uniform Quantization Note: L 1 x L y 0 cumulative probability function Can you write your own matlab function to implement this?
EE465: Introduction to Digital Image Processing 23 MATLAB Implementation function y=hist_eq(x) [M,N]=size(x); for i=1:256 h(i)=sum(sum(x= =i-1)); End y=x;s=sum(h); for i=1:256 I=find(x= =i-1); y(I)=sum(h(1:i))/s*255; end Calculate the histogram of the input image Perform histogram equalization
EE465: Introduction to Digital Image Processing 24 2D Median Filtering Y X ^ Sorted: [0, 0, 0, 225, 225, 225, 226, 226, 226]
EE465: Introduction to Digital Image Processing 25 Median Filtering with Noise Detection Noisy image Y x=medfilt2(y,[2*T+1,2*T+1]); Median filtering Noise detection C=(y==0)|(y==255); xx=c.*x+(1-c).*y; Obtain filtering results Why do we want to introduce noise detection?
EE465: Introduction to Digital Image Processing 26 Image Example clean noisy (p=0.2) w/o noise detection with noise detection
EE465: Introduction to Digital Image Processing 27 Image Deblurring: Inverse Filtering h(m,n) blurring filter h I (m,n) x(m,n) y(m,n) inverse filter To compensate the blurring, we require h combi (m,n) x(m,n) ^
EE465: Introduction to Digital Image Processing 28 Inverse Filtering (Con ’ t) h(m,n) + x(m,n)y(m,n) h I (m,n) inverse filter x(m,n) ^ Spatial: Frequency: amplified noise (what if H→0?)
EE465: Introduction to Digital Image Processing 29 Image Example Q: Why does the amplified noise look so bad? A: zeros in H(w 1,w 2 ) correspond to poles in H I (w 1,w 2 ) motion blurred image at BSNR of 40dB deblurred image after inverse filtering
EE465: Introduction to Digital Image Processing 30 Pseudo-inverse Filter Basic idea: To handle zeros in H(w 1,w 2 ), we treat them separately when performing the inverse filtering Why do we want to introduce this threshold parameter ?
EE465: Introduction to Digital Image Processing 31 Image Example motion blurred image at BSNR of 40dB deblurred image after Pseudo-inverse filtering ( =0.1)
EE465: Introduction to Digital Image Processing Copyright Xin Li 32 Gradient Operators Motivation: detect changes change in the pixel valuelarge gradient Gradient operator image Thresholding edge map x(m,n) g(m,n) I(m,n) MATLAB function: > help edge
EE465: Introduction to Digital Image Processing Copyright Xin Li 33 Examples of Different Gradient Operators horizontal edgevertical edge Prewitt operator (th=48) original image
EE465: Introduction to Digital Image Processing Copyright Xin Li 34 Effect of Thresholding Parameters thresholdsmall large
$ row m row m+1 Col n Col n Y a1-a b 1-b a=0.25 b=0.25 What is Y? A)112.5 B)125 C)137.5 D)150 Bilinear Interpolation Numerical Example
$ What is the pixel value at red zero after median filter (window size 5- by5)? A)224 B)225 C)226 D)0
Part III Image-related tasks –A collection of “bonus problems” which can be solved by different tools –Mentally solve it vs. experimentally solve it –Designed like interview questions of major IT companies (except the default computing language)
Final-Jeopardy What are the angles of tripod in the image cameraman.tif?
Final-Jeopardy Process the baby.bmp image in CA5 so you can see baby clearly
Final-Jeopardy Turn Cameran image from grayscale to a greenish color image.