1

我从 opencv 网站下载了 OpenCV 2.4.6。为了避免我之前提到的问题,我决定编译 OpenCV 库。在CMake和Mingw32-make之后,编译成功。但是,一个简单的测试程序在显示 jpeg 图像时会崩溃。这是我的 .pro 和 main.cpp 文件:

.pro:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

#INCLUDEPATH += D:/opencv2.4.6/build/include
INCLUDEPATH += D:/opencv2.4.6/release/install/include
LIBS += -LD:/opencv2.4.6/release/install/bin \
    -lopencv_core246 \
    -lopencv_highgui246 \
    -lopencv_imgproc246 \
    -lopencv_features2d246 \
    -lopencv_calib3d246

主.cpp:

int main() {
    Mat input = imread("Z:/1.jpg");
    cv::imshow("1.jpg",input);
}

这是问题所在:

OpenCV Error: OpenGL API call (Can't load OpenGL extension [glBindBuffer]) in In
tGetProcAddress, file ..\..\..\modules\core\src\gl_core_3_1.cpp, line 141
terminate called after throwing an instance of 'cv::Exception'
  what():  ..\..\..\modules\core\src\gl_core_3_1.cpp:141: error: (-219) Can't lo
ad OpenGL extension [glBindBuffer] in function IntGetProcAddress


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

我以前从未遇到过这样的问题。这有点奇怪。我应该怎么做才能摆脱这个问题?

4

1 回答 1

0

尝试编译 OpenCV 后,似乎应该取消选中 WITH_OPENGL。现在程序运行正常。

于 2013-10-11T12:21:59.337 回答