1 / 68

Introduction to Computer Vision Lecture 8

Introduction to Computer Vision Lecture 8. Roger S. Gaborski. Graduate Student Projects. Pupil Detection Results. Pineapple and Orange Examples. Histograms. A histogram is just a method for summarizing data, for example, gray level pixel values Can also summarize edge data.

sinead
Download Presentation

Introduction to Computer Vision Lecture 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Computer VisionLecture 8 Roger S. Gaborski

  2. Graduate Student Projects Roger S. Gaborski

  3. Roger S. Gaborski

  4. Pupil Detection Results Roger S. Gaborski

  5. Roger S. Gaborski

  6. Roger S. Gaborski

  7. Roger S. Gaborski

  8. Roger S. Gaborski

  9. Pineapple and Orange Examples Roger S. Gaborski

  10. Roger S. Gaborski

  11. Histograms • A histogram is just a method for summarizing data, for example, gray level pixel values • Can also summarize edge data Roger S. Gaborski

  12. >> imP1=imread('Pineapple1.jpg'); >> figure, imshow(imP1) >> %Convert to Gray scale >> imP1gray = rgb2gray(imP1); >> figure, imshow(imP1gray) >>%Minimum and Maximum code values >> MAXcode = max(imP1gray(:)) MAXcode = 214 >> MINcode = min(imP1gray(:)) MINcode = 1 >>%Histogram of Gray Level Pixel Values Roger S. Gaborski

  13. Edges >> imP1=imread('Pineapple1.jpg'); >> figure, imshow(imP1) >> %Convert to Gray scale >> imP1gray = rgb2gray(imP1); >> figure, imshow(imP1gray) >> imP1grayNor = mat2gray(imP1gray, [ 0 255]); >> figure, hist(imP1grayNor(:)) Roger S. Gaborski

  14. Edges >> imP1=imread('Pineapple1.jpg'); >> figure, imshow(imP1) >> %Convert to Gray scale >> imP1gray = rgb2gray(imP1); >> figure, imshow(imP1gray) >> imP1grayNor = mat2gray(imP1gray, [ 0 255]); >> figure, hist(imP1grayNor(:)) >> >> w=[1 1 1;0 0 0; -1 -1 -1] w = 1 1 1 0 0 0 -1 -1 -1 >> imP1edge = imfilter(double(imP1grayNor),w); >> figure, imshow(imP1edge, [ ]) Roger S. Gaborski

  15. >> figure, imshow(imP1edge,[ ]) >>figure, imshow(abs(imP1edge),[ ]) Roger S. Gaborski

  16. Edge Histogram Edge histogram Absolute Edge Histogram Roger S. Gaborski

  17. Edge Image Thresholds >> figure, imshow(abs(imP1edge)>1.0),title('Threshold 1.0') Roger S. Gaborski

  18. >> w=[1 1 1;0 0 0; -1 -1 -1]' w = 1 0 -1 1 0 -1 1 0 -1 >> imP1edge2 = imfilter(double(imP1gray),w); >> figure, imshow(imP1edge2,[ ]) >> figure, imshow(abs(imP1edge2,[ ])) Roger S. Gaborski

  19. >> w=[1 1 1;0 0 0; -1 -1 -1] w = 1 1 1 0 0 0 -1 -1 -1 >> w=[1 1 1;0 0 0; -1 -1 -1]' w = 1 0 -1 1 0 -1 1 0 -1 Roger S. Gaborski

  20. [BW,thresh,gv,gh] = edge(imP1grayNor,'prewitt'); >> [BW,thresh,gv,gh] = Edge(imP1grayNor,'prewitt'); >> figure, imshow(gv, [ ]), title(‘gv’) >> figure, imshow(gh, [ ]), title(‘gh’) >> figure, imshow(BW) >> thresh thresh = 0.0675 Roger S. Gaborski

  21. [BW,thresh,gv,gh] = edge(imP1grayNor,'sobel'); >> [BW,thresh,gv,gh] = edge(imP1grayNor,'sobel'); >> figure, imshow(gv,[ ]),title('gv') >> figure, imshow(gh,[ ]),title('gh') >> figure, imshow(BW),title('BW') >> thresh thresh = 0.0695 Roger S. Gaborski

  22. BW = edge(imP1grayNor,'canny',THRESH,SIGMA); >> BW = edge(imP1grayNor,'canny',.1); >> figure, imshow(BW), title(‘Threshold = .1’) Roger S. Gaborski

  23. Orange1 - Canny Roger S. Gaborski

  24. Edge Images • Very low level representations • Simply 0s and 1s • We would like to have a higher representation • Which 1’s belong to which edges? Roger S. Gaborski

  25. Connect component analysis Roger S. Gaborski

  26. Korean Textdemo Gray scale image Roger S. Gaborski Roger S. Gaborski 26

  27. Connect Component Labeling Foreground = 1 Background = 0 Roger S. Gaborski Roger S. Gaborski 27

  28. Connect Component Labeling-2 Foreground = 1 Background = 0 Roger S. Gaborski Roger S. Gaborski 28

  29. Connect Component Labeling-3 Foreground = 1 Background = 0 Roger S. Gaborski Roger S. Gaborski 29

  30. Connect Component Labeling-4 Foreground = 1 Background = 0 Roger S. Gaborski Roger S. Gaborski 30

  31. Connect Component Labeling-5 Foreground = 1 Background = 0 Roger S. Gaborski Roger S. Gaborski 31

  32. Connect Component Labeling-6 Foreground = 1 Background = 0 Roger S. Gaborski Roger S. Gaborski 32

  33. Connect Component Labeling-7 Foreground = 1 Background = 0 NW,W neighbors are a, but NE is b Roger S. Gaborski Roger S. Gaborski 33

  34. Connect Component Labeling-8 Foreground = 1 Background = 0 NW,W neighbors are a, but NE is b Resolve by making all elements in conflict the same label, in this case a Roger S. Gaborski Roger S. Gaborski 34

  35. Final Connect Component Labeling Foreground = 1 Background = 0 Roger S. Gaborski Roger S. Gaborski 35

  36. MATLAB Connected Component Labeling >> LabelImage = bwlabel(image,8) LabelImage = 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 • >> image = [ 0 1 0 0 0 0 0 0 1 1;... • 0 1 1 0 0 0 0 0 1 0;... • 0 0 1 0 0 0 0 1 1 1;... • 0 1 1 1 1 0 1 1 1 1;... • 0 0 0 0 1 1 1 0 0 0;... • 0 0 0 0 0 0 0 0 0 0;... • 0 0 0 0 1 1 1 0 0 0;... • 0 0 0 0 0 0 0 0 0 0;... • 0 0 1 1 1 0 0 0 0 0;... • 0 0 0 0 0 0 0 0 0 0]; Roger S. Gaborski Roger S. Gaborski 36

  37. Visualization of Labeled data Labeled image, three connected Components and dark blue background Original image, Foreground = white, Background = black Roger S. Gaborski Roger S. Gaborski 37

  38. Labeled Korean Characters Input image Output image Roger S. Gaborski Roger S. Gaborski 38

  39. Color Segmentation Roger S. Gaborski

  40. RGB Color Image M x N x 3 array of color pixels The three planes correspond to red, green and blue values. Each pixel location is actually a triplet, (r, g, b) Each plane drives the respective red, green and blue inputs of a color monitor Data classes: Double  [0,1] Uint8  [ 0 255] Color Image Processing Roger S. Gaborski Roger S. Gaborski 40

  41. ZR ZG ZB Blue component Green component Red component Roger S. Gaborski

  42. Roger S. Gaborski

  43. Row of Data (red, green and blue) Roger S. Gaborski 43

  44. Roger S. Gaborski 44

  45. Extract individual color planes: fRed = rgb_image(:,:,1); fGreen = rgb_image(:,:,2); fBlue = rgb_image(:,:,3); Combine individual frames rgb_image = cat(3, fRed, fGreen, fBlue); Roger S. Gaborski Roger S. Gaborski 45

  46. RGB color space rgbcube(vx, vy, vz) Roger S. Gaborski Roger S. Gaborski 46

  47. HSV color space hsv_image = rgb2hsv(rgb_image); rgb_image = hsv2rgb(hsv_image); Roger S. Gaborski Roger S. Gaborski 47

  48. SegmentationNot Well Defined Definition – divide an image in to non-overlapping regions based on properties of image, such as, Gray level Color Texture Motion Depth perception Etc. Roger S. Gaborski Roger S. Gaborski 48

  49. Image segmentation in RGB Partition image into regions Color-based segmentation Obtain a sample of color pixels that match region we wish to segment Estimate the mean of the three colors Store color values in column vector m Classify each pixel in image as having a color specified by m Roger S. Gaborski Roger S. Gaborski 49

  50. Classify pixels- Euclidean distance We need a measure of similarity to classify pixels – how ‘close’ is a given pixel to m? Let z denote arbitrary pixel in the image z is similar to m if the distance between them is less than some threshold, T Euclidean distance: D(z,m) = ||z-m|| where ||x|| is the norm of x Roger S. Gaborski Roger S. Gaborski 50

More Related