How do I resolved ‘samples’ has not been declared

asked 2019-06-02 11:11:34 -0600

ggo1 gravatar image

updated 2019-06-02 12:53:49 -0600

berak gravatar image

Hi, I tried to compile the facedetect.cpp file having entered the path to /opencv/samples/cpp as shown below, I received error: ‘samples’ has not been declared

 ~/opencv/samples/cpp$ g++ -ggdb facedetect.cpp -o facedetect `pkg-config --cflags --libs opencv`
facedetect.cpp: In function ‘int main(int, const char**)’:
facedetect.cpp:65:29: error: ‘samples’ has not been declared
     if (!nestedCascade.load(samples::findFileOrKeep(nestedCascadeName)))
                             ^
facedetect.cpp:67:23: error: ‘samples’ has not been declared
     if (!cascade.load(samples::findFile(cascadeName)))
                       ^
facedetect.cpp:84:24: error: ‘samples’ has not been declared
         image = imread(samples::findFileOrKeep(inputName), IMREAD_COLOR);
                        ^
facedetect.cpp:87:31: error: ‘samples’ has not been declared
             if (!capture.open(samples::findFileOrKeep(inputName)))
                               ^
facedetect.cpp:96:24: error: ‘samples’ has not been declared
         image = imread(samples::findFile("lena.jpg"), IMREAD_COLOR);
                        ^
facedetect.cpp: In function ‘void detectAndDraw(cv::Mat&, cv::CascadeClassifier&, cv::CascadeClassifier&, double, bool)’:
facedetect.cpp:187:45: error: ‘INTER_LINEAR_EXACT’ was not declared in this scope
     resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR_EXACT );
edit retag flag offensive close merge delete

Comments

which opencv version are you using ?

it looks, like you try to run opencv4.1.0 code with some older opencv version..

berak gravatar imageberak ( 2019-06-03 00:02:05 -0600 )edit

I have the same problem and I would appreciate if anyone could help.

Jean gravatar imageJean ( 2019-06-15 14:02:26 -0600 )edit