Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/projective/affine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function getprojection(scale::ScaleFixed, bounds::Bounds{N}; randstate = nothing
# If no scaling needs to be done, return a noop transform
(scale.sizes == length.(bounds.rs)) && return IdentityTransformation()

ratios = (scale.sizes .+ 1) ./ length.(bounds.rs)
ratios = (scale.sizes .+ 2) ./ length.(bounds.rs)
upperleft = SVector{N, Float32}(minimum.(bounds.rs)) .- 1
P = scaleprojection(ratios)
if any(upperleft .!= 0)
Expand Down Expand Up @@ -111,7 +111,12 @@ getrandstate(tfm::Zoom) = rand(tfm.dist)

function getprojection(tfm::Zoom, bounds::Bounds{N}; randstate = getrandstate(tfm)) where N
ratio = randstate
return scaleprojection(ntuple(_ -> ratio, N))
return getprojection(ScaleRatio{N}(ntuple(_ -> ratio, N)), bounds; randstate = nothing)
end

function projectionbounds(tfm::Zoom, P, bounds::Bounds{N}; randstate = getrandstate(tfm)) where N
ratio = randstate
projectionbounds(ScaleFixed{N}(fixed_sizes(ScaleRatio{N}(ntuple(_ -> ratio, N)), bounds)), P, bounds; randstate = nothing)
end

"""
Expand Down
2 changes: 1 addition & 1 deletion test/projective/affine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ include("../imports.jl")
testprojective(tfm)

end

@testset ExtendedTestSet "ScaleRatio" begin
tfm = ScaleRatio((1/2, 1/2))
@test_nowarn apply(tfm, image)
Expand Down
Loading