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.
- Direct OpenCV Bindings: Direct access to OpenCV C/C++ APIs (v2.4.13) from Delphi code.
- FFMPEG Integration: Powerful video parsing and streaming support using the Delphi-FFMPEG engine.
- 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.
To compile packages and run samples, you need the following dependencies:
| Dependency | Required Version | Description | Source / Link |
|---|---|---|---|
| VC++ Redistributable | 2015 (VC14) | Required for OpenCV DLLs (msvcp140.dll, msvcp140d.dll) |
Included in redist/VC14 or Microsoft Official |
| FFMPEG DLLs | v4.2.1 | Shared FFMPEG libraries for Windows | Included in redist/ffmpeg or ffbinaries |
| OpenCV DLLs | v2.4.13.6 | Dynamic link libraries (*2413.dll, *2413d.dll) |
Download from OpenCV Releases |
| SDL Libraries | v1.2 & v2.0 | Simple DirectMedia Layer (required for FFMPEG rendering examples) | Included in redist/SDL or libsdl.org |
Clone the repository recursively to get all modules:
git clone https://github.com/Laex/Delphi-OpenCV.gitThen, run InitDelphiFFMPEG.cmd located in the root directory to automatically initialize and pull the Delphi-FFMPEG submodule.
(If the initialization script fails, you can clone it manually into the <PROJECT_ROOT>\Delphi-FFMPEG directory):
git clone https://github.com/Laex/Delphi-FFMPEG.git Delphi-FFMPEGAdd the following folders to your Delphi IDE Library Paths under Tools -> Options -> Language -> Delphi -> Library -> Library Path (or equivalent in older versions):
<PROJECT_ROOT>\source
<PROJECT_ROOT>\source\opengl
<PROJECT_ROOT>\source\sdl
<PROJECT_ROOT>\source\sdl2
<PROJECT_ROOT>\packages
<PROJECT_ROOT>
esource
<PROJECT_ROOT>
esourceacedetectxml
<PROJECT_ROOT>\source3
<PROJECT_ROOT>\Delphi-FFMPEG\source
(Replace <PROJECT_ROOT> with the absolute path where you cloned the repository).
For the compiler to find external DLLs during debugging or execution, copy the redistributable libraries to your Windows directories or keep them next to your compiled binaries.
- On 64-bit Windows:
- Copy 64-bit DLLs to
C:\Windows\System32\ - Copy 32-bit DLLs to
C:\Windows\SysWOW64\
- Copy 64-bit DLLs to
- On 32-bit Windows:
- Copy 32-bit DLLs to
C:\Windows\System32\
- Copy 32-bit DLLs to
Alternatively, copy all corresponding 32-bit or 64-bit DLLs directly into the output folder next to your compiled executable.
You can verify that all redistributable DLLs are correctly detected by running the dependency checker tool located in the repository:
<PROJECT_ROOT>\CheckCVDep\CheckCVDep.exe
If configured correctly, the tool will output OK for all checked components (Microsoft, OpenCV, classes, FFMPEG, and SDL).
Open the appropriate package folder for your IDE version (e.g., packages\Delphi 13 Florence\ or packages\Delphi 12 Athens\) and build/install the packages in the following logical order:
rtpFFMPEG.dpk(FFMPEG Runtime Package)rclVCLOpenCV.dpk(VCL Runtime OpenCV components)rclFMXOpenCV.dpk(FMX Runtime OpenCV components)dclVCLOpenCV.dpk(VCL Design-time components)dclFMXOpenCV.dpk(FMX Design-time components)
<PROJECT_ROOT>
├── bin # Compiled binaries and executables for samples
├── CheckCVDep # Environment verification tool
├── Delphi-FFMPEG # Delphi-FFMPEG submodule
├── packages # Design and runtime Delphi IDE packages (D2010 to D13)
├── redist # Pre-packaged redistributable libraries (VC14, FFmpeg, SDL)
├── resource # Media files, XML classifiers, and Haar cascades
├── samples # Demos and VCL/FMX sample projects
├── source # Core Object Pascal bindings for OpenCV, SDL, and OpenGL
└── source3 # Source files for OpenCV 3 integration attempts
Delphi-OpenCV includes several demo group projects to showcase different capabilities. Open them in your Delphi IDE to compile and run:
samples\LibDemo\LibDemo.groupproj— Demonstrations of basic OpenCV functions, utilities, and bindings.samples\MultiDemo\MultiDemo.groupproj— Advanced video processing, motion detection, and image analysis algorithms.samples\VCLDemo\VCLDemo.groupproj— Visual OpenCV wrappers designed specifically for classic VCL Forms.samples\Components\ComponentsDemo.groupproj— Visual components usage (viewers, capturers, video writers).Delphi-FFMPEG\examples— Examples of low-level FFMPEG video parsing.
- Laentir Valetov (Lead Contributor) — laex@bk.ru
- Mikhail Grigorev — sleuthhound@gmail.com
This project is licensed under the Mozilla Public License Version 1.1 (MPL 1.1). You may obtain a copy of the License at Mozilla MPL 1.1 Page.