Histogram 直方圖 Statistics of the pixel gray-levels of an image h(r k )=n k : histogram gray level no. of occurrence
histogram p=imread( ‘ pout.tif ’ ); imshow(p), figure, imhist(p), axis tight
Histogram equalization ph=histeq(p);
Histogram equalization (cont.) [ph, t]=histeq(p); plot(t), title('transform function'); Exercise#1. Apply histogram equalization to tire image
Filtering in MATLAB x=uint8(10*magic(5)); a=ones(3,3)/9; filter2(a,x, ’ same ’ ); % output has same size, zero padding filter2(a,x, ’ valid ’ ); % apply to inside of image filter2(a,x, ’ full ’ ); % apply to each intersection between mask and image ans =
Exercise#2: average filtering Use the test pattern to generate the following results. original 5x5 15x15 3x3 9x9 35x35
Definition of 1st derivative in mask filters Sobel operators
Exercise#3: 1st derivative Apply the Sobel filters to the lens image 水平邊 垂直邊 | 垂直邊 |+ | 水平邊 |
Definition of 2nd derivatives in filter mask: Laplacian 90 0 rotation invariant 45 0 rotation invariant (include Diagonals)
Exercise#4: sharpening filter Generate the right images original Laplacian scaled sharpened