/* Principal Component Analysis Module for the IUPGLCAP application. */
/* Author: Marcos de Carvalho Machado (mmachado@tecgraf.puc-rio.br)  */
/* Date: 25/09/2004 */

#ifndef PCA_H
#define PCA_H

/* Function: it obtains the 2 eigenvalues and respectives eigenvectors of the image structure
             matrix around the point (x,y). 
			 The parameter "n" is the size of the neighbourhood; it must be odd. 
			 Internally allocated memory can be reused in subsequent calls. */
extern int GetEigPCA(imImage* image, int x, int y, int n, double * eig1, double * eigv1_x, 
					 double * eigv1_y, double * eig2, double * eigv2_x, double * eigv2_y);


/* Function: it frees the allocated memory used by GetEigPCA. */
extern void FreePCA();


/* Function: it obtains the best candidate to be a corner in a circular neighbourhood of 
             radius r around the point (x,y) of the image. It calls GetEigPCA.
			 The parameter "n" is the size of the neighbourhood for GetPCA; it must be odd 
			 It fails if the ratio beetween the lesser over the greather eigenvalue is less
			 than threshold parameter (0 <= threshold <= 1). */
extern int GetCornerPCA(imImage* image, int x, int y, int n, int r, double threshold, 
				 int* xc, int* yc);

#endif

