Complete Solution Classification For The Perspective-Three-Point Problem
Complete Solution Classification For The Perspective-Three-Point Problem
net/publication/3193582
Article in IEEE Transactions on Pattern Analysis and Machine Intelligence · September 2003
DOI: 10.1109/TPAMI.2003.1217599 · Source: IEEE Xplore
CITATIONS READS
885 4,860
4 authors, including:
Xiao-Shan Gao
Chinese Academy of Sciences
219 PUBLICATIONS 4,302 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Xiao-Shan Gao on 03 August 2013.
Abstract—In this paper, we use two approaches to solve the Perspective-Three-Point (P3P) problem: the algebraic approach and the
geometric approach. In the algebraic approach, we use Wu-Ritt’s zero decomposition algorithm to give a complete triangular
decomposition for the P3P equation system. This decomposition provides the first complete analytical solution to the P 3P problem. We
also give a complete solution classification for the P3P equation system, i.e., we give explicit criteria for the P3P problem to have one, two,
three, and four solutions. Combining the analytical solutions with the criteria, we provide an algorithm, CASSC, which may be used to find
complete and robust numerical solutions to the P3P problem. In the geometric approach, we give some pure geometric criteria for the
number of real physical solutions.
Index Terms—Perspective-Three-Point problem, pose determination, analytical solutions, solution classification, geometric criteria,
Wu-Ritt’s zero decomposition method.
1 INTRODUCTION
[
10
ZeroðES=I0 Þ ¼ Ci : ðDEÞ
i¼1
In the above formula, Ci ¼ ZeroðT Si =Ti Þ; i ¼ 1; ; 9 and 3. From the experimental results in Section 4, we can see
C10 ¼ ZeroðT S10 =T10 Þ [ ZeroðT S11 =T11 Þ, where T Si are poly- that the above decomposition provides a complete and
nomial equations in triangular form and Ti are polynomials. robust way to find the solutions to the P3P problem.
T Si and Ti may be found in Appendix A.
Among the 10 components, ZeroðT S1 =T1 Þ is called the 3 COMPLETE SOLUTION CLASSIFICATION FOR THE
main component of the P3P equation system, which is of the P3P EQUATION SYSTEM
following form: For polynomials fðxÞ and gðxÞ, let Vf be the number of
real solutions of fðxÞ, and Vf ðg > 0Þ the number of real
f ¼ a0 x4 þ a1 x3 þ a2 x2 þ a3 x þ a4 ¼ 0
ðTS 1 Þ solutions of fðxÞ such that g > 0. If fðxÞ has n real
g ¼ b0 y ÿ b1 ¼ 0: ðn;jÞ
solutions, then let Cf ðg > 0Þ denote the conditions that
The coefficients ai and bj may be found in Appendix A. This make fðxÞ having j real solutions such that g > 0. The
component has been obtained in [2], [4], [5], [9]. All other following lemmas will be used in this section.
components could be considered as degenerate cases. This is
Lemma 1 (Descartes’ Rule of Sign [19], [16]). Let f ¼
because, in these cases, the parameters a; b; p; q; r must Pn i
i¼k ai x ; ðan ak 6¼ 0Þ be a polynomial with real numbers as
satisfy certain algebraic relations. In other words, we are
coefficients. Then, the number of positive roots of f is less than
considering special cases of the problem.
or congruent to the number of sign changes in the sequence of
Compared to the main component, the “degenerate” cases
coefficients an ; . . . ; ak ð mod 2Þ.
are less possible to occur. But, they are still important due to
the following reasons: Solutions satisfying some degenerate Lemma 2 [16]. Let fðxÞ, gðxÞ be two polynomials and f of degree
n. Let
conditions, such as a þ b ÿ 1 ¼ 0 (in T S4 ) meaning that ffACB
is a right angle, may occur quite often if points A; B; C are from Y
n
man-made structures like buildings, where many right angles rðT Þ ¼ resultantðf; g ÿ T ; xÞ ¼ c ðgðxi Þ ÿ T Þ;
i¼1
exist. In the general case, the degenerate cases, such as T S2 ,
could be complicated and have no clear geometric meaning. where xi ; i ¼ 1; . . . ; n are the roots of fðxÞ ¼ 0. If all the
Therefore, it is difficult to tell when it will occur. solutions of fðxÞ ¼ 0 are real, then Vf ðg > 0Þ ¼ Vr ðT > 0Þ.
Table 1 gives the maximal number of solutions for each
component. Let fi ðxÞ; gi ðx; yÞ be the first two polynomials in T Si .
Since Ci and Cj ði 6¼ jÞ are disjoint, to solve the equation In components T Si ; i ¼ 5; 6; 7; 10, fi ðxÞ, and gi ðx; yÞ are
numerically, for a set of specific values of the parameters linear in x and y, respectively. In these cases, each component
p; q; r; a; b, either can have only one positive solution and it is trivial to give the
conditions for them to have such solutions.
ZeroðP S=I0 Þ ¼ ZeroðT Sk =Tk Þ In components T Si ; i ¼ 3; 4; 8; 9; 11, fi ðxÞ and gi ðx; yÞ are
if k satisfying 1 k 9 and Tk ðp; q; r; a; bÞ 6¼ 0, or either linear or quadratic in x and y, respectively. We will
treat these cases in Section 3.1.
ZeroðP S=I0 Þ ¼ ZeroðT S10 =T10 Þ [ ZeroðT S11 =T11 Þ In component T S2 , f2 ðxÞ is a cubic equation and g2 ðx; yÞ
is linear in y. We will treat this case in Section 3.2.
if T10 ðp; q; r; a; bÞ ¼ T11 ðp; q; r; a; bÞ 6¼ 0. Since the polynomials
In component T S1 , f1 ðxÞ is a quartic equation and g1 ðx; yÞ
in T Si are of degree 4, the solution of the P3P problem is
is linear in y. We will treat this case in Section 3.3.
reduced to the solution of equation systems in triangular
form and, hence, to the solution of univariate equations of 3.1 The Quadratic Cases
degree 4. The quadratic cases may have three forms: 1) fi ðxÞ is
From this decomposition, we have the following quadratic and gi ðx; yÞ is linear in y, 2) fi ðxÞ is linear and
observations: gi ðx; yÞ is quadratic in y, and 3) fi ðxÞ and gi ðx; yÞ are
quadratic in x and y, respectively. All of them can be treated
1. Since the solutions for each triangular set are well-
similarly. We will take T S9 as an illustrative example. The
determined, this decomposition provides a complete
set of analytical solutions for the P3P problem. equation system is
2. From Table 1 and the analysis following the table, it is 8
< f9 ¼ ðÿ1 þ a þ bÞx2 þ ðÿqa þ qÞx ÿ 1 þ a ÿ b ¼ 0;
easy to see that there are at most four distinct solutions
g ¼ ðÿ1 þ a þ bÞy2 ÿ 1 ÿ a þ qxa þ b ¼ 0; ð4Þ
under the reality condition (2). Notice that this result : 9
p ¼ 0; r ¼ 0; x > 0; y > 0; a þ b ÿ 1 6¼ 0:
was proven previously only for the main component.
GAO ET AL.: COMPLETE SOLUTION CLASSIFICATION FOR THE PERSPECTIVE-THREE-POINT PROBLEM 933
The number of solutions for the above system is the same as 1. Equation (4) has two physical solutions iff one of the
the following equation system: following statements holds:
8
< f9 ¼ ðÿ1 þ a þ bÞx2 þ ðÿqa þ qÞx ÿ 1 þ a ÿ b ¼ 0; 1:1: ½ p ¼ r ¼ 0; a þ b ÿ 1 > 0; q > 0; D13 > 0; 1 < 0; 2 < 0; 3 < 0
g ¼ ðÿ1 þ a þ bÞð1 þ a ÿ qxa ÿ bÞ > 0; ð5Þ 1:2: ½ p ¼ r ¼ 0; a þ b ÿ 1 < 0; q > 0; D13 > 0; 1 > 0; 2 < 0; 3 > 0:
:
p ¼ 0; r ¼ 0; a þ b ÿ 1 6¼ 0; x > 0:
We first assume that 2. Equation (4) has one physical solution iff one of the
following statements holds:
resultantðf9 ; g; xÞ 6¼ 0;
2:1: ½ p ¼ r ¼ 0; a ¼ 1; q þ b ÿ 2 < 0
resultantðf9 ; x; xÞ ¼ a ÿ b ÿ 1 6¼ 0; 2:2: ½ p ¼ r ¼ 0; a ÿ b þ 1 ¼ 0; q 6¼ 0
r12 ðT Þ ¼ resultantðf9 ; xg ÿ T ; xÞ ¼ r120 T 2 þ r121 T þ r122 : 2:9: ½ p ¼ r ¼ 0; q > 0; a ÿ b ÿ 1 > 0 ;D13 > 0; 1 < 0; 2 > 0; 3 6¼ 0
D13 (the discriminant), respectively. So, f9 has two real 2:12: ½ p ¼ r ¼ 0; q > 0; a þ b ÿ 1 > 0; D13 > 0; 1 > 0; 2 < 0; 3 6¼ 0;
solutions iff D13 > 0 and one real solution iff D13 ¼ 0. where
Since resultantðf9 ; g; xÞ 6¼ 0, resultantðf9 ; x; xÞ 6¼ 0, and
resultantðg; x; xÞÞ 6¼ 0, we have D13 ¼ q2 ða ÿ 1Þ2 ÿ 4ða þ b ÿ 1Þða ÿ b ÿ 1Þ;
8 1 ¼ q2 aða ÿ 1Þ ÿ 2ða ÿ b þ 1Þða þ b ÿ 1Þ;
>
> Vf ¼ Vf9 ðx > 0Þ þ Vf9 ðx < 0Þ;
< 9 2 ¼ q2 a ÿ ða ÿ b þ 1Þ2 ;
Vf9 ðx < 0Þ ¼ Vf9 ðx < 0; g > 0Þ þ Vf9 ðx < 0; g < 0Þ;
ð6Þ
>
> V ðg > 0Þ ¼ Vf9 ðx > 0; g > 0Þ þ Vf9 ðx < 0; g > 0Þ; 3 ¼ q2 aða ÿ 1Þ2 ÿ ða þ b ÿ 1Þðb ÿ 3ab ÿ 1 ÿ 2a þ 3a2 Þ:
: f9
Vf9 ðxg > 0Þ ¼ Vf9 ðx > 0; g > 0Þ þ Vf9 ðx < 0; g < 0Þ:
From the above equations, we obtain the following formula Proof. We know that (4) has two physical solutions iff
for the number of physical solutions: Vf9 ðx > 0; g > 0Þ ¼ 2. From (7), this is possible iff
Vf9 ðx > 0; g > 0Þ ¼ Vf9 ðx > 0Þ ¼ 2; Vf9 ðg > 0Þ ¼ 2; Vf9 ðxg > 0Þ ¼ 2; Vf9 ¼ 2:
1ÿ ð7Þ
Vf9 ðx > 0Þ þ Vf9 ðg > 0Þ þ Vf9 ðxg > 0Þ ÿ Vf9 : The first part of the Theorem 3 follows directly from these
2 conditions. For the second part, there are four cases.
By Lemmas 1 and 2, we have the following results: Suppose resultantðf9 ; g; xÞ 6¼ 0, resultantðf9 ; x; xÞ 6¼ 0,
Vf9 ðx > 0Þ ¼ the number of sign changes in coefficients of f9 ðxÞ; and resultantðg; x; xÞ 6¼ 0. In this case, (4) has one physical
Vf9 ðg > 0Þ ¼ the number of sign changes in coefficients of r11 ðT Þ; solution iff Vf9 ðx > 0; g > 0Þ ¼ 1. From (7), (4) has one
Vf9 ðxg > 0Þ ¼ the number of sign changes in coefficients of r12 ðT Þ: physical solution iff one of the following conditions holds:
If resultantðf9 ; g; xÞ ¼ 0, (5) becomes: Vf9 ðx > 0Þ ¼ 2; Vf9 ðg > 0Þ ¼ 2; Vf9 ðxg > 0Þ ¼ 0; Vf9 ¼ 2;
8 Vf9 ðx > 0Þ ¼ 2; Vf9 ðg > 0Þ ¼ 1; Vf9 ðxg > 0Þ ¼ 1; Vf9 ¼ 2;
>
> f ¼ ÿaqða þ b ÿ 1Þx ÿ q2 a þ q2 a2 ÿ 2b ÿ a2 þ 1 þ b2 ¼ 0;
<9 Vf9 ðx > 0Þ ¼ 2; Vf9 ðg > 0Þ ¼ 0; Vf9 ðxg > 0Þ ¼ 2; Vf9 ¼ 2;
g ¼ ðÿ1 þ a þ bÞð1 þ a ÿ qxa ÿ bÞ > 0;
>
> p ¼ 0; r ¼ 0; Vf9 ðx > 0Þ ¼ 1; Vf9 ðg > 0Þ ¼ 2; Vf9 ðxg > 0Þ ¼ 1; Vf9 ¼ 2;
:
a þ b ÿ 1 6¼ 0; x > 0 Vf9 ðx > 0Þ ¼ 1; Vf9 ðg > 0Þ ¼ 1; Vf9 ðxg > 0Þ ¼ 2; Vf9 ¼ 2;
ð8Þ Vf9 ðx > 0Þ ¼ 0; Vf9 ðg > 0Þ ¼ 2; Vf9 ðxg > 0Þ ¼ 2; Vf9 ¼ 2;
which may have one positive solution and the condition for Vf9 ðx > 0Þ ¼ 1; Vf9 ðg > 0Þ ¼ 1; Vf9 ðxg > 0Þ ¼ 1; Vf9 ¼ 1:
that is easy to obtain. For resultantðf9 ; x; xÞ ¼ a ÿ b ÿ 1 ¼ 0 Analyzing these conditions will lead to some of the
and resultantðg; x; xÞ ¼ ða þ b ÿ 1Þða ÿ b þ 1Þ ¼ 0, we can conditions in part two of Theorem 3. The other three
deal with them similarly.
cases are resultantðf9 ; g; xÞ ¼ 0, resultantðf9 ; x; xÞ ¼ 0,
Theorem 3. We have the following necessary and sufficient and resultantðg; x; xÞ ¼ 0, respectively. We can deal with
conditions to adjudicate the number of physical solutions them similarly. Combining the four cases will lead to the
Vf9 ðx > 0; g > 0Þ of ZeroðT S9 =T9 Þ. second part of Theorem 3. u
t
934 IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 25, NO. 8, AUGUST 2003
h i
3.2 The Cubic Case q21 ÿq21
3:1: D8 ¼ 0; D7 6¼ 0; < 0; g >0
For T S2 , we need to consider the polynomial system: q20 q20
h i
8 h31 ÿh31
3:2: D8 ¼ 0; D7 6¼ 0; < 0; g >0
< f2 ¼ a5 x3 þ a6 x2 þ a7 x þ a8 ; h30 h30
g ¼ b2 y ÿ b3 ¼ 0; ð9Þ h i
: 2 a2 ÿa2
x > 0; y > 0; a5 6¼ 0; b2 6¼ 0; 3:3: D8 ¼ 0; D7 ¼ 0; D6 6¼ 0; < 0; g >0
a1 3a1
h i
where the ai and bj could be found in Appendix A. The ð1;1Þ ð1;1Þ ð1;1Þ
3:4: D8 < 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ
number of solutions for the above system is the same as the h i
ð3;3Þ ð3;1Þ ð3;1Þ
following equation system: 3:5: D8 > 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ
h i
8 ð3;2Þ ð3;2Þ ð3;1Þ
< f2 ¼ a5 x3 þ a6 x2 þ a7 x þ a8 ; 3:6: D8 > 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ
g ¼ b2 b3 > 0 ð10Þ h i
ð3;2Þ ð3;1Þ ð3;2Þ
: 3:7: D8 > 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ
x > 0; a5 6¼ 0:
h i
ð3;1Þ ð3;3Þ ð3;1Þ
Let Resultantðf2 ; g; xÞ 6¼ 0, and Di the Sylvester-Habicht 3:8: D8 > 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ
h i
sequences of ðf2 ; diffðf2 ÞÞ, i ¼ 5; . . . ; 8 [21]. We know that ð3;1Þ ð3;2Þ ð3;2Þ
3:9: D8 > 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ
fðxÞ has three real solutions iff D8 > 0 [20]. Let h i
ð3;1Þ ð3;1Þ ð3;3Þ
3:10: D8 > 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ :
r7 ðT Þ ¼ resultantðf2 ; g ÿ T ; xÞ ¼ r70 T 3 þ r71 T 2 þ r72 T þ r73 ;
ðn;jÞ
The explicit expressions for all Cf may be found in
r8 ðT Þ ¼ resultantðf2 ; xg ÿ T ; xÞ ¼ r80 T 3 þ r81 T 2 þ r82 T þ r83 :
Appendix B.
If D8 > 0, then by Lemmas 1 and 2, we can give the conditions If Resultantðf2 ; g; xÞ ¼ 0, the problem becomes a quad-
for the equation system to have one, two, or three positive ratic case and can be treated similarly as in the preceding
solutions. If D8 < 0, f2 ðxÞ has only one real solution and two section.
complex solutions. By Descartes rule of sign, Vf2 ðx > 0Þ ¼ 1 3.3 The Quartic Case
iff the number of sign changes in coefficients of f2 ðxÞ is 1 or 3.
For T S1 , we need to count the number of solutions for the
Now, we consider the number of positive solutions of r7 ðT Þ
following system.
and r8 ðT Þ. Let x1 be real, x2 , x3 be complex. If gðx2 Þ is real, then 8
gðx3 Þ is also real, and the signs of gðx2 Þ and gðx3 Þ are the same. < f1 ¼ a0 x4 þ a1 x3 þ a2 x2 þ a3 x þ a4 ¼ 0;
So, by the Descartes rule of sign, Vrj ðT > 0Þ ¼ 1 iff the number g ¼ b0 y ÿ b1 ¼ 0; ð11Þ
: 1
x > 0; y > 0; a0 6¼ 0; b0 6¼ 0;
of sign changes in coefficients of rj ðxÞ is 1 or 3, j ¼ 7; 8: If
D8 ¼ 0, D7 6¼ 0, then there exists polynomial Q2 ðxÞ ¼ where ai and bi may be found in Appendix A. Since b0 0
q20 x þ q21 such that f2 ðxÞ ¼ cQ2 ðxÞH32 ðxÞ, where H3 ðxÞ ¼ (see Appendix A), it is equivalent to count the number of
h30 x þ h31 is the pseudoremainder of f2 with diffðf2 Þ for positive solutions for the following system
variable x. This case is easy to solve. If D8 ¼ 0, D7 ¼ 0, D6 6¼ 0, 8
< f1 ¼ a0 x4 þ a1 x3 þ a2 x2 þ a3 x þ a4
then f2 ðxÞ ¼ cH43 ðxÞ, where H4 ðxÞ ¼ 3a5 x þ a6 . b >0 ð12Þ
From the above discussion, we obtain the following result. : 1
x > 0; a0 6¼ 0; b0 6¼ 0:
Theorem 4. For T S2 , we have the following results:
We will first assume that Resultantðf1 ; b1 ; xÞ 6¼ 0 and
1. Equation (9) has three physical solutions iff the Resultantðf1 ðxÞ; x; xÞ 6¼ 0: Let f 0 ¼ Diffðf1 ; xÞ, and Di ;
following statements hold: Ai ; Bi ; Ci the Sylvester-Habicht sequences of ðf1 ; f 0 Þ,
h i
ð3;3Þ ð3;3Þ ð3;3Þ ðf1 ; xf 0 Þ, ðf1 ðxÞ; b1 f 0 Þ, and ðf1 ðxÞ; xb1 f 0 Þ, respectively, i ¼
D8 > 0; Cf2 ðx > 0Þ; Cf2 ðg > 0Þ; Cf2 ðxg > 0Þ :
0; ::; 4 [21]. First, let us assume D4 6¼ 0. It is known that
Vf1 ¼ 4 iff D2 > 0, D3 > 0, D4 > 0 which is denoted by
2. Equation (9) has two physical solutions iff one of the ð4Þ
Cf1 [20]. Let
following statements holds:
ð3;3Þ ð3;2Þ ð3;2Þ
Y
4
2:1: D8 > 0; Cf
2
ðx > 0Þ; Cf
2
ðg > 0Þ; Cf
2
ðxg > 0Þ r1 ðT Þ ¼ resultantðf1 ; b1 ÿ T ; xÞ ¼ a40 ðb1 ðxi Þ ÿ T Þ
ð3;2Þ ð3;3Þ ð3;2Þ
i¼1
2:2: D8 > 0; Cf ðx > 0Þ; Cf ðg > 0Þ; Cf ðxg > 0Þ
2 2 2
ð3;2Þ ð3;2Þ ð3;2Þ
¼ r10 T 4 þ r11 T 3 þ r12 T 2 þ r13 T þ r14
2:3: D8 > 0; Cf ðx > 0Þ; Cf ðg > 0Þ; Cf ðxg > 0Þ
2 2 2
h i Y
4
2:4:
h
D8 ¼ 0; D7 6¼ 0; h31 < 0; g
ÿh31
h30
q
> 0; q21 < 0; g
ÿq21
q20 >0 : r2 ðT Þ ¼ resultantðf1 ; xb1 ÿ T ; xÞ ¼ a40 ðxb1 ðxi Þ ÿ T Þ
30 20
i¼1
¼ r20 T 4 þ r21 T 3 þ r22 T 2 þ r23 T þ r24 ;
3. Equation (9) P S has one physical solution iff one of the
following statements holds: where fðxi Þ ¼ 0, i ¼ 1; 2; 3; 4.
GAO ET AL.: COMPLETE SOLUTION CLASSIFICATION FOR THE PERSPECTIVE-THREE-POINT PROBLEM 935
By the Lemmas 1 and 2, we have the following results: 2. Equation (11) has three physical solutions iff one of the
following statements holds:
Vf1 ðx > 0Þ ¼ the number of sign changes in coefficients of fðxÞ
h i
ð4;4Þ ð4;3Þ ð4;3Þ ð4Þ
Vf1 ðb1 > 0Þ ¼ the number of sign changes in coefficients of r1 ðT Þ 2:1: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
Vf1 ðxb1 > 0Þ ¼ the number of sign changes in coefficients of r2 ðT Þ:
h i
ð4;3Þ ð4;4Þ ð4;3Þ ð4Þ
2:2: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
By the complete discrimination method [22], Vf1 ¼ 2 iff one h i
ð4;3Þ ð4;3Þ ð4;3Þ ð4Þ
of the following conditions holds: 2:3: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1 :
8
>
> 1Þ D2 > 0; D3 > 0; D4 < 0
< 3. Equation (11) has two physical solutions iff one of the
2Þ D2 6¼ 0; D3 < 0; D4 < 0
ð13Þ following statements holds:
> 3Þ D2 0; D3 > 0; D4 > 0
>
: h i
4Þ D2 > 0; D3 ¼ 0; D4 > 0: ð2;2Þ ð2;2Þ ð2;2Þ ð2Þ
ð2Þ
3:1: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
We denote one of the conditions by Cf1 : It is clear that there h i
ð4;4Þ ð4;2Þ ð4;2Þ ð4Þ
are the following results: 3:2: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
h i
ð4;3Þ ð4;3Þ ð4;2Þ ð4Þ
1 3:3: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
Vf1 ðx > 0Þ ÿ Vf1 ðx < 0ÞÞ ¼ h i
h 2 i ð4;3Þ ð4;2Þ ð4;3Þ ð4Þ
3:4: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
signðA1 Þ þ signðA1 A2 Þ þ signðA2 A3 Þ þ signðA3 A4 Þ ; h i
ð4;2Þ ð4;4Þ ð4;2Þ ð4Þ
1 3:5: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
Vf1 ðb1 > 0Þ ÿ Vf1 ðb1 < 0Þ ¼ h i
h 2 i ð4;2Þ ð4;3Þ ð4;3Þ ð4Þ
3:6: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
signðB1 Þ þ signðB1 B2 Þ þ signðB2 B3 Þ þ signðB3 B4 Þ ; h i
ð4;2Þ ð4;2Þ ð4;4Þ ð4Þ
1 3:7: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1 :
Vf1 ðxb1 > 0Þ ÿ Vf1 ðxb1 < 0Þ ¼
h 2 i
signðC1 Þ þ signðC1 C2 Þ þ signðC2 C3 Þ þ signðC3 C4 Þ : 4. Equation (11) has one physical solution iff one of the
following statements holds:
Since Resultantðf1 ; b1 ; xÞ 6¼ 0; and Resultantðf1 ðxÞ; h i
ð2;2Þ ð2;1Þ ð2;1Þ ð2Þ
x; xÞ 6¼ 0, we have 4:1: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
h i
1 ð2;1Þ ð2;2Þ ð2;1Þ ð2Þ
Vf1 ðx > 0Þ ¼ 4:2: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
h 2 i h i
ð2;1Þ ð2;1Þ ð2;2Þ ð2Þ
Vf1 þ signðA1 Þ þ signðA1 A2 Þ þ signðA2 A3 Þþ signðA3 A4 Þ ; 4:3: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
h i
ð4;4Þ ð4;1Þ ð4;1Þ ð4Þ
1 4:4: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
Vf1 ðb1 > 0Þ ¼ h i
h 2 i ð4;3Þ ð4;2Þ ð4;1Þ ð4Þ
4:5: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
Vf1 þ signðB1 Þþ signðB1 B2 Þ þ signðB2 B3 Þþ signðB3 B4 Þ ; h i
ð4;3Þ ð4;1Þ ð4;2Þ ð4Þ
1 4:6: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
Vf1 ðxb1 > 0Þ ¼ h i
h 2 i ð4;2Þ ð4;3Þ ð4;1Þ ð4Þ
4:7: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
Vf1 þ signðC1 Þ þ signðC1 C2 Þ þ signðC2 C3 Þ þ signðC3 C4 Þ : h i
ð4;2Þ ð4;2Þ ð4;2Þ ð4Þ
4:8: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
For any two equations fðxÞ and gðxÞ, if ResultantðfðxÞ; h i
ð4;2Þ ð4;1Þ ð4;3Þ ð4Þ
gðxÞ; xÞ 6¼ 0, then 4:9: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
h i
ÿ ð4;1Þ ð4;4Þ ð4;1Þ ð4Þ
VfðxÞ ¼ VfðxÞ gðxÞ > 0Þ þ VfðxÞ ðgðxÞ < 0 : 4:10: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
h i
ð4;1Þ ð4;3Þ ð4;2Þ ð4Þ
Then, we have 4:11: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
h i
ð4;1Þ ð4;2Þ ð4;3Þ ð4Þ
Vf1 ðx > 0; b1 > 0Þ ¼ 4:12: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1
1ÿ h i
ð4;1Þ ð4;1Þ ð4;4Þ ð4Þ
Vf1 ðx > 0Þ þ Vf1 ðb1 > 0Þ þ Vf1 ðxb1 > 0Þ ÿ Vf1 : 4:13: Cf1 ðx > 0Þ; Cf1 ðb1 > 0Þ; Cf1 ðxb1 > 0Þ; Cf1 :
2
So, for a0 6¼ 0 and D4 6¼ 0, we can solve the equation system ðn;jÞ
The explicit expressions for all Cf may be found in
completely. Note that D4 is the discriminant for f1 . From the
Appendix B.
above discussion, we have proven.
If D4 ¼ 0 and D3 6¼ 0, then we know that there exists a
Theorem 5. For a0 6¼ 0, D4 6¼ 0, we have
polynomial Q1 ðxÞ ¼ q10 x2 þ q11 x þ q12 such that f1 ðxÞ ¼
1. Equation (11) has four physical solutions iff cQ1 ðxÞ H12 ðxÞ, where H1 ðxÞ ¼ D3 x þ D3 . Let DQ1 ¼ resultant
ð4;4Þ ð4;4Þ ð4;4Þ ð4Þ
Cf1 ðx > 0Þ, Cf1 ðb1 > 0Þ, Cf1 ðxb1 > 0Þ, and Cf1 ðQ1 ; diffðQ1 Þ; xÞ. If DQ1 > 0, then Q1 ðxÞ has two different real
hold. solutions. Let
936 IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 25, NO. 8, AUGUST 2003
h ÿÿD i
r3 ðT Þ ¼ resultantðQ1 ; b1 ÿ T ; xÞ ¼ r30 T 2 þ r31 T þ r32 ; 3:1:
D
D3 6¼ 0; D3 < 0; b1 3 >0
3 D3
ÿ 2 h i
If DQ1 ¼ 0, then Q1 ðxÞ ¼ q0 x þ 2qq1110 . 3:9: D3 ¼ 0; D2 6¼ 0; DH1 > 0; CH
ð2;1Þ
1
ðx > 0Þ; CH
ð2;2Þ
1
ðb1 > 0Þ; CH
ð2;1Þ
2
ðxb1 > 0Þ
4 þ q2
3. Equation (11) has one physical solution iff one of the q > 0 and > p > 1:
4
following statements holds:
GAO ET AL.: COMPLETE SOLUTION CLASSIFICATION FOR THE PERSPECTIVE-THREE-POINT PROBLEM 937
TABLE 2
Number of Solutions and the Component Providing the Solutions
938 IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 25, NO. 8, AUGUST 2003
that one of the following formulas: > 0, < 0, 6¼ 0 occurs values. If they are stable, let M ¼ 16 (usual floating-point
in C. For instance, let C be Condition 1.1 in Theorem 3. Then, number); otherwise, let M ¼ 40.
F ðCÞ ¼ fa þ b ÿ 1; q; D13 ; 1 ; 2 ; 3 g: S4 Find all the solutions of T Sk ¼ 0 using high precision
numbers with M digits.
A set of values for the parameters a; b; p; q; r is said to be stable
S5 If the number of solutions obtained in S4 is the same as
for condition C if for each 2 F ðCÞ, jða; b; p; q; rÞj > ,
N, then these are the solutions. Otherwise, we need to
where > 0 is a small number, say 1 percent of the value
select N “right” solutions from them. We first replace a
range of the parameters. Otherwise, it is critical. Basically
complex number u þ vi in the solutions with u if v is very
speaking, the critical values are those which will approxi-
small, say jvj < 10ÿ4 m. Then, we select the N largest
mately vanish the expressions in F ðCÞ. Therefore, the
positive solutions. According to Step S2, this is possible.
probability for the occurrence of the critical values is near
zero. The following experiments are done with Maple. The
If a set of values is stable, then a small variation of these first experiment is to show the stability of the criteria in
values will give the same number of solutions. On the Section 3. These formulas use arithmetic operations (+, -, *)
contrary, for a set of critical values, a small variation may lead only and are of moderate size. The computation will be
to changes in the number of solutions. Therefore, for a set of robust. Also, from the above analysis, only for critical
stable values, we may use usual floating-point calculations to values of the parameters, the computation will be unstable.
enhance the computation speed; and for a set of critical values, We also know that the probability for the occurrence of the
we may use high-precision computation tools provided by critical values is near zero. This observation gives another
symbolic computation software or by other special tools, like assurance that the computation is stable. The following
the exact geometric computation method [18]. experimental results support this statement.
From the above discussion, we propose the following the The parameters a, b, p, q, and r are randomly generated
CASSC algorithm. within some ranges by a random number generator in
1
Maple 7. We take a, b 2 ð10 10Þ, and p, q, r 2 ðÿ2 2Þ. One
CASSC Algorithm hundred trials are carried out and 100 sets of parameters are
Input: A set of values for parameters a; b; p; q; r. generated for each trial. For each set of parametric values,
Output: The physical solutions. two results are computed: one with the original parametric
values; the other with the parametric values perturbed by
S1 In this step, we will decide which of the 10 components in
random noises in certain level. In trial i, let ni be the number
(DE) will provide the solution. Let ESi be the set of
of the parametric values such that the two results are the
polynomials in T Si involving the parameters a; b; p; q; r
same and let kninÿnk (here, n ¼ 100) be the relative sets error.
only. Then, for a set of parameter values a; b; p; q; r, the
Fig. 3a gives the median, mean, and standard deviation of
solutions will be provided by Ck if ESk ða; b; p; q; rÞ ¼ 0 and
the relative errors w.r.t. varying noises. We observe that the
tk ¼ jTk ða; b; p; q; rÞj 6¼ 0. In practice, we use the criteria:
algorithm yields very graceful degradation with increasing
jP ða; b; p; q; rÞj < 10ÿ4 m for each P 2 ESk and tk > 10ÿ2 m,
noises and are, therefore, very stable.
where m ¼ maxða; b; p; q; rÞ. We will find the smallest k
The second experiment concerns the stability of the
such that the above conditions are satisfied. If no such k
exits, then there exists no solution. Otherwise, goto S2. whole CASSC algorithm. We choose three sets of parametric
values S1 ¼ fa ¼ 0:6; b ¼ 0:5; p ¼ r ¼ 0; q ¼ 0g, S2 ¼ fa ¼
S2 Determine the number of physical solutions with the 1; b ¼ 1; p ¼ 1:2; r ¼ 1:2; q ¼ 1:3g, and S3 ¼ fa ¼ 1:35; b ¼
criteria given in Section 3. Let N be the number and the 1:65; p ¼ 1:2; r ¼ 1:0; q ¼ 1:67g. We choose n ¼ 100 random
criterion used to determine this number. If N ¼ 0, the numbers as noises nearing each of the seven numbers:
algorithm terminates. Otherwise goto S3. e1 ¼ 0:08, e2 ¼ 0:1, e3 ¼ 0:12, e4 ¼ 0:14, e5 ¼ 0:16, e6 ¼ 0:18,
S3 In this step, we will decide the digits of precisions used e7 ¼ 0:2 and compute the solutions for S1 , S2 , and S3 with
in the computation. With the criterion obtained in our algorithm. Let ni be the number of parametric values
Step S2, we may determine whether a; b; p; q; r are stable near ei which give different number of solutions with the
GAO ET AL.: COMPLETE SOLUTION CLASSIFICATION FOR THE PERSPECTIVE-THREE-POINT PROBLEM 939
Fig. 4. Existence conditions for point J. Fig. 5. Two cases for point H.
original parametric values, and knni k the relative sets error. 5.1 Determine CA ¼ SAB \ SAC
The experimental results are illustrated in Fig. 3b. It is easy Let ABdi (AB de ) denote the intersection of SAB and plane ABC
to check that S3 is stable and S1 ; S2 are critical. The
which is on the same (opposite) side of AB with point C. Since
experimental results strongly support the fact that our
0 0
definition of stable and critical values is meaningful. From the axes of symmetry for part-toroids SAB and SAC meet in
Fig. 3b, we see that even for a set of stable values (S3 ), the point A and point A is also on the part-toroids, from the shape
computation may be unstable. This is caused by the high of the part-toroid each branch of CA must pass through plane
noise level. The computation is stable for noises less that
ABC. That is, CA must meet with plane ABC. Curve CA
10 percent of the value range of the parameters, which is
intersects with plane ABC in at most four points: J ¼ AB de
quite reasonable.
We test our algorithm with a larger set of samples. For a \ACde ; H ¼ AB de \ ACdi ; K ¼ ABdi \ ACde , and I ¼ AB di \ AC
di .
set of solutions obtained with the algorithm, we substitute Please note that, in some cases (e.g., in Fig. 7), point A may not
them into (ES) and check whether the substituted values be on CA . In this case, point A is on the intersection curve of the
are zero or not. We take 100 sets of parameters randomly.
The maximal substituted value into ðESÞ is 0:3 10ÿ10 for parts of the toroids that are excluded by us.
the equation systems which is satisfactory. From now on, we also use A; B; C to denote the angles of
We also tested the speed for the CASSC algorithm, which ffA; ffB; ffC. We first give the existence conditions for points J,
should be fast for the following reasons. Steps S1, S2, and S3 H, K, and I.
only involve the evaluation of rational expressions of
moderate size. Step S4 is to solve univariate equations of . Point J exists if þ < A (Fig. 4). In Fig. 4,
degrees at most four. Step S5 is computationally trivial. We ffBJA ¼ , ffCJA ¼ , and ffBJC ¼ þ . If þ
test our algorithm with 100 randomly chosen samples. The is large enough, AB de and AC de will have no
average running time for Steps S1, S3, and S5 is almost zero; intersection point. If þ ¼ A, AB de is tangent to
the average running time for Step S2 is 0.011 second; the de at point A. If þ < A, the intersection of
AC
average running time for Step S4 is 0.013 second. The data is de and AC
AB de will exist.
collected with Maple V on a PC with a 2G CPU. Step S4, which . Point H. There are two cases. If B < , then point B
is to solve the quartic equations, is the most time consuming is outside of SAC and H1 exists if B < and þ
step. Note that this step is needed in most previous A < : In Fig. 5, ffBH1 A ¼ , ffCH1 A ¼ . To ensure
approaches to solving the P3P problem. The implementation the existence of H1 , must be greater than þ A. If
is based on the interpreter language of Maple for symbolic ¼ þ A, AC di is tangent to AB de at point A. If
computation which is known to be much slower than < B, then point B is inside SAC and H2 exists if
implementations with C languages for the tasks mentioned
< B and < þ A.
above. As a conclusion, the CASSC algorithm is quite fast.
. Point K. There are two cases. K1 exists if C < and
There is no problem to provide realtime solutions to the
þ A < : K2 exists if < C and < þ A.
P3P problem.
. Point I. There are two cases: I1 exists if B < ; C < ,
and þ þ A < 2 (Fig. 6). I2 exists if < B and
5 THE GEOMETRIC APPROACH < C (Fig. 6).
Let us consider the three conditions ¼ ffBP C, ¼ ffAP C,
and ¼ ffAP B separately. The set of all P satisfying
0
condition ffAP B ¼ is part of a toroid (part-toroid) SAB .
0 0
Similarly, we can define SAC and SBC . Because the three
part-toroids are symmetric with the plane ABC, we need
only consider what happens on one side of plane ABC. Let
0
SAB denote the half of SAB which is on one side of
plane ABC. We can similarly define SAC and SBC .
We divide the problem into two steps: First, we
determine the intersection curve CA of surfaces SAB and
SAC ; then, we determine the intersection of CA with SBC .
We have solved the first step completely. For the second
step, we have some partial results. Fig. 6. Existence conditions for point I.
940 IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 25, NO. 8, AUGUST 2003
We will now give a classification of CA by counting the Using (19) we can simplify this condition to
intersections of CA with plane ABC. Suppose that S; U; V are EðH2 Þ \ EðK2 Þ \ EðJÞ. That is,
points. We use EðSÞ (EðSÞ) to denote the existence (non-
existence) condition of point S. Notation S n ðU; V Þ means j ÿ j<A< þ ; B < ; and < C:
that if S exists, then U and V will not exist. Notation S; U ) V In this case, CA consists of two spatial curves: one is
means that, if S and U exist, then V exists. From the results in from A to I2 and the other is from H2 to K2 . Since the
the preceding sections, we have the following conclusion:
detailed analysis is the same, we will omit it below.
8
> J n ðK1 ; H1 Þ . CA intersects plane ABC in two points. There are
>
> five subcases.
>
< H1 n ðJ; K1 ; H2 ; I2 Þ; H2 n ðH1 ; I1 Þ
K1 n ðJ; H1 ; K2 ; I2 Þ; K2 n ðK1 ; I1 Þ ð19Þ
>
> Case 1. The intersections are J; K2 (J; H2 ) if
>
> I 1 n ðI 2 ; K2 ; H2 Þ; I 2 n ðI 1 ; K 1 ; H1 Þ
: 8 08 1
K2 ; H2 ) I2 ; J; I2 ) H2 ; K2 : < þ <A < þ <A
B< @ <B A:
: :
. CA intersects plane ABC in four points. From the <C C<
above analysis, the four points must come from
In this case, CA consists of one spatial curve from
H1 ; H2 ; K1 ; K2 ; I1 ; I2 ; and J. Since H1 n ðH2 Þ; K1 nðK2 Þ
and I1 n ðI2 Þ, the fourth point must be J. From J n J to K2 (J to H2 ).
ðK1 ; H1 Þ; K2 and H2 must exist. Finally, from Case 2. The intersections are J; I1 if
K2 ; H2 ) I2 we get the fourth point I2 . So, the four þ < A; B < ; and C < :
points are J; H2 ; K2 ; I2 . Then, the condition of this case
should be EðJÞ \ EðH2 Þ \ EðK2 Þ \ EðI2 Þ \ EðH1 Þ \ In this case, CA consists of one spatial curve from
EðK1 Þ \ EðI1 Þ which is equivalent to EðJÞ \ EðI2 Þ by J to I1 .
(19). That is, Case 3. The intersections are H2 ; K1 (H1 ; K2 ) if
8 08 1
þ < A; < B; and < C: < þA< < þA<
<B @ B< A:
In this case, CA consists of two spatial curves: one is : :
from point J to I2 and the other is from H2 to K2 . Fig. 7 C< <C
shows the case in the ABC plane and the spatial case. In this case, CA consists of one spatial curve from
Note that, in this case, point A is not on the curves.
H2 to K1 (or H1 to K2 ).
. CA intersects plane ABC in three points. From
Case 4. The intersections are K1 ; I1 (H1 ; I1 ) if
J n ðK1 ; H1 Þ, we know that, if J exists, at lease one of
8 08 1
H2 and K2 should exist. Actually only one of H2 and K2 > þA< > þA<
>
< >
<
can exist. Otherwise, from K2 ; H2 ) I2 we know that B< B B< C
B C:
there will be four points! Then, we know that either H2 > C < @> C < A
>
: >
:
or K2 exists. From H2 n ðH1 ; I1 Þ and K2 n ðK1 ; I1 Þ, we þ þ A < 2 þ þ A < 2
know that I2 must exist. Since J; I2 ) H2 ; K2 , point J
must not exist. Since H1 n ðH2 Þ; K1n ðK2 Þ and I1 n ðI2 Þ, if In this case, CA consists of one spatial curve from
we assume that H1 exists, from H1 n ðJ; K1 ; H2 ; I2 Þ we K1 to I1 (H1 to I1 ).
know that the other two points are K2 and I1 . This Case 5. The intersections are K2 ; I2 (H2 ; I2 ) if
contradicts to K2 n ðK1 ; I1 Þ. Thus, H2 must exist. From 8 08 1
H2 n ðH1 ; I1 Þ, we know the other two points are K2 and < þA< < þA<
<B @ <B A:
I2 . The condition of this case should be : :
<C <C
EðH2 Þ \ EðK2 Þ \ EðI2 Þ
In this case, CA consists of one spatial curve from
\ EðJÞ \ EðH1 Þ \ EðK1 Þ \ EðI1 Þ: K2 to I2 (H2 to I2 ).
GAO ET AL.: COMPLETE SOLUTION CLASSIFICATION FOR THE PERSPECTIVE-THREE-POINT PROBLEM 941
6 CONCLUSION
In this paper, we give a complete and robust algorithm
CASSC to find the numerical solutions for the P3P problem.
Fig. 8. A unique solution exists. This algorithm is based on two sets of formulas obtained by
us. The first is a set of complete analytical solutions to the
. CA intersects plane ABC in one point. We need to P3P problem. The second is a set of formulas to determine
consider two subcases. the number of real positive solutions to the P3P problem.
We also give partial geometric criteria for the number of
Case 1. The intersection is H2 (K2 ) if solutions of the P3P problem. This kind of results, like
8 08 1 Theorem 9, involves linear inequalities only and, hence, is
<j ÿ j < A < þ <j ÿ j < A < þ simpler and more intuitive than the algebraic approach. To
<B @ B< A:
: : find a complete geometric classification for the P3P problem
C< <C is a still challenging problem. There might be two
In this case, CA consists of one spatial curve from difficulties in doing so. The complete results reported in
A to H2 (A to K2 ). Section 5.1 are based on geometric intuition coming from a
Case 2. The intersection is I1 if dynamic geometry software: Geometry Expert [23].
Using Geometry Expert, we can see clearly how AB di and
j ÿ j<A< þ ; B < ; C < ; and þ þA de change when changing the six free parameters
AB
< 2: continuously. But for the 3D case, there is still no adequate
software to get an intuitive idea of how CA looks like. Also,
In this case, CA consists of one spatial curve from it is doubtful that the complete classification of the
A to I1 . P3P problem can be expressed with linear inequalities only.
5.2 Determine CA \ SBC
Determining the intersection of CA and SBC is much more APPENDIX A
difficult than determining CA . We will discuss the reason in The triangular sets in the zero decomposition for the
Section 6. Here, we will report some partial results. P3P problem.
4
Lemma 7. The P3P problem has one or three solutions if CA 3 2
a0 x þa1 x þa2 x þa3 xþa4 ;
ðT S1 Þ
consists of one spatial curve and the two intersection points of b0 yÿb1 :
plane ABC and CA are not in the same side of SBC . 8
> 3 2
< a5 x þa6 x þa7 xþa8 ;
Proof. Since CA is a continuous spatial curve and the two b2 yÿb3 ; ðT S2 Þ
intersection points of plane ABC and CA are not in the >
: 2
a þðÿ2þ2bÿbr2 Þaÿ2bþb2 þ1:
same side of SBC , CA must intersect SBC for odd times. In 8 2 2
> ðr p ÿ4pqrþr2 q2 Þx2 þð4p2 qÿp2 r2 qÞxÿ4p2 þr2 p2 ;
addition, the maximum number of solutions is four, hence >
>
the problem has a unique solution or three solutions. t u < b4 yÿb5 ;
ðT S3 Þ
Lemma 8. If , ( ; ; ; ) are obtuse angles and > A >
> ðÿ4p2 þ4pqrþr2 p2 þr2 q2 ÿr3 pqÿ4q2 Þaþr2 p2 ÿ4pqrþ4q2 ;
>
:
( > B; > C), then the P3P problem can only have one or ðÿ4p2 þ4pqrþr2 p2 þr2 q2 ÿr3 pqÿ4q2 Þbþr2 q2 þ4p2 ÿ4pqr:
three solutions. 8 2 2 2 2
> ðp bþq bÿp Þx þðÿ4bqþp2 qÞxþ4bÿp2 ;
>
>
Proof. See Fig. 8. We have ffBI1 A ¼ > 2 , ffCI1 A ¼ > 2 . < pyþqxÿ2;
ðT S4 Þ
Point I1 is on the same side of BC with point A. >
>
> aþbÿ1;
According to the “reality condition,” we know that :
r:
þ þ < 2, which implies that point I1 is inside SBC . 8
Condition > A means that point A is in the outside of >
> qxÿ1;
>
>
SBC . Thus, the result follows from Lemma 7. u
t >
>
< pyÿ1;
ðp2 þq2 Þaÿq2 ; ðT S5 Þ
>
>
Theorem 9. Under the reality conditions (2), if , , and are >
> ðp2 þq2 Þbÿp2 ;
>
>
obtuse, then the P3P problem can only have one solution. :
r:
Furthermore if A < ; B < ; C < , then the P3P problem 8
has a unique solution. >
> qxÿ1;
>
>
>
>
Proof. From Lemma 8, we know that the problem will have < pyÿ1;
one or three solutions since , , and are obtuse and at ðp4 ÿ2p2 q2 þq4 Þaÿp2 q2 ÿq4 ; ðT S6 Þ
>
>
least one of A; B; C is acute. Since the three angles are all >
> ðp4 ÿ2p2 q2 þq4 Þbÿp2 q2 ÿp4 ;
>
>
obtuse, the three part-toroids and their intersection :
ðp2 þq2 Þrÿ4pq:
curves are concave. This implies that they can only have
942 IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 25, NO. 8, AUGUST 2003
8 2
> ðp qÿ2prÞxÿp2 þr2 ; b4 ¼ r2 p2 ðrq2 þp2 rÿ4pqÞðp2 ÿpqrþr2 þq2 ÿ4Þ;
>
>
< pyÿ1; b5 ¼ r2 qððrp2 þrq2 ÿr2 pqÞxþpr2 ÿ4pÞððrp2 þrq2 ÿ4pqÞxþq2 pÿqp2 rþp3 Þ;
ðT S7 Þ
>
> ð4r2 þp2 q2 þp4 ÿr4 ÿp3 qrþpr3 qÿ4qprÞb I1 ¼ a0 ;I2 ¼ b0 ;I3 ¼ a5 ;I4 ¼ b2 ;I5 ¼ r;I6 ¼ rpÿ4pqþrq2 ;I7 ¼ p;I8 ¼ ðp2 þq2 Þbÿp2 :
>
:
þ2pr3 qÿ2p2 r2 þ2p3 qrÿp2 q2 r2 ÿp4 ÿr4 : T1 ¼ I0 I1 I2 ;T2 ¼ I0 I2 I3 I4 ;T3 ¼ I0 I2 I4 I5 I6 I7 ;T4 ¼ I0 I2 I4 I6 I7 I8 ;
8
>
> ð2pr3 qÿ2p2 r2 þ4br2 þp2 q2 bþp4 bÿr4 bþ2p3 qrÿp2 q2 r2 ÿp4 ÿr4 ÿ T5 ¼ I0 I2 I4 I6 I7 ;T6 ¼ I0 I2 I4 I5 I7 ;T7 ¼ I0 I2 I3 ;T8 ¼ T7 ;T9 ¼ I0 I1 ;T10 ¼ I0 I1 ;T11 ¼ I0 I1 :
>
>
>
> 3 3 2 2 3 2 2 2 2 3 2 4 4
< p qrbþr pbqÿ4qbprÞx þðÿq r pbþ2pq brþ2p r qþp q r þr qþqr b
þp4 qÿ2bpr3 þ3qr2 bp2 ÿ4r2 bqþ8rpbÿ2rbp3 ÿ2p3 q2 rÿ4bp2 qÿ2r3 pq2 Þx ðT S8 Þ
>
> APPENDIX B
>
> ÿp2 q2 r2 þ2pr3 qþ2p3 qrÿp4 ÿr4 ÿ2p2 r2 ÿ4qbprþq2 br2 þ4bp2 ;
>
> The explicit formulas for the conditions in the theorems in
:
ðÿqprþp2 þr2 Þyþpqxÿ2rxÿ2pþqr: Section 3 can be found at http://www.mmrc.iss.ac.cn/
8
>
>
ðÿ1þaþbÞx2 þðÿqaþqÞxÿ1þaÿb; ~xgao/paper/appendix.ps.
>
< 2
ðÿ1þaþbÞy ÿ1ÿaþqxaþb;
ðT S9 Þ
>
> p; ACKNOWLEDGMENTS
>
:
r: The authors would like to thank the anonymous referees for
8
>
> ð2prÿp2 qÞxÿr2 þp2 ; their valuable suggestions that led to the addition of Section 4
>
>
>
> and other improvements. This work is supported in part by
< pyÿ1;
Chinese National Science Foundation under an outstanding
ðÿpqr3 þr4 þrp3 qÿ4r2 ÿp2 q2 þ4rpqÿp4 Þaþp2 q2 ÿ4rpqþ4r2 ; ðT S10 Þ
>
> youth grant (No. 69725002) and by a National Key Basic
>
> ðÿpqr3 þr4 þrp3 qÿ4r2 ÿp2 q2 þ4rpqÿp4 Þbþ
>
> Research Project of China (No. G1998030600).
:
p4 þr4 þ2r2 p2 þp2 r2 q2 ÿ2rp3 qÿ2pqr3 :
8
>
> rxÿp;
REFERENCES
>
>
>
> 2 2 3 4 2 3 2 2 3 4
< ðÿp r þr qpÿr Þy þðp r ÿp r qþr pÞy [1] M.A. Abidi and T. Chandra, “A New Efficient and Direct Solution
ðÿpqr3 þr4 þrp3 qÿ4r2 ÿp2 q2 þ4rpqÿp4 Þaþp2 q2 ÿ4rpqþ4r2 ; ðT S11 Þ for Pose Estimation Using Quadrangular Targets: Algorithm and
>
> Evaluation,” IEEE Trans. Pattern Analysis and Machine Intelligence,
>
> ðÿpqr3 þr4 þrp3 qÿ4r2 ÿp2 q2 þ4rpqÿp4 Þbþ vol. 17, no. 5, pp. 534-538, May 1995.
>
>
: [2] M.A. Fishler and R.C. Bolles, “Random Sample Consensus: A
p4 þr4 þ2r2 p2 þp2 r2 q2 ÿ2rp3 qÿ2pqr3 :
Paradigm for Model Fitting with Applications to Image Analysis
and Automated Cartomated Cartography,” Comm. ACM, vol. 24,
no. 6, pp. 381-395, 1981.
Here, [3] R. Horaud, B. Conio, and O. Leboulleux, “An Analytic Solution
for the Perspective 4-Point Problem,” Computer Vision, Graphics,
2 2 2
a0 ¼ ÿ2bþb þa þ1ÿbr aþ2baÿ2a and Image Processing, vol. 47, pp. 33-44, 1989.
a1 ¼ ÿ2bqaÿ2a2 qþbr2 qaÿ2qþ2bqþ4aqþpbrþbrpaÿb2 rp [4] L. Quan and Z. Lan, “Linear N-Point Camera Pose Determina-
tion,” IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 21,
a2 ¼ q2 þb2 r2 ÿbp2 ÿqpbrþb2 p2 ÿbr2 aþ2ÿ2b2 ÿabrpqþ2a2 ÿ4aÿ2q2 aþq2 a2 Þ no. 8, pp. 774-780, Aug. 1999.
[5] C. Su, Y. Xu, H. Li, and S. Liu, “Application of Wu’s Method in
a3 ¼ ÿb2 rpþbrpaÿ2a2 qþqp2 bþ2bqaþ4aqþpbrÿ2bqÿ2q
Computer Animation,” Proc. Fifth Int’l Conf. CAD/CG, vol. 1,
a4 ¼ 1ÿ2aþ2bþb2 ÿbp2 þa2 ÿ2ba; pp. 211-215, 1997.
[6] J.S.C. Yuan, “A General Photogrammetric Method for Determin-
a5 ¼ ðaprþ2qaÿrpbþ2bqÿ2qÿar2 qþpr; ing Object Position and Orientation,” IEEE Trans. Robotics and
a6 ¼ ðÿ2q2 þr2 ÿ4þr2 q2 ÿpqrÞaþbr2 ÿp2 ÿbq2 þbp2 þ2q2 þ4ÿpqrÿ4b; Automation, vol. 5, no. 2, pp. 129-142, 1989.
[7] W.J. Wolfe, D. Mathis, C. Weber, and M. Magee, “The Perspective
a7 ¼ ð6qþprÿ2r2 qÞaþprÿ6qÿrpbþ2bqþqp2 ; View of Three Points,” IEEE Trans. Pattern Analysis and Machine
a8 ¼ 4ÿ4aÿp2 þar2 ;
Intelligence, vol. 13, no. 1, pp. 66-73, Jan. 1991.
[8] Y. Hung, P. Yeh, and D. Harwood, “Passive Ranging to Known
b0 ¼ bðp2 aÿp2 þbp2 þpqrÿqarpþar2 ÿr2 ÿbr2 Þ2 ; Planar Points Sets,” Proc. IEEE Int’l Conf. Robotics and Automation,
vol. 1, pp. 80-85, 1985.
b1 ¼ ðð1ÿaÿbÞx2 þðqaÿqÞxþ1ÿaþbÞðða2 r3 þ2br3 aÿbr5 aÿ2ar3 þr3 þb2 r3 ÿ2r3 bÞx3 þ
[9] R.M. Haralick, C. Lee, K. Ottenberg, and M. Nolle, “Analysis and
ðpr2 þpa2 r2 ÿ2br3 qaþ2r3 bqÿ2r3 qÿ2par2 ÿ2pr2 bþr4 pbþ4ar3 qþbqar5 ÿ2r3 a2 q Solutions of The Three Point Perspective Pose Estimation
Problem,” Proc. Int’l Conf. Computer Vision and Pattern Recognition,
þ2r2 pbaþb2 r2 pÿr4 pb2 Þx2 þðr3 q2 þr5 b2 þrp2 b2 ÿ4ar3 ÿ2ar3 q2 þr3 q2 a2 þ pp. 592-598, 1991.
2a2 r3 ÿ2b2 r3 ÿ2p2 brþ4par2 qþ2ap2 rbÿ2ar2 qbpÿ2p2 arþrp2 ÿbr5 aþ2pr2 bqþ [10] D. DeMenthon and L.S. Davis, “Exact and Approximate Solutions
of the Perspective-Three-Point Problem,” IEEE Trans. Pattern
rp2 a2 ÿ2pqr2 þ2r3 ÿ2r2 pa2 qÿr4 qbpÞxþ4ar3 qþpr2 q2 þ2p3 baÿ4par2 þ Analysis and Machine Intelligence, vol. 14, no. 11, pp. 1100-1105,
Nov. 1992.
ÿ2r3 bqÿ2p2 qrÿ2b2 r2 pþr4 pbþ2pa2 r2 ÿ2r3 a2 qÿ2p3 aþp3 a2 þ2pr2 þp3 þ2br3 qa
[11] D.F. DeMenthon and L.S. Davis, “Model-Based Object Pose in 25
þ2qp2 brþ4qarp2 ÿ2par2 q2 ÿ2p2 a2 rqþpa2 r2 q2 ÿ2r3 qÿ2p3 bþp3 b2 ÿ2p2 brqaÞ; Lines of Code,” Int’l J. Computer Vision, vol. 15, pp. 123-141, 1995.
[12] W.J. Wolfe and K. Jones, “Camera Calibration Using the
b2 ¼ bðÿ4ar3 þ4r3 þar5 ÿ2p3 qþ4rp2 ÿ6pqr2 ÿ4rp2 bÿ4p2 arþ6par2 qþ Perspective View of a Triangle,” Proc. SPIE Conf. Automation
2p2 rq2 þ2p2 ar3 þ2p3 bqþ2p3 qaþp4 arþp2 ar3 q2 ÿ2p2 rq2 aÿp2 rbq2 ÿ Inspection Measurement, vol. 730, pp. 47-50, 1986.
[13] C. Su, C.Y. Xu, H. Li, and S. Liu, “Necessary and Sufficient
2p3 ar2 qÿ2par4 qþ2pr2 bqÞ; Condition of Positive Root Number of P3P Problem,” Chinese J.
b3 ¼ ððÿ1þaþbÞx2 þðÿqaþqÞxÿ1þaÿbÞððÿpar3 þar4 qÿ2ar2 qÿ2r2 bqþ2r2 qÿpr3 þ
Computer Sciences, vol. 21, pp. 1084-1095, 1998 (in Chinese).
[14] L. Yang, “A Simplified Algorithm for Solution Classification of the
r3 bpÞx2 þðÿr2 p2 aþ2r3 paqþ4ar2 ÿr4 q2 aÿar4 ÿ2qarpþ2ar2 q2 ÿr4 bþr2 bq2 þr3 pq Perspective-three-point Problem,” MM-Preprints, MMRC, Acade-
mia Sinica, no. 17, pp. 135-145, 1998.
þ2pqrþ4r2 bÿ2qpbrÿ2r2 q2 ÿ4r2 Þxÿp3 arþ2ar4 qÿpar3 q2 þ2p2 ar2 qÿ2par3 þ2prq2 a
[15] W.T. Wu, Basic Principles of Mechanical Theorem Proving in
ÿ2p2 aqÿ6ar2 qþ4aprÿpr3 þ4pbrþprbq2 ÿ2r2 bqÿ2prq2 þ2qp2 ÿ2bqp2 ÿ4prþ6r2 qÞ; Geometries, vol. I: Part of Elementary Geometries, Beijing: Science
Press, (in Chinese), 1984, English version, Berlin: Springer, 1995.
GAO ET AL.: COMPLETE SOLUTION CLASSIFICATION FOR THE PERSPECTIVE-THREE-POINT PROBLEM 943
[16] B. Mishra, Algorithmic Algebra, pp. 297-381, Berlin: Springer, 1993. Xiao-Shan Gao received the PhD degree from
[17] D. Wang, “An Implementation of the Characteristic Set Method in the Chinese Academy of Sciences in 1988. He is
Maple,” Automated Practical Reasoning: Algebraic Approaches, a professor in the Institute of Systems Science,
J. Pfalzgraf and D. Wang, eds., pp. 187-201, New York: Springer, Academia Sinica. He has published more than 70
Wien, 1995. research papers and two monographs. His
[18] C.K. Yap, “Robust Geometric Computation,” Handbook of Discrete research interests include: automated reasoning,
and Computational Geometry, J.E. Goodman and J. O’Rourke, eds., symbolic computation, and intelligent CAD and
pp. 653-668, CRC Press, 1997. CAI (computer aided instruction). Web page:
[19] J. Bochnak, M. Coste, and M.F. Roy, Real Algebraic Geometry. http://www.mmrc.iss.ac.cn/~xgao. His a member
Berlin: Springer, 1998. of the IEEE and the IEEE Computer Society.
[20] D.S. Arnon, “Geometric Reasoning with Logic and Algebra,”
Artificial Intelligence, vol. 37, pp. 37-60, 1988.
[21] A.M. Cohen, H. Cuypers, and H. Sterk, Some Tapas of Computer Xiao-Rong Hou received the MS degree in
Algebra, pp. 121-167, Berlin: Springer, 1999. mathematics from the Chengdu Institute of
[22] L. Yang, J.Z. Zhang, and X.R. Hou, Non-Linear Equation System and Computer Applications, Academia Sinica. He is
Automated Theorem Proving, pp. 137-176, Shanghai: Shanghai Press now a professor of mathematics and computer
of Science, Technology, and Education, 1996. science at the University of Science and Tech-
[23] X.S. Gao, J.Z. Zhang, and S.C. Chou, Geometry Expert, Taipai, nology of China and at Ningbo University of
Taiwan: Nine Chapter Pub., 1998 (in Chinese). China. His research interests include symbolic
computation, real algebraic geometry, automated
reasoning, and intelligent software technology.