We have existing machinery that lets us find the optimal (maximum a-posteriori) 2D curve tree, given a 2D Gaussian prior and a foreground probability map.
We'd like to use that to perform tracking when we know a 3D Gaussian distribution over the tree position, given previous evidence.
Given: p(xn|y1:n−1)
Estimate: p(xn|y1:n)
Let p(xn|y1,...,yn−1) be the prior of xn), conditioned on all previous data. At the current prior mean, μ, the projection function π(x) has Jacobian, J(μ), which can be decomposed using RQ decomposition into J=(R0)Q, where Q is a rotation and R is square, upper triangular, and nonsingular. This corresponds to rotating to face the camera, followed by scaling and/or shearing corresponding to foreshortening at the given depth. The projection function can be then approximated using taylor series expansion:
We can project the 3D prior to 2D using this transformation:
Here A2D and A3D are precision matrices.
For this section, let μ=μ2D as derived above, let A=QA3DQ⊤ and let x′=π(x) be the projected point. Let p(yn|x′n)=N([R−10]⊤μL,[R−10]⊤L−1[R−10]) be the image likelihood in 3D space, where μL is (x′1,x′2)⊤, and L is a 2x2 precision matrix. Let L′=R−⊤LR−1 and μ′L=R−1μL Running warping in step 2 gives us the hessian H of the marginal in-plane posterior. This is the negative marginal posterior covariance for the (u,v) space. Since the likelihood is uninformative in the dpeth direction, the deriving the full posterior covariance, (Z), is straightforward:
Warping also gives us the marginal posterior mean πx,πy, in the image space. Let π′x=π(μ)+R−1πx and π′y=R−1πy be the marginal posterior mean in camera space. Deriving π′z takes a few steps (primes are omitted below, all quantities are assumed to be in camera space)
Let A=(a1a2a3)⊤ be the rows of A. Omitting all but the third row gives:
Observing that z3i=a3i,
Written compactly:
Testing in matlab:
A = rand(3,3); A = A * A';
L = rand(2,2); L = L * L';
mu = randn(3,1);
mu_L = randn(2,1);
pi = inv(A + [L zeros(2,1);0 0 0]) * (A * mu + [L*mu_L; 0]);
true_pi_z = pi(3);
test_pi_z = mu(3) + A(3,1:2)*(mu(1:2) - pi(1:2))/A(3,3);
err = test_pi_z - true_pi_z
err =
-2.2204e-16
It remains to rotate π and A by Q⊤ to convert back to world space.
Posted by Kyle Simek