我正在尝试从openCV 2.4.5到Visual Studio 2010(基于VC++)的示例代码bagofwords_classification.cpp.但是我找到了错误代码:
error C2664: 'CreateDirectoryW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
Run Code Online (Sandbox Code Playgroud)
你能帮我解决一下这个问题吗?谢谢.:)
更新v1:
static void makeDir( const string& dir )
{
#if defined WIN32 || defined _WIN32
CreateDirectory( dir.c_str(), 0 );
#else
mkdir( dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
#endif
}
static void makeUsedDirs( const string& rootPath )
{
makeDir(rootPath + bowImageDescriptorsDir);
makeDir(rootPath + svmsDir);
makeDir(rootPath + plotsDir);
}
Run Code Online (Sandbox Code Playgroud) 我的错误代码是:
错误LNK2019:函数_main中引用的未解析的外部符号"public:__thiscall cv :: SURF :: SURF(double,int,int,bool,bool)"(?? 0SURF @ cv @@ QAE @ NHH_N0 @ Z)
我不知道如何解决它.
我的代码是:
#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <iostream>
#include <conio.h>
#include <opencv2\nonfree\features2d.hpp>
#include <opencv2\legacy\legacy.hpp>
#include <opencv2\core\core.hpp>
#include <stdio.h>
using namespace cv;
using namespace std;
int main()
{
Mat img_1 = imread("kmu1.jpg", CV_LOAD_IMAGE_GRAYSCALE);
Mat img_2 = imread("all.jpg", CV_LOAD_IMAGE_GRAYSCALE);
if(!img_1.data || !img_2.data)
{
cout << "could not open or find the image" << endl;
return -1;
}
int minHessian = 400;
SURF surf( …Run Code Online (Sandbox Code Playgroud)