JuliaImages / ImageTransformations.jl

Geometric transformations on images for Julia
Other
46 stars 27 forks source link

Warp seems to be off #166

Open ChantalJuntao opened 9 months ago

ChantalJuntao commented 9 months ago

I don't know if this used to be a problem too, but I'm having trouble reproducing some image transformations I had saved last month, and I found that warp doesn't seem to be making accurate rotations right now?

using ImageTransformations, TestImages, ImageView, Rotations, OffsetArrays, CoordinateTransformations

mri = centered(testimage("mri"));
tfm = AffineMap(RotXYZ(2*pi,0,0), [0, 0, 0]);
imgw = warp(mri, tfm, axes(mri));

imshow(colorview(RGB, mri.data, imgw, zeroarray));
empet commented 9 months ago

Is this the transformation you are looking for?

mri = testimage("mri")
tfm = recenter(RotXYZ(pi/4, 0, 0), center(mri))
imgw = warp(mri, tfm,  axes(mri))
imshow(colorview(RGB, mri.data, imgw, zeroarray));

with:

[150eb455] CoordinateTransformations v0.6.3
  [02fcd773] ImageTransformations v0.10.0
  [6fe1bfb0] OffsetArrays v1.12.10

Your centered is unknown:

UndefVarError: `centered` not defined  

The transformation, tfm, in my definition is an AffineMap that first rotates the image about origin, and then translates it on the direction defined by the center of the image testimage("mri").