`
up2pu
  • 浏览: 223117 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Opencv+Mingw+Eclipse

阅读更多
http://www.argong.com/docs/how-to-OpenCV-2.2.0.pdf
http://blog.eyalarubas.com/2012/10/23/opencv-installation-on-windows-netbeans-mingw/
http://nenadbulatovic.blogspot.com/2013/07/configuring-opencv-245-eclipse-cdt-juno.html
----------------------------------------------------------------------
通过OpenCV例子生成的exe,使用Opencv直接下载的dll都不能用。需要自己重新编译生成。

Include:
"C:\opencv245\build\include"
"C:\opencv245\build\include\opencv2"
"C:\opencv245\build\include\opencv"
Library:
opencv_core245
opencv_highgui245
opencv_imgproc245
"E:\software\dev\OpenCV245MinGW\x86\lib"(改成自己编译生成的目录)

PATH添加:
E:\software\dev\OpenCV245MinGW\x86\bin;C:\MinGW\bin;E:\software\dev\cmake-2.8.12-win32-x86\bin;

----------------------------------------------------------------------
Configuring OpenCV 2.4.6, Eclipse CDT (Juno), MinGW (x86) on Windows 7
After many trials and errors I decided to follow this tutorial and to compile my own binaries as it seems that too many people are complaining that precompiled binaries are NOT working for them. Eclipse CDT Juno was already installed.

My procedure was as follows:

1. Download and install MinGW and add to the system PATH with  c:/mingw/bin

2. Download cmake from http://www.cmake.org and install it

3. Download OpenCV2.4.6 Windows version

4. Install/unzip Opencv to C:\OpenCV246PC\ (README,index.rst and CMakeLists.txt are here with all subfolders)

5. Run CMake GUI tool

6. Choose C:\OpenCV246PC\ as source

7. Choose the destination, C:\OpenCV246MinGW\x86  where to build the binaries

8. Press Configure button, choose MinGW Makefiles as the generator. There are some red highlights in the window, choose options as you need.

9. Press the Configure button again. Configuring is now done.

10. Press the Generate button.

11. Exit the program when the generating is done.

12. Exit the Cmake program.

13. Run the command line mode (cmd.exe) and go to the destination directory C:\OpenCV246MinGW\x86

14. Type "mingw32-make" (without quotation marks). You will see a progress of building binaries. If the command is not found, you must make sure that the system PATH is added with c:/mingw/bin. The build continues according the chosen options to a completion.

15. In Windows system PATH (My Computer > Right button click > Properties > Advanced > Environment Variables > Path) add the destination's bin directory, C:\OpenCV246MinGW\x86\bin

16. RESTART COMPUTER

17. Go to the Eclipse CDT IDE, create a C++ program using the sample OpenCV code (You can use code from top of this topic).

18. Go to Project > Properties > C/C++ Build > Settings > GCC C++ Compiler > Includes, and add the source OpenCV folder (including quotation marks) "C:\OpenCV246PC\build\include"

19. Go to Project > Properties > C/C++ Build > Settings > MinGW C++ Linker > Libraries, and add to the Libraries (-l) ONE BY ONE (this could vary from project to project, you can add all of them if you like or some of them just the ones that you need for your project):

opencv_calib3d246
opencv_contrib246
opencv_core246
opencv_features2d246
opencv_flann246
opencv_gpu246
opencv_highgui246
opencv_imgproc246
opencv_legacy246
opencv_ml246
opencv_nonfree246
opencv_objdetect246
opencv_photo246
opencv_stitching246
opencv_video246
opencv_videostab246

20. Add the built OpenCV library folder (including quotation marks),  "C:\OpenCV246MinGW\x86\lib" to Library search path (-L)

You can use this code to test your setup:

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

using namespace std;
using namespace cv;

int main()
{

Mat img = imread("c:/lenna.png", CV_LOAD_IMAGE_COLOR);

namedWindow("MyWindow", CV_WINDOW_AUTOSIZE);
imshow("MyWindow", img);

waitKey(0);
return 0;
}


Don't forget to put image to the C:\ (or wherever you might find suitable, just be sure that eclipse have read acess.
分享到:
评论

相关推荐

    opencv3.0.0 mingw x86 windows 10编译好的包

    7. **集成开发环境(IDE)集成**:对于MingW环境,开发者可能使用像Code::Blocks、Qt Creator或Eclipse这样的IDE,这些IDE通常支持添加外部库,只需配置好库路径和包含路径,就能在项目中直接使用OpenCV的功能。...

    CMake + MinGW编译的OpenCV2.4.10 库

    这是Windows 8平台下使用MinGW + CMake 编译的OpenCV,版本是2.4.10, 注:这是已经编译的库,不是源码,源码请到官网下载。这个库适用于喜欢Eclipse下开发OpenCV的朋友。如果你想自己编译,请参考我的博文教程 ...

    OpenCV3.3 mingw64位编译 包含contribute部分,适用于除vc编译器的ide

    2. **设置项目配置**:在你的IDE(比如Code::Blocks, Eclipse, 或者Qt Creator)中,需要配置项目的链接器设置,指向OpenCV的.lib文件,并添加相应的头文件目录。 3. **链接问题**:在编译过程中,可能会遇到未解决...

    Eclipse+OpenCV开发环境搭建

    ### Eclipse+OpenCV开发环境搭建知识点详解 #### 一、简介 随着计算机视觉技术的不断发展,OpenCV作为一款开源的计算机视觉库,在图像处理、视频分析等领域发挥了重要作用。结合Eclipse这一强大的集成开发环境(IDE...

    opencv2.4.10_mingw_getCameraName

    标题“opencv2.4.10_mingw_getCameraName”指的是一个关于OpenCV 2.4.10版本的项目,目标是在Windows操作系统中,使用MinGW编译器通过Eclipse IDE获取摄像头设备的个数及名称。OpenCV是一个强大的计算机视觉库,广泛...

    win7 安装Eclipse IDE for C C++&Opencv

    总之,安装和配置Eclipse IDE for C/C++及OpenCV涉及多个步骤,包括下载和安装Eclipse和MinGW,配置环境变量,安装OpenCV库,以及在Eclipse中设置项目属性。通过这些操作,开发者能够在Windows 7上搭建一个完整的C/...

    opencv英文开发入门手册

    同时,确保你的IDE(如Visual Studio、Code::Blocks或Eclipse)能够正确识别OpenCV的头文件和库文件。 三、基本图像处理 1. 图像读取与显示:使用`imread()`函数读取图像,`imshow()`函数显示图像,`waitKey()`函数...

    testOpencvV1.0(测试通过).rar

    这通常包括下载OpenCV的源代码库,将其解压到本地目录,然后配置相关的编译器环境,如Visual Studio或Eclipse。在Windows 7 32位系统下,可以选择使用MinGW作为编译器,它是一个轻量级且兼容32位系统的GCC(GNU ...

    win7、winxp c++可用的编程工具

    4. **Eclipse CDT**:基于Eclipse平台的C++开发工具,适合那些熟悉Eclipse界面的开发者。它需要JRE支持,所以在配置时需要确保系统满足相应需求。 5. **Notepad++**:虽然不是完整的IDE,Notepad++是一个强大的文本...

Global site tag (gtag.js) - Google Analytics