Delphi-OpenCV
Project Delphi-OpenCV. Translation of OpenCV library header files in Delphi
- Active · last change 6-17-2026
- ★ 542 on GitHub
README
Delphi-OpenCV
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][4] |
| VC++ Redistributable | 2015 (VC14) | msvcp140.dll, vcruntime140.dll, … |
[Microsoft VC++ 2015 Redistributable][2] |
| FFmpeg DLLs | see Delphi-FFMPEG | Shared libs for rtpFFMPEG / IP camera (Win32 & Win64) |
[Delphi-FFMPEG script][7], [BtbN Win64][8], [defisym Win32][11] |
| SDL | 1.2 & 2.0 | SDL.dll, SDL2.dll for some video examples |
[SDL 1.2][3], [SDL2 releases][9] |
| JEDI | submodule | jedi.inc required by source/OpenCV.inc |
[project-jedi/jedi][10] |
| Delphi-FFMPEG | submodule / junction | Pascal FFmpeg bindings (libav*.pas) |
[Laex/Delphi-FFMPEG][6] — 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-OpenCVor after a plain clone:
InitDelphiFFMPEG.cmdThis 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 repositoryRun from <PROJECT_ROOT>:
InitDelphiFFMPEG.cmdThe 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.cmdStep 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/sourceNote:
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][4] |
| VC++ 2015 | [VC++ 2015][2] |
| FFmpeg | [Delphi-FFMPEG download script][7] |
| SDL | [SDL 1.2][3], [SDL2][9] |
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.
[2]: https://www.microsoft.com/en-us/download/details.aspx?id=48145 [3]: https://www.libsdl.org/download-1.2.php [4]: https://github.com/opencv/opencv/releases/tag/2.4.13.6 [6]: https://github.com/Laex/Delphi-FFMPEG [7]: https://github.com/Laex/Delphi-FFMPEG/blob/main/bin/download_ffmpeg_dll.ps1 [8]: https://github.com/BtbN/FFmpeg-Builds/releases [9]: https://github.com/libsdl-org/SDL/releases [10]: https://github.com/project-jedi/jedi [11]: https://github.com/defisym/FFmpeg-Builds-Win32

