[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: pixel coordinates of a line*From*: Alex Schuster <Wonko(at)planet-interkom.de>*Date*: Thu, 28 Jun 2001 14:43:09 +0200*Newsgroups*: comp.lang.idl-pvwave*Organization*: Der Alex*References*: <3B3ACEBC.B64C9408@hotmail.com>*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:25452

Marc Schellens wrote: > I want to extract pixels along a line. > I know start and endpoint (ie. I draw the line in top of the > image). > How to get the pixel values? Do I have to do it 'by hand'? Good question. I don't know about such a function in IDL, but I think there should be a routine for that. What about this: Your line runs from (x1,y1) to (x2,y2), the image has a size of dimx*dimy. Let's create a thin, one pixel wide polygon along this line: index = polyfillv( [x1,x2,x2+1,x1+1], [y1,y2,y2,y1], dimx, dimy ) (This assumes that |x2-x1| lt |y2-y1|). Your pixel values are image[index] then. Well, nearly. Another method would be drawing a real line via PLOTS (preferably in the Z buffer), use TVRD() to get this screen part, use WHERE() to get the indices of this line, and again image[index] is the information you seek. But let's wait a little for other responses, I'm pretty sure J.D. will come up with another idea involving HISTOGRAM(). Alex -- Alex Schuster Wonko@planet-interkom.de alex@pet.mpin-koeln.mpg.de

**Follow-Ups**:**Re: pixel coordinates of a line***From:*David Fanning

**References**:**pixel coordinates of a line***From:*Marc Schellens

- Prev by Date:
**IDL and 'nice' question** - Next by Date:
**Re: pixel coordinates of a line** - Prev by thread:
**Re: pixel coordinates of a line** - Next by thread:
**Re: pixel coordinates of a line** - Index(es):