简体   繁体   English

OpenCV项目无法编译

[英]OpenCV project doesn't compile

I have this code that compiled perfectly, but had to format my machine and now it will not compile, a window pops up "The application failed to initialize properly (0xc0150002). Click OK to close the application." 我的代码可以完美编译,但是必须格式化我的计算机,现在无法编译,弹出一个窗口“应用程序无法正确初始化(0xc0150002)。单击“确定”以关闭应用程序。”

Does anyone know how to solve this problem? 有谁知道如何解决这个问题?

Below the code and log visual studio. 下面的代码和日志Visual Studio。 I am using visual studio express 2010, windows 8. 我正在使用Visual Studio Express 2010,Windows 8。

Code: 码:

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main ( int argc, char **argv )
{
Mat im_gray;
Mat img_bw;
Mat img_final;

Mat im_rgb  = imread("img.jpg");
cvtColor(im_rgb,im_gray,CV_RGB2GRAY);


adaptiveThreshold(im_gray, img_bw, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 105, 1);


dilate(img_bw, img_final, Mat(), Point(-1, -1), 5, 1, 1);

imwrite("img_final.jpg", img_final);

return 0;

} }

Output: 输出:

'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\Debug\opencv.exe', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\opencv\opencv_core230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\opencv\opencv_highgui230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\opencv\opencv_imgproc230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9200.16658_none_bf1359a245f1cd12\comctl32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\avifil32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvfw32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\avicap32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\OpenCV2.3\build\x86\vc9\bin\tbb_debug.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\combase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\winmm.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msacm32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\version.dll', Cannot find or open the PDB file
The program '[2112] opencv.exe: Native' has exited with code -1072365566 (0xc0150002).

Update: 更新:

I followed this and solved my problem. 我遵循了这一点,解决了我的问题。 Now everything is working normally. 现在一切正常。 Thank you all for the help. 谢谢大家的帮助。 http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html#windowssetpathandenviromentvariable http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html#windowssetpathandenviroment变量

I've test this code (your code with minor edition) and it works fine: 我已经测试了此代码(您的带有次要版本的代码),并且工作正常:

#include <opencv2/opencv.hpp>
using namespace cv;
int main ( int argc, char **argv )
{
    Mat im_gray;
    Mat img_bw;
    Mat img_final;
    Mat im_rgb  = imread("D:\\ImagesForTest\\lena.jpg");
    cvtColor(im_rgb,im_gray,cv::COLOR_RGB2GRAY);
    adaptiveThreshold(im_gray, img_bw, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 105, 1);
    dilate(img_bw, img_final, Mat(), Point(-1, -1), 5, 1, 1);
    imwrite("img_final.jpg", img_final);
    return 0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM