UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor morkc
Visitor
1,214 Views
Registered: ‎10-31-2018

Using openCV together with xfopenCV

I want to use xfopenCV and openCV together in opticalflow from the reVISION stack while using SDSoC.
Is it possible for openCV and xfopenCV to be used together with optical_flow_sds.cpp?
- I have confirmed that it can be built when the openCV header is included in gstdsxopticalflow.cpp.
- Among the functions that perform hardware acceleration, I am under the impression that an ordinary OpenCV (not xfOpenCV) cannot be used, so I want to use OpenCV's functionality outside of the hardware accelerator orientated functions.
In regards to opticalflow, I have confirmed the following:
1) If I include opencv2/opencv.hpp in optical_flow_sds.cpp, it displays an error saying "unknown type name".

#include <cmath>
#include <common/xf_common.h>
#include <imgproc/xf_dense_npyr_optical_flow.hpp>
#include <linux/videodev2.h>
#include <stdlib.h>

#include "optical_flow_sds.h"

#include "opencv2/opencv.hpp"
/opt/Xilinx/SDK/2018.2/gnu/aarch64/lin/aarch64-linux/lib/gcc/aarch64-linux-gnu/7.2.1/include/arm_neon.h:56:9: error: unknown type name '__Float32x4_t'
typedef __Float32x4_t float32x4_t;
        ^fatal error: too many errors emitted, stopping now [-ferror-limit=]ERROR: [SdsCompiler 83-5005] clang exited with non-zero code processing /home/fpga/workspace/opticalflow/opticalflow/src/optical_flow_sds.cpp
sds++ log file saved as /home/fpga/workspace/opticalflow/opticalflow/Release/_sds/reports/sds_opticalflow_sds.log
ERROR: [SdsCompiler 83-5004] Build failed

src/subdir.mk:18: recipe for target 'src/optical_flow_sds.o' failed
make: *** [src/optical_flow_sds.o] Error 1

2) When I take optical_flow_sds.cpp and include the OpenCV header file (opencv2/opencv.hpp), just as in the implementation example on the Xilinx website indicates, I get a build error that says "use of undeclared identifier '__builtin_addressof".

#include <cmath>
#include <common/xf_common.h>
#include <imgproc/xf_dense_npyr_optical_flow.hpp>
#include <linux/videodev2.h>
#include <stdlib.h>

#include "optical_flow_sds.h"

#if __SDSCC__
#undef __ARM_NEON__#undef __ARM_NEON#include "opencv2/opencv.hpp"
#define __ARM_NEON__#define __ARM_NEON#else
#include "opencv2/opencv.hpp"
#endif

 

In file included from /opt/Xilinx/SDK/2018.2/gnu/aarch64/lin/aarch64-linux/aarch64-linux-gnu/include/c++/7.2.1/bits/stl_pair.h:59:
/opt/Xilinx/SDK/2018.2/gnu/aarch64/lin/aarch64-linux/aarch64-linux-gnu/include/c++/7.2.1/bits/move.h:51:16: error: use of undeclared identifier '__builtin_addressof'
      { return __builtin_addressof(__r); }
               ^ERROR: [SdsCompiler 83-5019] Exiting sds++ : Error when calling '/opt/Xilinx/Vivado/2018.2/bin/vivado_hls /home/fpga/workspace/opticalflow/opticalflow/Release/_sds/vhls/read_f2d_input_run.tcl -l read_f2d_input_vivado_hls.log'sds++ log file saved as /home/fpga/workspace/opticalflow/opticalflow/Release/_sds/reports/sds_optical_flow_sds.log
ERROR: [SdsCompiler 83-5004] Build failed

src/subdir.mk:18: recipe for target 'src/optical_flow_sds.o' failed
make: *** [src/optical_flow_sds.o] Error 1

 

0 Kudos
7 Replies
Xilinx Employee
Xilinx Employee
1,189 Views
Registered: ‎08-20-2018

Re: Using openCV together with xfopenCV

Hi @morkc

 

Please check if you have added opencv include path, library path in C/C++ Build settings

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
0 Kudos
Visitor morkc
Visitor
1,155 Views
Registered: ‎10-31-2018

Re: Using openCV together with xfopenCV


@nutang wrote:

Hi @morkc

 

Please check if you have added opencv include path, library path in C/C++ Build settings


@nutang
My include path for openCV is:

c/c++ Build Setting -> SDS++ Compiler -> Directories
"${SYSROOT}/usr/include"

/home/fpga/zcu104-rv-ss-2018-2/zcu104_rv_ss/sw/a53_linux/a53_linux/inc/xfopencv


My C++ build settings library is:
c/c++ Build Setting -> SDS++ Linker -> Libraries
opencv_core

opencv_ximgproc

0 Kudos
Adventurer
Adventurer
1,137 Views
Registered: ‎06-05-2018

Re: Using openCV together with xfopenCV

You have something wrong somewhere because I have used OpenCV and xfOpenCV in Sdsoc successfully ! The information you supply is few so there is no detail solution.
0 Kudos
Visitor morkc
Visitor
1,128 Views
Registered: ‎10-31-2018

Re: Using openCV together with xfopenCV

If there is a specific piece of information that you think would be helpful in answering my question, please let me know.
I'm not quite sure what else to mention.
Any help would be much appreciated!

0 Kudos
Adventurer
Adventurer
1,116 Views
Registered: ‎06-05-2018

Re: Using openCV together with xfopenCV

Emmmm......here is my process building projects when opencv and xfOpenCV in the same project with different boards : https://blog.csdn.net/wd1603926823/article/details/82867166
0 Kudos
Adventurer
Adventurer
1,111 Views
Registered: ‎06-05-2018

Re: Using openCV together with xfopenCV

I am trying to build project which need opencv and xfOpenCV and HLS video functions in the same project with Sdx 2018.2 but i have failed several times .however ,I succeed with Vivado HLS 2018.2 ! Does it not be supported using HLS video functions in Sdsoc ?
0 Kudos
Highlighted
Visitor morkc
Visitor
1,066 Views
Registered: ‎10-31-2018

Re: Using openCV together with xfopenCV

I am going to go ahead and reword my question:
<Question>
In SDSoC, I would like to use both xfopenCV and openCV, which are from opticalflow in the reVISION stack (zcu104-rv-ss-2018-2), concurrently.
You can call openCV and xfopenCV functions from optical_flow_sds.cpp, correct? If I were to call both together in the same program, how should I adjust my OpenCV include path and library path from the SDSoC GUI?

@wd-hyj
Thank you very much for your reply! In regards to HLS video functions, I am not quite sure how that relates to the problem that I am facing, but if you would be so kind as to explain that part to me, I would greatly appreciate it.

0 Kudos