[SciPy-user] hough transform again

Kfir Breger kbreger at science.uva.nl
Fri Aug 18 01:56:29 EDT 2006


   I am working on a voxel coloring implementation with scipy and  
have used (in the beginning) hough transformation to detect lines
the algroithm i used is quite simple
1. get the PIL library, which is quite good imo
2. use the build in filter function for edge detection  
imagename.filter(ImageFilter.FIND_EDGES)
3. make a scipy array from the image
4. to eliminate noise do a closing operation on the edge image
5. set a threshold on edge value (i.e pixel value > t is a point on  
the edge). I used a double threshold whith 2 runs
6. for each of the pixels found in 6 calculate the p value found for  
a discreat number of tetas (i used 360 values between 0 and pi)
	as in x cos tet + y sin tet = p where x,y and tet are know. and  
store for each pair of tet and p how often they come out
7. set a threshhold for the value to determine if its a real line or  
not ( i u sed max value found /2) and all p and tetas tuple with
	a total value bigger then this are your lines.

I eventually dropped this in favour of radon transform as the results  
are better imo.

    Kfir Breger

On Aug 17, 2006, at 10:56 PM, Brent Pedersen wrote:

> right,  extending the example at the bottom of the houghtf.py,
> i do:
>
>     import scipy as S
>     largevals = S.where(out + delta >  max(out.flatten()));
>     largevals = N.array(zip(ss[0],ss[1]))
>
> which gives an array of r,thetas that are within delta of the  
> maximum. now, to find img coordinates that match those values...
>
>
> On 8/17/06, stephen emslie <stephenemslie at gmail.com> wrote:
> I'm busy doing just that at the moment (in fact literally right  
> now), and I'll be happy to post any results here.
>
> My understanding is that you'll need to search the output of the  
> hough transform for cells with a high count as those will be the  
> most likely to correspond to lines in the main image. The output is  
> a matrix relating combinations of rho and theta to the number of  
> feature points that that line passes through - so the combinations  
> of rho and theta with that go through the most feature points will  
> be the strongest lines.
>
> Or something like that - I'm also really new to this stuff so I'd  
> be happy to be corrected by someone that knows more.
>
> The second to last part of this document is a good read on the  
> hough transform: http://homepages.inf.ed.ac.uk/rbf/BOOKS/VERNON/ 
> Chap006.pdf
>
> Stephen
>
>
> On 8/17/06, Brent Pedersen <bpederse at gmail.com > wrote:
> hi, i found this in recent archives and the script is useful.
> http://projects.scipy.org/pipermail/scipy-user/2006-August/008841.html
>
> has anyone written the code to go from the hough transform back to  
> the image with the lines/edges enhanced or with non-lines removed?  
> it's bending my mind a bit so if someone's already done it, i'd be  
> glad of it--or any pointers.
> thanks.
> -brent
> [please include my email in the reply, i've subscribed to scipy- 
> users, but not sure if it went through yet]
>
>
>
>
>
>
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20060818/805b9623/attachment.html>


More information about the SciPy-User mailing list