Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV compile Eigenface.cpp in Linux with using CodeBlocks

I want to compile the following OpenCV programm with CodeBlocks or with Linux Terminal.

http://plaza.ufl.edu/tyler727/imdl/src/eigenface.cpp

line 57:   nTrainFaces = loadFaceImgArray("/home/hacker/data/Eigenfacecpp/train.txt");

line 192: // load test images and ground truth for person number
         nTestFaces = loadFaceImgArray("/home/hacker/data/Eigenfacecpp/test.txt");

// project the training images onto the PCA subspace
projectedTrainFaceMat = cvCreateMat(nTrainFaces, nEigens,

CV_32FC1); for(i=0; i<ntrainfaces; i++)="" {="" cveigendecomposite(faceimgarr[i],="" neigens,="" eigenvectarr,="" 0,="" 0,="" pavgtrainimg,="" line="" 78:="" <br=""> projectedTrainFaceMat->data.fl + i*nEigens); }

 cvCalcEigenObjects(nTrainFaces,
                    (void*)faceImgArr,
                    (void*)eigenVectArr,
                    CV_EIGOBJ_NO_CALLBACK,
                    0,
                    0,
                    &calcLimit,
                    pAvgTrainImg, line 154:

eigenValMat->data.fl);

    //project the test image onto the PCA subspace
    cvEigenDecomposite(faceImgArr[i],
                       nEigens,
                       eigenVectArr,
                       0, 0,
                       pAvgTrainImg, line 211:

projectedTestFace);

And i got those errors:

Compiling: eigenface.cpp

In Function »void learn()«: line 57: deprecated conversion from string constant to ‘char*’ [Wwrite-strings]

In Function »double recognize()«: line 192: deprecated conversion from string constant to ‘char*’ [Wwrite-strings]

/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function _start': (.text+0x18): undefined reference tomain' obj/Debug/eigenface.o: In function learn()': /home/hacker/data/Eigenfacecpp/eigenface.cpp:78: undefined reference tocvEigenDecomposite'

obj/Debug/eigenface.o: In function doPCA()': /home/hacker/data/Eigenfacecpp/eigenface.cpp:154: undefined reference tocvCalcEigenObjects'

obj/Debug/eigenface.o: In function recognize()': /home/hacker/data/Eigenfacecpp/eigenface.cpp:211: undefined reference tocvEigenDecomposite' I don't understand what I did wrong. I think it's something stupid but I can't find it.

Compiler and Debugger Settings from CodeBlocks:

Linker Settings->Other Options: -lopencv_core -lopencv_objdetect -lopencv_imgproc -lopencv_highgui

Search Directories->Compiler: /usr/local/include/opencv Search Directories->Linker: /usr/lib

What have I done wrong here? Please help me with this problem.

OpenCV compile Eigenface.cpp in Linux with using CodeBlocks

I want to compile the following OpenCV programm with CodeBlocks or with Linux Terminal.

http://plaza.ufl.edu/tyler727/imdl/src/eigenface.cpp

line 57:   nTrainFaces = loadFaceImgArray("/home/hacker/data/Eigenfacecpp/train.txt");

line 192: // load test images and ground truth for person number
         nTestFaces = loadFaceImgArray("/home/hacker/data/Eigenfacecpp/test.txt");

// project the training images onto the PCA subspace
projectedTrainFaceMat = cvCreateMat(nTrainFaces, nEigens, > CV_32FC1);

for(i=0; i<nTrainFaces; i++)
{
    cvEigenDecomposite(faceImgArr[i],
                       nEigens,
                       eigenVectArr,
                       0, 0,
                       pAvgTrainImg,

CV_32FC1); for(i=0; i<ntrainfaces; i++)="" {="" cveigendecomposite(faceimgarr[i],="" neigens,="" eigenvectarr,="" 0,="" 0,="" pavgtrainimg,="" line="" 78:="" <br=""> line 78: projectedTrainFaceMat->data.fl + + i*nEigens); }

 cvCalcEigenObjects(nTrainFaces,
                    (void*)faceImgArr,
                    (void*)eigenVectArr,
                    CV_EIGOBJ_NO_CALLBACK,
                    0,
                    0,
                    &calcLimit,
                    pAvgTrainImg, line 154:
pAvgTrainImg,

line 154: eigenValMat->data.fl);

    //project the test image onto the PCA subspace
    cvEigenDecomposite(faceImgArr[i],
                       nEigens,
                       eigenVectArr,
                       0, 0,
                       pAvgTrainImg, line 211:
211:               
                       projectedTestFace);

projectedTestFace);

And i got those errors:

Compiling: eigenface.cpp

In Function »void learn()«: line 57: deprecated conversion from string constant to ‘char*’ [Wwrite-strings]

In Function »double recognize()«: line 192: deprecated conversion from string constant to ‘char*’ [Wwrite-strings]

/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function _start': (.text+0x18): undefined reference tomain' obj/Debug/eigenface.o: In function learn()': /home/hacker/data/Eigenfacecpp/eigenface.cpp:78: undefined reference tocvEigenDecomposite'

obj/Debug/eigenface.o: In function doPCA()': /home/hacker/data/Eigenfacecpp/eigenface.cpp:154: undefined reference tocvCalcEigenObjects'

obj/Debug/eigenface.o: In function recognize()': /home/hacker/data/Eigenfacecpp/eigenface.cpp:211: undefined reference tocvEigenDecomposite' I don't understand what I did wrong. I think it's something stupid but I can't find it.

Compiler and Debugger Settings from CodeBlocks:

Linker Settings->Other Options: -lopencv_core -lopencv_objdetect -lopencv_imgproc -lopencv_highgui

Search Directories->Compiler: /usr/local/include/opencv Search Directories->Linker: /usr/lib

What have I done wrong here? Please help me with this problem.