Delphi-OpenCV
June 17, 2026 ยท View on GitHub
A comprehensive port of the OpenCV (Open Source Computer Vision Library) v2.4.13 to Delphi and FreePascal (FPC). This library enables object pascal developers to leverage computer vision algorithms, image/video processing tools, and FFMPEG integration directly in their applications.
๐ Key Features
- Direct OpenCV Bindings: Direct access to OpenCV C/C++ APIs (v2.4.13) from Delphi code.
- FFMPEG Integration: IP camera / RTSP streaming via Delphi-FFMPEG (
rtpFFMPEG,TocvFFMpegIPCamSource) on Win32 and Win64. - Cross-Framework UI: Components and views ready for both VCL and FireMonkey (FMX) platforms.
- Rich Samples Collection: Ready-to-run examples demonstrating object tracking, camera captures, face detection (Haar cascades), motion detection, and OpenGL overlays.
๐ Prerequisites & Requirements
| Dependency | Version | Description | Download |
|---|---|---|---|
| OpenCV DLLs | 2.4.13.6 | opencv_*2413.dll / *2413d.dll (Win32) | OpenCV 2.4.13.6 release |
| VC++ Redistributable | 2015 (VC14) | msvcp140.dll, vcruntime140.dll, โฆ | Microsoft VC++ 2015 Redistributable |
| FFmpeg DLLs | see Delphi-FFMPEG | Shared libs for rtpFFMPEG / IP camera (Win32 & Win64) | Delphi-FFMPEG script, BtbN Win64, defisym Win32 |
| SDL | 1.2 & 2.0 | SDL.dll, SDL2.dll for some video examples | SDL 1.2, SDL2 releases |
| JEDI | submodule | jedi.inc required by source/OpenCV.inc | project-jedi/jedi |
| Delphi-FFMPEG | submodule / junction | Pascal FFmpeg bindings (libav*.pas) | Laex/Delphi-FFMPEG โ see setup below |
Note: The
redist/folder contains onlyreadme.mdstubs (ffmpeg,SDL,VC14) with download links. Runtime DLLs are not included in the repository.
๐ Delphi-FFMPEG: submodule or development junction
All projects reference Delphi-FFMPEG/source inside this repository (<PROJECT_ROOT>/Delphi-FFMPEG/).
Standard setup (GitHub clone)
git clone --recurse-submodules https://github.com/Laex/Delphi-OpenCV.git
cd Delphi-OpenCV
or after a plain clone:
InitDelphiFFMPEG.cmd
This initializes jedi and Delphi-FFMPEG git submodules.
Development setup (local Delphi-FFMPEG repo)
If you maintain FFmpeg bindings in a separate clone (e.g. D:\Work\Delphi\Delphi-FFMPEG), place it as a sibling of this repo or set a custom path:
Delphi/
โโโ Delphi-FFMPEG/ โ your working clone
โโโ OpenCV/
โโโ Delphi-OpenCV/ โ this repository
Run from <PROJECT_ROOT>:
InitDelphiFFMPEG.cmd
The script creates a directory junction Delphi-FFMPEG โ ..\..\Delphi-FFMPEG when that folder contains source/. Projects keep using Delphi-FFMPEG/source โ no path changes needed.
Custom path: copy InitDelphiFFMPEG.local.cmd.example to InitDelphiFFMPEG.local.cmd and set FFMPEG_DEV_PATH.
Manual junction:
mklink /J Delphi-FFMPEG D:\Work\Delphi\Delphi-FFMPEG
๐ ๏ธ Installation Guide
Step 1: Clone and run setup
git clone https://github.com/Laex/Delphi-OpenCV.git
cd Delphi-OpenCV
InitDelphiFFMPEG.cmd
Step 2: Configure Delphi Library Paths
Add in Tools โ Options โ Language โ Delphi โ Library โ Library path:
<PROJECT_ROOT>/source
<PROJECT_ROOT>/source/opengl
<PROJECT_ROOT>/source/sdl
<PROJECT_ROOT>/source/sdl2
<PROJECT_ROOT>/packages
<PROJECT_ROOT>/resource
<PROJECT_ROOT>/resource/facedetectxml
<PROJECT_ROOT>/jedi
<PROJECT_ROOT>/Delphi-FFMPEG/source
Note:
opencv_cpp_classesis archival only. For OpenCV C++ / 5.x use Delphi-OpenCV5.
Step 3: Set up runtime DLLs
| DLL group | Source |
|---|---|
| OpenCV 2.4.13 | OpenCV 2.4.13.6 |
| VC++ 2015 | VC++ 2015 |
| FFmpeg | Delphi-FFMPEG download script |
| SDL | SDL 1.2, SDL2 |
Copy DLLs next to your .exe or onto PATH.
Step 4: Verify configuration
Build and run <PROJECT_ROOT>/CheckCVDep/CheckCVDep.dproj.
Step 5: Install Delphi packages
Open packages/<your Delphi version>/ and install in order:
rtpFFMPEG.dpkrclVCLOpenCV.dpkrclFMXOpenCV.dpkdclVCLOpenCV.dpkdclFMXOpenCV.dpk
๐ Directory Structure
<PROJECT_ROOT>
โโโ Delphi-FFMPEG # Submodule, or junction to your dev clone
โโโ jedi # JEDI submodule
โโโ packages # Delphi IDE packages (D2010โD13)
โโโ samples # Demo projects
โโโ source # OpenCV 2.4 C API bindings
โโโ opencv_cpp_classes # Archival C++ experiment (see folder README.md)
๐ Examples & Demos
samples/LibDemo/LibDemo.groupprojโ basic OpenCV functions and bindingssamples/MultiDemo/MultiDemo.groupprojโ video processing, motion detectionsamples/VCLDemo/VCLDemo.groupprojโ VCL visual wrapperssamples/Components/ComponentsDemo.groupprojโ IDE componentsDelphi-FFMPEG/examples/Examples.groupprojโ low-level FFmpeg API samples
For OpenCV C++ / 5.x see Delphi-OpenCV5.
๐ฅ Contributors
- Laentir Valetov (Lead Contributor) โ laex@bk.ru
- Mikhail Grigorev โ sleuthhound@gmail.com
๐ License
This project is licensed under the Mozilla Public License Version 1.1 (MPL 1.1). See Mozilla MPL 1.1.