How to detect perfect edges using hough transform??

3 views (last 30 days)
I am using Hough transform to find the edges of an arrow but I am getting only 2 of the required edges.
It has 7 edges.
After Hough transform. http://tinypic.com/r/2vdh9o5/6
It is showing only 2 edges.
Why???? and how to get the all the edges???
Here is my code....(Its the same code given Matlab tutorials)
I = imread('d:\test.jpg');
rot = rgb2gray(I);
rotI = imadjust(rot);
figure(3),imshow(rotI);
BW = edge(rotI,'canny');
[H,T,R] = hough(BW);
P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
x = T(P(:,2)); y = R(P(:,1));
% Find lines and plot them
lines = houghlines(BW,T,R,P,'FillGap',5,'MinLength',7);
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');
% Plot beginnings and ends of lines
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
end

Answers (1)

Image Analyst
Image Analyst on 4 Jan 2013
Spandan (of the Mathworks Image Processing team) gave you the answer in your newsgroup posting of the same question: http://www.mathworks.com/matlabcentral/newsreader/view_thread/325581

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!