Image Processing LECTURE 7
Image Processing LECTURE 7
LECTURE 7
Hough Transform
Segmentation
Hough Transform
Hough Transform
– Hough Transform is used to detect parametric geometric
structures (such as lines, circles, ellipses, etc) from images.
– The general practice is to detect the edges first.
– The input to line detection through Hough Transform is the
binary edge image.
Representation of lines
Quantize the parameter space (ρ, θ), i.e., divide it into cells.
We call this quantized space the accummulator cells.
Hough Transform
rotI = imrotate(I,33,'crop');
fig1 = imshow(rotI);
BW = edge(rotI,'canny');
figure, imshow(BW);
[H,theta,rho] = hough(BW);
figure, imshow(imadjust(mat2gray(H)),[],'XData',theta,'YData',rho,...
'InitialMagnification','fit');
xlabel('\theta (degrees)'), ylabel('\rho');
axis on, axis normal, hold on;
P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
lines = houghlines(BW,theta,rho,P,'FillGap',5,'MinLength',7);
Detecting Lines Using the Hough Transform
figure, imshow(rotI), hold on
max_len = 0;
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
-200
-100
0
100
200
300
Multiple thresholding
a if f ( x, y) T2
g ( x, y ) = b if T1 f ( x, y) T2
c if f ( x, y) T1
The Role of Noise in Image Thresholding
The Role of Illumination and Reflectance
Basic Global Thresholding
=
P1 (1 − P1 )
mG P1 − m
2
=
P1 (1 − P1 )
Optimum Global Thresholding Using
Otsu’s Method
1 if f ( x, y) k *
g ( x, y ) =
0 if f ( x, y) k *
B2
Separability measure = 2
G
Otsu’s Algorithm: Summary
k =1
1
where Pk = pi and mk = ip i
iCk Pk iCk
PCA-fitted
Sample ellipsoid
K-Means Clustering
Algorithm
• Region Splitting
– Start with one large region
– Recursively Top-down
• Choose the region with highest dissimilarity approach
• If sufficiently similar, stop, otherwise split
• repeat until no more splitting occurs
Region Growing
1
1
m( R ) = I ( r , c )
n ( r ,c )R
std ( R) = (
n − 1 ( r ,c )R
I ( r , c ) − m ( R )) 2
Quadtree
R0 R1
R0
R3
R2 R1
I = imread('coins.png');
imshow(I)
level = graythresh(I);
BW = im2bw(I,level);
imshow(BW)