# How to get maxima of rho in hough table

i applyed hough transform in my image and this is the result of hough table, i must get the maxima of rho in two basic angles of theta , the one is around -65 : -60 and the other is round 30:35

How can i get them? I tried the below code about hough but the houghpeaks function returns all the maxima peaks in the hough table. I want to detect the two basic angles as you can see

[hough,theta,rho] = hough(negfillHoles,'Theta',-90:1:89,'RhoResolution',2);
lenHough=length(hough(:));
maxpeaks=lenHough; %10000;
peaks = houghpeaks(hough,maxpeaks,'threshold',20); %50
x=theta(peaks(:,2));
y=rho(peaks(:,1));
plot(x,y,'o','color','r');


I will really appreciate your help, it is a matter of life or death to find this answer for my home work

• First idea: start with taking only the N largest peaks in your Hough plane. Second idea: marginalize over $\rho$ first, then detect peaks in $\theta$ domain (1-D peak serach). Use these to narrow down your search in the 2-D Hough plane. – Florian May 21 at 7:34

Why don't you try to mask your data first. E.g. take the variance for every $$\theta$$ value, so that you get a $$\rho$$ variance information for each $$\theta$$ value. Variance should be high around your peask, since all the other parts are basically black or gray - only in the peak region there is a lot of changes. You could also play around with a auto-correlation of the data along that axis. Then, you could threshold the resulting vector so that you have a better estimate where the peaks are. Then apply the peak detection algorithm only in those areas of $$\theta$$.