Open mkeays opened 5 years ago
I just noticed that applying the affine() function with antialias = TRUE does not do this:
> affine( pre_aff, mat, output.dim = c( 10, 10 ), antialias = TRUE )
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 0 0 0 0 0 0 0 0 0 0
[2,] 0 0 0 0 0 0 0 0 0 0
[3,] 0 0 0 1 1 1 1 0 0 0
[4,] 0 0 0 1 1 1 1 0 0 0
[5,] 0 0 0 1 1 1 1 0 0 0
[6,] 0 0 0 1 1 1 1 0 0 0
[7,] 0 0 0 0 0 0 0 0 0 0
[8,] 0 0 0 0 0 0 0 0 0 0
[9,] 0 0 0 0 0 0 0 0 0 0
[10,] 0 0 0 0 0 0 0 0 0 0
Thank you for reporting this! Might be some rounding issue occurring in bilinear filtering step, will need to investigate.
If you are interested in performing pixel transformations which have a 1:1 pixel mapping between the input and the output such as translation by whole pixel coordinates or rotation by multiplies of 90 degrees consider using affine()
with filter = "none"
. Another option is to use wrapper functions translate()
or rotate()
which set the appropriate arguments to for you.
Cheers, Andrzej
Hi Andrzej,
Thanks very much for looking at this! I am quite new to this sort of analysis so I was trying out the function with a simple example to see what the result would be. I have a dataset from a collaborator with images and a transformation matrix defining an affine transform to align them. I'll try out the function with filter = "none"
as you suggest.
Thanks, Maria
I am trying out the affine() function with a simple example matrix, and I noticed something that puzzled me. It seems to add an extra row and column to the transformed matrix even if the scaling factors are both 1:
Is this expected behaviour? I thought that the above transformation matrix would simply translate the matrix to a new position but leave the dimensions the same as before the transformation.