Skip to main content
OpenCV is organized into a set of modules, each providing specific functionality for computer vision tasks. Understanding this modular structure helps you choose the right tools for your applications.

Core Modules

core

Fundamental data structures (Mat), basic operations, and utilities

imgproc

Image processing functions including filtering, transforms, and feature detection

imgcodecs

Image file reading and writing with support for multiple formats

videoio

Video capture and writing interfaces for cameras and video files

highgui

High-level GUI functions for window management and user interaction

video

Video analysis including motion tracking and background subtraction

calib3d

Camera calibration and 3D reconstruction algorithms

Module Dependencies

OpenCV modules are designed with clear dependencies to maintain modularity:
The core module is the foundation - all other modules depend on it for basic data structures and operations.

Module Descriptions

Core Module

The backbone of OpenCV providing:
  • Mat class for n-dimensional arrays
  • Basic array operations (add, subtract, multiply)
  • Mathematical functions
  • XML/YAML persistence
  • Utility functions and system information

Image Processing (imgproc)

Comprehensive image processing capabilities:
  • Linear and non-linear filtering
  • Geometric transformations
  • Color space conversions
  • Histograms
  • Structural analysis and shape descriptors
  • Motion analysis and object tracking
  • Feature detection

Image Codecs (imgcodecs)

Image I/O operations:
  • Support for JPEG, PNG, TIFF, WebP, AVIF, and more
  • Image reading with imread()
  • Image writing with imwrite()
  • Animation support (GIF, AVIF, APNG)
  • Metadata handling (EXIF, XMP, ICC)

Video I/O (videoio)

Video capture and writing:
  • VideoCapture class for reading from cameras or files
  • VideoWriter class for creating video files
  • Multiple backend support (FFmpeg, GStreamer, DirectShow)
  • Audio stream support
  • Hardware acceleration options

High-Level GUI (highgui)

User interface utilities:
  • Window creation and management
  • Image display with imshow()
  • Keyboard and mouse event handling
  • Trackbars for interactive parameter adjustment
  • OpenGL integration support

Video Analysis (video)

Advanced video processing:
  • Optical flow (Lucas-Kanade, Farneback)
  • Object tracking (MeanShift, CamShift)
  • Background subtraction (MOG2, KNN)
  • Motion analysis algorithms

Camera Calibration (calib3d)

3D vision and calibration:
  • Camera calibration (intrinsic and extrinsic parameters)
  • Stereo calibration and rectification
  • 3D reconstruction
  • Pose estimation
  • Homography computation

Choosing the Right Module

Use imgproc for:
  • Filtering and smoothing images
  • Edge detection
  • Color transformations
  • Geometric transformations (resize, rotate)
  • Contour detection

Getting Started

To use OpenCV modules in your code:
#include <opencv2/core.hpp>        // Core functionality
#include <opencv2/imgproc.hpp>     // Image processing
#include <opencv2/imgcodecs.hpp>   // Image I/O
#include <opencv2/highgui.hpp>     // GUI functions
#include <opencv2/videoio.hpp>     // Video I/O
#include <opencv2/video.hpp>       // Video analysis
#include <opencv2/calib3d.hpp>     // Calibration and 3D

using namespace cv;

Next Steps

Explore Core Module

Learn about Mat and fundamental operations

Image Processing

Discover filtering and transformation functions

Quick Start Guide

Build your first OpenCV application

API Reference

Browse the complete API documentation