Page 1 of 1

Nearest Neighbor Interpolation with Perspective

Posted: 2014-04-13T18:13:52-07:00
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!

Re: Nearest Neighbor Interpolation with Perspective

Posted: 2014-04-13T18:40:12-07:00
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?

Re: Nearest Neighbor Interpolation with Perspective

Posted: 2014-04-13T21:52:23-07:00
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

Re: Nearest Neighbor Interpolation with Perspective

Posted: 2014-04-14T15:35:18-07:00
by josephs
Thank you for your help.