Installation Overview
OpenCV can be installed in two ways: using prebuilt binaries or building from source. This guide covers both methods across different platforms.For most users, especially Python developers, using prebuilt packages (pip, conda, or system package managers) is the quickest way to get started.
Quick Install
For rapid setup, use these package managers:- Python
- Linux
- macOS
- Windows
Building from Source
Building OpenCV from source gives you full control over features, optimizations, and dependencies.Prerequisites
Install Build Tools
Install a C++ compiler and build tools for your platform:Linux:Windows:
- Visual Studio 2015 or later (Community Edition is free)
- Or MinGW-w64 compiler
Download OpenCV Source
Platform-Specific Build Instructions
- Linux
- Windows
- macOS
Configuration Options
Customize your OpenCV build with these CMake options:Common Options
Language-Specific Setup
Python
Verify Python bindings:C++
Create a CMakeLists.txt for your project:Java
Add OpenCV to your Java project:Troubleshooting
CMake cannot find dependencies
CMake cannot find dependencies
Install missing packages or specify paths manually:
Build fails with memory errors
Build fails with memory errors
Reduce parallel jobs:
Python can't find cv2 module
Python can't find cv2 module
Check installation path:Add OpenCV to Python path:
Windows DLL errors
Windows DLL errors
Ensure OpenCV bin directory is in PATH:Copy DLLs to your application directory as a workaround.
Next Steps
Now that OpenCV is installed, you’re ready to write your first computer vision application!Quickstart Guide
Build your first OpenCV application with step-by-step examples
