Ask Your Question

Revision history [back]

How do I resolved ‘samples’ has not been declared

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 );

click to hide/show revision 2
None

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

berak gravatar image

How do I resolved ‘samples’ has not been declared

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 `pkg-config --cflags --libs opencv 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 );

);