solvePnP in JuMP (Pose Estimation)

first steps in JuMP
How can I solve the PnP problem using JuMP?

I have a set of labeled 2d points with the corresponding 3d points.
The camera matrix K is known.

For any given R(3-element unit quaternion representing rotation) and T(3-element vector) the reprojection error is
is the mean squared distance between actual 2d-points and projected 3d-points

I want to use Levenberq-marquedt to minimize the reprojection error.
I don’t want to supply gradients or jacobians by hand , but I want some magic to do auto differentiating for me.

This optimization problem need to be re-usable and to run fast…I have about 8ms to spare.

I’m not familiar with this problem area, but can you express what your unknown variables, objective function, and constraints are? Are the objective and constraint functions linear, quadratic, more complicated nonlinear? Equality and/or inequality constraints? When you use JuMP you usually don’t need to worry about what optimization algorithm is getting used to solve the problem, you just have to select an available solver that is capable of solving your problem class based on the characteristics of your objective and constraints. If you can write functions algebraically within JuMP’s macros and they are smooth, well-behaved functions, then JuMP will handle auto-differentiation to calculate the Jacobian and Hessian for you without you having to do anything else.

Are you solving a sequence of related problems (say same structure, but modified initial conditions or constraint parameters) in a loop?

I may be wrong, but I think it’s unlikely you’ll obtain solves in 8ms using JuMP off the shelf. JuMP is designed to be fast but has never been explicitly optimized for the millisecond use case (PRs accepted).

Thanks guys, I think I looked in the wrong place , what I need is
in:
https://github.com/JuliaNLSolvers

And for your question about the problem and the time frame:
I am grabbing images of a known marker using an IR Camera at 60 fps (15ms per frame)
I have a about 8ms to spare , because it takes about 5ms to come from full image to labeled points.

So I have a function of 6 variables that needs to be optimized(find minimum) , it depends on “static”" parameters which are the center of mass of the blobs detected in the first phase.

15 ms later a new image arrives and the “static” parameters are updated and a new solution is needed.
So yes it is a sequence of related problems with different initial conditions(“static” parameters).