最近在学习《深入理解OpenCV:实用计算机视觉项目解析》一书的第三章和第四章时,遇到很多编译问题,书中又没有详细的讲解环境配置和搭建过程。经过多天的捉摸、调试、排错终于将两章的程序都调试成功了,先做个记录以备忘。该书的英文名为:《Mastering OpenCV with Practical Computer Vision Projects》。

一、开发环境概述

  1、OpenCV版本:2.4.4;

  2、PCL版本:1.6.0;

  3、SSBA版本:3.0;

  4、IDE版本:VS2010 32位,字符集:使用多字节字符集

  5、PCL如果涉及到OpenGL,则采用OpenGL32.lib和OpenGL.dll。

二、OpenCV2.4.4编译和安装

  1、OpenCV2.4.4下载地址:https://github.com/opencv/opencv/releases?after=2.4.6.1,如下图所示:

  2、具体的编译和配置工作参考:OpenCV2.4.12 开启OpenGL启用三维可视化支持

  注意:(1)第一次点击“Configure”时,请在“Specify the generator for this project”选择“Visual Studio 10”,该选项是32位的;

     (2)如果你的计算机上已经安装了英伟达GPU CUDA驱动程序,则CMake会检测出来并默认勾选上“WITH_CUDA”。一般情况下,大家的计算机的GPU卡的计算能力CC不够高,为了避免后续编译时出现的各种错误,此去请不要勾选上“WITH_CUDA”。除非你的显卡支持能够支持高级的CUDA计算能力,才能够编译通过。

     (3)OpenCV默认情况下是不支持OpenGL的,如果要使OpenCV支持OpenGL,则需要重编译。则需要勾选上“WITH_OPENGL”。如下图所示:

  3、常见编译问题汇总:

  1. OPENCV3.3+CUDA9.0 环境搭建若干错误总结
  2. VS2010自行编译OpenCV2.4.4时缺少python27_d.lib的解决方法
  3. VS2015+OpenCV3.3 GPU模块和opencv_contrib模块的编译以及采用CMake编译opencv_contrib时提示“No extra modules found in folder”问题的解决方案

三、PCL1.6.0编译和安装

  PCL1.6.0下载、编译和安装请参考文档:VS2010中配置PCL

四、SSBA3.0编译和安装

  SSBA3.0下载、编译和安装请参考博文:VS2013+简单稀疏光束调整库SSBA配置(64位编译)

  注意:该项目编译出来的colamd.lib和V3D.lib都是静态库,没有*.dll后缀的文件。因为colamd和V3D两个项目的配置类型都是“静态库(.lib)”。如下图所示:

五:其它注意事项

  1、所有的所依赖的第三方开源框架库都配置好后,如果还需要OpenGL库的话,需要给工程文件添加OpenGL32.lib的静态到入库(项目属性-连接器-输入-附加依赖项)和OpenGL.dll动态链接库。

  2、在编译的过程中可能会提示“vtk***无法解决的外部符号”,如下所示:

>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: thiscall vtkSmartPointerBase::vtkSmartPointerBase(void)" (imp_??0vtkSmartPointerBase@@QAE@XZ),该符号在函数 "public: thiscall vtkSmartPointer::vtkSmartPointer(void)" (???$vtkSmartPointer@VvtkImageData@@@@QAE@XZ) 中被引用
>vtkSDIView.obj : error LNK2001: 无法解析的外部符号 "declspec(dllimport) public: thiscall vtkSmartPointerBase::vtkSmartPointerBase(void)" (imp_??0vtkSmartPointerBase@@QAE@XZ)
>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: thiscall vtkSmartPointerBase::~vtkSmartPointerBase(void)" (imp_??1vtkSmartPointerBase@@QAE@XZ),该符号在函数 "public: thiscall vtkSmartPointer::~vtkSmartPointer(void)" (???$vtkSmartPointer@VvtkImageData@@@@QAE@XZ) 中被引用
>vtkSDIView.obj : error LNK2001: 无法解析的外部符号 "declspec(dllimport) public: thiscall vtkSmartPointerBase::~vtkSmartPointerBase(void)" (imp_??1vtkSmartPointerBase@@QAE@XZ)
>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: class vtkSmartPointerBase & thiscall vtkSmartPointerBase::operator=(class vtkObjectBase *)" (imp_??4vtkSmartPointerBase@@QAEAAV0@PAVvtkObjectBase@@@Z),该符号在函数 "public: class vtkSmartPointer & thiscall vtkSmartPointer::operator=(class vtkImageData *)" (???$vtkSmartPointer@VvtkImageData@@@@QAEAAV0@PAVvtkImageData@@@Z) 中被引用
>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "declspec(dllimport) public: class vtkSmartPointerBase & thiscall vtkSmartPointerBase::operator=(class vtkSmartPointerBase const &)" (imp_??4vtkSmartPointerBase@@QAEAAV0@ABV0@@Z),该符号在函数 "public: class vtkSmartPointer & thiscall vtkSmartPointer::operator=(class vtkSmartPointer const &)" (???$vtkSmartPointer@VvtkImageData@@@@QAEAAV0@ABV0@@Z) 中被引用
>vtkSDIView.obj : error LNK2001: 无法解析的外部符号 "declspec(dllimport) public: class vtkSmartPointerBase & thiscall vtkSmartPointerBase::operator=(class vtkSmartPointerBase const &)" (imp_??4vtkSmartPointerBase@@QAEAAV0@ABV0@@Z)
>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) protected: thiscall vtkSmartPointerBase::vtkSmartPointerBase(class vtkObjectBase *,class vtkSmartPointerBase::NoReference const &)" (imp_??0vtkSmartPointerBase@@IAE@PAVvtkObjectBase@@ABVNoReference@@@Z),该符号在函数 "protected: thiscall vtkSmartPointer::vtkSmartPointer(class vtkImageData *,class vtkSmartPointerBase::NoReference const &)" (???$vtkSmartPointer@VvtkImageData@@@@IAE@PAVvtkImageData@@ABVNoReference@vtkSmartPointerBase@@@Z) 中被引用
>vtkSDIView.obj : error LNK2001: 无法解析的外部符号 "declspec(dllimport) protected: thiscall vtkSmartPointerBase::vtkSmartPointerBase(class vtkObjectBase *,class vtkSmartPointerBase::NoReference const &)" (imp_??0vtkSmartPointerBase@@IAE@PAVvtkObjectBase@@ABVNoReference@@@Z)
>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static class vtkImageData * cdecl vtkImageData::New(void)" (imp_?New@vtkImageData@@SAPAV1@XZ),该符号在函数 "public: static class vtkSmartPointercdecl vtkSmartPointer::New(void)" (?New@?$vtkSmartPointer@VvtkImageData@@@@SA?AV1@XZ) 中被引用
>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "declspec(dllimport) public: class vtkImageData * thiscall vtkImageAlgorithm::GetOutput(void)" (imp_?GetOutput@vtkImageAlgorithm@@QAEPAVvtkImageData@@XZ),该符号在函数 "public: void thiscall CvtkSDIDoc::OnFileOpen(void)" (?OnFileOpen@CvtkSDIDoc@@QAEXXZ) 中被引用
>vtkSDIDoc.obj : error LNK2019: 无法解析的外部符号 "declspec(dllimport) public: static class vtkJPEGReader * cdecl vtkJPEGReader::New(void)" (imp_?New@vtkJPEGReader@@SAPAV1@XZ),该符号在函数 "public: static class vtkSmartPointercdecl vtkSmartPointer::New(void)" (?New@?$vtkSmartPointer@VvtkJPEGReader@@@@SA?AV1@XZ) 中被引用
>vtkSDIView.obj : error LNK2019: 无法解析的外部符号 "declspec(dllimport) public: static class vtkImageViewer2 * cdecl vtkImageViewer2::New(void)" (imp_?New@vtkImageViewer2@@SAPAV1@XZ),该符号在函数 "public: static class vtkSmartPointercdecl vtkSmartPointer::New(void)" (?New@?$vtkSmartPointer@VvtkImageViewer2@@@@SA?AV1@XZ) 中被引用
>vtkSDIView.obj : error LNK2019: 无法解析的外部符号 "declspec(dllimport) public: static class vtkRenderWindowInteractor * cdecl vtkRenderWindowInteractor::New(void)" (imp_?New@vtkRenderWindowInteractor@@SAPAV1@XZ),该符号在函数 "public: static class vtkSmartPointer __cdecl vtkSmartPointer::New(void)" (?New@?$vtkSmartPointer@VvtkRenderWindowInteractor@@@@SA?AV1@XZ) 中被引用

  首先说明,VTK是PCL所依赖的第三方库开源的可视化工具库。此时,需要把C:\Program Files (x86)\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8目录下的vtk开头的相关*.lib文件通过“项目属性-连接器-输入-附加依赖项”方式添加到工程,但是这样太麻烦,可在“解决方案资源管理器”中的“资源文件”上单击右键-添加-现有项,从而将所有vtk开头的相关*.lib文件添加到工程中。如下图所示:

  3、fatal error C1083: 无法打开包括文件:“vtkCommand.h”: No such file or direct:可在系统环境变量PATH中将VTK的包含目录再增加一层:$(PCL_ROOT)\3rdParty\VTK\include\vtk-5.8。其中PCL_ROOT为PCL安装时设置的系统环境变量,其值为:C:\Program Files (x86)\PCL 1.6.0。

  4、OpenCV和PCL同时引用了Flann 引起冲突:Opencv+PCL=Flann 冲突?

  5、安装CMake和PCL-1.6.0-AllInOne-msvc2010-win32.exe打算使安装程序自行将路径添加到系统的环境变量PATH时,会弹出失败提示:path too long installer unable to modify path 导致PCL配置失败记。此时可手工将相关路径添加到系统的环境变量PATH中。path too long installer unable to modify path 导致PCL配置失败记

  6、std::max、std::min error C2589: “(”:“::”右边的非法标记,error C2059: 语法错误:“::”

参考链接:

1、OpenCV2.4.13+CUDA8.0+SSBA3.0+VS2010编译安装

2、WIN7(32位)VS2010+openCV 2.4.10+PCL 1.6.0+CUDA 6.5.14+CMake 3.2.1+SSBA-3.0配置

Windows7系统下OpenCV2.4.4+PCL1.6.0+SSBA3.0+VS2010 IDE32环境下编译和安装以实现Sfm和PCL点云数据可视化的更多相关文章

  1. VS2010 C++环境下DLL和LIB文件目录及名称修改

    VS2010 C++环境下DLL和LIB文件目录及名称修改 转自:http://blog.csdn.net/archielau/article/details/8507581 DLL工程,Debug版 ...

  2. 水晶报表在vs2010 WPF环境下的尝试

    原文:水晶报表在vs2010 WPF环境下的尝试 由于VS2010没有集成水晶报表组件,尝试前必须先安装 水晶报表 for VS2010,若机器未安装的可点击这里>>>下载安装 新建 ...

  3. 【原创】Linux环境下的图形系统和AMD R600显卡编程(1)——Linux环境下的图形系统简介

    Linux/Unix环境下最早的图形系统是Xorg图形系统,Xorg图形系统通过扩展的方式以适应显卡和桌面图形发展的需要,然而随着软硬件的发展,特别是嵌入式系统的发展,Xorg显得庞大而落后.开源社区 ...

  4. Linux环境下的图形系统和AMD R600显卡编程(1)——Linux环境下的图形系统简介

    转:https://www.cnblogs.com/shoemaker/p/linux_graphics01.html Linux/Unix环境下最早的图形系统是Xorg图形系统,Xorg图形系统通过 ...

  5. win8.1 vs2010 C++环境下 编译Android Adb.exe

    1 IntelliSense: cannot open source file "usb100.h"  adb 这是因为没有安装sdk造成的.win7下安装wdk,vs2010能够 ...

  6. VS2010 C++环境下DLL和LIB文件的生成与调试

    利用VS2010工具,调试DLL文件的方法现总结如下: 在一个解决方案中生成两个工程,假设MYDLL和MYDLG两个工程,前者是DLL工程,后者DLG调用前边的DLL工程.设置如下: 目录如下:图,本 ...

  7. VS2010 C++环境下DLL和LIB文件的生成与调试 备忘

    利用VS2010工具,调试DLL文件的方法现总结如下: 在一个解决方案中生成两个工程,假设MYDLL和MYDLG两个工程,前者是DLL工程,后者DLG调用前边的DLL工程.设置如下: 目录如下:图,本 ...

  8. 【转】Oracle RAC 环境下的连接管理

    文章转自:http://www.oracle.com/technetwork/cn/articles/database-performance/oracle-rac-connection-mgmt-1 ...

  9. Redis学习——Linux环境下Redis的安装(一)

    一.关于Redis Redis最为一款开源的key-value存储系统,自推出到现在一直受到编程人员的喜爱.它支持存储多种value类型,String .List .Set .Zset .Hash.这 ...

随机推荐

  1. UI-12组结对编程作业总结

    UI-12组结对编程作业总结 源码Github地址 https://github.com/tilmto/TILMTO/tree/master/Arithmetic 作业摘要 本次结对编程作业分为以下两 ...

  2. 记一次Full GC问题的排查

    今天看到监控平台显示项目的Full GC次数过多,查看了一下监控曲线,如下图,发现发生的时间点基本上都是在上午十点之后,到下午五点. 分析:考虑到业务形态,开始初步怀疑是访问人数增多引起的虚拟机内存不 ...

  3. Javascript 随机数函数 学习之一:产生服从均匀分布随机数

    大家都知道Math.random是 javascript 中返回伪随机数的函数,但查看 MDN, The Math.random() function returns a floating-point ...

  4. sql 获取批处理信息的脚本(优化器在处理批处理时所发生的优化器事件)

    --获取批处理信息的脚本(优化器在处理批处理时所发生的优化器事件) SET NOCOUNT ON; DBCC FREEPROCCACHE; --清空过程缓存 GO --使用tempdb..Optsta ...

  5. <Android 应用 之路> 干货集中营 ~ GankIOClient

    简介 利用干货集中营 , daimajia和他的小伙伴给我们开发者带来的福利开发的一个干货集中营客户端,主要功能在阅读干货上. Github地址: https://github.com/onlylov ...

  6. flutter .g文件生成不了

    [SEVERE] Conflicting outputs were detected and the build is unable to prompt for permission to remov ...

  7. Android Relative Layout 安卓相对布局详解

    思维导图可在幕布找到 1. 基础 如果在相对布局里,控件没有指明相对位置,则默认都是在相对布局的左上角: <TextView android:layout_width="wrap_co ...

  8. OpenCV 图片美化

    1.彩色直方图 def ImgHist(image,type): color = (255,255,255) windowName='gray' if type==31: color=(255,0,0 ...

  9. show命令

    数据库 show databases; 表 show tables; show tables in xxdb; show tables 'a*'; tblproperties show tblprop ...

  10. Expo大作战(十一)--expo中的预加载和缓存资产(Preloading & Caching Assets),expo中的图标 (Icon)

    简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...