1、错误 99 error MSB6006: “cmd.exe”已退出,代码为 -1073741571。 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 170 5 opencv_bioinspired 2、错误 376 error LNK1104: 无法打开文件“..\..\lib\Debug\opencv_bioinspired310d.lib” E:\安装包\opencv-3.1.0\myBuildx64\modules\bioinspired\LINK opencv_perf_bioinspired 3、错误 440 error LNK1104: 无法打开文件“..\..\lib\Debug\opencv_bioinspired310d.lib” E:\安装包\opencv-3.1.0\myBuildx64\modules\bioinspired\LINK opencv_test_bioinspired 4、忽视上部分问题用编译出的.lib .dll继续配置工程,运行程序时报下面的错误 OpenCV Error: Bad argument (Wrong shapes for given matrices. Was size(src) = (1,30912), size(W) = (10304,389).) in cv::LDA::subspaceProject, file E:\安装包\opencv-3.1.0\opencv\sources\modules\core\src\lda.cpp, line 182 程序为 #include <iostream> #include <dlib/image_processing/frontal_face_detector.h> #include <dlib/image_processing/render_face_detections.h> #include <dlib/image_processing.h> #include <dlib/gui_widgets.h> #include <dlib/image_io.h> #include <dlib/opencv/cv_image_abstract.h> #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/face/facerec.hpp> #include <vector> using namespace cv; using namespace dlib; using namespace std; using namespace cv::face; int main(int argc, char** argv) { /************************************读取图片并处理***********************************/ //两个容器来存放图像数据和对应的标签 std::vector<Mat> images; std::vector<int> labels; string input_path; string output_path; Mat img; int each_folder_nums = 10; int floder_nus = 10; for (int j = 1; j < floder_nus; j++) { for (int i = 1; i <= each_folder_nums; i++) { input_path = format("./orl_faces/s%d/%d", j, i); int jpg_order = (j - 1) * 10 + i; output_path = format("./orl_faces/JPG/%d", jpg_order); img = imread(input_path + ".pgm"); images.push_back(img); labels.push_back(j - 1); //imwrite(output_path + ".jpg", img); //imwrite(input_path + ".jpg", img); //cout << "已转换格式:" + input_path << endl; } } // 得到第一张图片的高度,在下面对图像变形得到他们原始大小时需要 int height = images[0].rows; //下面代码仅从数据集中移除最后一张图片,用于做测试,需要根据自己的需要进行修改 Mat testSample = images[images.size() - 1]; int testLabel = labels[labels.size() - 1]; images.pop_back(); //删除最后一张图片 labels.pop_back(); //删除最后一个标签 //[5] 创建一个特征脸模型用于人脸识别 Ptr<BasicFaceRecognizer> model = createEigenFaceRecognizer(); model->train(images, labels); //[6] 对测试图像进行预测,predictedLabel是预测标签结果 int predictedLabel = model->predict(testSample); cout << "predictedLabel=" << predictedLabel << endl; cout << "testLabel=" << testLabel << endl; system("Pause"); return 0; }
#include <iostream> #include <dlib/image_processing/frontal_face_detector.h> #include <dlib/image_processing/render_face_detections.h> #include <dlib/image_processing.h> #include <dlib/gui_widgets.h> #include <dlib/image_io.h> #include <dlib/opencv/cv_image_abstract.h> #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/face/facerec.hpp> #include <vector> using namespace cv; using namespace dlib; using namespace std; using namespace cv::face; int main(int argc, char** argv) { /************************************读取图片并处理***********************************/ //两个容器来存放图像数据和对应的标签 std::vector<Mat> images; std::vector<int> labels; string input_path; string output_path; Mat img; int each_folder_nums = 10; int floder_nus = 10; for (int j = 1; j < floder_nus; j++) { for (int i = 1; i <= each_folder_nums; i++) { input_path = format("./orl_faces/s%d/%d", j, i); int jpg_order = (j - 1) * 10 + i; output_path = format("./orl_faces/JPG/%d", jpg_order); img = imread(input_path + ".pgm"); images.push_back(img); labels.push_back(j - 1); //imwrite(output_path + ".jpg", img); //imwrite(input_path + ".jpg", img); //cout << "已转换格式:" + input_path << endl; } } // 得到第一张图片的高度,在下面对图像变形得到他们原始大小时需要 int height = images[0].rows; //下面代码仅从数据集中移除最后一张图片,用于做测试,需要根据自己的需要进行修改 Mat testSample = images[images.size() - 1]; int testLabel = labels[labels.size() - 1]; images.pop_back(); //删除最后一张图片 labels.pop_back(); //删除最后一个标签 //[5] 创建一个特征脸模型用于人脸识别 Ptr<BasicFaceRecognizer> model = createEigenFaceRecognizer(); model->train(images, labels); //[6] 对测试图像进行预测,predictedLabel是预测标签结果 int predictedLabel = model->predict(testSample); cout << "predictedLabel=" << predictedLabel << endl; cout << "testLabel=" << testLabel << endl; system("Pause"); return 0; }
4,445
社区成员
15,335
社区内容
加载中
试试用AI创作助手写篇文章吧