Dear Phoenix Contact, We trying to get openCV in the PLCNext by following the tutorial: Compile OpenCV for a PLCnext Control We encountered a problem at the configure Eclipse section. Hereby we cannot reach the linker and compilers settings which are shown in the tutorial. Is it possible to add libraries in eclipse with the PLCNext pluggin program? The picture shows the current settings window. Thanks for your response. Kind regards, Florian
Hello Florian, the solution is to set the include path in eclipse-project. To link the library two additions in the CMakeLists.txt are necessary. Here is an example: The line 22 target_include_directories(RedisTest PUBLIC $ $) Has been replaced with target_include_directories(RedisTest PUBLIC $ $ PRIVACY “C:/temp/redis/out/include”) Where the path points to the folder with the header files. The line 50 target_link_libraries(RedisTest PRIVATE ArpDevice ArpProgramming) has been replaced with target_link_libraries(RedisTest PRIVATE ArpDevice ArpProgramming “C:/temp/redis/out/lib/libcpp_redis.a” “C:/temp/redis/out/lib/libtacopie.a”) where also here the paths have to be replaced accordingly.
Hello Florian, the editor has a mistake, please replace
with ) in prevois answer.
Dear Eduard, Thank you for your help. The library I use now can be found but apperently the library wich is called inside the library couldn’t. It is searching for: opencv2/core.hpp wich couldnt be found this opencv2 folder can be found in: “C:/Users/florian/Documents/opencv3.4.4/opencv-3.4.4-vc14_vc15/opencv/build/include” so the whole path is: “C:/Users/florian/Documents/opencv3.4.4/opencv-3.4.4-vc14_vc15/opencv/build/include/opencv2/core.hpp” Wich is the correct one. I did add the include folder in: target_include_directories(OPENCV_PLCNEXT PUBLIC $ $ \tPRIVACY \t"C:/Users/florian/Documents/opencv3.4.4/opencv-3.4.4-vc14_vc15/opencv/build/include)" And also tried to get it in public but this didnt change a thing. Thanks for your response. Kind regards, Florian
Thank you for the reply, Would like to hear Olivers findings soon. Regards, Florian
Hi Florian, Oliver is off this week, but I will try to help. The tutorial you are following was written for an earlier version of the CLI and Eclipse add-in, which I think explains why you cannot access the Eclipse settings mentioned in the tutorial. As Eduard indicated, project settings should be made via CMake. An example of how to include references to external projects is given in this article: https://www.plcnext-community.net/index.php?option=com_content&view;=article&id;=371:how-to-include-an-open-source-library-in-your-own-c-project&catid;=78&Itemid;=366⟨=en I have not tried this with opencv, but the procedure in the referenced article - from Step 4 onwards - should work with opencv. You will need to create a file called “FindOpenCV.cmake” (for example) and this file should mention the path(s) to your include files, similar to the example given for NE10. Please let me know if you have success with this. - Martin.
Hi Martin,
Apology for the late reply, also had a week off.
Momentarily we are trying to work out the tutorial but still got some issues with the Linux environment. We still would like to hear Olivers findings about Cmake and openCV.
Regards, Florian
Hi, Now got the next error when linking: We tried the 64bit version and the 32 bit version of the dll files, but i’m still stuck. We hope there is a solution for this error. Regards, Florian
Hi Florian, From the error messages, it looks like you are trying to link a .dll, which won’t work. I am guessing that the libopencv..dll file was built using the host (Windows) toolchain, rather than using the target toolchain - this will have to be changed so you link to libopencv .so , rather than .dll. Oliver is currently working on his opencv project, and I hope he will have time to share some findings with you soon. Martin.
Hello Florian,
this indeed looks like you are having some issues building the Open CV Library.
Make sure you realy are building for the PLCnext Controller / with our SDK and not for the Operating system you are working on…
The problem with openCV and FFMPEG is that FFMPEG does not have Cmake Support at all.
Getting it to work with cmake can be quite the hassle. First you will have to successfully build OpenCV with FFMPEG. Here you can find some binaries I compiled and some scripts I used for compiling.
To use openCV with FFMPEG in a PLCnext Project I did the following modifications to the CMakeLists file. OpenCV does support find_package(xxx) but FFMPEG does not.
So I linked the nesesarry FFMPEG libraries with find_library(xxxx)target_include_directories(MyProject PUBLIC BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/intermediate/code/ BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/ PRIVATE BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deploy/include/ BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deploy/include/opcencv4/ ) ..... ################# add link targets #################################################### find_package( ArpDevice REQUIRED ) find_package( ArpProgramming REQUIRED ) ## Find OpenCV find_package( OpenCV REQUIRED ) include_directories( ${OpenCV_INCLUDE_DIRS} ) ## Find all the FFMPEG library find_library( PTHREAD_LIBRARY pthread ) find_library( AVCODEC_LIBRARY avcodec ) find_library( AVDEVICE_LIBRARY avdevice ) find_library( AVFILTER_LIBRARY avfilter ) find_library( AVFORMAT_LIBRARY avformat ) find_library( AVRESAMPLE_LIBRARY avresample ) find_library( AVUTIL_LIBRARY avutil ) find_library( SWRESAMPLE_LIBRARY swresample ) find_library( SWSCALE_LIBRARY swscale ) ## link all dependencies target_link_libraries(Rubiks2019 PRIVATE ArpDevice ArpProgramming ${OpenCV_LIBS} ${AVCODEC_LIBRARY} ${AVDEVICE_LIBRARY} ${AVFILTER_LIBRARY} ${AVFORMAT_LIBRARY} ${AVUTIL_LIBRARY} ${AVRESAMPLE_LIBRARY} ${SWRESAMPLE_LIBRARY} ${SWSCALE_LIBRARY} ${PTHREAD_LIBRARY})kind regards, Oliver
Hello Oliver, Our customer want to build OpenCV with FFMPEG, so I want to download the binaries and scripts you mentioned. But the Link :https://phoenixcontact.sharefile.eu/d-s2223af19d3144fb8 may not be able to download for now . Can you give me a new link for download? And if you have any new tutoral for OpenCV on AXCF2152 , that would be really nice~
Hello Oliver-san, I also would like to get opencv library but I couldn’t access the following site where you uploaded the materials. https://phoenixcontact.sharefile.eu/d-s2223af19d3144fb8 Could you upload again or put PLCnext GitHub? Best regards, Atsushi












