Skip to content
Snippets Groups Projects
Commit 1c9eb0ea authored by Stephan Hilb's avatar Stephan Hilb
Browse files

improve on warping

parent 8916fc05
No related branches found
No related tags found
No related merge requests found
......@@ -15,13 +15,14 @@ function interpolate_bilinear(img, x)
end
function warp_backwards(img, u)
axes(img) == axes(u)[2:end] ||
d = ndims(img)
axes(img) == axes(u)[2:end] && d == size(u, 1) ||
throw(ArgumentError("invalid dimensions"))
res = similar(img)
for I in CartesianIndices(img)
x = Tuple(I) .+ u[:, I]
res[I] = interpolate_bilinear(img, (x...,))
x = Tuple(I) .+ ntuple(i -> u[i, I], d)
res[I] = interpolate_bilinear(img, x)
end
return res
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment