diff --git a/src/projective/affine.jl b/src/projective/affine.jl index 0c77695..d66e72f 100644 --- a/src/projective/affine.jl +++ b/src/projective/affine.jl @@ -60,7 +60,7 @@ end function projectionbounds(tfm::ScaleKeepAspect{N}, P, bounds::Bounds{N}; randstate = nothing) where N origsz = length.(bounds.rs) ratio = maximum((tfm.minlengths) ./ origsz) - sz = floor.(Int,ratio .* origsz) + sz = round.(Int, ratio .* origsz) bounds_ = transformbounds(bounds, P) bs_ = offsetcropbounds(sz, bounds_, ntuple(_ -> 0.5, N)) return bs_ diff --git a/test/projective/affine.jl b/test/projective/affine.jl index 1d51365..24311e6 100644 --- a/test/projective/affine.jl +++ b/test/projective/affine.jl @@ -94,9 +94,12 @@ include("../imports.jl") @testset ExtendedTestSet "ScaleKeepAspect" begin tfm = ScaleKeepAspect((32, 32)) + img = rand(RGB{N0f8}, 64, 96) @test apply(tfm, Image(img)) |> itemdata |> size == (32, 48) + img = rand(RGB{N0f8}, 196, 196) + @test apply(tfm, Image(img)) |> itemdata |> size == (32, 32) end end