Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unable to compile program due to dependencies

Command used to compile the code:-

g++ `fltk-config --cxxflags` disguise_gui_1306.cpp `fltk-config --ldflags --use-images` `pkg-config opencv --cflags --libs` -o disgui

disguise_gui_1306.cpp:102:9: error: ‘FaceRecognizer’ was not declared in this scope cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp:102:23: error: template argument 1 is invalid cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp:102:30: error: invalid type in declaration before ‘,’ token cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp: In function ‘void snapshotCB(Fl_Widget, void)’:

disguise_gui_1306.cpp:233:40: error: base operand of ‘->’ is not a pointer int predictedMouthLabel = mouthModel->predict(testSample); ^

disguise_gui_1306.cpp:243:31: error: base operand of ‘->’ is not a pointer int predictedLabel = model->predict(testSample); ^

disguise_gui_1306.cpp:261:29: error: base operand of ‘->’ is not a pointer int predictedLabel = model->predict(testSample); ^

disguise_gui_1306.cpp: In function ‘void trainFaceRecogniserModel(std::vector<cv::mat>, std::vector<int>)’: disguise_gui_1306.cpp:395:39: error: ‘createEigenFaceRecognizer’ was not declared in this scope model = createEigenFaceRecognizer();
^

disguise_gui_1306.cpp:396:10: error: base operand of ‘->’ is not a pointer model->train(img, lab); ^

disguise_gui_1306.cpp: In function ‘int main(int, char**)’:

disguise_gui_1306.cpp:417:39: error: ‘createEigenFaceRecognizer’ was not declared in this scope model = createEigenFaceRecognizer();
^

disguise_gui_1306.cpp:418:10: error: base operand of ‘->’ is not a pointer model->train(images, labels); ^

disguise_gui_1306.cpp:433:15: error: base operand of ‘->’ is not a pointer mouthModel->train(mouthimages, mouthlabels);

I have tried using:-

cv::Ptr<face::facerecognizer> model, mouthModel;

error: ‘face’ cannot appear in a constant-expression cv::Ptr<face::facerecognizer> model, mouthModel;

The same code compiles perfectly on my friends laptop,and the only difference i am able to understand is he have installed opencv in usr/local while i have the same in downloads folder.

Kindly help,because i have been stuck around this from couple of days. I have even installed extra folders from https://github.com/itseez/opencv_contrib, but no difference.

Unable to compile program due to dependencies

Command used to compile the code:-

g++ `fltk-config --cxxflags` disguise_gui_1306.cpp `fltk-config --ldflags --use-images` `pkg-config opencv --cflags --libs` -o disgui

disguise_gui_1306.cpp:102:9: error: ‘FaceRecognizer’ was not declared in this scope cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp:102:23: error: template argument 1 is invalid cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp:102:30: error: invalid type in declaration before ‘,’ token cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp: In function ‘void snapshotCB(Fl_Widget, void)’:

disguise_gui_1306.cpp:233:40: error: base operand of ‘->’ is not a pointer int predictedMouthLabel = mouthModel->predict(testSample); ^

disguise_gui_1306.cpp:243:31: error: base operand of ‘->’ is not a pointer int predictedLabel = model->predict(testSample); ^

disguise_gui_1306.cpp:261:29: error: base operand of ‘->’ is not a pointer int predictedLabel = model->predict(testSample); ^

disguise_gui_1306.cpp: In function ‘void trainFaceRecogniserModel(std::vector<cv::mat>, std::vector<int>)’: disguise_gui_1306.cpp:395:39: error: ‘createEigenFaceRecognizer’ was not declared in this scope model = createEigenFaceRecognizer();
^

disguise_gui_1306.cpp:396:10: error: base operand of ‘->’ is not a pointer model->train(img, lab); ^

disguise_gui_1306.cpp: In function ‘int main(int, char**)’:

disguise_gui_1306.cpp:417:39: error: ‘createEigenFaceRecognizer’ was not declared in this scope model = createEigenFaceRecognizer();
^

disguise_gui_1306.cpp:418:10: error: base operand of ‘->’ is not a pointer model->train(images, labels); ^

disguise_gui_1306.cpp:433:15: error: base operand of ‘->’ is not a pointer mouthModel->train(mouthimages, mouthlabels);

I have tried using:-

cv::Ptr<face::facerecognizer> model, mouthModel;

error: ‘face’ cannot appear in a constant-expression cv::Ptr<face::facerecognizer> model, mouthModel;

The same code compiles perfectly on my friends laptop,and the only difference i am able to understand is he have installed opencv in usr/local while i have the same in downloads folder.

Kindly help,because i have been stuck around this from couple of days. I have even installed extra folders from https://github.com/itseez/opencv_contrib, but no difference.

These are relevant parts of code, I am trying to detect a mouth and face and then create a database of the same.

// // libraies path:- -#include <opencv2 opencv.hpp="">

-#include <opencv highgui.h="">

-#include <opencv ml.h="">

-#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/core/include/opencv2/core.hpp"

-#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/objdetect/include/opencv2/objdetect.hpp"

-#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/imgproc/include/opencv2/imgproc.hpp"

cv::Ptr<face::facerecognizer> model, mouthModel;

if(predictedMouthLabel == 1){

    pureFaces.push_back(face);

    testSample = face;

    int predictedLabel = model->predict(testSample);

    }

for(int i = 0; i < pureFaces.size(); ++i){

    Mat temp  = pureFaces[i];

    resize(temp, temp, Size(92, 112));

    testSample = temp;    

    int predictedLabel = model->predict(testSample);

    }

void trainFaceRecogniserModel(std::vector<mat> img, std::vector<int> lab){

img.clear();

lab.clear();

try {

    readdb("database/database.txt", img, lab);

} catch (cv::Exception& e) {

    cerr << "Error opening file . Reason: " << e.msg << endl;

    exit(1);

}

if(!(img.size() >= 2)) {

    string error_message = "This demo needs at least 2 images to work. Please add more images to your data set!";

    CV_Error(CV_StsError, error_message);

}

//resize images

for(int i = 0; i < img.size(); ++i){

    resize(img[i],img[i], Size(92,112) );

}

int height = img[0].rows;

model = createEigenFaceRecognizer();  

model->train(img, lab);

}

int main(int argc, char **argv)

{

int height = images[0].rows;

model = createEigenFaceRecognizer();  

model->train(images, labels);

string mouth_csv = "database/mouth.txt";

try {

    readdb(mouth_csv, mouthimages, mouthlabels);

} catch (cv::Exception& e) {

    cerr << "Error opening file \"" << fn_csv << "\". Reason: " << e.msg << endl;

    exit(1);

}

for(int i = 0; i < mouthimages.size(); ++i){

    resize(mouthimages[i],mouthimages[i], Size(92,112) );

}

int mouthheight = mouthimages[0].rows;

mouthModel = createEigenFaceRecognizer();

mouthModel->train(mouthimages, mouthlabels);

}

click to hide/show revision 3
No.3 Revision

updated 2015-07-09 08:47:05 -0600

berak gravatar image

Unable to compile program due to dependencies

Command used to compile the code:-

g++ `fltk-config --cxxflags` disguise_gui_1306.cpp `fltk-config --ldflags --use-images` `pkg-config opencv --cflags --libs` -o disgui

disguise_gui_1306.cpp:102:9: error: ‘FaceRecognizer’ was not declared in this scope cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp:102:23: error: template argument 1 is invalid cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp:102:30: error: invalid type in declaration before ‘,’ token cv::Ptr<facerecognizer> model, mouthModel; ^

disguise_gui_1306.cpp: In function ‘void snapshotCB(Fl_Widget, void)’:

disguise_gui_1306.cpp:233:40: error: base operand of ‘->’ is not a pointer int predictedMouthLabel = mouthModel->predict(testSample); ^

disguise_gui_1306.cpp:243:31: error: base operand of ‘->’ is not a pointer int predictedLabel = model->predict(testSample); ^

disguise_gui_1306.cpp:261:29: error: base operand of ‘->’ is not a pointer int predictedLabel = model->predict(testSample); ^

disguise_gui_1306.cpp: In function ‘void trainFaceRecogniserModel(std::vector<cv::mat>, std::vector<int>)’: disguise_gui_1306.cpp:395:39: error: ‘createEigenFaceRecognizer’ was not declared in this scope model = createEigenFaceRecognizer();
^

disguise_gui_1306.cpp:396:10: error: base operand of ‘->’ is not a pointer model->train(img, lab); ^

disguise_gui_1306.cpp: In function ‘int main(int, char**)’:

disguise_gui_1306.cpp:417:39: error: ‘createEigenFaceRecognizer’ was not declared in this scope model = createEigenFaceRecognizer();
^

disguise_gui_1306.cpp:418:10: error: base operand of ‘->’ is not a pointer model->train(images, labels); ^

disguise_gui_1306.cpp:433:15: error: base operand of ‘->’ is not a pointer mouthModel->train(mouthimages, mouthlabels);

I have tried using:-

cv::Ptr<face::facerecognizer> model, mouthModel;

error: ‘face’ cannot appear in a constant-expression cv::Ptr<face::facerecognizer> model, mouthModel;

The same code compiles perfectly on my friends laptop,and the only difference i am able to understand is he have installed opencv in usr/local while i have the same in downloads folder.

Kindly help,because i have been stuck around this from couple of days. I have even installed extra folders from https://github.com/itseez/opencv_contrib, but no difference.

These are relevant parts of code, I am trying to detect a mouth and face and then create a database of the same.

//
// libraies path:-
#include <opencv2/opencv.hpp>
#include <opencv/highgui.h>
#include <opencv/ml.h>
#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/core/include/opencv2/core.hpp"
#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/objdetect/include/opencv2/objdetect.hpp"
-#include <opencv2 opencv.hpp="">

-#include <opencv highgui.h="">

-#include <opencv ml.h="">

-#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/core/include/opencv2/core.hpp"

-#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/objdetect/include/opencv2/objdetect.hpp"

-#include "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/imgproc/include/opencv2/imgproc.hpp"

cv::Ptr<face::facerecognizer> "/home/isenses/Downloads/opencv-3.0.0-rc1/modules/imgproc/include/opencv2/imgproc.hpp" cv::Ptr<face::FaceRecognizer> model, mouthModel;

mouthModel; if(predictedMouthLabel == 1){

1){
 pureFaces.push_back(face);
 testSample = face;
  int predictedLabel = model->predict(testSample);
 }

for(int i = 0; i < pureFaces.size(); ++i){

++i){
 Mat temp = pureFaces[i];
  resize(temp, temp, Size(92, 112));
 testSample = temp;
  int predictedLabel = model->predict(testSample);
 }

void trainFaceRecogniserModel(std::vector<mat> trainFaceRecogniserModel(std::vector<Mat> img, std::vector<int> lab){

lab){
img.clear();
 lab.clear();
 try {
  readdb("database/database.txt", img, lab);
 } catch (cv::Exception& e) {
  cerr << "Error opening file . Reason: " << e.msg << endl;
 exit(1);
 }
 if(!(img.size() >= 2)) {
  string error_message = "This demo needs at least 2 images to work. Please add more images to your data set!";
 CV_Error(CV_StsError, error_message);
 }
 //resize images
 for(int i = 0; i < img.size(); ++i){
 resize(img[i],img[i], Size(92,112) );
 }
 int height = img[0].rows;
 model = createEigenFaceRecognizer();
 model->train(img, lab);

}

} int main(int argc, char **argv)

{

**argv)
{
int height = images[0].rows;
 model = createEigenFaceRecognizer();
 model->train(images, labels);
 string mouth_csv = "database/mouth.txt";
 try {
  readdb(mouth_csv, mouthimages, mouthlabels);
 } catch (cv::Exception& e) {
  cerr << "Error opening file \"" << fn_csv << "\". Reason: " << e.msg << endl;
 exit(1);
 }
 for(int i = 0; i < mouthimages.size(); ++i){
 resize(mouthimages[i],mouthimages[i], Size(92,112) );
 }
 int mouthheight = mouthimages[0].rows;

mouthModel = createEigenFaceRecognizer();
mouthModel->train(mouthimages, mouthlabels);
}

mouthModel = createEigenFaceRecognizer();

mouthModel->train(mouthimages, mouthlabels);

}