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;
}
uj5u.com熱心網友回復:
百度搜相關關鍵字。uj5u.com熱心網友回復:
樓,請問你解決了這個問題嗎,轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/113097.html
標籤:工具平臺和程序庫
上一篇:pcl1.72 visualization::CloudViewer 顯示不出影像怎么辦
下一篇:C語言基礎性題目
