Статья: Реализация метода главных компонент с помощью библиотеки OpenCV
void (__stdcall *cvShowImage)( const char* name, const CvArr* image );
IplImage* (__stdcall *cvCreateImage_)( CvSize size, int depth, int channels );
double (__stdcall *cvDotProduct_)(const CvArr* src1, const CvArr* src2 );
void (__stdcall *cvMul_)(const CvArr* src1, const CvArr* src2, CvArr* dst, double scale=1 );
void (__stdcall *cvThreshold_)(const CvArr* src, CvArr* dst, double threshold,double max_value, int threshold_type);
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void show_im(TCanvas*c,IplImage *p)
{
for(int i=0;i<p->width;i++)
for(int j=0;j<p->height;j++)
{
int a=p->imageDataOrigin[p->widthStep*j+i];
c->Pixels[i][j]=a&0x0000ff|(a<<8)&0x00ff00|(a<<16)&0xff0000;
}
}
void pca(int obj_number, IplImage **Objs,CvTermCriteria limit, IplImage *Object,IplImage *Pro)
{
CvSize size;
int m1=obj_number;
IplImage **EigObjs, *Avg;
float *coeffs;
HINSTANCE hDLL = LoadLibrary("cvaux100.dll");
if (!hDLL) return;
void (__stdcall *cvCalcEigenObjects)( int nObjects, void* input, void* output, int ioFlags, int ioBufSize, void* userData, CvTermCriteria* calcLimit, IplImage* avg, float* eigVals );