Size not supported for arrays with axes (-671:-1, -546:138)

I am not sure what I am doing wrong. This is my code:

subs(img, t) = img[1:round(Int, t):end, :];
delT = sqrt(2); n = 5; b = 72;
t_all = [delT^i for i in 0:5];
k = 2; t = 2;
theta = k*b/t;
tfm = LinearMap(RotMatrix(theta));
uR = warp(img1, inv(tfm));
uF = imfilter(uR, KernelFactors.gaussian((0, 0.8*t)));

# Here is the error:
uT = subs(uF, t);

size not supported for arrays with axes (-671:-1, -546:138); see

[1] errmsg(::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}) at /home/subhankar/.julia/v0.6/OffsetArrays/src/OffsetArrays.jl:94
[2] sqrt_restrict(::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}, ::Int64) at ./In[21]:1

Any help please? Thanks!

Did you read the docs linked in the error? In particular: You will need to define your indexing in subs differently.

Hi @mauro3,

Thanks a lot for the reply. Actually the paper I am trying to implement says I need to rotate the image and then subsample in vertical direction(hence the subs function). I am confused how I can still subsample vertically.

Also size(uF) gives me size not supported.

Yes, it’s an array who’s indices do not run from 1 to n, instead from some other number. From your error message it’s from -671 to -1 and -546 to 138. For these, so-called offset arrays, you need to do a few special things, which are described in that section of the docs, for instance instead of size you need to use axes, the docs indeed state: "replace many uses of size with axes. Please read the chapter of the docs first before asking more questions.