MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by rahul on 4 Jan 2013

I am using Hough transform to find the edges of an arrow but I am getting only 2 of the required edges.

Original image :- http://tinypic.com/r/35d94p1/6

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

*No products are associated with this question.*

Answer by 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

## 0 Comments