1 / 44

Foundations of Computer Vision Lecture 12

Roger S. Gaborski. Foundations of Computer Vision Lecture 12. QUIZ 1. Chest Radiographic Image. separate lung region and bone region. What information can we extract from the image – separate lung region and bone region? As a first step, techniques we can try: Thresholding Imadjust

eris
Download Presentation

Foundations of Computer Vision Lecture 12

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. Roger S. Gaborski Foundations of Computer VisionLecture 12 Roger S. Gaborski

  2. QUIZ 1 Roger S. Gaborski

  3. Chest Radiographic Image separate lung region and bone region Roger S. Gaborski

  4. What information can we extract from the image – separate lung region and bone region? • As a first step, techniques we can try: • Thresholding • Imadjust • Edge detection • Texture Roger S. Gaborski

  5. Histogram of Image Roger S. Gaborski

  6. Threshold = .4 Roger S. Gaborski

  7. Threshold = .6 Roger S. Gaborski

  8. Otsu’s graythreshThresholdingMethod • Algorithm assumes the image’s histogram is bi-model • Finds the optimal threshold to separate the two classes of pixels Roger S. Gaborski

  9. Matlab - Otsu’s Method • level = graythresh(Ig) • figure, imshow(Ig>level), title('Graythresh Level') • level = 0.5373 Roger S. Gaborski

  10. Roger S. Gaborski

  11. Threshold Level Determined by Otsu Method Roger S. Gaborski

  12. Otsu’s method, continued • Since the histogram is not bi-modal should not expect good separation between lungs and bones Roger S. Gaborski

  13. imadjust Roger S. Gaborski

  14. Original and imadjust Image Roger S. Gaborski

  15. Edge Detection fh = fspecial('sobel'); %horiz edge fv = fh'; %vertical edge i_horiz = imfilter(Ig, fh); figure, imshow(i_horiz, []), title('Horizontal Edges') i_vert = imfilter(Ig, fv); figure, imshow(i_vert, []),title('Vertical Edges') Roger S. Gaborski

  16. Horizontal Edges Roger S. Gaborski

  17. How do I find pixel locations of edges with largest magnitude? Roger S. Gaborski

  18. Vertical Edges Roger S. Gaborski

  19. Canny- stddev = 2 Roger S. Gaborski

  20. Canny- stddev = 3 Roger S. Gaborski

  21. Laplacian of Gaussian, stddev =2 Roger S. Gaborski

  22. Laplacian of Gaussian, stddev=3 Roger S. Gaborski

  23. Laplacian of Gaussian, stddev =2.5 Roger S. Gaborski

  24. Sensitivity of standard deviation: • Compare the last three images • Significant difference with a small change in standard deviation • How do you automatically choose the standard deviation if you have a large collection of images that you need to process? Roger S. Gaborski

  25. Reconsider Thresholding • Does it make sense to have only one threshold value? • Physically, maybe the image cannot be separated into only 2 classes • Consider more than one thresholding values Roger S. Gaborski

  26. IMQUANTIZE • imquantize Quantize image using specified quantization levels and output values. • QUANT_A = imquantize(A, LEVELS) uses the quantization levels specified • in the 1xN vector LEVELS to convert image A into an output image • QUANT_A with N+1 discrete levels. The entries in LEVELS have to be in • strictly increasing order. The output image QUANT_A contains integer • values in the range [1 (N+1)] assigned as per the criterion below: • If A(k) <= LEVELS(1), then QUANT_A(k) = 1 • If LEVELS(m-1) < A(k) <= LEVELS(m), then QUANT_A(k) = m • If A(k) >LEVELS(N), then QUANT_A(k) = N+1 Roger S. Gaborski

  27. imquantize > A =[1:10] A = 1 2 3 4 5 6 7 8 9 10 LEVELS = [5] % N=1 %Results in 2 levels, N+1 = 2 % Values less than and equal to 5 are assigned a value 1 %Values greater than 5 are assigned value 2 L = imquantize(A,LEVELS) L = 1 1 1 1 1 2 2 2 2 2 A = 1 2 3 4 5 6 7 8 31 310 >> L = imquantize(A,LEVELS) L = 1 1 1 1 1 2 2 2 2 2 Roger S. Gaborski

  28. Multi-levels LEVELS = [3,7] %Two levels, N=2, N+1 = 3 L = imquantize(A,LEVELS) L = 1 1 1 2 2 2 2 3 3 3 1 to 3 is first level, 4-7 is second level and 8 to 10 is 3rd level Roger S. Gaborski

  29. >> R = rand(5) R = 0.7577 0.7060 0.8235 0.4387 0.4898 0.7431 0.0318 0.6948 0.3816 0.4456 0.3922 0.2769 0.3171 0.7655 0.6463 0.6555 0.0462 0.9502 0.7952 0.7094 0.1712 0.0971 0.0344 0.1869 0.7547 >> LEVELS = [.3] LEVELS = 0.3000 >> L = imquantize(R,LEVELS) L = 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 1 2 2 2 1 1 1 1 2 Roger S. Gaborski

  30. Could we apply this technique to segmentation (lungs and bones)? >> R = rand(100); >> LEVELS = [.1 .2 .5 .6 .7]; >> L = imquantize(R,LEVELS); >> R(1,1:10) = 0.270 0.417 0.963 0.301 0.916 0.736 0.146 0.456 0.109 0.163 >> L(1,1:10) = 3 3 6 3 6 6 2 3 2 2 BUT, HOW DO WE SELECT LEVELS? Roger S. Gaborski

  31. Displaying the L image: label2rgb • label2rgb Convert label matrix to RGB image. • The RGB matrix can then be visualized LEVELS = [3,7] L = imquantize(A,LEVELS) L = 1 1 1 2 2 2 2 3 3 3 1 to 3 is first level, 4-7 is second level and 8 to 10 is 3rd level iData=label2rgb(L) iData(:,:,1) = 0 0 0 0 0 0 0 255 255 255 iData (:,:,2) = 0 0 0 255 255 255 255 255 255 255 iData(:,:,3) = 255 255 255 255 255 255 255 0 0 0 figure, imshow(iData,'InitialMagnification','fit') Roger S. Gaborski

  32. iData Roger S. Gaborski

  33. THRESH = multithresh(A, N) • THRESH = multithresh(A, N) computes N thresholds for image A using the Otsu's method and returns them in THRESH. • THRESH is a 1xN vector which can be used to convert A into an image with (N+1) discrete levels using IMQUANTIZE. Roger S. Gaborski

  34. >> I = imread('chestRadiograph1.png'); • I = rgb2gray(I); • Id = im2double(I); • thresh = multithresh(I,3) = 0.4416 0.5356 0.6233 seg_I= imquantize(Id,thresh); • RGB = label2rgb(seg_I); • figure, imshow(RGB) Roger S. Gaborski

  35. Histogram of Image Interval 1 2 3 Interval 4 Roger S. Gaborski

  36. thresh = multithresh(I,3) = 0.4416 0.5356 0.6233 I(20,20:30) = Columns 1 through 7 0.4235 0.4235 0.4235 0.4275 0.4275 0.4353 0.4431 Columns 8 through 11 0.4549 0.4667 0.4784 0.4824 >> seg_I(20,20:30) 1 1 1 1 1 1 2 2 2 2 2 Roger S. Gaborski

  37. Multi-level Thresholding Roger S. Gaborski

  38. Another Example Roger S. Gaborski

  39. >> i = imread('Powder21.jpg'); >> i = im2double(i); >> Ig = rgb2gray(i); >> figure, imshow(Ig) >> thresh = graythresh(Ig) thresh = 0.3765 >> Igt = Ig>thresh; >> figure, imshow(Igt) Roger S. Gaborski

  40. Roger S. Gaborski

  41. Roger S. Gaborski

  42. I=imread('Powder21.jpg'); >> I = rgb2gray(I); >> I=im2double(I); >> thresh=multithresh(I,4); >> seg_I = imquantize(I,thresh); Roger S. Gaborski

  43. Roger S. Gaborski

  44. RGB = label2rgb(seg_I); figure, imshow(RGB) Roger S. Gaborski

More Related