/* type of matching feature when computing 2D homography */
typedef enum { GAN_HOMOG33_POINT, /* Match scene point to image point */
GAN_HOMOG33_LINE, /* Match scene line to image line */
GAN_HOMOG33_LINE_ENDPOINTS, /* Match scene line endpoints to
image line */
GAN_HOMOG33_IGNORE } /* rejected match */
Gan_Homog33MatchType;
where GAN_HOMOG33_IGNORE denotes a match that has been rejected.
The match structure contains the details of the match:
/* structure to hold details of scene and image data to be used in
* computing 2D homographies
*/
typedef struct
{
Gan_Homog33MatchType type;
union
{
struct { Gan_Vector3 X, x; } p; /* point --> point match */
struct { Gan_Vector3 L, l; } l; /* line --> line match */
struct { Gan_Vector3 X1, X2, l; } le; /* line endpoints --> line match */
} d;
} Gan_Homog33Match;
Given an array of the Gan_Homog33Match structures, you can compute
the homography from scene to image by calling
Gan_Homog33Match *aMatch;
unsigned uiNoMatches;
Gan_Matrix33 m33P;
/* ... create and fill array of matches, set uiNoMatches to the number
of structures in the array ... */
/* fit projective 2D homography */
gan_homog33_fit ( aMatch, uiNoMatches, &m33P );
Error detection: gan_homog33_fit() returns a boolean value; hence GAN_FALSE is returned on error and the Gandalf error handler is invoked.