使用了Dev C++ 4.9.9.2搭配OpenCV版本2.4.7。
軟體:
作業系統:Windows 7 旗艦版
Dev-C++:4.9.9.2 (http://prdownloads.sourceforge.net/dev-cpp/devcpp-4.9.9.2_setup.exe)
OpenCV:2.4.7 (https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.7/OpenCV-2.4.7.exe/download)
設定:
1. 使用預設編譯器或者新增都可以
2. 連結器命令列中加入以下命令(是新增的話,前面框號記得要先打勾)
-lopencv_core247d -lopencv_highgui247d -lopencv_video247d -lopencv_ml247d -lopencv_legacy247d -lopencv_imgproc247d
3. 工具→編譯器選項→目錄→二進位檔
C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2
C:\Dev-Cpp\bin
C:\opencv\build\x86\vc10\bin
C:\Dev-Cpp\bin
C:\opencv\build\x86\vc10\bin
4. 工具→編譯器選項→目錄→函式庫
C:\opencv\build\x86\vc10\lib
C:\Dev-Cpp\lib
C:\Dev-Cpp\lib
5. 工具→編譯器選項→目錄→C引入檔
C:\opencv\build\include
C:\opencv\build\include\opencv
C:\opencv\build\include\opencv2
C:\Dev-Cpp\include
C:\opencv\build\include\opencv
C:\opencv\build\include\opencv2
C:\Dev-Cpp\include
6. DEV 工具→編譯器選項→目錄→C++引入檔
C:\opencv\build\include\opencv
C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include
C:\Dev-Cpp\include\c++\3.4.2\backward
C:\Dev-Cpp\include\c++\3.4.2\mingw32
C:\Dev-Cpp\include\c++\3.4.2
C:\Dev-Cpp\include
C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include
C:\Dev-Cpp\include\c++\3.4.2\backward
C:\Dev-Cpp\include\c++\3.4.2\mingw32
C:\Dev-Cpp\include\c++\3.4.2
C:\Dev-Cpp\include
使用範例:
1 2 3 4 5 6 7 8 9 10 | #include "highgui.h" int main( int argc, char** argv) { IplImage* img = cvLoadImage("D:/個人檔案/Facbook covers/wallpaper-730977.jpg", 1); cvNamedWindow("Back to Space", CV_WINDOW_AUTOSIZE); cvShowImage("Back to Space", img); cvWaitKey(0); cvDestroyWindow("Back to Space"); cvReleaseImage(&img); } |
請問一下為什麼我全部照做後,#include "highgui.h"出現錯誤?
回覆刪除可以給更詳細的描述嗎? 有出現什麼訊息?
刪除作者已經移除這則留言。
回覆刪除不好意思
回覆刪除我也照做了
出現了
opencv2/core/core.hpp: No such file or directory.
opencv2/core/core.hpp: No such file or directory.
opencv2/highgui/highgui_c.h: No such file or directory.
opencv2/highgui/highgui.hpp: No such file or directory.