DESCRIPTION:Match vectors of (x, y) positions.
The VECTOR inputs are made with shVectorNew - they are the expected and measured (x, y) values. xdist and ydist describe the maximum distance two matching objects are separated by, in whatever units the VECTORs use. nfit can be 4 or 6. 4 gives solid body rotation and 6 gives the full linear fit. The 6 parameters returned when nfit=4 are degenerate The returned TRANS struct contains the size constants in a linear transformation from the measured coordinate to the expected coordinates. The higher-order distortion and color terms are set to 0.
The algorithm works by making an array (roughmatches) which says which objects match within xdist and ydist. All sets of three possible matched objects (based on the rough matches) are tried. The match that matches the most objects within CUT1SIGMA*error (in each direction) is chosen as the winner. So, IT IS IMPORTANT THAT THE VECTORS PASSED INTO THIS ROUTINE HAVE NON-ZERO ERROR. The new TRANS struct is the best fit to this larger set of matched points.
Finally, outlying points are rejected one at a time to improve the fit. The worst fitting point is found. If it is more than CUT2SIGMA away in either direction, it is eliminated and a new TRANS is calculated. This process is repeated until there are only three points left, or until the worst fit points are withing CUT2SIGMA of each other.
RETURN VALUES:Returns the number of objects matched. A negative number returned is an error flag:
SIGNATURE: int atVCloseMatch( VECTOR *vxe, /* VECTOR of expected x values */ VECTOR *vye, /* VECTOR of expected y values */ VECTOR *vxm, /* VECTOR of measured x values */ VECTOR *vym, /* VECTOR of measured y values */ VECTOR *vxeErr, /* VECTOR of expected x values */ VECTOR *vyeErr, /* VECTOR of expected y values */ VECTOR *vxmErr, /* VECTOR of measured x values */ VECTOR *vymErr, /* VECTOR of measured y values */ double xdist, /* x distance within which the two sets of points must match to be considered possible matches */ double ydist, /* y distance within which the two sets of points must match to be considered possible matches */ int nfit, /* number of parameters in fit - must be 4 or 6. 4 is a solid body fit, and 6 includes squash and shear */ TRANS *trans /* Returned TRANS struct */ )
DESCRIPTION:Matches two sets of objects. The matching is done by looking for similar differences in length, so it is dependent on scale but not on offset of the objects.
RETURN VALUES:Returns the linear transformation to be applied to the measured positions to produce the expected positions. The higher-order distortion and color terms are set to 0. A value less than 2 is an error.
SIGNATURE: int atVDiMatch(VECTOR *vxe, /* VECTOR of expected x values */ VECTOR *vye, /* VECTOR of expected y values */ int ne, /* use first ne expected points - if set to 0 use all points */ VECTOR *vxm, /* VECTOR of measured x values */ VECTOR *vym, /* VECTOR of measured y values */ int nm, /* use first nm measured points - if set to 0 use all points */ double xSearch, /* x distance within which the two sets of points must match to be considered possible matches */ double ySearch, /* y distance within which the two sets of points must match to be considered possible matches */ double delta, /* width of each bin for voting */ int nfit, /* number of parameters in fit - must be 4 or 6. 4 is a solid body fit, and 6 includes squash and shear */ TRANS *trans /* Returned TRANS struct */ )
DESCRIPTION:Matches two sets of objects. The matching is done by looking for similar differences in length, so it is dependent on scale but not on offset of the objects. Use the magnitude as a third dimension.
RETURN VALUES:Returns the linear transformation to be applied to the measured positions to produce the expected positions. The higher-order distortion and color terms are set to 0. A value less than 2 is an error.
SIGNATURE: RET_CODE atVDiMatch2( VECTOR *vxe, /* VECTOR of expected x values */ VECTOR *vye, /* VECTOR of expected y values */ VECTOR *vme, /* VECTOR of expected magnitudes */ int ne, /* use first ne expected points - if set to 0 use all points */ VECTOR *vxm, /* VECTOR of measured x values */ VECTOR *vym, /* VECTOR of measured y values */ VECTOR *vmm, /* VECTOR of measured magnitudes */ int nm, /* use first nm measured points - if set to 0 use all points */ double xSearch, /* x distance within which the two sets of points must match to be considered possible matches */ double ySearch, /* y distance within which the two sets of points must match to be considered possible matches */ double delta, /* width of each bin for voting */ double magSearch, double deltaMag, double zeroPointIn, int nfit, /* number of parameters in fit - must be 4 or 6. 4 is a solid body fit, and 6 includes squash and shear */ TRANS *trans, /* Returned TRANS struct */ VECTOR *vmatche, /* filled in with matches used for fit if it is not NULL */ VECTOR *vmatchm, /* filled in with matches used for fit if it is not NULL */ double *zeroPointOut, int *nMatch )