00001 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef _GAN_HOMOG33_FIT_H
00030 #define _GAN_HOMOG33_FIT_H
00031 
00032 #include <gandalf/linalg/3vector.h>
00033 #include <gandalf/linalg/3x3matrix.h>
00034 #include <gandalf/linalg/mat_square.h>
00035 #include <gandalf/linalg/symmat_eigen.h>
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00054 typedef enum
00055 {
00056    GAN_HOMOG33_POINT, 
00057    GAN_HOMOG33_LINE, 
00058    GAN_HOMOG33_LINE_ENDPOINTS, 
00059    GAN_HOMOG33_IGNORE 
00060 }
00061 Gan_Homog33MatchType;
00062 
00067 typedef struct
00068 {
00069    Gan_Homog33MatchType type;
00070    union
00071    {
00072       struct { Gan_Vector3 X, x; } p; 
00073       struct { Gan_Vector3 L, l; } l; 
00074       struct { Gan_Vector3 X1, X2, l; } le; 
00076    } d;
00077 } Gan_Homog33Match;
00078 
00087  Gan_SymMatEigenStruct *gan_homog33_init ( Gan_SymMatEigenStruct *sme );
00088 
00098  void gan_homog33_free ( Gan_SymMatEigenStruct *sme );
00099 
00100  Gan_Bool gan_homog33_increment_p ( Gan_SymMatEigenStruct *sme,
00101                                    Gan_Vector3 *X, Gan_Vector3 *x,
00102                                    double scale, int *eq_count );
00103  Gan_Bool gan_homog33_increment_l ( Gan_SymMatEigenStruct *sme,
00104                                    Gan_Vector3 *L, Gan_Vector3 *l,
00105                                    double scale,
00106                                    int *eq_count );
00107  Gan_Bool gan_homog33_increment_le ( Gan_SymMatEigenStruct *sme,
00108                                     Gan_Vector3 *X, Gan_Vector3 *l,
00109                                     double scale, int *eq_count );
00110  Gan_Bool gan_homog33_solve ( Gan_SymMatEigenStruct *sme, int eq_count,
00111                              Gan_Matrix33 *P );
00112  Gan_Bool gan_homog33_fit ( Gan_Homog33Match *match, unsigned nmatches,
00113                            Gan_Matrix33 *H );
00114  Gan_Bool gan_homog33_fit_points ( const Gan_Vector3 *x, const Gan_Vector3 *X,
00115                                   unsigned int n, Gan_Matrix33 *H );
00116 
00126  Gan_Bool gan_homog33_reset ( Gan_SymMatEigenStruct *sme );
00127 
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139 
00140 #endif