Page 1 of 1

AffineTransformImage + interpolate

Posted: 2008-01-31T06:44:42-07:00
by nicolas1
Hello,

I found that it is impossible to apply affine transform on image with interpolation (filter).

Following code runs forever.

Magick::Image *bitmap_;
MagickLib::Image *resized_;

MagickLib::AffineMatrix _affine;

_affine.sx = 0.1; _affine.rx = 0; _affine.tx = 0;
_affine.sy = 0.1; _affine.ry = 0; _affine.ty = 0;

bitmap_->image()->filter = MagickLib::BoxFilter;
bitmap_->image()->interpolate = MagickLib::FilterInterpolatePixel;

resized_ = MagickLib::AffineTransformImage( bitmap_->image(), &_affine, NULL);

Following code produces non-Bicubic interpolated result:

MagickLib::AffineMatrix _affine;

_affine.sx = 0.1; _affine.rx = 0; _affine.tx = 0;
_affine.sy = 0.1; _affine.ry = 0; _affine.ty = 0;

bitmap_->image()->interpolate = MagickLib::BicubicInterpolatePixel;

resized_ = MagickLib::AffineTransformImage( bitmap_->image(), &_affine, NULL);

How interpolation can be set for affine transform?

Re: AffineTransformImage + interpolate

Posted: 2008-01-31T17:09:58-07:00
by anthony
You could switch to using the DistortImages AffineProjection method instead. This should have a lot more control.

The older affine functions has not been modified to use the new more general distortion method as yet.