Delphi-OpenCV

June 17, 2026 ยท View on GitHub

Delphi Support OpenCV Version FPC Support License

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

DependencyVersionDescriptionDownload
OpenCV DLLs2.4.13.6opencv_*2413.dll / *2413d.dll (Win32)OpenCV 2.4.13.6 release
VC++ Redistributable2015 (VC14)msvcp140.dll, vcruntime140.dll, โ€ฆMicrosoft VC++ 2015 Redistributable
FFmpeg DLLssee Delphi-FFMPEGShared libs for rtpFFMPEG / IP camera (Win32 & Win64)Delphi-FFMPEG script, BtbN Win64, defisym Win32
SDL1.2 & 2.0SDL.dll, SDL2.dll for some video examplesSDL 1.2, SDL2 releases
JEDIsubmodulejedi.inc required by source/OpenCV.incproject-jedi/jedi
Delphi-FFMPEGsubmodule / junctionPascal FFmpeg bindings (libav*.pas)Laex/Delphi-FFMPEG โ€” see setup below

Note: The redist/ folder contains only readme.md stubs (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_classes is archival only. For OpenCV C++ / 5.x use Delphi-OpenCV5.

Step 3: Set up runtime DLLs

DLL groupSource
OpenCV 2.4.13OpenCV 2.4.13.6
VC++ 2015VC++ 2015
FFmpegDelphi-FFMPEG download script
SDLSDL 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:

  1. rtpFFMPEG.dpk
  2. rclVCLOpenCV.dpk
  3. rclFMXOpenCV.dpk
  4. dclVCLOpenCV.dpk
  5. dclFMXOpenCV.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 bindings
  • samples/MultiDemo/MultiDemo.groupproj โ€” video processing, motion detection
  • samples/VCLDemo/VCLDemo.groupproj โ€” VCL visual wrappers
  • samples/Components/ComponentsDemo.groupproj โ€” IDE components
  • Delphi-FFMPEG/examples/Examples.groupproj โ€” low-level FFmpeg API samples

For OpenCV C++ / 5.x see Delphi-OpenCV5.


๐Ÿ‘ฅ Contributors


๐Ÿ“„ License

This project is licensed under the Mozilla Public License Version 1.1 (MPL 1.1). See Mozilla MPL 1.1.