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 numpy :)
(sorry for the double post to you Torgil)
On 7/3/06, Torgil Svensson <firstname.lastname@example.org
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
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(
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)
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 <email@example.com
> 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?
> 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
> Download IBM WebSphere Application Server
v.1.0.1 based on Apache Geronimo
> Numpy-discussion mailing list