Giter Club home page Giter Club logo

thinplatesplines.jl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

thinplatesplines.jl's Issues

TagBot trigger issue

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!

Regression: tps_deform does not generalize to 3D

@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

Runtime in applying the warp

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?

Release

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.