How to choose the pixels along a curve in an image [message #88086] |
Wed, 19 March 2014 09:35  |
spright
Messages: 4 Registered: March 2014
|
Junior Member |
|
|
Hi guys,
I want to get the values of pixels along a curve in an image. Could anyone give some suggestions? This curve may be got by a polynomial fit to a few points on the image.
For pixels along a straight line, it is easier as I can rotate the image to leave the line in horizontal or vertical direction and choose these pixels in an array of the image, like img[*,n]. But seems it is difficult for the one with curve.
Any suggestions? Thanks.
|
|
|
Re: How to choose the pixels along a curve in an image [message #88087 is a reply to message #88086] |
Wed, 19 March 2014 10:03   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
spright writes:
> I want to get the values of pixels along a curve in an image. Could anyone give some suggestions? This curve may be got by a polynomial fit to a few points on the image.
>
> For pixels along a straight line, it is easier as I can rotate the image to leave the line in horizontal or vertical direction and choose these pixels in an array of the image, like img[*,n]. But seems it is difficult for the one with curve.
>
> Any suggestions?
If you really mean "pixels", I would draw the curve in a blank pixmap
window, take a 2D snapshot of the window, and use Where to tell me which
pixels in that window were different from the background color.
Armed with that information, it would be easy to convert the pixel
values into the coordinate system of the image (I like to use
Value_Locate for this if there isn't a one-to-one correspondence between
the image and the display) and fish out the underlying image values.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|
|
|
|
Re: How to choose the pixels along a curve in an image [message #88136 is a reply to message #88135] |
Sun, 23 March 2014 09:53  |
sprightzhu
Messages: 2 Registered: March 2014
|
Junior Member |
|
|
On Saturday, March 22, 2014 10:58:19 PM UTC-5, kagol...@lbl.gov wrote:
> If I understand what you're looking for, the interpolate() function should work for you. You can take your 2D images, and extract an arbitrary number of output values at positions you specify along an (x,y) path.
Great thanks for this. I will look into it.
|
|
|