Lecture-12-h - Lecture-12 Hough Transform Examples Hough...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture-12 Hough Transform Examples Hough Space Theta is from -90 to +90 1 Fitting Lines In an Image Fitting Lines In an Image 2 Fitting lines in an image Fitting Circles 3 Fitting Circles Detecting Lines in Gray Level Images Detect yellow line in the middle Use gray levels instead of edges Increment the parameter space by gray level at a pixel instead of by 1. 4 Pyramids • Very useful for representing images. • Pyramid is built by using multiple copies of image. • Each level in the pyramid is 1/4 of the size of previous level. • The lowest level is of the highest resolution. • The highest level is of the lowest resolution. Pyramid 5 Gaussian Pyramids g l (i, j ) = 2 2 Â Â w(m, n) g l -1 (2i + m,2 j + n) m = -2n = -2 g l = REDUCE[ g l -1 ] Convolution 6 Gaussian Pyramids g l ,n (i, j ) = 2 2 Â Â w( p, q) g p = -2q = -2 l , n -1 ( i- p j-q , ) 2 2 g l ,n = EXPAND[ g l ,n -1 ] Reduce (1D) g l (i) = 2 ˆ Â w(m) g l -1 (2i + m) m = -2 ˆ ˆ ˆ g l (2) = w(-2) g l -1 (4 - 2) + w(-1) g l -1w(4 - 1) + ˆ ˆ ˆ w(0) g l -1 (4) + w(1) g l -1 (4 + 1) + w(2) g l -1 (4 + 2) ˆ ˆ ˆ g l (2) = w(-2) g l -1 (2) + w(-1) g l -1w(3) + ˆ ˆ ˆ w(0) g l -1 (4) + w(1) g l -1 (5) + w(2) g l -1 (6) 7 Reduce Expand (1D) g l ,n (i ) = 2 ˆ Â w( p) gl ,n-1 ( p = -2 i- p ) 2 4-2 4 -1 ˆ ) + w(-1) g l ,n -1 ( )+ 2 2 4 4 +1 4+2 ˆ ˆ ˆ w(0) g l ,n -1 ( ) + w(1) g l ,n -1 ( ) + w(2) g l ,n -1 ( ) 2 2 2 ˆ g l ,n (4) = w(-2) g l ,n -1 ( ˆ ˆ ˆ g l ,n (4) = w(-2) g l ,n -1 (1) + w(0) g l ,n -1 (2) + w(2) g l ,n -1 (3) 8 Expand (1D) g l ,n (i ) = 2 ˆ Â w( p) gl ,n-1 ( p = -2 i- p ) 2 3- 2 3 -1 ˆ ) + w(-1) g l ,n -1 ( )+ 2 2 3 3 +1 3+ 2 ˆ ˆ ˆ w(0) g l ,n -1 ( ) + w(1) g l ,n -1 ( ) + w(2) g l ,n -1 ( ) 2 2 2 ˆ g l ,n (3) = w(-2) g l ,n -1 ( ˆ ˆ g l ,n (3) = w(-1) g l ,n -1 (1) + w(1) g l ,n -1 (2) Expand 9 Convolution Mask [ w(-2), w(-1), w(0), w(1), w(2)] Convolution Mask • Separable ˆ ˆ w(m, n) = w(m) w(n) •Symmetric ˆ ˆ w(i ) = w(-i ) [c, b, a, b, c] 10 Convolution Mask • The sum of mask should be 1. a + 2b + 2c = 1 •All nodes at a given level must contribute the same total weight to the nodes at the next higher level. a + 2c = 2b c c bb a 11 Convolution Mask $ w(0) = a 1 4 1a $ $ w ( -2 ) = w ( 2 ) = 42 $ $ w( -1) = w(1) = a=.4 GAUSSIAN, a=.5 TRINGULAR Triangular 0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 Triangular c b a b c 12 Approximate Gaussian 0.4 0.35 0.3 0.25 Gaussian 0.2 0.15 0.1 0.05 0 c b a b c Gaussian g ( x) = e - x2 2o 2 13 Gaussian g ( x) = e x -3 -2 .011 .13 - x2 2o 2 -1 0 1 2 3 .6 1 .6 .13 .011 g(x) 14 Separability Algorithm • Apply 1-D mask to alternate pixels along each row of image. • Apply 1-D mask to alternate pixel along each column of resultant image from previous step. 15 Gaussian Pyramid Laplacian Pyramids • Similar to edge detected images. • Most pixels are zero. • Can be used for image compression. L1 = g1 - EXPAND[ g 2 ] L2 = g 2 - EXPAND[ g 3 ] L3 = g 3 - EXPAND[ g 4 ] 16 Coding using Laplacian Pyramid •Compute Gaussian pyramid g1 , g 2 , g 3 , g 4 •Compute Laplacian pyramid L1 = g1 - EXPAND[ g 2 ] L2 = g 2 - EXPAND[ g 3 ] L3 = g 3 - EXPAND[ g 4 ] L4 = g 4 •Code Laplacian pyramid 17 Decoding using Laplacian pyramid • Decode Laplacian pyramid. • Compute Gaussian pyramid from Laplacian pyramid. g 4 = L4 g 3 = EXPAND[ g 4 ] + L3 g 2 = EXPAND[ g 3 ] + L2 g1 = EXPAND[ g 2 ] + L1 • g1 is reconstructed image. Laplacian Pyramid 18 Image Compression (Entropy) 7.6 4.4 .77 1.9 5.0 5.6 3.3 6.2 4.2 Huffman Coding (Example-1) 0 A1 P=.5 A2 A3 P=.25 P=.125 A4 P=.125 0 1 0 1 1 A1 0 A2 10 A3 110 A4 111 19 Huffman Coding 255 Entropy H = -Â p (i ) log 2 p (i ) i =0 H = -.5 log .5 - .25 log .25 - .125 log .125 .125 log .125 = 1.75 Image Compression 1.58 1 .73 20 Combining Apple & Orange Combining Apple & Orange 21 Algorithm • Generate Laplacian pyramid Lo of orange image. • Generate Laplacian pyramid La of apple image. • Generate Laplacian pyramid Lc by copying left half of nodes at each level from apple and right half of nodes from orange pyramids. • Reconstruct combined image from Lc. Quad Trees • • • • Data structure to represent regions Three types of nodes: gray, black and white First generate the pyramid, then: If type of pyramid is black or white then return else – – – – – Recursively find quad tree of SE quadrant Recursively find quad tree of SW quadrant Recursively find quad tree of NE quadrant Recursively find quad tree of NW quadrant Return 22 Chain Code • A simple technique to represent a shape of boundary. • Each directed line segment is assigned a code. • Chain code is integer obtained by putting together the codes of all consecutive line segments. • Shape number is a normalized chain code, which is invariant to translation and rotation. 23 24 ...
View Full Document

Ask a homework question - tutors are online