anj1 / thinplatesplines.jl Goto Github PK
View Code? Open in Web Editor NEWThin-plate splines in Julia
License: MIT License
Thin-plate splines in Julia
License: MIT License
I have read the document of Thin Plate Spline carefully in wikipedia throughly. But I am still unable to figure out which equations used in L46-L55 (https://github.com/anj1/ThinPlateSplines.jl/blob/master/src/ThinPlateSplines.jl#L46). Could you give some clue or some references?
Thanks for your awesome work. Wish to hear from you.
Cheers,
Dongdong
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
@anj1 @RainerHeintzmann I believe there has been a regression in the n-dimensional generality of the package from before and after #5 .
julia> start_pts = [0 0 0; 0 0 1; 0 1 0; 1 0 0]
4×3 Matrix{Int64}:
0 0 0
0 0 1
0 1 0
1 0 0
julia> end_pts = [-0.7 -0.7 0; 0 0 1; 0 1 0; 1 0 0]
4×3 Matrix{Float64}:
-0.7 -0.7 0.0
0.0 0.0 1.0
0.0 1.0 0.0
1.0 0.0 0.0
julia> tps = tps_solve(start_pts, end_pts, 1.0)
ThinPlateSpline(1.0, [0 0 0; 0 0 1; 0 1 0; 1 0 0], [1.0 -0.7 -0.7 0.0; 1.0 0.0 0.0 1.0; 1.0 0.0 1.0 0.0; 1.0 1.0 0.0 0.0], [0.0 0.0 0.0 0.0; 0.0 0.0 0.6931471805599455 0.6931471805599455; 0.0 0.6931471805599455 0.0 0.6931471805599455; 0.0 0.6931471805599455 0.6931471805599455 0.0], [0.9999999999999999 -0.7 -0.6999999999999996 -4.143642362094349e-17; 2.3532914146181465e-16 1.6999999999999997 0.6999999999999996 2.3373269225929986e-16; 1.447594855068065e-16 0.6999999999999998 1.699999999999999 -6.798699777552591e-17; 1.7663540160192472e-16 0.7000000000000001 0.7 1.0], [0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0])
julia> tps_deform(Float64[0 0 0], tps)
1×2 Matrix{Float64}:
-0.7 -0.7
import ThinPlateSplines: my_norm, is_zero, tps_basis
function tps_deform_old(x2::AbstractArray,tps::ThinPlateSpline) where T<:Any
x1,d,c=tps.x1,tps.d,tps.c
d==[] && throw(ArgumentError("Affine component not available; run tps_solve with compute_affine=true."))
# deform
y2 = zeros(eltype(x2),size(x2,1),size(x2,2)+1)
for i = 1 : size(x2,1)
z = x2[i:i,:]
defc = zeros(eltype(x2),1,size(x2,2)+1)
for j = 1 : size(x1,1)
n = my_norm(z - x1[j:j,:])
defc += tps_basis(n)*c[j:j,:]
end
y2[i:i,:] = cat(dims=2, 1.0, z)*d + defc
end
y2[:,2:end]
end
julia> tps_deform_old(Float64[0 0 0], tps)
1×3 Matrix{Float64}:
-0.7 -0.7 -4.14364e-17
Great Work!
Trying to apply it to warping larger images, I noticed that there is a runtime issue.
This may be partly due to the tps_deform
function needing too many allocations, which I guess could be fixed somehow.
However, a more serious issue is the general runtime behaviour. As far as I see from the code, all warp nodes have an influence on the each of the pixels to warp.
If the input data is gridded (i.e. just the coordinates of the input image to warp as in my case), is there a simple way to prune
the warps during application, such that only the neighboring control points will have a significant influence?
Are you thinking about making a release? It would be good, since others may want to release a package that may depend on this great ThinPlateSpline.jl
package and it may also be much easier to find within the Julia REPL
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.