当前位置:   article > 正文

如何获取OpenCV并于DELPHI10.3中搭建开发环境_open cv library for delphi

open cv library for delphi

1、首先下载Delphi-OpenCV

下载地址:https://github.com/Laex/Delphi-OpenCV

Requirements:

  • Visual C++ Redistributable for Visual Studio 2015
    Files: msvcp140.dll, msvcp140d.dll in "Delphi-OpenCV\redist" or here, but it is not exactly
    or from the repository (Delphi-OpenCV\redist\VC14):
  1. (1) 32-bit in the "\x86"
  2. (2) 64-bit in the "\x64"
  • Shared library FFMPEG 4.2.1 for Windows can be downloaded from here,(注意此界面选择x86或x64版本,然后拉到最下面下载ffmpeg-latest-win32-shared,或者ffmpeg-latest-win64-shared)
    or from the repository (Delphi-OpenCV\redist\ffmpeg):
  1. (3) FFmpeg 32-bit Shared "\x86"
  2. (4) FFmpeg 64-bit Shared "\x64"
  • Dynamic library OpenCV need to download here
    Files: *2413.dll and *2413d.dll
    After installing OpenCV:
  1. (5) 32-bit in the C:\OpenCV\build\x86\vc14\bin\*.dll
  2. (6) 64-bit in the C:\OpenCV\build\x64\vc14\bin\*.dll
  • Some examples (FFMPEG) required SDL 2.0 and SDL 1.2
    or from the repository (Delphi-OpenCV\redist\SDL\1.2 and \2.0):
  1. (7) 32-bit - SDL.dll and SDL2.dll "\x86"
  2. (8) 64-bit - SDL.dll and SDL2.dll "\x64"

2、DELPHI中配置Delphi-OpenCV

1. Delphi environment setting

Download and unzip the archive or clone repository

git clone https://github.com/Laex/Delphi-OpenCV.git

Get the following directory structure

  1. <PROJECT_ROOT> - Directory, for example, "C:\Delphi\OpenCV\"
  2. <bin> - here are the executable files of the examples
  3. <CheckCVDep> - program for checking the environment
  4. <Delphi-FFMPEG> - empty directory for "Delphi-FFMPEG"
  5. <packages> - packages for D10-D10.3
  6. <redist> - redistributable packages
  7. <resource> - media for working examples and Haar-cascades
  8. <samples> - examples
  9. <source> - object pascal sources for OpenCV, SDL, OpenGL
  10. <source3> - attempt for opencv 3
  11. <source4> - blank for OpenCV 4

Run InitDelphiFFMPEG.cmd to initialize the Delphi-FFMPEG submodule. The directory should be populated with sources for Delphi-FFMPEG. If it didn’t work, then

git clone https://github.com/Laex/Delphi-FFMPEG.git

Add the search path for the modules of the project in Delphi IDE
"Tools-Options-Delphi Options-Library-Library path" or "Tools-Options-Language-Delphi-Library"

  1. <PROJECT_ROOT>\source
  2. <PROJECT_ROOT>\source\opengl
  3. <PROJECT_ROOT>\source\sdl
  4. <PROJECT_ROOT>\source\sdl2
  5. <PROJECT_ROOT>\packages
  6. <PROJECT_ROOT>\resource
  7. <PROJECT_ROOT>\resource\facedetectxml
  8. <PROJECT_ROOT>\source3
  9. <PROJECT_ROOT>\Delphi-FFMPEG\source

where <PROJECT_ROOT> directory, which was unzipped (or cloned) repository.

2. Copy dynamic libraries files

OS Windows 64-bit

  1. Target platform 64-bit: (2),(4),(6),(8) -> "C:\Windows\System32\"
  2. Target platform 32-bit: (1),(3),(5),(7) -> "C:\Windows\SysWOW64\"

OS Windows 32-bit

  1. Target platform 32-bit: (1),(3),(5),(7) -> "C:\Windows\System32\"

Alternatively, dynamic libraries can be placed next to an executable file.

3. Verify that the environment is configured correctly

Run from the repository

 Delphi-OpenCV/CheckCVDep/CheckCVDep.exe

The program checks the availability of dynamic libraries

  1. ------- Verifying Microsoft DLL -------
  2. OK
  3. ------- OpenCV DLL -------
  4. OK
  5. ------- Delphi-OpenCV classes DLL -------
  6. OK
  7. ------- FFMPEG DLL -------
  8. OK
  9. ------- SDL DLL -------
  10. OK

To successfully install components and run most of the examples, the availability of FFMPEG DLL, Microsoft DLL and OpenCV DLL is sufficient

4. Install the components

To install the components, open and install

  1. <PROJECT_ROOT>\packages\Delphi XXX\rtpFFMPEG.dpk
  2. <PROJECT_ROOT>\packages\Delphi XXX\rclVCLOpenCV.dpk
  3. <PROJECT_ROOT>\packages\Delphi XXX\rclFMXOpenCV.dpk
  4. <PROJECT_ROOT>\packages\Delphi XXX\dclVCLOpenCV.dpk
  5. <PROJECT_ROOT>\packages\Delphi XXX\dclFMXOpenCV.dpk

Examples

Open in Delphi IDE and compile:
Examples of the use of certain functions and procedures

<PROJECT_ROOT>\samples\LibDemo\LibDemo.groupproj

Examples of the use of video processing algorithms

<PROJECT_ROOT>\samples\MultiDemo\MultiDemo.groupproj

Examples of the use of video processing algorithms using VCL.Forms

<PROJECT_ROOT>\samples\VCLDemo\VCLDemo.groupproj

Examples of using FFMPEG library header files are in the

<PROJECT_ROOT>\Delphi-FFMPEG\examples

Examples of use of components

<PROJECT_ROOT>\samples\Components\ComponentsDemo.groupproj

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/580872
推荐阅读
相关标签
  

闽ICP备14008679号