Last active
November 27, 2025 19:36
-
-
Save themultiplexer/b5c322e9001546bb0b6b1e729a8a4bc2 to your computer and use it in GitHub Desktop.
Compile OpenCV 4.8 with OpenGL+OpenCL support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install some libraries (might not be all) | |
| sudo apt install libeigen3-dev libopengl-dev libgtk2.0-dev libgtkglext1-dev libvtk9-dev | |
| git clone https://github.com/opencv/opencv | |
| cd opencv | |
| git checkout 4.8.0 | |
| git clone https://github.com/opencv/opencv_contrib | |
| cd opencv_contrib | |
| git checkout 4.8.0 | |
| cd .. | |
| mkdir build | |
| cd build | |
| cmake .. -D CMAKE_BUILD_TYPE=DEBUG \ | |
| -D WITH_LIBV4L=ON \ | |
| -D WITH_OPENCL=ON \ | |
| -D BUILD_opencv_python3=ON \ | |
| -D BUILD_opencv_python2=OFF \ | |
| -D BUILD_opencv_java=OFF \ | |
| -D BUILD_opencv_stitching=OFF \ | |
| -D WITH_GSTREAMER=OFF \ | |
| -D OpenGL_GL_PREFERENCE=LEGACY \ | |
| -D WITH_GTK=ON \ | |
| -D WITH_GTK_2_X=ON \ | |
| -D WITH_OPENGL=ON \ | |
| -D BUILD_TESTS=OFF \ | |
| -D BUILD_PERF_TESTS=OFF \ | |
| -D BUILD_EXAMPLES=OFF \ | |
| -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules | |
| make -j$(nproc --ignore=2) | |
| sudo make Install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment