Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image Processing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.

Similar presentations


Presentation on theme: "Image Processing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr."— Presentation transcript:

1 Image Processing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr

2 Overview Image Representation Sampling and Reconstruction
What is an image? Sampling and Reconstruction Key steps in image processing kucg.korea.ac.kr

3 A pixel is a sample, not a little square!!
What is an Image? An image is a 2D rectilinear array of pixels Continuous image Digital image A pixel is a sample, not a little square!! kucg.korea.ac.kr

4 What is an Image? An image is a 2D rectilinear array of pixels
Continuous image Digital image kucg.korea.ac.kr

5 What is an Image? An image is a 2D rectilinear array of pixels
Continuous image Digital image kucg.korea.ac.kr

6 Image Acquisition Pixels are samples from continuous function
Photoreceptors in eye CCD cells in digital camera Rays in virtual camera kucg.korea.ac.kr

7 Quantization Artifact due to limited intensity resolution
Frame buffers have limited number of bits per pixel Physical devices have limited dynamic range 255 150 75 255 150 75 255 150 75 Blue channel Green channel Red channel kucg.korea.ac.kr

8 Image Display Re-create continuous function from samples
Example: cathode ray tube Image is reconstructed by displaying pixels with finite area (Gaussian) kucg.korea.ac.kr

9 Image Resolution Intensity resolution Spatial resolution
Each pixel has only “Depth” bits for colors/intensities Spatial resolution Image has only “Width” x “Height” pixels Temporal resolution Monitor refreshes images at only “Rate” Hz National Television System Committee kucg.korea.ac.kr

10 Overview Image Representation Sampling and Reconstruction
What is an image? Sampling and Reconstruction Key steps in image processing kucg.korea.ac.kr

11 Sampling and Reconstruction
kucg.korea.ac.kr

12 Sampling and Reconstruction
kucg.korea.ac.kr

13 Image Processing Pixel operations Filtering Warping Add luminance Blur
Add contrast Filtering Blur Detect edge Warping Scale Rotate Warps kucg.korea.ac.kr

14 Adjusting Brightness Simply scale pixel components
Must clamp to range (e.g., 0 to 255) Original Brighter kucg.korea.ac.kr

15 Adjusting Contrast Compute mean luminance L for all pixels
Luminance = 0.30*r *g *b Scale deviation from L for each pixel component Must clamp to range (e.g. 0 to 255) L Original More contrast kucg.korea.ac.kr

16 Image Processing Pixel operations Filtering Warping Add luminance Blur
Add contrast Filtering Blur Detect edge Warping Scale Rotate Warps kucg.korea.ac.kr

17 Adjusting Blurriness Convolve with a filter whose entries sum to one
Each pixel becomes a weighted average of its neighbors Original Blur kucg.korea.ac.kr

18 Edge Detection Convolve with a filter that finds differences between neighbor pixels Original Edge Detection kucg.korea.ac.kr

19 Blurring and Convolution
3 We call this “filter” kucg.korea.ac.kr

20 Blurring and Convolution
3 kucg.korea.ac.kr

21 Blurring and Convolution
3 kucg.korea.ac.kr

22 Blurring and Convolution
3 kucg.korea.ac.kr

23 Blurring and Convolution
3 kucg.korea.ac.kr

24 Blurring and Convolution
3 kucg.korea.ac.kr

25 Blurring and Convolution
3 kucg.korea.ac.kr

26 Blurring and Convolution
3 kucg.korea.ac.kr

27 Blurring and Convolution
3 kucg.korea.ac.kr

28 Blurring and Convolution
3 kucg.korea.ac.kr

29 Blurring and Convolution
3 kucg.korea.ac.kr

30 Blurring and Convolution
3 kucg.korea.ac.kr

31 Blurring and Convolution
3 kucg.korea.ac.kr

32 Blurring and Convolution
3 kucg.korea.ac.kr

33 Blurring and Convolution
3 kucg.korea.ac.kr

34 Blurring and Convolution
3 kucg.korea.ac.kr

35 Blurring and Convolution
3 kucg.korea.ac.kr

36 Blurring and Convolution
3 kucg.korea.ac.kr

37 Blurring and Convolution
3 kucg.korea.ac.kr

38 Blurring and Convolution
3 kucg.korea.ac.kr

39 Blurring and Convolution
3 kucg.korea.ac.kr

40 Edge Detection kucg.korea.ac.kr

41 Discretize Convolution
kucg.korea.ac.kr

42 Edge Detection Pixel alteration using convolution mask mask
int sumX, sumY, sum; for( y=1 ; y<image_height-1 ; y++ ) for( x=1 ; x<image_width-1 ; x++ ) { sumX=0; for( j=0 ; j<3 ; j++ ) for( i=0 ; i<3 ; i++ ){ sumX += maskX[i][j]*image[x+i-1][y+j-1] } sumY=0; sumY += maskY[i][j]*image[x+i-1][y+j-1] sum = abs(sumX)+abs(sumY); if(sum > 255) sum =255; if(sum < 0) sum = 0; result_Image[x][y] = sum; mask kucg.korea.ac.kr

43 Edge Detection Various masks for edge detection Prewitt Sobel
Frei-Chen Laplacian 1 Laplacian 2 Laplacian 3 kucg.korea.ac.kr

44 Image Processing Pixel operations Filtering Warping Add luminance Blur
Add contrast Filtering Blur Detect edge Warping Scale Rotate Warps kucg.korea.ac.kr

45 Image Warping Move pixels of image Mapping Resampling Warp
Source Image Destination Image kucg.korea.ac.kr

46 Overview Mapping Resampling Forward Reverse Point sampling
Triangle filter Gaussian filter kucg.korea.ac.kr

47 Mapping Define transformation
Describe the destination (x, y) for every location (u, v) in the source (or vice-versa, if invertible) v y u x kucg.korea.ac.kr

48 Example Mappings Scale by factor : x = factor * u y = factor * v v y
0.8 u x kucg.korea.ac.kr

49 Example Mappings Rotate by θ degrees: x = u cos θ – v sin θ
y = u sin θ + v cos θ x y v Rotate 30 u kucg.korea.ac.kr

50 Example Mappings Shear in X by factor : Shear in Y by factor :
x = u + factor * v y = v Shear in Y by factor : x = u y = v + factor * u u v x y Shear X 1.3 u v x y Shear Y 1.3 kucg.korea.ac.kr

51 Other Mappings Any function of u and v : x = fx(u, v) y = fy(u, v)
Fish-eye Swirl Rain kucg.korea.ac.kr

52 Image Warping Implementation I
Forward mapping : for(int u=0; u<umax; u++) { for(int v=0; v<vmax; v++) { float x = fx(u,v); float y = fy(u,v); dst(x,y) = src(u,v); } (u, v) f (x, y) Source Image Destination Image kucg.korea.ac.kr

53 Forwarding Mapping Iterate over source image y v Rotate -30 u x
kucg.korea.ac.kr

54 Forwarding Mapping – NOT
Iterate over source image Many source pixels can map to same destination pixel x y u v Rotate -30 kucg.korea.ac.kr

55 Forwarding Mapping – NOT
Iterate over source image Some destination pixels may not be covered Many source pixels can map to same destination pixel x y u v Rotate -30 kucg.korea.ac.kr

56 Image Warping Implementation II
Reverse mapping for(int x=0; x<xmax; x++) { for(int y=0; y<ymax; y++) { float u = fx-1(x,y); float v = fy-1(x,y); dst(x,y) = src(u,v); } (u, v) f (x, y) Source Image Destination Image kucg.korea.ac.kr

57 Reverse Mapping Iterate over destination image
At least, no pixel in destination goes empty Must resample source May oversample, but much simpler x y u v Rotate -30 kucg.korea.ac.kr

58 Usually (u, v) is not an integer
Resampling Evaluate source image at arbitrary (u, v) Usually (u, v) is not an integer (u, v) (x, y) Source Image Destination Image kucg.korea.ac.kr

59 Overview Mapping Resampling Forward Reverse Point sampling
Triangle filter Gaussian filter kucg.korea.ac.kr

60 This method is simple, but it causes aliasing
Point Sampling Take value at closest pixel int iu = trunc(u+0.5); int iv = trunc(v+0.5); dst(x, y) = src(iu, iv); This method is simple, but it causes aliasing x y u v F kucg.korea.ac.kr

61 Triangle Filtering Convolve with triangle filter Input Output
kucg.korea.ac.kr

62 Triangle Filtering Bilinearly interpolate four closest pixels
a = linear interpolation of src(u1, v2) and src(u2, v2) b = linear interpolation of src(u1, v1) and src(u2, v1) dst(x, y) = linear interpolation of “a” and “b” a (u1, v2) (u2, v2) (u, v) (u1, v1) (u2, v1) b kucg.korea.ac.kr

63 Width of Gaussian kernel affects bluriness
Gaussian Filtering Convolve with Gaussian filter Input Output Width of Gaussian kernel affects bluriness kucg.korea.ac.kr

64 Gaussian Filtering Compute weighted sum of pixel neighborhood :
Weights are normalized values of Gaussian function r (u, v) kucg.korea.ac.kr

65 Filtering Methods Comparison
Trade-offs Aliasing versus blurring Computation speed Point Bilinear Gaussian kucg.korea.ac.kr

66 Image Warping Implementation III
Reverse mapping for(int x=0; x<xmax; x++) { for(int y=0; y<ymax; y++) { float u = fx-1(x,y); float v = fy-1(x,y); dst(x,y) = resample_src(u,v,w); } (u, v) f (x, y) Source Image Destination Image kucg.korea.ac.kr

67 Image Warping Implementation III
Reverse mapping for(int x=0; x<xmax; x++) { for(int y=0; y<ymax; y++) { float u = fx-1(x,y); float v = fy-1(x,y); dst(x,y) = resample_src(u,v,w); } (u, v) f (x, y) w Source Image Destination Image kucg.korea.ac.kr

68 Example: Scale Scale (src, dst, sx, sy) : float w ≈ max(1/sx, 1/sy)
for(int x=0; x<xmax; x++) { for(int y=0; y<ymax; y++) { float u = x/sx ; float v = y/sy; dst(x,y) = resample_src(u,v,w); } v y (u, v) Scale 0.5 (x, y) u x kucg.korea.ac.kr

69 Example: Rotate Rotate (src, dst, theta)
for(int x=0; x<xmax; x++) { for(int y=0; y<ymax; y++) { float u = x*cos(-θ)-y*sin(-θ) float v = x*sin(-θ)+y*cos(-θ) dst(x,y) = resample_src(u,v,w); } x y v (u, v) (x, y) Rotate 30 u kucg.korea.ac.kr

70 Example: Fun Swirl (src, dst, theta) for(int x=0; x<xmax; x++) {
for(int y=0; y<ymax; y++) { float u = rot(dist(x,xcenter)*θ) float v = rot(dist(y,ycenter)*θ) dst(x,y) = resample_src(u,v,w); } v (u, v) y (x, y) Swirl 45 u x kucg.korea.ac.kr


Download ppt "Image Processing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr."

Similar presentations


Ads by Google