[Numpy-discussion] iterate along a ray: linear algebra?

Torgil Svensson torgil.svensson at gmail.com
Mon Jul 3 16:39:04 CDT 2006

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 the
> point where the difference in intensity goes beyond a particular threshold.
> 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 way
> 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, security?
> 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 Geronimo
> 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

More information about the Numpy-discussion mailing list