-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with projective transform #33
Comments
Cool - interesting problem. Sorry I've been too busy to check this out in detail yet. |
No worries! |
I think a good place to start (other than the code in the beginning of this |
Wow, cool..! Now all we need to do is convince Manolis Lourakis to contribute to Julia (or use his library). |
I think Lourakis work is excellent .. I would love to see lev-mar sba and pose-est wrappers for Julia, I don't think it is necessary to port it. Specifically for pose-est we use it directly using ccall using StaticArrays,Rotations
Libdl.dlopen("PoseEst.dll")
const POSEST_REPR_ERR_NO_NLN_REFINE = 0 # reprojection error without non-linear refinement */
const POSEST_REPR_ERR_NLN_REFINE = 1 # reprojection error with non-linear refinement */
const POSEST_REPR_ERR_NLN_MLSL_REFINE = 2 # reprojection error with non-linear refinement & multistart scheme */
const POSEST_OBJSPC_ERR_LHM = 3
const d2 = SVector{2,Float64}
const d3 = SVector{3,Float64}
function pose_est(pts2D::Vector{d2}, pts3D::Vector{d3}, K::SMatrix{3,3,Float64})
nmatches = length(pts2D);
inlPcent=0.8
pp = zeros(6)
npp = 6
NLrefine = POSEST_REPR_ERR_NLN_REFINE
idxOutliers = Vector{Int32}(nmatches)
nbOutliers = Ref{Int32}(0)
verbose = 0
Ktag = Matrix{Float64}(K') # C is row_major
ret = ccall( (:posest,:PoseEst) , Int32,(Ptr{d2},Ptr{d3},Int32,Float64,Ptr{Float64},
Ptr{Float64},Int32,Int32,Ptr{Int32},Ref{Int32},Int32),
pts2D,pts3D,nmatches,inlPcent,Ktag,pp,npp,NLrefine,
idxOutliers,nbOutliers,verbose )
R = RodriguesVec(pp[1],pp[2],pp[3])
T = SVector{3}(pp[4],pp[5],pp[6])
return SMatrix{4,4,Float32,16}([R T;[0 0 0 1]])
end
export pose_est |
Fantastic! I wish I could improve my wrapping skills, especially now with the holiday season 😉 Not sure how the maintainers of |
@TsurHerman sorry for necroposting. I just discovered this thread. Can you explain how you obtained a shared library version of posest? My C compiling skills are a little rusty and it seems posest produces statically linked output by default. |
@jw3126 download the source file from the author web site put all relevant files in the same directory ( don't bother compiling the Matlab interface part) and just call gcc with the list of .c files ( I think you can skip mlsl) It will still complain abut missing symbols , you need to have openBLAS or MKL installed somewhere and you'll need to specify it on the command line using -lopenblas or -lmkl |
@TsurHerman thanks! It mostly worked, I needed to omit all the |
Yes you are probably correct , you did not link openblas correctly. Try removing the |
Hi!
I'm trying to implement a function that will calculate the projective transformation from a bunch of projected coordinates and their corresponding real world values. This is just another (equally relevant) way of creating a projective transformation (other than with the cam_rotation and cam_position).
The following has been inspired by matlab's version for the same task (nothing revolutionary):
Can you guys help me understand what I'm doing wrong with that final step?
I think this could be a great addition to this package.
The text was updated successfully, but these errors were encountered: