Image Segmentation I - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Image Segmentation I

Description:

Image Segmentation I Comp344 Tutorial Kai Zhang Outline Line & Edge detection Hough transform Line Detection Apply a mask and compute the image response Design of ... – PowerPoint PPT presentation

Number of Views:89
Avg rating:3.0/5.0
Slides: 12
Provided by: twi117
Category:

less

Transcript and Presenter's Notes

Title: Image Segmentation I


1
Image Segmentation I
  • Comp344 Tutorial
  • Kai Zhang

2
Outline
  • Line Edge detection
  • Hough transform

3
Line Detection
  • Apply a mask and compute the image response
  • Design of Mask determines what kind of line is
    detected
  • -1 -1 -1 -1 -1 2 -1 2 -1 2
    -1 -1
  • 2 2 2 -1 2 -1 -1 2 -1
    -1 2 -1
  • -1 -1 -1 2 -1 -1 -1 2 -1 -1
    -1 2
  • Horizontal 45o vertical
    -45o

4
(No Transcript)
5
Codes
  • f imread('wirebond.tif')
  • w 2 -1 -1 -1 2 -1 -1 -1 2
  • g imfilter(double(f),w)
  • imshow(g,)
  • gtop g(1120,1120)
  • gtop pixeldup(gtop, 4)
  • figure,imshow(gtop, )
  • gbot g(end - 119end, end-119end)
  • gbot pixeldup(gbot, 4)
  • figure,imshow(gbot, )
  • g abs(g)
  • figure,imshow(g,)
  • T max(g())
  • g g gt T
  • figure,imshow(g,)

6
Hough Transform
  • A method for line detection on binary images
  • Transform points in the x-y plane into the
    parameter space (\rho, \theta)
  • Detect local maximum on the parameter space (kind
    of voting), which corresponds to strong line
    signals
  • Complexity much lower than naïve method

7
Sparse matrices in matlab
  • Sparse matrix Matrices that contain only a small
    number of non-zero elements
  • Sparse matrix can reduce both the storage and the
    computational complexity
  • Example
  • A 0 0 0 5 0 2 0 0 1 3 0 0 0 0 4 0
  • S sparse(A)
  • S
  • (3,1) 1
  • (2,2) 2
  • (3,2) 3
  • (4,3) 4
  • (1,4) 5

8
Example 1
9
Codes
  • f zeros(101,101)
  • f(1,1) 1 f(101,1) 1 f(1,101) 1
  • f(101,101) 1 f(51,51) 1
  • figure,imshow(f,)
  • H hough(f)
  • figure, imshow(histeq(H),)
  • H, theta, rho hough(f)
  • figure, imshow(theta, rho, histeq(H), ,
    'notruesize')
  • axis on axis normal
  • xlabel('theta'),ylabel('\rho')

10
Example 2
11
codes
  • f double(imread('building.tif'))
  • canny,tc edge(f,'canny',0.04 0.1, 1.5)
  • figure,imshow(canny,)
  • f g_canny_default
  • H, theta, rho hough(f,0.5)
  • figure, imshow(theta, rho, H/30,
    'notruesize'),axis on axis normal
  • r,c houghpeaks(H, 5)
  • hold on plot(theta(c),rho(r),'linestyle','none','
    marker','s','color','w')
  • lines houghlines(f, theta, rho, r,c)
  • figure,imshow(f,)hold on
  • for k 1length(lines)
  • xy lines(k).point1 lines(k).point2
  • plot(xy(,2),xy(,1),'LineWidth',4,'Color',.9 .0
    .0)
  • end
Write a Comment
User Comments (0)
About PowerShow.com