OpenCV默认情况下是不支持OpenGL的,如果要使OpenCV支持OpenGL,则需要重编译,具体步骤如下:

注意事项:从The OpenCV Reference ManualOpenCV参考手册 opencv2refman.pdf [点击下载]228页来看,OpenGL仅支持32位操作系统;

一、准备工作:

(1)下载OpenCV2.4.12 [点击下载] ,并解压到相应路径,本文解压在 D:\opencv-2.4.12;

(2)下载CMake工具 [点击下载],并安装;

(3)建一个重编译后文件存放文件夹,本文存放在 D:\opencv-2.4.12 build.

二、开始重编译:

(1)打开CMake,设置OpenCV2.4.12源码目录及 OpenCV2.4.12编译存放目录,勾选 Advanced 选项,如图:

(2)点击 ConfigureSpecify the generator for this project 选择对应的 Visual Studio 版本,比如:我电脑装的是 Visual Studio 2013,故选择 Visual Studio 12 2013,如图所示:

然后按 Finish

(3)找到 WHTH_OPENGL ,并打勾,如图:

(4)再次点击 Configure,完成之后点击 Generate,结果如下:

(5)打开 D:\opencv-2.4.12 build,找到 OpenCV.sln 并双击(使用 Visual Studio 打开);

(6)在 Debug 、Win32 环境下,选择 ALL_BUILD,单击右键,选择 生成,如图:

如果提示错误  error LNK1104:无法打开文件“python27_d.lib”,则把 python27_d.lib 下载下来点击打开链接,放在Visual Studio 安装目录下的 VC\lib 文件下即可;然后,重新选择 ALL_BUILD,单击右键,选择 生成即可;

(7)选择 INSTALL,单击右键,选择 生成,如下图:

(8)在 Release、Win32 环境下,重复(6)(7)步;

三、Visual Studio环境配置:

(1)点击 属性管理器,分别打开 Debug | Win32 和Release | Win32 下的Microsoft.Cpp.Win32.user ,通用属性 -> VC++ 目录 -> 包含目录 设置为:

D:\opencv-2.4.12 build\install\include
D:\opencv-2.4.12 build\install\include\opencv
D:\opencv-2.4.12 build\install\include\opencv2

通用属性 -> VC++ 目录 -> 库目录 设置为:

D:\opencv-2.4.12 build\install\x86\vc12\lib

如图:

(2)链接器 -> 输入 ->附加依赖项,Debug 环境配置为:

opencv_calib3d2412d.lib

opencv_contrib2412d.lib

opencv_core2412d.lib

opencv_features2d2412d.lib

opencv_flann2412d.lib

opencv_gpu2412d.lib

opencv_highgui2412d.lib

opencv_imgproc2412d.lib

opencv_legacy2412d.lib

opencv_ml2412d.lib

opencv_nonfree2412d.lib

opencv_objdetect2412d.lib

opencv_ocl2412d.lib

opencv_photo2412d.lib

opencv_stitching2412d.lib

opencv_superres2412d.lib

opencv_ts2412d.lib

opencv_video2412d.lib

opencv_videostab2412d.lib

Release 环境配置为:

opencv_calib3d2412.lib

opencv_contrib2412.lib

opencv_core2412.lib

opencv_features2d2412.lib

opencv_flann2412.lib

opencv_gpu2412.lib

opencv_highgui2412.lib

opencv_imgproc2412.lib

opencv_legacy2412.lib

opencv_ml2412.lib

opencv_nonfree2412.lib

opencv_objdetect2412.lib

opencv_ocl2412.lib

opencv_photo2412.lib

opencv_stitching2412.lib

opencv_superres2412.lib

opencv_ts2412.lib

opencv_video2412.lib

opencv_videostab2412.lib

kernel32.lib

user32.lib

gdi32.lib

winspool.lib

comdlg32.lib

advapi32.lib

shell32.lib

ole32.lib

oleaut32.lib

uuid.lib

odbc32.lib

odbccp32.lib

如图:

(3)至此配置完成。

四、编译时常见错误:

(1)若报如下错误:

  1. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  2. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  3. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  4. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  5. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  6. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  7. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  8. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  9. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  10. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  11. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  12. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  13. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  14. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  15. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  16. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  17. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  18. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  19. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  20. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  21. 错误 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  22. 错误 error C2371: APIENTRY”: 重定义;不同的基类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  23. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  24. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  25. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  26. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  27. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  28. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  29. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  30. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  31. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  32. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  33. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  34. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  35. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  36. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  37. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  38. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  39. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  40. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  41. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  42. 错误 error C2182: APIENTRY”: 非法使用“void”类型 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  43. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glColor3dv”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  44. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glColor3d”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  45. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glColor3bv”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  46. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glColor3b”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  47. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glClipPlane”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  48. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glClearStencil”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  49. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glClearIndex”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  50. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glClearDepth”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  51. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glClearColor”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  52. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glClearAccum”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  53. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glClear”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  54. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glCallLists”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  55. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glCallList”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  56. 错误 error C2146: 语法错误: 缺少“;”(在标识符“GLboolean”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  57. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glBlendFunc”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  58. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glBitmap”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  59. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glBindTexture”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  60. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glBegin”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  61. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glArrayElement”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  62. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glAreTexturesResident”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  63. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glAlphaFunc”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  64. 错误 error C2146: 语法错误: 缺少“;”(在标识符“glAccum”的前面) c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  65. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  66. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  67. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  68. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  69. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  70. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  71. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  72. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  73. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  74. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  75. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  76. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  77. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  78. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  79. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  80. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  81. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  82. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  83. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  84. 错误 error C2144: 语法错误:“void”的前面应有“;” c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  85. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  86. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  87. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  88. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  89. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  90. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  91. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  92. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  93. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  94. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  95. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  96. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  97. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  98. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  99. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  100. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  101. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  102. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  103. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  104. 错误 error C2086: int WINGDIAPI”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  105. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  106. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  107. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  108. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  109. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  110. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  111. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  112. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  113. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  114. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  115. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  116. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  117. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  118. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  119. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  120. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  121. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  122. 错误 error C2086: int APIENTRY”: 重定义 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest
  123. 错误 error C1003: 错误计数超过 ;正在停止编译 c:\program files\windows kits\8.1\include\um\gl\gl.h opengltest

则在 GL.h 文件下,添加 #include <windows.h> 头文件即可;

如图:

(2)若报如下错误:

  1. 错误 error LNK2019: 无法解析的外部符号 __imp__glRectf@,该符号在函数 "void __cdecl onDraw(void *)" (?onDraw@@YAXPAX@Z) 中被引用 F:\VS2013 program\opengltest\opengltest\opengltest.obj opengltest
  2. 错误 error LNK2019: 无法解析的外部符号 __imp__glFlush@,该符号在函数 "void __cdecl onDraw(void *)" (?onDraw@@YAXPAX@Z) 中被引用 F:\VS2013 program\opengltest\opengltest\opengltest.obj opengltest
  3. 错误 error LNK2019: 无法解析的外部符号 __imp__glColor3f@,该符号在函数 "void __cdecl onDraw(void *)" (?onDraw@@YAXPAX@Z) 中被引用 F:\VS2013 program\opengltest\opengltest\opengltest.obj opengltest
  4. 错误 error LNK2019: 无法解析的外部符号 __imp__glClearColor@,该符号在函数 "void __cdecl onDraw(void *)" (?onDraw@@YAXPAX@Z) 中被引用 F:\VS2013 program\opengltest\opengltest\opengltest.obj opengltest
  5. 错误 error LNK2019: 无法解析的外部符号 __imp__glClear@,该符号在函数 "void __cdecl onDraw(void *)" (?onDraw@@YAXPAX@Z) 中被引用 F:\VS2013 program\opengltest\opengltest\opengltest.obj opengltest
  6. 错误 error LNK1120: 个无法解析的外部命令 F:\VS2013 program\opengltest\Debug\opengltest.exe opengltest
则在 main 函数所在文件下添加 #pragma comment(lib,"opengl32.lib") 即可;
 
(3)若编译成功,在 cmd终端 运行时报错为“OpenCV Error: No OpenGL support (Library was built without OpenGL support) ……”,则把编译前的文件删除即可,即把 D:\opencv-2.4.12 文件夹删除即可;
 

[转]OpenCV2.4.12 开启OpenGL启用三维可视化支持的更多相关文章

  1. Ubuntu 12.04 Virtualbox 启用USB 设备支持

    转载自:http://www.cnblogs.com/ericsun/archive/2013/06/10/3130679.html 具体步骤在上面的链接中 今天在ubuntu下安装了Virtualb ...

  2. 在Ubuntu 12.04 上为Virtualbox 启用USB 设备支持

    在Ubuntu 12.04 上为Virtualbox 启用USB 设备支持  http://www.cnblogs.com/ericsun/archive/2013/06/10/3130679.htm ...

  3. Vs2013+opencv2.4.12+x64用VideoCapture无法打开视频

    环境变量中匹配的是x86的opencv_ffmpeg244.dll,与项目不匹配,需在项目exe文件同目录下添加X:\opencv\opencv2.4.12\build\x64\vc12\bin\op ...

  4. 基于OpenGL的三维曲面动态显示实现

    在使用Visual C++的MFC AppWizard建立应用程序框架后,生成了多个类,与OpenGL编程相关的类是视图类,主要的显示任务都在其中完成. 1.基于OpenGL绘图的基本设置 1.1 设 ...

  5. 在qt的QOpenGLWidget开启opengl的抗锯齿

    在QOpenGLWidget的构造函数添加下面几句代码即可 QSurfaceFormat surfaceFormat; surfaceFormat.setSamples();//多重采样 setFor ...

  6. ubuntu14.04上Virtualbox安装win7(使用Ghost镜像安装,启用USB设备支持,设置共享目录)

    由于某些软件只有windows版本,于是只好安装个虚拟机win7 /**************************安装*************************************/ ...

  7. 科学计算三维可视化---TVTK入门(安装与测试)

    推文:http://docs.huihoo.com/scipy/scipy-zh-cn/tvtk_intro.html 推文:http://code.enthought.com/pages/mayav ...

  8. Python科学计算三维可视化(整理完结)

    中国MOOC<Pyhton计算计算三维可视化>总结 课程url:here ,教师:黄天宇,嵩天 下文的图片和问题,答案都是从eclipse和上完课后总结的,转载请声明. Python数据三 ...

  9. C# WPF 嵌入网页版WebGL油田三维可视化监控

    0x00 楔子 最近做的一个项目,是一个油田三维可视化监控的场景编辑和监控的系统,和三维组态有些类似,不过主要用于油田上. 效果如下图所示: 首先当然是上模型,设计人员跟进. 有了相关的模型,使用我们 ...

随机推荐

  1. 在Linux上实现SVN用户密码自助修改

    1.首先本文是在一篇百度经验的基础上修改而成,将网址记录上,以示尊重. https://jingyan.baidu.com/article/48b37f8dd4bbb31a646488c2.html ...

  2. Codeforces339D(SummerTrainingDay06-A 线段树)

    D. Xenia and Bit Operations time limit per test:2 seconds memory limit per test:256 megabytes input: ...

  3. HDU2859(KB12-Q DP)

    Phalanx Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Su ...

  4. Python 进阶必备函数

    1. lambda 表达式 匿名函数(英语:anonymous function)是指一类无需定义标识符(函数名)的函数.通俗来说呢,就是它可以让我们的函数,可以不需要函数名. 正常情况下,我们定义一 ...

  5. Dynamics 365Online Server-Side OAuth身份认证

    在上篇演示了在html页面中通过调用online的OAuth身份验证后再通过web api取10条客户数据并展示,本篇继续讲述如何在server-side程序中调用online的OAuth认证再通过w ...

  6. 前端开发笔记(4)css基础(下)

    标签定位 相对定位 相对定位是用来微调元素位置的,让元素相对于原来的位置进行调整. <head> <meta http-equiv="Content-Type" ...

  7. Android Studio 自动更新失败解决办法

    Check Update一直提示Connection failed. Please check your network connection and try again,开始以为是由于G*W在捣乱, ...

  8. Android应用程序启动过程(一)总结

    一.App启动方式 1,冷启动 冷启动:当启动应用时,后台没有该应用的进程,这时系统会重新创建一个新的进程分配给该应用. 冷启动的特点:因为系统会重新创建一个新的进程分配给它,所以会创建和初始化App ...

  9. 【jdk源码3】HashMap源码学习

    可以毫不夸张的说,HashMap是容器类中用的最频繁的一个,而Java也对它进行优化,在jdk1.7及以前,当将相同Hash值的对象以key的身份放到HashMap中,HashMap的性能将由O(1) ...

  10. Android IOC注解库EasyUI

    EasyUI介绍 1.使用反射机制和注解实现类似于butterknife的IOC框架 2.快速的findViewById和OnClick 3.扩展了click时无网络监测 4.扩展了快速点击监测 使用 ...