Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/149.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Visual studio使用opencv生成错误的项目_C++_Visual Studio_Opencv_Visual Studio 2012_Visual Studio 2015 - Fatal编程技术网

C++ Visual studio使用opencv生成错误的项目

C++ Visual studio使用opencv生成错误的项目,c++,visual-studio,opencv,visual-studio-2012,visual-studio-2015,C++,Visual Studio,Opencv,Visual Studio 2012,Visual Studio 2015,所以,我不确定如何解决这个问题,但基本上我创建的任何新项目都不起作用。 我正在使用Visual Studio 2012 Ultimate来使用opencv 2.4.9。当我创建新项目并输入示例代码以加载图像时,它成功构建: 但是,当我在VS2012中运行可执行文件或调试时,它会崩溃/无法正常工作:,有时会自行创建两个无法终止的进程。 以下是我使用的示例代码: #include <opencv2/core/core.hpp> #include <opencv2/highgui/h

所以,我不确定如何解决这个问题,但基本上我创建的任何新项目都不起作用。 我正在使用Visual Studio 2012 Ultimate来使用opencv 2.4.9。当我创建新项目并输入示例代码以加载图像时,它成功构建:

但是,当我在VS2012中运行可执行文件或调试时,它会崩溃/无法正常工作:,有时会自行创建两个无法终止的进程。 以下是我使用的示例代码:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char** argv )
{
    if( argc != 2)
{
 cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
 return -1;
}

Mat image;
image = imread(argv[1], IMREAD_COLOR); // Read the file

if(! image.data ) // Check for invalid input
{
    cout << "Could not open or find the image" << std::endl ;
    return -1;
}

namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
imshow( "Display window", image ); // Show our image inside it.

waitKey(0); // Wait for a keystroke in the window
return 0;
}
#包括
#包括
#包括
使用名称空间cv;
使用名称空间std;
int main(int argc,字符**argv)
{
如果(argc!=2)
{

cout For VS2012确保在vc11文件夹中使用opencv二进制文件。是的,我的意思是vc11.vc12=Visual Studio 2013。2位数字#仅与vc10的年份匹配。并且确保在调试版本中使用调试库和DLL,在发布版本中使用发布库和DLL。是的,我使用了正确的文件夹路径,并设置了告诉VS2012从何处获取LIB和DLL。我已尝试重新使用工作项目中的属性表,并为新项目从头开始重新制作它们。由于它成功构建了这些属性表,但在这两种情况下都无法生成工作可执行文件,我确信它们不是问题的原因。请确保没有其他opencv dlls在您的路径中。是的;从提取opencv文件夹的那天起,我就没有接触过它。我尝试使用环境变量指向DLL和LIB,也尝试使用完整路径,它可以毫无问题地到达它们(如果我没有正确指向,我在尝试构建时会出错)。我还尝试重新下载opencv,希望它以某种方式损坏,这是原因-它仍然无法工作。在这一点上,我或多或少地完全重新安装/重新制作了我在第一个工作项目中使用的所有内容,但没有成功。