Getting error while compiling sampleDetectLandmarks.cpp [closed]

asked 2019-09-09 02:17:46 -0600

Rakesh_V gravatar image

updated 2019-12-09 07:48:20 -0600

ojesus gravatar image

I was trying to compiling sampleDetectLandmarks.cpp but I'm getting this error please help me resolving this error

sampleDetectLandmarks.cpp: In function ‘int main(int, char**)’:
sampleDetectLandmarks.cpp:69:5: error: ‘FacemarkKazemi’ has not been declared
     FacemarkKazemi::Params params;
     ^~~~~~~~~~~~~~
sampleDetectLandmarks.cpp:70:9: error: ‘FacemarkKazemi’ was not declared in this scope
     Ptr<FacemarkKazemi> facemark = FacemarkKazemi::create(params);
         ^~~~~~~~~~~~~~
sampleDetectLandmarks.cpp:70:23: error: template argument 1 is invalid
     Ptr<FacemarkKazemi> facemark = FacemarkKazemi::create(params);
                       ^
sampleDetectLandmarks.cpp:70:36: error: ‘FacemarkKazemi’ is not a class, namespace, or enumeration
     Ptr<FacemarkKazemi> facemark = FacemarkKazemi::create(params);
                                    ^~~~~~~~~~~~~~
sampleDetectLandmarks.cpp:70:59: error: ‘params’ was not declared in this scope
     Ptr<FacemarkKazemi> facemark = FacemarkKazemi::create(params);
                                                           ^~~~~~
sampleDetectLandmarks.cpp:70:59: note: suggested alternative: ‘parser’
     Ptr<FacemarkKazemi> facemark = FacemarkKazemi::create(params);
                                                           ^~~~~~
                                                           parser
sampleDetectLandmarks.cpp:71:13: error: base operand of ‘->’ is not a pointer
     facemark->setFaceDetector((FN_FaceDetector)myDetector, &face_cascade);
             ^~
sampleDetectLandmarks.cpp:71:32: error: ‘FN_FaceDetector’ was not declared in this scope
     facemark->setFaceDetector((FN_FaceDetector)myDetector, &face_cascade);
                                ^~~~~~~~~~~~~~~
sampleDetectLandmarks.cpp:71:32: note: suggested alternative: ‘myDetector’
     facemark->setFaceDetector((FN_FaceDetector)myDetector, &face_cascade);
                                ^~~~~~~~~~~~~~~
                                myDetector
sampleDetectLandmarks.cpp:72:13: error: base operand of ‘->’ is not a pointer
     facemark->loadModel(filename);
             ^~
sampleDetectLandmarks.cpp:75:41: error: ‘INTER_LINEAR_EXACT’ was not declared in this scope
     resize(img,img,Size(460,460), 0, 0, INTER_LINEAR_EXACT);
                                         ^~~~~~~~~~~~~~~~~~
sampleDetectLandmarks.cpp:75:41: note: suggested alternative: ‘CV_INTER_LINEAR’
     resize(img,img,Size(460,460), 0, 0, INTER_LINEAR_EXACT);
                                         ^~~~~~~~~~~~~~~~~~
                                         CV_INTER_LINEAR
sampleDetectLandmarks.cpp:76:13: error: base operand of ‘->’ is not a pointer
     facemark->getFaces(img,faces);
             ^~
sampleDetectLandmarks.cpp:82:20: error: base operand of ‘->’ is not a pointer
         if(facemark->fit(img,faces,shapes))
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-23 05:18:13.426170

Comments

Have you compiled opencv_contrib using cmake?

LBerger gravatar imageLBerger ( 2019-09-09 02:45:13 -0600 )edit

yes, this is the cmake i have done.

cmake -D BUILD_TIFF=ON
-D WITH_CUDA=OFF
-D ENABLE_AVX=OFF
-D WITH_OPENGL=OFF 
-D WITH_OPENCL=OFF 
-D WITH_IPP=OFF 
-D WITH_TBB=ON 
-D BUILD_TBB=ON 
-D WITH_EIGEN=OFF 
-D WITH_V4L=OFF 
-D WITH_VTK=OFF 
-D BUILD_TESTS=OFF 
-D BUILD_PERF_TESTS=OFF 
-D CMAKE_BUILD_TYPE=RELEASE 
-D CMAKE_INSTALL_PREFIX=/usr/local
 -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules /opt/opencv/
Rakesh_V gravatar imageRakesh_V ( 2019-09-09 02:49:38 -0600 )edit

There is no problem with this sample (in windows or raspberry). Can you explain how do you get those error messages? Are you sure that you haven't got an old version of opencv?

You can check this with cout<<getbuildinformation()&lt;<endl;< p="">

LBerger gravatar imageLBerger ( 2019-09-09 03:37:37 -0600 )edit

my current OpenCV version is 3.2.0, while compiling the sample face landmarks as mentioned in this link I got that error message.

Rakesh_V gravatar imageRakesh_V ( 2019-09-09 04:41:31 -0600 )edit

You cannot use this sample with opencv3.2 :

contrib modules are under constant development and it is recommended to use them alongside the master branch or latest releases of OpenCV

1 update (git ull) opencv repo

2 update (git ull) opencv_contrib repo

3 rebuild everything using camke

LBerger gravatar imageLBerger ( 2019-09-09 05:04:17 -0600 )edit