[Numpy-discussion] iterate along a ray: linear algebra?
stephenemslie at gmail.com
Tue Jul 4 07:00:29 CDT 2006
I've found some matlab code that seems to do the same sort of thing.
Interestingly enough it just uses trigonomotry to do find the x,y positions
in the matrix that correspond to the ray at a particular angle. I had
origionally discarded this idea because I thought there must be a more
efficient way to do it, but perhaps not. I still have a lot to learn about
(sorry for the double post to you Torgil)
On 7/3/06, Torgil Svensson <torgil.svensson at gmail.com> wrote:
> I've done something similar a few years ago (numarray,numeric). I
> started roughly at the middle and did 64 points from a reference point
> (xc,yc). This point together with a point at the edge of the image
> (xp,yp) also defined a reference angle (a0). (ysize,xsize) is the
> shape of the intensity image.
> I used the following code to calculate points of interest:
> if a0<0: a0+=2*pi
> if numarray:
> 0: lambda a: a<=a1 and xr/cos(a-0.0*pi) or yr/cos(0.5*pi-a),
> 1: lambda a: a<=a2 and yr/cos(a-0.5*pi) or xc/cos(1.0*pi-a),
> 2: lambda a: a<=a3 and xc/cos(a-1.0*pi) or yc/cos(1.5*pi-a),
> 3: lambda a: a<=a4 and yc/cos(a-1.5*pi) or xr/cos(2.0*pi-a)
> if numarray:
> crmax=array([int(floor(rmaxfn[floor(a*2/pi)](a))) for a in angles])
> After this I did cubic spline interpolation in the image with these
> points and did something useful. I don't know how relevant this is to
> you and it doesn't use the linear algebra package but it might give
> you some hint.
> If you find out a nifty way to do your rays please post on this thread.
> Sidenote -- Watch my explicit float argument to arange and even
> putting in pi there in one case. There's a discussion on this list
> that floats in arange are troublesome
> On 6/30/06, stephen emslie <stephenemslie at gmail.com> wrote:
> > I am in the process of implementing an image processing algorithm that
> > requires following rays extending outwards from a starting point and
> > calculating the intensity derivative at each point. The idea is to find
> > point where the difference in intensity goes beyond a particular
> > Specifically I'm examining an image of an eye to find the pupil, and the
> > edge of the pupil is a sharp change in intensity.
> > How does one iterate along a line in a 2d matrix, and is there a better
> > to do this? Is this a problem that linear algebra can help with?
> > Thanks
> > Stephen Emslie
> > Using Tomcat but need to do more? Need to support web services,
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpy-discussion at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion