Nearest Neighbor Interpolation with Perspective

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
josephs
Posts: 40
Joined: 2014-04-08T10:13:43-07:00
Authentication code: 6789

Nearest Neighbor Interpolation with Perspective

Post by josephs »

I have been trying to control how the pixels are interpolated with distort perspective as follows:

...-interpolate nearest -distort Perspective ...

I am referring to this: http://www.imagemagick.org/Usage/misc/#interpolate

There is absolutely no difference in result with "nearest", however other method like "Average16" the difference is visible. Is it possible to apply nearest interpolation to perspective?

Basically I am trying to achieve a distort that is NOT anti-aliased.

Any help is appreciated!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Nearest Neighbor Interpolation with Perspective

Post by fmw42 »

-interpolate nearest -distort Perspective
try

Code: Select all

-interpolate nearestneighbor -filter point -distort Perspective
-filter point turns off the EWA interpolation so that -interpolate nearestneighbor works. See the example for Pixel Color Lookup at http://www.imagemagick.org/Usage/distorts/#mapping

I am not sure what "nearest" does. It is not listed for -interpolate on the options page at http://www.imagemagick.org/script/comma ... nterpolate. I wonder if that is a typo for convert -list interpolate?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Nearest Neighbor Interpolation with Perspective

Post by anthony »

-interpolation in distort only happens when... Fred "nearest" or "NearestNeighbor" just takes the color from the nearest pixel that is to the 'lookup point'.
http://www.imagemagick.org/Usage/misc/#nearest-neighbor
It is a good interpolation to use when you want to be sure you get exact colors when the lookup point many not be absolutely exact, perhaps due to floating point. However No-Op distorts should not have that problem, though it recommends it as a precaution even though it is not needed.
http://www.imagemagick.org/Usage/distort/#distort_noop
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
josephs
Posts: 40
Joined: 2014-04-08T10:13:43-07:00
Authentication code: 6789

Re: Nearest Neighbor Interpolation with Perspective

Post by josephs »

Thank you for your help.
Post Reply