Size not supported for arrays with axes


#1

Hi Guys!

I have an error:

for t in [delT^i for i in 0:5]
    k = 0;
    if t == 1.0
        kptTheta = [];
        theta = 0;
        kpts = Keypoints(fastcorners(img1, 12, 0.35));
        push!(kptTheta, kpts);
        push!(kpT, kptTheta);
    else
        kptTheta = [];
        while k*b/t < 180
            theta = k*b/t;
            tfm = Translation((r/2)-1,(c/2)-1) ∘ LinearMap(RotMatrix(-theta)) ∘ Translation(-((r/2)-1),-((c/2)-1));
            uR = warp(img1, inv(tfm));
            uF = imfilter(uR, KernelFactors.gaussian((0, 0.8*t)));
            uT = subSam(uF, axes(uF)[1][1], axes(uF)[1][end], t);
            kpts = Keypoints(fastcorners(uT, 12, 0.35));
            push!(kptTheta, kpts);
            k += 1;
        end
        push!(kpT, kptTheta);
    end
end

size not supported for arrays with axes (1:105, 1:140); see http://docs.julialang.org/en/latest/devdocs/offset-arrays/

Stacktrace:
[1] errmsg(::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}) at /////////////////////////////////////////////////home/subhankar/julia/JuliaPro-0.6.4.1/JuliaPro/pkgs-0.6.4.1/v0.6/OffsetArrays/src/OffsetArrays.jl:94
[2] setindex_shape_check at ./indices.jl:150 [inlined]
[3] macro expansion at ./multidimensional.jl:554 [inlined]
[4] _unsafe_setindex!(::IndexLinear, ::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}, ::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}, ::UnitRange{Int64}, ::UnitRange{Int64}) at ./multidimensional.jl:549
[5] macro expansion at ./multidimensional.jl:541 [inlined]
[6] _setindex! at ./multidimensional.jl:537 [inlined]
[7] setindex! at ./abstractarray.jl:968 [inlined]
[8] padarray(::Type{ColorTypes.Gray{Float64}}, ::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}, ::ImageFiltering.Fill{Int64,2}) at /////////////////////////////////////////////////home/subhankar/julia/JuliaPro-0.6.4.1/JuliaPro/pkgs-0.6.4.1/v0.6/ImageFiltering/src/border.jl:905
[9] fastcorners(::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}, ::Int64, ::Float64) at /////////////////////////////////////////////////home/subhankar/julia/JuliaPro-0.6.4.1/JuliaPro/pkgs-0.6.4.1/v0.6/Images/src/corner.jl:247
[10] macro expansion at ./In[6]:17 [inlined]
[11] anonymous at ./:?

subSam(img, rS, rE, t) = img[rS:round(Int, t):rE, :];

I can’t make out what the error is.

Any suggestions please?

Thanks!


#2

warp produces an OffsetArray, which is not acceptable to fastcorners. Try putting uR=parent(warp(img1, inv(tfm))). You may have to check that your indices still work out. Also, the RotMatrix constructor wants radians, not degrees.


#3

Thanks @Ralph_Smith.

I am trying as you said.