JuliaImages / Images.jl

An image library for Julia
http://juliaimages.org/
Other
533 stars 141 forks source link

Cannot display rotated small images #717

Closed tbenst closed 5 years ago

tbenst commented 6 years ago

similar to #640. Tested with both Juno and IJulia on Images v0.13.0. Interestingly, it does work in REPL so it appears to be related to displaying the image.

using Images,TestImages,CoordinateTransformations
start = 200
ending = start + 75
img = testimage("lighthouse")[start:ending,start:ending]
tfm = recenter(RotMatrix(pi/8), center(img))
imgrot = warp(img, tfm) # works

start = 200
ending = start + 74
img = testimage("lighthouse")[start:ending,start:ending]
tfm = recenter(RotMatrix(pi/8), center(img))
imgrot = warp(img, tfm) # gives error

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

Evizero commented 6 years ago

I suspect this is caused by repeat in the show method: https://github.com/JuliaImages/Images.jl/blob/master/src/showmime.jl#L33

julia> using OffsetArrays

julia> A = OffsetArray(rand(3,3), -1, -1)
OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}} with indices 0:2×0:2:
 0.256666  0.274267  0.962343
 0.580651  0.694334  0.78365 
 0.167408  0.304966  0.766681

julia> repeat(A, inner=2)
ERROR: size not supported for arrays with axes (0:2, 0:2); see http://docs.julialang.org/en/latest/devdocs/offset-arrays/
zygmuntszpak commented 6 years ago

This seems to be the same underlying issue as #650. See Tim's comments in that thread.

johnnychen94 commented 5 years ago

my temporary solution is to convert it to Array

imgrot = imrotate(img, pi/8) |> Array