Skip to main content
OpenCV provides comprehensive support for Linux platforms across multiple architectures including x86, x86_64, ARM, RISC-V, and more.

Quick Start

Get up and running with OpenCV on Linux in a few minutes:
1

Install Dependencies

Install compiler, build tools, and CMake:
2

Download OpenCV

Get the source code from GitHub:
Or download a release archive:
3

Build OpenCV

Configure and compile:
4

Install

Install to system directories (optional):

Compiler Support

OpenCV supports multiple compilers on Linux:
GCC is the default compiler on most Linux systems:

Build System Options

Traditional GNU Make build system:
The -j$(nproc) flag enables parallel compilation using all CPU cores.

Installing Dependencies

Required Dependencies

Optional Dependencies

Cross-Compilation

OpenCV provides toolchain files for cross-compilation to other architectures:

ARM 32-bit (ARMv7)

ARM 64-bit (AArch64)

RISC-V 64-bit

Available toolchain files in platforms/linux/:
  • arm-gnueabi.toolchain.cmake - ARM v7 with hard float
  • aarch64-gnu.toolchain.cmake - ARM 64-bit
  • riscv64-gcc.toolchain.cmake - RISC-V 64-bit (GCC)
  • riscv64-clang.toolchain.cmake - RISC-V 64-bit (Clang)
  • ppc64le-gnu.toolchain.cmake - PowerPC 64-bit little-endian
  • mips64r6el-gnu.toolchain.cmake - MIPS 64-bit

Build Configuration Options

Common CMake Options

Minimal Build for Embedded Systems

GPU Acceleration

Installation

System-Wide Installation

System-wide installation requires root privileges and may conflict with distribution packages. Consider using a custom prefix instead.

Custom Installation Directory

Verification

Verify your OpenCV installation:
1

Check Installed Files

2

Test with Python

3

Build Info

Distribution-Specific Notes

Troubleshooting

Install development packages for missing dependencies:
Clean and rebuild:
Ensure Python can find the cv2 module:

Next Steps

CMake Configuration

Explore all CMake configuration options

Getting Started

Write your first OpenCV application

Cross-Compilation

Build for embedded systems

GPU Acceleration

Enable CUDA and OpenCL support