OpenCV 项目无法编译
OpenCV project doesn't compile
我有这段代码编译得很好,但必须格式化我的机器,现在它无法编译,弹出一个窗口"应用程序未能正确初始化(0xc0150002)。单击"确定"关闭应用程序。"
有人知道如何解决这个问题吗?
下面的代码和日志可视化工作室。我使用的是visualstudioexpress2010,windows8。
代码:
#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;
}
输出:
'opencv.exe': Loaded 'C:UsersAnneDocumentsopencvDebugopencv.exe', Symbols loaded.
'opencv.exe': Loaded 'C:WindowsSystem32ntdll.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32kernel32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32KernelBase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:UsersAnneDocumentsopencvopencvopencv_core230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:UsersAnneDocumentsopencvopencvopencv_highgui230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:UsersAnneDocumentsopencvopencvopencv_imgproc230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32msvcp100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:WindowsSystem32msvcr100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:WindowsSystem32user32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32gdi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32ole32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32oleaut32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32advapi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsWinSxSx86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9200.16658_none_bf1359a245f1cd12comctl32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32avifil32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32msvfw32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32avicap32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:OpenCV2.3buildx86vc9bintbb_debug.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32combase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32msvcrt.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32rpcrt4.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32sechost.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32winmm.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32msacm32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32shell32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:WindowsSystem32version.dll', Cannot find or open the PDB file
The program '[2112] opencv.exe: Native' has exited with code -1072365566 (0xc0150002).
更新:
我照做了,解决了我的问题。现在一切正常。谢谢大家的帮助。http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html#windowssetpathandenviromentvariable
我已经测试了这个代码(您的代码有小版本),它运行良好:
#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;
}
相关文章:
- 当我尝试通过 mingw 使用 CMake 和 SFML 库编译项目时出错
- LD:尝试编译项目时找不到架构x86_64符号
- 如何在不需要LIBCD.lib的情况下在Visual Studio 6中编译C项目
- 如何使用 Makefile 使用 VTK 库编译项目?
- UE4无法使用vs2017编译C++项目
- 无法让 CMAKE 编译项目
- 了解如何编译C++项目
- [UE4错误]无法编译项目.你想在Visual Studio中打开它吗?
- 使用 -O1 优化标志编译项目时共享库崩溃
- 每次都构建(make)lib,只有在lib较新时才重新编译项目
- 如何在 g++ 上使用 opencv 编译项目 c++
- 尝试使用 TMXlite 编译项目时LNK2019错误
- 编译项目时文件无效或损坏,包括 V8
- 为什么当我在Visual Studio中编译C++项目时会出现致命错误"LNK1104:无法打开文件'cryptlib.lib'?
- 在 netbeans 中编译项目中的单个文件
- 用cmake中的makefile编译项目
- 使用makefile编译C++项目时出现问题
- 用多个文件制作和编译C 项目
- 如何有条件地为 Eclipse 中的交叉编译项目包含两个不同名称的相同版本的库
- 如何编译项目后不运行exe文件