我正在尝试通过替换
来提高代码的性能cv::namedWindow("Display frame", WINDOW_NORMAL);
与
cv::namedWindow("Display frame", WINDOW_OPENGL);
进行更改后,我收到以下错误:
No OpenGL support (Library was built without OpenGL support) in cvNamedWindow, file C:\tmp\opencv32\sources\modules\highgui\src\window_w32.cpp, line 764
所以现在我知道我的OpenCV版本不支持OpenGL。我见过很多关于如何使用OpenGL支持构建OpenCV的解决方案。但我不想重建OpenCV,因为它是我正在使用的更大SDK的一部分,当前版本的配置选项非常具体。对我来说,以某种方式将OpenGL的支持添加到当前版本会更容易。这有可能,怎么样?
更新:我查看了用于构建顶级SDK的CMakeLists.txt文件。随SDK附带的openCV文件夹的CMakeLists.txt文件如下所示:
# Add target for OpenCV
add_library(OpenCV INTERFACE)
target_include_directories(OpenCV INTERFACE opencv-3.2/include)
set(OPENCV_LIB ${CMAKE_CURRENT_SOURCE_DIR}/opencv-3.2/library)
target_link_libraries(OpenCV INTERFACE
${OPENCV_LIB}/opencv_core320.lib
${OPENCV_LIB}/opencv_highgui320.lib
${OPENCV_LIB}/opencv_imgcodecs320.lib
${OPENCV_LIB}/opencv_imgproc320.lib)
file(GLOB OPENCV_DLL "opencv-3.2/binary/*.dll")
file(COPY ${OPENCV_DLL} DESTINATION ${CMAKE_BINARY_DIR}/Release)
我对CMake不太熟悉,所以如果我错了请纠正我,但我认为这意味着预构建的SDK包含已经构建的openCV,而CMakeLists.txt只是将已经构建的openCV库添加到最终的SDK构建。现在,有了这些信息,有没有办法添加openGL支持?