Статья: Реализация метода главных компонент с помощью библиотеки OpenCV

if (!cvCalcEigenObjects) return;

void (__stdcall *cvEigenDecomposite)( IplImage* obj, int nEigObjs, void* eigInput, int ioFlags, void* userData, IplImage* avg, float* coeffs );

cvEigenDecomposite = (void(__stdcall *)( IplImage* obj, int nEigObjs, void* eigInput, int ioFlags, void* userData, IplImage* avg, float* coeffs ))GetProcAddress(hDLL, "cvEigenDecomposite");

if (!cvEigenDecomposite) return;

void (__stdcall *cvEigenProjection)( void* eigInput, int nEigObjs, int ioFlags, void* userData, float* coeffs, IplImage* avg, IplImage* proj );

cvEigenProjection = (void(__stdcall *)( void* eigInput, int nEigObjs, int ioFlags, void* userData, float* coeffs, IplImage* avg, IplImage* proj ))GetProcAddress(hDLL, "cvEigenProjection");

if (!cvEigenProjection) return;

EigObjs=new IplImage*[m1];

coeffs=new float[m1];

size.width = Object->width; size.height = Object->height;

Avg = cvCreateImage_( size, IPL_DEPTH_32F, 1 );

for(int i=0; i<m1; i++ )

{

EigObjs[i] = cvCreateImage_( size, IPL_DEPTH_32F, 1 );

}

cvCalcEigenObjects( obj_number, (void*)Objs, (void*)EigObjs, 0, 0, NULL, &limit, Avg, NULL );

cvEigenDecomposite( Object, m1, (void*)EigObjs, 0, NULL, Avg, coeffs );

cvEigenProjection ( (void*)EigObjs, m1, 0, NULL, coeffs, Avg, Pro );

FreeLibrary(hDLL);

// cvReleaseImage( &Avg );

// for(int i=0; i<m1; i++ )

// {

// cvReleaseImage( &EigObjs[i] );

// }

// cvFree( &coeffs);

}

void __fastcall TForm1::FormCreate(TObject *Sender)

{

highgui = LoadLibrary("highgui100.dll");

К-во Просмотров: 332
Бесплатно скачать Статья: Реализация метода главных компонент с помощью библиотеки OpenCV