I had very little experience with ImageMagick C API in the past, mostly by means of finding a similar example code and adopting it to my needs, but now I am trying to accomplish a project in which I don't even know if it is doable with ImageMagick, and don't know where to start.
In short, I want to do my own (fairly complex) warping/distortion of images. I have all the math. What I need is a way to read color information (r,g,b,alpha) for floating point pixel coordinates in the input image. The color should be computed by ImageMagick using an interpolation from the neighboring pixels.
I do see the interpolation discussed here: http://www.imagemagick.org/Usage/misc/#interpolate , where the functionality I need (floating point pixel coordinates) is described. But this is not for C API, just for command line.
Is floating point pixels coordinates (get color via interpolation) feature supported by C API? In MagickWand, I could only find get color methods which use integer pixel coordinates (PixelWand). I couldn't find anything relevant in MagickCore description.
Thank you very much for any feedback!
Floating point pixel coordinates
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Floating point pixel coordinates
Yes. I use InterpolateMagickPixelPacket(...), defined in pixel.h. This respects the -virtual-pixel and -interpolate settings. See examples in http://im.snibgo.com/customim.htmpulsar wrote:Is floating point pixels coordinates (get color via interpolation) feature supported by C API?
snibgo's IM pages: im.snibgo.com
Re: Floating point pixel coordinates
That's perfect - your link even contains an example code! Thank you very much!snibgo wrote:Yes. I use InterpolateMagickPixelPacket(...), defined in pixel.h. This respects the -virtual-pixel and -interpolate settings. See examples in http://im.snibgo.com/customim.htmpulsar wrote:Is floating point pixels coordinates (get color via interpolation) feature supported by C API?