1

I'm using IDL to take an image of the outside surface of a cylinder and flatten it to obtain a roughly accurate non-curved picture. I have already done the math necessary to know that given an input pixel at location (x,y)[with 0,0 being the center of the image], where the output pixel (x',y') should be, but I cannot figure out how to apply this to build my new image. I am also aware that due to the fact that the flattened image is larger than the original image, some pixels on the final image will not have a corresponding input pixel (do they appear black? Transparent?), but I'll deal with that when I get there.

Any ideas would be greatly appreciated.

1 Answers1

0

Try the interpol routine. If you have a) an array of input coordinates, b) an array of input values, and c) an array of output coordinates you wish to interpolate to, interpol (not interpolate, which is similar but not the same) will do the magic. Here is copy-pasted from the IDL docs:

Result = INTERPOL( V, X, XOUT [, /LSQUADRATIC] [, /NAN] [, /QUADRATIC] [, /SPLINE] )

V would be your input values, X your input coordinates, and XOUT your output coordinates. They do not have to be on a regular grid, so nice for the kind of mapping you want.

Ajean
  • 5,528
  • 14
  • 46
  • 69