1 / 104

Introduction to Computer Vision Image Texture Analysis

Introduction to Computer Vision Image Texture Analysis. Lecture 12. A few examples. Morphological processing for background illumination estimation Optical character recognition. Image with nonlinear illumination. Original Image Thresholded with graythresh.

clifforda
Download Presentation

Introduction to Computer Vision Image Texture Analysis

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 VisionImage Texture Analysis Lecture 12

  2. A few examples • Morphological processing for background illumination estimation • Optical character recognition Roger S. Gaborski

  3. Image with nonlinear illumination Original Image Thresholded with graythresh

  4. Obtain Estimate of Background background = imopen(I,strel('disk',15)); %GRAYSCALE figure, imshow(background, []) figure, surf(double(background(1:8:end,1:8:end))),zlim([0 1]); Roger S. Gaborski

  5. %subtract background estimate from original image I2 = I - background; figure, imshow(I2), title('Image with background removed') level = graythresh(I2); bw = im2bw(I2,level); figure, imshow(bw),title('threshold') Roger S. Gaborski

  6. Comparison Original Threshold Background Removal - Threshold Roger S. Gaborski

  7. Optical Character Recognition • After segmenting a character we still need to recognize the character. • How do we determine if a matrix of pixels represents an ‘A’, ‘B’, etc? Roger S. Gaborski

  8. Roger S. Gaborski

  9. Roger S. Gaborski

  10. Approach • Select line of text • Segment each letter • Recognize each letter as ‘A’, ‘B’, ‘C’, etc. Roger S. Gaborski

  11. Select line 3: Samples of segment of individual letters in line 3: Roger S. Gaborski

  12. We need labeled samples of each potential letter to compare to unknown • Take the product of the unknown character and each labeled character and determine with labeled character is the closest match Roger S. Gaborski

  13. %Load Database of characters (samples of known characters) load charDB08182009.mat whos char08182009 Name Size Bytes Class Attributes char08182009 26x1050 218400 double EACH ROW IS VECTORIZED CHARACTER BITMAP Roger S. Gaborski

  14. BasicOCR.m CODE SOMETHING LIKE THIS: cc = ['A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' ... 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z']; First, convert matrix of textcharacter to a rowvector for j=1:26 score(j)= sum(t .* char08182009R(j,:)); end ind(i)=find(score= =max(score)); fprintf('Recognized Text %s, \n', cc(ind)) OUTPUT: Recognized Text HANSPETERBISCHOF, Roger S. Gaborski

  15. How can I segment this image? Assumption: uniformity of intensities in local image region Roger S. Gaborski University of Bonn

  16. What is Texture? Roger S. Gaborski University of Bonn

  17. Roger S. Gaborski

  18. Edge Detection • Histogram • Threshold - graythresh Roger S. Gaborski

  19. Roger S. Gaborski

  20. Roger S. Gaborski

  21. Roger S. Gaborski

  22. lev = graythresh(I) lev = 0.5647 >> figure, imshow(I<lev) Roger S. Gaborski

  23. What is Texture • No formal definition • There is significant variation in intensity levels between nearby pixels • Variations of intensities form certain repetitive patterns (homogeneous at some spatial scale) • The local image statistics are constant, slowly varying • human visual system: textures are perceived as homogeneous regions, even though textures do not have uniform intensity Roger S. Gaborski

  24. Texture • Apparent homogeneous regions: • In both cases the HVS will interpret areas of sand or bricks as a ‘region’ in an image • But, close inspection will reveal strong variations in pixel intensity • Sand on a beach • A brick wall Roger S. Gaborski

  25. Texture • Is the property of a ‘group of pixels’/area; a single pixel does not have texture • Is scale dependent • at different scales texture will take on different properties • Large number of (if not countless) primitive objects • If the objects are few, then a group of countable objects are perceived instead of texture • Involves the spatial distribution of intensities • 2D histograms • Co-occurrence matrixes Roger S. Gaborski

  26. Scale Dependency • Scale is important – consider sand • Close up • “small rocks, sharp edges” • “rough looking surface” • “smoother” • Far Away • “one object •  brown/tan color” Roger S. Gaborski

  27. Terms (Properties) Used to Describe Texture • Coarseness • Roughness • Direction • Frequency • Uniformity • Density How would describe dog fur, cat fur, grass, wood grain, pebbles, cloth, steel?? Roger S. Gaborski

  28. “The object has a fine grain and a smooth surface” • Can we define these terms precisely in order to develop a computer vision recognition algorithm? Roger S. Gaborski

  29. Features • Tone – based on pixel intensity in the texture primitive • Structure – spatial relationships between primitives • A pixel can be characterized by its Tonal/Structural properties of the group of pixels it belongs to Roger S. Gaborski

  30. Tonal: Average intensity Maximum intensity Minimum intensity Size, shape Spatial Relationship of Primitives: Random Pair-wise dependent Roger S. Gaborski

  31. Artificial Texture                         Roger S. Gaborski

  32. Artificial Texture                         Segmenting into regions based on texture Roger S. Gaborski

  33. Color Can Play an Important role in Texture                         Roger S. Gaborski

  34. Color Can Play an Important Role in Texture                         Roger S. Gaborski

  35. Statistical and Structural Texture Consider a brick wall: • Statistical Pattern – close up pattern in bricks • Structural (Syntactic) Pattern – brick pattern •  on previous slides can be represented by a grammar, • such as, ababab) Roger S. Gaborski

  36. Most current research focuses on statistical texture Edge density is a simple texture measure - edges per unit distance Segment object based on edge density HOW DO WE ESTIMATE EDGE DENSITY?? Roger S. Gaborski

  37. Move a window across the image • and count the number of edges in • the window • ISSUE – window size? • How large should the window be? • What are the tradeoffs? • How does window size affect accuracy of segmentation? Segment object based on edge density Roger S. Gaborski

  38. Move a window across the image • and count the number of edges in • the window • ISSUE – window size? • How large should the window be? • Large enough to get a good estimate • Of edge density • What are the tradeoffs? • Larger windows result in larger overlap • between textures • How does window size affect Accuracy of segmentation? • Smaller windows result in better region • segmentation accuracy, but poorer • Estimate of edge density Segment object based on edge density Roger S. Gaborski

  39. Average Edge Density Algorithm • Smooth image to remove noise • Detect edges by thresholding image • Count edges in n x n window • Assign count to edge window • Feature Vector  [gray level value, edge density] • Segment image using feature vector Roger S. Gaborski

  40. Run Length Coding Statistics • Runs of ‘similar’ gray level pixels • Measure runs in the directions 0,45,90,135 Y( L, LEV, d) Where L is the number of runs of length L LEV is for gray level value and d is for direction d Image Roger S. Gaborski

  41. Image 45 degrees 0 degrees Run Length, L Run Length, L Gray Level, LEV Gray Level, LEV Roger S. Gaborski

  42. Image 45 degrees 0 degrees Run Length, L Run Length, L Gray Level, LEV Gray Level, LEV Roger S. Gaborski

  43. Run Length Coding • For gray level images with 8 bits 256 shades of gray  256 rows • 1024x1024  1024 columns • Reduce size of matrix by quantizing: • Instead of 256 shades of gray, quantize each 8 levels into one resulting in 256/8 = 32 rows • Quantize runs into ranges; run 1-8  first column, 9-16 the second…. Results in 128 columns Roger S. Gaborski

  44. Gray Level Co-occurrence Matrix, P[i,j] • Specify displacement vector d = (dx, dy) • Count all pairs of pixels separated by d having gray level values i and j. Formally: P(i, j) = |{(x1, y1), (x2, y2): I(x1, y1) = i, I(x2, 21) = j}| Roger S. Gaborski

  45. Gray Level Co-occurrence Matrix • Consider simple image with gray level values 0,1,2 • Let d = (1,1) x One pixel right One pixel down y x y Roger S. Gaborski

  46. Count all pairs of pixels in which the first pixel has value i and the second value j displaced by d. P(1,0) 1 0 P(2,1) 2 1 Etc. Roger S. Gaborski

  47. Co-occurrence Matrix, P[i,j] j i P(i, j) There are 16 pairs, so normalize by 16 Roger S. Gaborski

  48. Uniform Texture d=(1,1) Let Black = 1, White = 0 P[i,j] P(0,0)= P(0,1)= P(1,0)= P(1,1) = x y Roger S. Gaborski

  49. Uniform Texture d=(1,1) Let Black = 1, White = 0 P[i,j] P(0,0)= 24 P(0,1)= 0 P(1,0)= 0 P(1,1) = 25 x y Roger S. Gaborski

  50. Uniform Texture d=(1,0) Let Black = 1, White = 0 P[i,j] P(0,0)= ? P(0,1)= ? P(1,0)= ? P(1,1) = ? x y Roger S. Gaborski

More Related