打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
OpenCV 1.1pre1编译方案及其在VisualC++6.0的配置

因库函数支持问题,今天卸载了OpenCV1.0 ,安装了OpenCV_1.1pre1a ,并把我的项目在这个新的环境重新编译了,以后就暂时用OpenCV_1.1pre1a 支持库了。


在配置OpenCV_1.1pre1a环境时遇到不少问题,网友发言很热烈,但总没找到一个能完全解决这些问题的发言。在这里把自己在VC++6.0环境下
成功使用OpenCV_1.1pre1a的过程写下来,以便于交流。


1、先来看下OpenCV_1.1pre1a的ChangeLog(摘自OpenCV安装路径下的说明文档)

=============================================================================
                      OpenCV 1.1pre1, October, 2008
=============================================================================

>>> New functionality/features: <<<

  - General:
    * Octave bindings have been added. See interfaces/swig/octave (for now, Linux only)
    * [Windows] OpenCV is now built with VS2005 with SSE2 and OpenMP support
      included (if you want to rebuild OpenCV using Express or
      Standard Edition of VS, use _make\opencv.vs2005.no_openmp.sln).
    * [Windows] Python bindings have been updated to use Python 2.6
    * [Windows] cvcam has been removed (as videoInput is now supported by highgui)

  - CXCORE, CV, CVAUX:
    * Speeded-up Robust Features (SURF), contributed by Liu Liu.
      see samples/c/find_obj.cpp and the documentation opencvref_cv.htm
    * Many improvements in camera calibration:
      - Added stereo camera calibration: cvStereoCalibrate, cvStereoRectify etc.
      - Single camera calibration now uses Levenberg-Marquardt method and supports
        extra flags to switch on/off optimization of individual camera parameters
      - The optional 3rd radial distortion parameter (k3*r^6) is now supported in
        every calibration-related function
    * 2 stereo correspondence algorithms:
      - very fast block matching method by Kurt Konolige
        (processes the Tsukuba stereo pair in <10ms on Core2Duo laptop)
      - slow but more accurate graph-cut based algorithm by Kolmogorov and Zabin
    * Better homography estimation algorithms (RANSAC and LMEDs)
    * new C++ template image classes contributed by Daniel Filip (Google inc.).
      see opencv/cxcore/include/cvwimage.h
    * Fast approximate nearest neighbor search (by Xavier Delacour)
    * Codebook method for background/foreground segmentation (by Gary Bradski)
    * Sort function (contributed by Shiqi Yu)
    * [OpenCV+IPP] Face Detection (cvHaarDetectObjects) now runs much faster
      (up to 2x faster) when using IPP 5.3 or higher.
    * Much faster (~4x faster) fixed-point variant of cvRemap has been added

  - MLL:
    * Python bindings for MLL have been added. There are no samples yet.

  - HighGUI:
    * [Windows, 32bit] Added support for videoInput library.
      Hence, cvcam is [almost] not needed anymore
    * [Windows, 32bit] FFMPEG can now be used for video decoding/encoding
      via ffopencv*.dll
    * [Linux] Added unicap support
    * Improved internal video capturing and video encoding APIs

  - Documentation:
    * OpenCV book has been published (sold separately :) see docs/index.htm)

  - New samples (opencv/samples):
    * Many Octave samples
    * find_obj.cpp (SURF), bgfg_codebook.cpp (Codebook BG/FG segmentation),
      stereo_calib.cpp (Stereo calibration and stereo correspondence)

>>> Bug fixes: <<<
     Many thanks to everybody who submitted bug reports and/or provided the patches!

    * added dma_unlisten to icvCloseCAM_DC1394 (thanks to Victor Benso)
    * LMEDs algorithm for cvFindFundamentalMat estimation has been fixed
    * Broken debug build of highgui in VS2005/2008 (SF #2056185, SF #1709435)
    * cvFindChessboardCorners memory leak and incorrect size checks
      (SF #1972896, SF #1910323)
    * disabling GTK causes v4l runtime error (SF #2088102)
    * cvsetmousecallback bug (SF #2053529)
    * libhighgui needed deprecated "img_convert" replacement (SF #2011753)
    * Segfault in createsamples caused by uninitialized variable (SF #1977989)
    * Data Alignment Issue in bgfg_gaussmix (SF #1961755)
    * libpng need to be updated (SF #1952793)
    * cvCreateVideoWriter_Win32 - identifier not found (SF #1944254)
    * Bug in cvmorph.cpp (SF #1908844)
    * dilate (cvDilate) works bogus with default kernel (SF #1887130)
    * CvEM non-default constructor declared but not defined (SF #1830346)
    * cvFloodFill (in ver 1.0) Hangs (SF #1790565)
    * double delete in CvImage (SF #1733437)
    * cvFilter2D anchor default value is not working properly (SF #1713779)
    * cvCvtColor - Bug? in converting HSV2RGB (SF #1676344)
    * Invalid selection of the MKL-dll version in cvUseOptimized() (SF #1633017)
    * ...

>>> Known issues:
    * Borland compiler is not supported (but might work) in this update.
    * 64-bit Windows is not supported (but might work) in this update.
    * SF bug tracker still contains over 50 records of open bugs.
      Many of them will be addressed in the next update.


2、安装 OpenCV_1.1pre1a

OpenCV_1.1pre1a 官方下载:
http://sourceforge.net/projects/opencvlibrary/files/opencv-win/1.1pre1/
OpenCV_1.1pre1a 安装基本同 OpenCV 1.0 安装
可以参考:
http://www.opencv.org.cn/index.php/VC6%E4%B8%8B%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE

3、分别在Debug 和 Release 模式下 编译 OpenCV_1.1pre1a
在你的OpenCV安装目录下找到_make文件夹,用Visual C++ 6.0打开工作空间 opencv.dsw 对这里的每一个工程进行逐个编译,逐个编译时并不是按工程从上到下编译,而是有先后顺序的,如你编译工程 highgui 会提示连接错误,不能连接libjpegd.lib(Debug 模式下),这时你需要先
编译工程libjpeg,其他工程编译类似处理。

在编译工程cvaux,还会遇到一个小小的错误

error C2039: 'foreground_regions' : is not a member of 'CvFGDStatModel
处理如下:
搜索关键字foreground_regions,
第1137行
CvMemStorage* storage; /*storage for 揻oreground_regions?/ \
CvSeq* foreground_regions /*foreground object contours*/
改为如下形式:
CvMemStorage* storage; /*storage for foreground_regions*/ \
CvSeq* foreground_regions /*foreground object contours*/

每一行后面的这些"\"是表下一行是上一行的接续.如
define可以替代多行的代码,例如MFC中的 非常经典的 宏定义
#define MACRO(arg1, arg2) do { \
/* declarations */ \
stmt1; \
stmt2; \
/* ... */ \
} while(0) /* (no trailing ; ) */
关键是要在每一个换行的时候加上一个"\"

编译好所有的工程后我们就可以配置环境了

注:如果我们只在 Debug 模式下编译OpenCV_1.1pre1a,那么任然会有很多程序运行出现问题!

4、VC6下安装与配置
OpenCV_1.1pre1a 在VC6下安装与配置过程基本同 OpenCV 1.0
可以参考:
http://www.opencv.org.cn/index.php/VC6%E4%B8%8B%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE

不同的地方是:
在 配置Visual C++ 6.0 时
全局设置 因为在OpenCV_1.1pre1a,"cvcam has been removed" ,所以相应的,所有关于cvcam的配置项目我们不需要配置。

项目设置 变为:
每创建一个将要使用OpenCV的VC Project,都需要给它指定需要的lib。菜单:Project->Settings,然后将Setting for选为All
Configurations,然后选择右边的link标签,在Object/library modules附加上

Debug 模式编译时:

cvd.lib cvauxd.lib cxcored.lib highguid.lib mld.lib

Release 模式编译时:

cv.lib cvaux.lib cxcore.lib highgui.lib ml.lib

如果你不需要这么多lib,你可以只添加你需要的lib。

另 :在 C:\Program Files\OpenCV\otherlibs目录下有个 _graphics 文件夹("This folder contains libraries and headers of a few very popular still image codecs used by highgui."),其下有include、src、lib三个文件夹,如有需要,我们可以参照前面的相应配置进行。

到此VC6下OpenCV_1.1pre1a安装与配置基本完成, 我们可以 运行opencv.dsw里的工程cvtest,看看一些函数的测试结果。

完成以后步骤后,我就开始重新编译我的项目了,OK ,一切正常!



本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
windows下安装opencv
在没有安装Opencv的电脑上运行基于Opencv库的程序
opencv2.3在VS2010下的配置
VS2008(10及以上版本)opencv2.413的配置
【配置】win7+VS2013+OpenCV3.0.0
Windows下利用CMake和VS2013编译OpenCV 
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服