OpenCV (Open Source Computer Vision) is a cross-platform and free-for-use library for use in the emerging field of computer vision, a science on how computers extract information from digital images or videos. It’s about acquiring and processing visual data, and making decisions and performing actions based on the analysis. OpenCV support deep learning frameworks and includes a statistical machine learning library, what makes it applicable for motion tracking, gesture and facial recognition, and object identification.
Because community member David Petter was really interested in using OpenCV in combination with a PLCnext Control, he made an updated tutorial on this topic, using the current versions of FFmpeg, OpenCV, and the AXC firmware.
For this, he used the ‘old’ tutorial he got from community member Vincent Gijsen, who works at Phoenix Contact. All the used scripts and install commands are originally created by Vincent. David only changed small details to make it all work for the current versions of the used libraries and its dependencies.
Thanks a lot to both of them for sharing this tutorial with the community. This is a great example on how to implement open source code with PLCnext Technology!
(…virtually handing over the microphone to David…)
Preconditions and links
Preconditions
So, to get started, I need to make some assumptions. If you don’t have the listed things ready yet, I suggest you start at the ‘getting started’ pages on the community website.
- Operating System (VM): Linux
(tested with Ubuntu 16.04.1 LTS 64-bit) - nano editor in use
- CMake installed
- Eclipse with PLCnext Technology Plug-in already installed
(tested with Neon.3 rel. 4.6.3) - Newest PLCnext Technology SDK installed in this folder:
/opt/pxc/2.2.1 - You can consider a symlink:
/opt/pxc/current
A symlink or “symbolic link” can be used as a reference to a directory. Example: Your files are in /opt/pxc/folder1/folder2/folder3/
.
If you were to make a symlink, you can for instance link /opt/file
to /opt/pxc/folder1/folder2/folder3/
.
This is useful for many things, especially if you need to reference that file in folder3 a lot. Instead of needing to re-type that long file location, you just type /opt/file
. I did not use a symlink in this tutorial.
Download links:
- nano – this tutorial is based on the nano editor for Linux; adapt, if you use another editor.
- CMake – we will use it later
- PLCnext Technology SDK – be sure to download the matching SDK, either for 32-bit or 64-bit Linux OS
- Eclipse Plug-in – same source as the SDK, second link just for convenience
Make sure everything is set up to create, build, and export the library. If all that is working, you can proceed with this tutorial. All other dependencies will be compiled in the course of this tutorial.
Set up the build environment

Compile FFmpeg

Compile OpenCV

Transfer Libraries to PLCnext Control
Configure Eclipse




Leave a Reply
You must be logged in to post a comment.