Introduction to Digital Image Processing

80
Introduction Introduction to Digital to Digital Image Image Processing Processing

Transcript of Introduction to Digital Image Processing

Page 1: Introduction to Digital Image Processing

Introduction to Introduction to Digital Image Digital Image ProcessingProcessing

Page 2: Introduction to Digital Image Processing

Digital Image ProcessingDigital Image Processing

• Digital image processing is the use of computer algorithms to perform image processing on digital images.

Taken from Wikipedia

Page 3: Introduction to Digital Image Processing

Why should we care?Why should we care?

• Everyone has a digital camera• Everyone shares photos and videos• Concepts can be used in videogames• Robotics• New technologies (Google Glass, Oculus Rift)• Useful in other fields of science (medical

imaging, astronomy)• Many frameworks for image processing• It’s just fun

Page 4: Introduction to Digital Image Processing

What is a digital image?What is a digital image?

Page 5: Introduction to Digital Image Processing

A Pixel!!!!A Pixel!!!!

Page 6: Introduction to Digital Image Processing

Pixel!!!!Pixel!!!!

Page 7: Introduction to Digital Image Processing

IR y UVIR y UV

Page 8: Introduction to Digital Image Processing

Representing PixelsRepresenting Pixels

Page 9: Introduction to Digital Image Processing

Representing Pixels: 2Representing Pixels: 2

Page 10: Introduction to Digital Image Processing

Representing Pixels: 4Representing Pixels: 4

Page 11: Introduction to Digital Image Processing

Representing Pixels: 8Representing Pixels: 8

Page 12: Introduction to Digital Image Processing

Representing Pixels: 16Representing Pixels: 16

Page 13: Introduction to Digital Image Processing

Representing Pixels: 32Representing Pixels: 32

Page 14: Introduction to Digital Image Processing

Representing Pixels: 64Representing Pixels: 64

Page 15: Introduction to Digital Image Processing

Representing Pixels: 128Representing Pixels: 128

Page 16: Introduction to Digital Image Processing

Representing Pixels: 256Representing Pixels: 256

Page 17: Introduction to Digital Image Processing

Colors: RGB spaceColors: RGB space

Page 18: Introduction to Digital Image Processing

Colors: RGBColors: RGB

Page 19: Introduction to Digital Image Processing

Lab: Image loading, color Lab: Image loading, color channelschannelsimg = imread ( 'Desktop/guitarra.jpg' );img_size = size ( img )

img_red = uint8 ( zeros ( img_size ) );img_green = uint8 ( zeros (img_size) );img_blue = uint8 ( zeros ( img_size ) );

Page 20: Introduction to Digital Image Processing

Lab: Image loading, color Lab: Image loading, color channelschannelsimg_red (:, :, 1 ) = img ( :, :, 1 );img_green (:, :, 2 ) = img ( :, :, 2 );img_blue (:, :, 3 ) = img ( :, :, 3 );

imshow ( img );imshow ( img_red );imshow ( img_green );imshow ( img_blue );

Page 21: Introduction to Digital Image Processing

Lab: Image loading, color Lab: Image loading, color channelschannelsimg = rgb2gray ( img );imshow ( img );

Page 22: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 23: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 24: Introduction to Digital Image Processing

Imagen: Matriz de PixelesImagen: Matriz de Pixeles

Page 25: Introduction to Digital Image Processing

Imagen: Matriz de PixelesImagen: Matriz de Pixeles

Page 26: Introduction to Digital Image Processing

Imagen: Matriz de PixelesImagen: Matriz de Pixeles

Page 27: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 28: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 29: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 30: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 31: Introduction to Digital Image Processing

Lab: Gamma CorrectLab: Gamma Correct

function output = gcorrect ( i, g )i = double ( i );output = ( i / 255).^g * 255;output = uint8 ( output );end;

imshow ( gcorrect (img, 2 ) );imshow ( gcorrect (img, 0.5 ) );

Page 32: Introduction to Digital Image Processing

Guess the PixelGuess the Pixel

Page 33: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 34: Introduction to Digital Image Processing

Imagen: Matriz de PixelesImagen: Matriz de Pixeles

Page 35: Introduction to Digital Image Processing

Image: Matrix of Pixel ValuesImage: Matrix of Pixel Values

Page 36: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

• Every pixel has neighbors

Page 37: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

Page 38: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

Page 39: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

5 8 7

4 1 6

3 2 9

1 2 3 4 5 6 7 8 95

Page 40: Introduction to Digital Image Processing

Lab: Median FilterLab: Median Filter

img_noise = imnoise (img, 'salt & pepper', 0.4);imshow ( img_noise );img_filt = medfilt2 ( img_noise );imshow ( img_filt );

Page 41: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

Page 42: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

5x5 9x9 13x13 17x17 21x21 25x25 29x29

Page 43: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

Page 44: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

Page 45: Introduction to Digital Image Processing

Image: Pixel NeighborhoodImage: Pixel Neighborhood

Page 46: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Page 47: Introduction to Digital Image Processing

Imagen: f(x,y)Imagen: f(x,y)

Page 48: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Page 49: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Page 50: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Page 51: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Page 52: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Laplacian Derivative

Page 53: Introduction to Digital Image Processing

Imagen: f(x,y)Imagen: f(x,y)

Page 54: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Page 55: Introduction to Digital Image Processing

Image: f(x,y)Image: f(x,y)

Page 56: Introduction to Digital Image Processing

Image: f(x,y), Gradients, SobelImage: f(x,y), Gradients, Sobel

Page 57: Introduction to Digital Image Processing

Image: f(x,y), Gradients, SobelImage: f(x,y), Gradients, Sobel

Page 58: Introduction to Digital Image Processing

Image: f(x,y), Gradients, SobelImage: f(x,y), Gradients, Sobel

Page 59: Introduction to Digital Image Processing

Image: f(x,y), Gradients, SobelImage: f(x,y), Gradients, Sobel

Page 60: Introduction to Digital Image Processing

Image: f(x,y), Gradients, SobelImage: f(x,y), Gradients, Sobel

Page 61: Introduction to Digital Image Processing

Image: f(x,y), Gradients, SobelImage: f(x,y), Gradients, Sobel

Page 62: Introduction to Digital Image Processing

Lab: Edge DetectionLab: Edge Detection

Step 1: Create a Gauss filtergauss_fil = [2 4 5 4 24 9 12 9 45 12 15 12 54 9 12 9 42 4 5 4 2 ]sum ( sum (gauss_fil ) )gauss_fil = gauss_fil / 159

Page 63: Introduction to Digital Image Processing

Lab: Edge DetectionLab: Edge Detection

Step 2: Apply Gauss filterimg_blur = conv2 ( double ( img ), gauss_fil );img_blur = uint8 ( img_blur );figure, imshow ( img ), figure, imshow ( img_blur );

Page 64: Introduction to Digital Image Processing

Lab: Edge DetectionLab: Edge Detection

Step 3: Create kernels to calculate gradientker_gx = [-1 0 1-2 0 2-1 0 1 ]ker_gy = [1 2 10 0 0-1 -2 -1]

Page 65: Introduction to Digital Image Processing

Lab: Edge DetectionLab: Edge Detection

Step 4: Calculate gradientgx = conv2 ( double ( img ), ker_gx );gy = conv2 ( double ( img ), ker_gy );img_g = abs( gx ) + abs( gy );img_g = uint8 ( img_g );imshow ( img_g );

Page 66: Introduction to Digital Image Processing

Lab: Edge DetectionLab: Edge Detection

Step 5: Suppression of non-maxima

Page 67: Introduction to Digital Image Processing

Lab: Edge DetectionLab: Edge Detection

Step 6: Two thresholdsStep 7: Hysteresis

img_c = edge (img, 'canny' );figure, imshow(img_g), figure, imshow ( img_c );

Page 68: Introduction to Digital Image Processing

Image: f(x,y), Hough TransformImage: f(x,y), Hough Transform

Page 69: Introduction to Digital Image Processing

Image: f(x,y), Hough TransformImage: f(x,y), Hough Transform

0 45 90 135

1

2

3

4

5

6

7

Page 70: Introduction to Digital Image Processing

Imagen: f(x,y), Transformada de Imagen: f(x,y), Transformada de HoughHough

Page 71: Introduction to Digital Image Processing

Image: f(x,y), Hough TransformImage: f(x,y), Hough Transform

Page 72: Introduction to Digital Image Processing

Lab: Segment DetectionLab: Segment Detection

• Visit: www.ipol.im• Segmentation and Edges• LDS: a Line Segment Detector

Page 73: Introduction to Digital Image Processing

Lab: SegmentationLab: Segmentation

• Visit: www.ipol.im• Segmentation and Edges• Chan-Vese Segmentation• Consider: A Real Time Morphological Snakes

Algorithm

Page 74: Introduction to Digital Image Processing

Things to ConsiderThings to Consider

• Quadtrees• Review Graph Theory (Laplace, Gradiantes,

Watersheds)– Strongly Connected Components– Minimum Cut Algorithm

• Gather feedback from the user (make the user select areas or faces)

• Sparse Modeling• Machine Learning

Page 75: Introduction to Digital Image Processing

WatershedsWatersheds

Page 76: Introduction to Digital Image Processing

Solving a Maze with Image Solving a Maze with Image Processing?Processing?

Page 77: Introduction to Digital Image Processing

Solving a Maze with Image Solving a Maze with Image Processing?Processing?

Page 78: Introduction to Digital Image Processing

Solving a Maze with Image Solving a Maze with Image Processing?Processing?

Page 79: Introduction to Digital Image Processing

Usefool ToolsUsefool Tools

• Matlab / Octave• Mathematica• OpenCV• ipol.im• Python• Photoshop

Page 80: Introduction to Digital Image Processing

Thanks for watching.Thanks for watching.

• Email: [email protected]• Twitter: @jseaman76• G+: [email protected]• FB: www.facebook.com/julio.seaman