What OpenCV is
OpenCV is an open-source software library for image processing and computer vision. The name stands for Open Source Computer Vision Library. It started as an Intel research project in 1999, had its first public release in 2000 and is now maintained by the non-profit OpenCV.org with contributions from thousands of developers.
The core is written in C++ for speed, with official bindings for Python and Java. Most people meet it as the cv2 module in Python, where an image is simply a NumPy array, so OpenCV works directly alongside NumPy, PyTorch and the rest of the Python data stack. Community bindings exist for other languages, including Rust and C#.
OpenCV is free for commercial use. Releases from 4.5.0 in 2020 onwards use the Apache 2.0 licence; earlier versions used the 3-clause BSD license. Neither asks you to publish your own code.
What OpenCV can do
OpenCV is split into modules, and most projects use only a few of them. The main ones cover the whole path from camera to result.
-
//
Image processing (imgproc). Resizing, color conversion, filtering, thresholding, edge detection, contours and geometric transforms: the clean-up work that comes before any measurement or AI model.
-
//
Video input and output (videoio, imgcodecs). Reading and writing image files, video files and live camera streams through back ends such as FFmpeg, GStreamer, V4L2 on Linux and Media Foundation on Windows.
-
//
Features and 3D (features2d, calib3d). Keypoint detection and matching, camera calibration, lens distortion correction, stereo depth and pose estimation for measurement and robot guidance.
-
//
Detection and tracking (objdetect, video). QR code and barcode reading, classic cascade detectors, optical flow and object trackers.
-
//
Deep learning inference (dnn). Loads trained networks in ONNX, TensorFlow, Caffe and Darknet formats and runs them on the CPU, or on a GPU through CUDA or OpenVINO back ends.
OpenCV vs PyTorch, YOLO and other vision tools
OpenCV is often compared with deep learning tools, but in practice they do different jobs and usually sit in the same pipeline. OpenCV handles the pixels before and after the model; the framework trains the model; an inference engine runs it quickly on the target hardware.
| Tool | What it is | Trains models? | Typical job in a vision pipeline |
|---|---|---|---|
| OpenCV | Computer vision and image processing library | Classic machine learning only | Capture, pre-processing, measurement, drawing results |
| PyTorch / TensorFlow | Deep learning frameworks | Yes | Training and exporting neural networks |
| YOLO | Family of object detection models | Trained in PyTorch | Detecting and locating objects in each frame |
| TensorRT / OpenVINO | Inference engines from NVIDIA and Intel | No | Running trained models fast on GPUs, NPUs and CPUs |
| NVIDIA VPI | Accelerated vision library for Jetson | No | Offloading filters and warps to the GPU and vision accelerators |
A typical edge pipeline reads frames with OpenCV, resizes and normalises them, passes them to a model optimized with TensorRT for faster inference, then uses OpenCV again to draw boxes, measure parts or write video.
How to install OpenCV
For Python, the quickest route is pip. There are four official packages, and you should install only one of them in a given environment, because they all provide the same cv2 module.
opencv-python: the main modules, with window and GUI functions.opencv-contrib-python: the main modules plus the extra contributed modules.opencv-python-headlessandopencv-contrib-python-headless: the same without GUI functions, for servers, containers and embedded systems with no display.
On Linux, the distribution package (python3-opencv on Ubuntu and Debian) is another option. To use CUDA acceleration or a custom GStreamer build, you compile OpenCV from source with CMake, because the pip packages do not include CUDA.
The system requirements are modest. OpenCV runs on 64-bit Windows, Linux and macOS, on Android and iOS, and on x86 and Arm processors, from a Raspberry Pi-class board upwards. What sets the hardware need is the workload: resolution, frame rate, number of cameras and whether a neural network runs on every frame.
Camera input and real-time video
OpenCV reads cameras through the VideoCapture class and writes video with VideoWriter. A USB webcam usually opens with one line of code, because it is a standard UVC device. Industrial cameras often need one more step.
GigE Vision and USB3 Vision cameras are normally driven through the manufacturer’s SDK or a GenICam library, and the frames are handed to OpenCV as arrays. On NVIDIA Jetson, MIPI and GMSL cameras are read through a GStreamer pipeline, which OpenCV can open directly when it is built with GStreamer support.
Whether OpenCV runs in real time depends on the resolution, the algorithm and the hardware. Simple operations on a 1080p frame typically take a few milliseconds on a current processor, while a deep learning model on every frame usually needs a GPU or NPU. OpenCV’s CUDA modules and its transparent OpenCL acceleration help, and on Jetson NVIDIA’s VPI library can take over the heaviest filtering steps.
OpenCV on Jetson and industrial edge computers
Most production vision systems run OpenCV on an edge computer next to the cameras rather than in the cloud, to keep latency low and avoid sending raw video over the network. NVIDIA JetPack includes OpenCV, but the bundled build is typically compiled without CUDA, so teams that want the CUDA modules build their own. Our Jetson Orin computers and x86 edge AI computers run both kinds of build.
-
//
Inspection and measurement. Finding edges, contours and blobs to check that parts are present, the right size and correctly placed.
-
//
Code reading and traceability. Reading QR codes and barcodes on parts, labels and packaging.
-
//
Robot guidance. Camera calibration and pose estimation so a robot knows where an object is in its own coordinates.
-
//
Traffic and security. Pre-processing frames for number plate recognition, people counting and video analytics models.
Quick answers on OpenCV
OpenCV: common questions
Is OpenCV free?
Yes, including for commercial products. Current versions use the Apache 2.0 license, which allows commercial use and modification without publishing your own source code.
Is OpenCV an AI tool?
Partly. Most of OpenCV is classic image processing with no AI involved, but it includes traditional machine learning and a dnn module that runs trained neural networks.
Is OpenCV still used?
Yes, widely. Deep learning replaced some of its older detectors, but almost every vision pipeline still uses OpenCV or something like it for capture, pre-processing and post-processing.
Which is better, YOLO or OpenCV?
They are not alternatives. YOLO is an object detection model; OpenCV is a library. A common setup uses OpenCV to read and prepare frames and YOLO to detect objects in them.
Does OpenCV support Mask R-CNN?
Yes, through the dnn module. Support for running Mask R-CNN instance segmentation models arrived in the 3.4.3 release in 2018 and remains in OpenCV 4.
What language is OpenCV written in?
C++. The library is written in C++ for speed, and the Python and Java versions are bindings that call the same compiled code.
We supply edge and Jetson computers for vision projects with the operating system, camera drivers and your chosen OpenCV build installed as standard, and validate the cameras before the system ships.