Delphi-OpenCV: calling the OpenCV 2.4 C API from Delphi and FreePascal
Project Delphi-OpenCV. Translation of OpenCV library header files in Delphi
At a glance
- What is it?
- Delphi-OpenCV is a translation of the OpenCV 2.4.13 header files into Object Pascal, with VCL and FireMonkey components, FFMPEG camera streaming, and Delphi IDE packages for Delphi 2010 through 13. It binds an OpenCV version that is well past end of life, and the README says so.
- Who is it for?
- Delphi-OpenCV fits a Delphi or FreePascal team maintaining an existing Win32 or Win64 desktop application that needs computer vision, and that wants the OpenCV 2.4 C API available without writing its own declarations. It is the wrong choice for new work, since the bound version is OpenCV 2.4.13 and the README points OpenCV C++ and 5.x users to Delphi-OpenCV5 instead.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Yes. The repository last received commits 128 days ago.
- What is it written in?
- Mainly Pascal, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.
Editorial analysis
It is a header translation, and the version it binds is old on purpose
Delphi-OpenCV is described as a comprehensive port of the OpenCV 2.4.13 library to Delphi and FreePascal, and the repository description puts it more precisely as a translation of the OpenCV library header files in Delphi. That is the mechanism. There is no reimplementation of the algorithms; there are Pascal declarations for the C API, and the actual work happens inside the OpenCV DLLs at runtime. The direct bindings give access to the OpenCV C and C++ APIs from Delphi code, and the samples cover object tracking, camera capture, face detection with Haar cascades, motion detection and OpenGL overlays. The audience is a Windows desktop developer in a language where no first-party OpenCV binding exists, and the age of the bound version is the central fact about the project. OpenCV 2.4.13.6 is the DLL release the README points at, and the badge in the README header confirms that version.
The repository is two submodules and a setup script
All projects reference `Delphi-FFMPEG/source` inside the repository, and getting that in place is the first thing a new user has to handle. The standard setup is a clone with submodules:
git clone --recurse-submodules https://github.com/Laex/Delphi-OpenCV.git
cd Delphi-OpenCVOr, after a plain clone, run the setup script:
InitDelphiFFMPEG.cmdThat script initializes the `jedi` and `Delphi-FFMPEG` git submodules, and `jedi` matters because `source/OpenCV.inc` requires `jedi.inc`. The `jedi` dependency is the JEDI Codebase Toolkit, which provides the include mechanism the translation relies on to pull in the many small C header declarations. If you do not fetch it, the source will not compile, and the failure will look like a missing include rather than a missing submodule.
Contributors who maintain their own FFmpeg bindings use a directory junction
The README describes a second setup for people who keep the FFmpeg bindings in a separate clone, such as `D:\Work\Delphi\Delphi-FFMPEG`, placing it as a sibling of this repository:
Delphi/
├── Delphi-FFMPEG/ ← your working clone
└── OpenCV/
└── Delphi-OpenCV/ ← this repositoryThe script then creates a directory junction named `Delphi-FFMPEG` pointing at `..\..\Delphi-FFMPEG` when that folder contains `source/`, and projects keep using `Delphi-FFMPEG/source` with no path changes needed. If you need a path elsewhere, copy `InitDelphiFFMPEG.local.cmd.example` to `InitDelphiFFMPEG.local.cmd` and set `FFMPEG_DEV_PATH`. The junction can also be made by hand:
mklink /J Delphi-FFMPEG D:\Work\Delphi\Delphi-FFMPEGThis is a Windows-only convention, which tells you something about the intended environment. The same README lists Delphi support from 2010 to 13, the VC++ 2015 redistributable, and FFMPEG DLLs for Win32 and Win64.
Setting up the IDE means adding nine library paths and installing five packages
The installation guide has five steps. After cloning and running the setup script, you add paths 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/sourceThen you set up the runtime DLLs, and the README is explicit that the `redist/` folder contains only `readme.md` stubs for ffmpeg, SDL and VC14 with download links, so the runtime DLLs are not in the repository. You copy them next to your `.exe` or onto `PATH`. The verification step is to build and run `CheckCVDep/CheckCVDep.dproj`, which is the fastest way to find out whether the OpenCV DLLs resolve. The last step is to open `packages/<your Delphi version>/` and install the packages in order: `rtpFFMPEG.dpk`, `rclVCLOpenCV.dpk`, `rclFMXOpenCV.dpk`, `dclVCLOpenCV.dpk` and `dclFMXOpenCV.dpk`. The order matters, since the runtime packages depend on the others being installed first.
Two flavours of component: runtime wrappers for VCL and FMX
The cross-framework support is the reason the package list has both VCL and FMX entries. The `rcl` packages are the runtime libraries, one for VCL and one for FireMonkey, and the `dcl` packages are the design-time components that put the visual wrappers on the palette. The samples show the same split. `samples/LibDemo/LibDemo.groupproj` covers the basic OpenCV functions and bindings, `samples/MultiDemo/MultiDemo.groupproj` handles video processing and motion detection, `samples/VCLDemo/VCLDemo.groupproj` shows the VCL visual wrappers, and `samples/Components/ComponentsDemo.groupproj` covers the IDE components. There are also FPC samples and a `cvDelphiErrorHandler` sample, plus the `LearningOpenCV_Code` folder that mirrors the code from the OpenCV learning material.
The C++ experiment is marked archival, and a separate project covers OpenCV 5
Two notes in the README mark the boundaries of this project. The first says `opencv_cpp_classes` is archival only, and for OpenCV C++ or 5.x you should use Delphi-OpenCV5. The second is the directory structure itself, which labels the folder as an archival C++ experiment with a pointer to the folder's own readme:
<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)That is a useful thing to know before you start reading source, because the C++ class-based API has a different shape from the C API and the directory does not reflect what the maintained bindings look like. The maintained path is the `source` directory, described as the OpenCV 2.4 C API bindings. The distinction between the two projects also implies a version skew that a team should plan for: this repository targets the 2.4 C API and a specific DLL release, while Delphi-OpenCV5 targets the newer generation.
Where Delphi-OpenCV is the wrong tool
Three limits are concrete. The first is the OpenCV version. OpenCV 2.4 dates from the middle of the previous decade, and its C API is frozen, so any algorithm added to OpenCV since then is simply not reachable from these bindings, and any security issue fixed upstream in a later 2.4 point release would need a DLL update on your side. The README's own pointer to Delphi-OpenCV5 is the clearest signal. The second is the platform. Everything in the setup is Windows-specific: the VC++ 2015 redistributable, `InitDelphiFFMPEG.cmd`, `mklink /J`, the `.dpk` packages and the Win32 and Win64 FFMPEG builds. FreePascal is supported as a compiler, but the samples and package tooling are Delphi shaped, so a cross-platform team inherits a Windows-only build process. The third is that you supply the binaries yourself, with no DLLs in the repository, which means every deployment target needs the OpenCV, VC++ 2015, FFmpeg and SDL libraries assembled by hand.
The alternative is Delphi-OpenCV5, which binds a different OpenCV generation
The alternative is not another language binding but the sibling project Delphi-OpenCV5, and the difference in approach is which OpenCV API shape you expose. Delphi-OpenCV wraps the C++ class-based interface of a current OpenCV, which means the Delphi side gets the same classes, RAII wrappers and modern algorithm set that C++ developers have, rather than the older procedural C API with its manual memory handling and `cv::Mat` equivalents written in Pascal records. The trade-off is that the 2.4 line is stable and familiar to anyone who has used OpenCV for a decade, and the C API it exposes has not changed under existing code, whereas moving to the 5.x bindings means rewriting call sites and re-testing anything touching the library. For an application being maintained rather than built, the older bindings can be the cheaper choice; for anything new, the README's own advice points the other way.
Editorial conclusion
Delphi-OpenCV fits a Delphi or FreePascal team maintaining an existing Win32 or Win64 desktop application that needs computer vision, and that wants the OpenCV 2.4 C API available without writing its own declarations. It is the wrong choice for new work, since the bound version is OpenCV 2.4.13 and the README points OpenCV C++ and 5.x users to Delphi-OpenCV5 instead. Before you adopt it, confirm your Delphi version has a package directory under `packages/`, and budget for the runtime DLLs, since the repository ships only stub readmes in `redist/` and you supply the OpenCV, VC++ 2015, FFmpeg and SDL binaries yourself.
Frequently asked questions
How do I clone Delphi-OpenCV with its submodules?
Run `git clone --recurse-submodules https://github.com/Laex/Delphi-OpenCV.git` and change into the directory. After a plain clone you can instead run `InitDelphiFFMPEG.cmd`, which initializes the `jedi` and `Delphi-FFMPEG` submodules.
Which OpenCV version does Delphi-OpenCV bind?
It is a port of OpenCV 2.4.13, and the README points at the 2.4.13.6 DLL release for the `opencv_*2413.dll` and `*2413d.dll` binaries. For OpenCV C++ or 5.x, the README directs you to the Delphi-OpenCV5 project.
Where do the runtime DLLs come from?
The repository does not include them. The `redist/` folder holds only `readme.md` stubs for ffmpeg, SDL and VC14 with download links, and you copy the OpenCV, VC++ 2015, FFmpeg and SDL DLLs next to your `.exe` or onto `PATH`.
How do I verify that the OpenCV DLLs are found?
Build and run `<PROJECT_ROOT>/CheckCVDep/CheckCVDep.dproj`. For IDE setup, add the source, opengl, sdl, sdl2, packages, resource, facedetectxml, jedi and Delphi-FFMPEG/source directories to the Delphi library path, then install the packages from `packages/<your Delphi version>/` in the listed order.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/laex-delphi-opencv)Was this useful?