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!

取消
显示结果 
搜索替代 
您的意思是: 
Adventurer
Adventurer
820 次查看
注册日期: ‎06-05-2018

Sdx中使用xfOpenCV+HLS video functions

Sdx中使用opencv+HLS video functions已经通过写小例子验证过。但当我试着写xfOpenCV+hls video functions的小例子时编译始终有很多问题,我想是我哪里没有按要求做,有人这样用过吗?

0 项奖励
6 条回复6
Voyager
Voyager
809 次查看
注册日期: ‎08-16-2018

回复: Sdx中使用xfOpenCV+HLS video functions

"a lot of problems" with just "a small example" doesn't prove those problems are general. If you post your concrete problem, you may get a concrete solution for it.

0 项奖励
Adventurer
Adventurer
751 次查看
注册日期: ‎06-05-2018

回复: Sdx中使用xfOpenCV+HLS video functions

Here is my xf_myxf_accel.cpp file :

#include "xf_myxf_accel.h"

void hlsfun(hls::stream<ap_axiu<24,1,1,1> > &bgr_src,hls::stream<ap_axiu<8,1,1,1> > &grayimg)
{
	hls::Mat<HEIGHT,WIDTH,HLS_8UC3> bgr_srcmat;
	hls::AXIvideo2Mat(bgr_src,bgr_srcmat);
	hls::Mat<HEIGHT,WIDTH,HLS_8UC3> bgr_scaleimg;
	hls::Scale(bgr_srcmat,bgr_scaleimg,1.5);
	hls::Mat<HEIGHT,WIDTH,HLS_8UC1> grayimg_argu;
	hls::CvtColor<HLS_BGR2GRAY>(bgr_scaleimg, grayimg_argu);
	hls::Mat2AXIvideo(grayimg_argu,grayimg);
}


#pragma SDS data zero_copy("threshimg.data"[0:HEIGHT*WIDTH], "dilateimg.data"[0:HEIGHT*WIDTH])
#pragma SDS data access_pattern("_src.data":SEQUENTIAL, "_dst.data":SEQUENTIAL)
#pragma SDS data copy("_src.data"[0:HEIGHT*WIDTH], "_dst.data"[0:HEIGHT*WIDTH])
#pragma SDS data mem_attribute("_src.data":NON_CACHEABLE|PHYSICAL_CONTIGUOUS)
#pragma SDS data mem_attribute("_dst.data":NON_CACHEABLE|PHYSICAL_CONTIGUOUS)
void myxffun(xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &_src,xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &threshimg,xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &dilateimg,xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &_dst)
{
	xf::Threshold<XF_THRESHOLD_TYPE_BINARY,XF_8UC1,HEIGHT, WIDTH,NPC1>(_src,threshimg,30,255,0);
	xf::dilate<XF_BORDER_CONSTANT,TYPE ,HEIGHT, WIDTH,NPC1>(threshimg,dilateimg);
	xf::erode<XF_BORDER_CONSTANT,TYPE ,HEIGHT, WIDTH,NPC1>(dilateimg,_dst);
}

The following error occurs when i try to build it.

/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1180:5: error: use of undeclared identifier 'getStructuringElement'
    getStructuringElement<unsigned char,int,int,2*1+1,2*1+1>(MORPH_RECT, size, anchor,temp_kernel);
    ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1180:36: error: expected '(' for function-style cast or type construction
    getStructuringElement<unsigned char,int,int,2*1+1,2*1+1>(MORPH_RECT, size, anchor,temp_kernel);
                          ~~~~~~~~ ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1182:5: error: too many template arguments for class template 'filter_opr'
    filter_opr<OPR_KERNEL, BORDERMODE>::filter(_src,_dst,temp_kernel,anchor,rows,cols);
    ^                      ~~~~~~~~~~~
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:574:7: note: template is declared here
class filter_opr<OPR_KERNEL, BORDER_CONSTANT> {
      ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1203:9: error: use of undeclared identifier 'getStructuringElement'
        getStructuringElement<KN_T,int,int,K_WIDTH+ITERATIONS*(K_WIDTH-1),K_HEIGHT+ITERATIONS*(K_HEIGHT-1)>(MORPH_RECT, size, anchor,temp_kernel);
        ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1203:31: error: 'KN_T' does not refer to a value
        getStructuringElement<KN_T,int,int,K_WIDTH+ITERATIONS*(K_WIDTH-1),K_HEIGHT+ITERATIONS*(K_HEIGHT-1)>(MORPH_RECT, size, anchor,temp_kernel);
                              ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1184:115: note: declared here
template<typename OPR_KERNEL, typename BORDERMODE, int Shape_type, int ITERATIONS, int SRC_T, int DST_T, typename KN_T, typename POINT_T,
                                                                                                                  ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1205:9: error: too many template arguments for class template 'filter_opr'
        filter_opr<OPR_KERNEL, BORDERMODE>::filter(_src,_dst,temp_kernel,anchor,rows,cols);
        ^                      ~~~~~~~~~~~
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:574:7: note: template is declared here
class filter_opr<OPR_KERNEL, BORDER_CONSTANT> {
      ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1209:9: error: too many template arguments for class template 'filter_opr'
        filter_opr<OPR_KERNEL, BORDERMODE>::filter(_src,_dst,_kernel,anchor,rows,cols);
        ^                      ~~~~~~~~~~~
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:574:7: note: template is declared here
class filter_opr<OPR_KERNEL, BORDER_CONSTANT> {
      ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1277:5: error: too many template arguments for class template 'filter_opr'
    filter_opr<filter2d_kernel, BORDERMODE>::filter(_src,_dst,_kernel,anchor,rows,cols);
    ^                           ~~~~~~~~~~~
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:574:7: note: template is declared here
class filter_opr<OPR_KERNEL, BORDER_CONSTANT> {
      ^
/opt/Xilinx/Vivado/2018.2/include/hls/hls_video_imgproc.h:1291:5: error: too many template arguments for class template 'filter_opr'
    filter_opr<filter2d_kernel, BORDER_DEFAULT>::filter(_src,_dst,_kernel,anchor,rows,cols);
sds++ log file saved as /home/jumper/FPGA_projects/sdsoc2018.2/HLSxfOpenCV/Release/_sds/reports/sds_xf_myxf_accel.log
ERROR: [SdsCompiler 83-5004] Build failed

src/subdir.mk:21: recipe for target 'src/xf_myxf_accel.o' failed
0 项奖励
Adventurer
Adventurer
747 次查看
注册日期: ‎06-05-2018

回复: Sdx中使用xfOpenCV+HLS video functions

I did not use hlsfun() function actually and my function myxffun() is the hardware function.

0 项奖励
Voyager
Voyager
717 次查看
注册日期: ‎08-16-2018

回复: Sdx中使用xfOpenCV+HLS video functions

The first thing I suspect is you may not have the proper set of libraries and include files

0 项奖励
Adventurer
Adventurer
706 次查看
注册日期: ‎06-05-2018

回复: Sdx中使用xfOpenCV+HLS video functions

However,I have really set proper libraries and include files . Well, I am wandering if can't use hls function and xfopencv function at the same time in sdsoc because there is no error when i delete hlsfun() !
0 项奖励
Voyager
Voyager
696 次查看
注册日期: ‎08-16-2018

回复: Sdx中使用xfOpenCV+HLS video functions

Have you checked this?

 

The xfOpenCV library is designed to work with Zynq and Zynq Ultrascale+ FPGAs. The library has been verified on zcu102 and zcu104 boards. SDSoC 2018.2 Development Environment is required to work with the library. zcu102 reVISION platform is required to run the library on zcu102 board and zcu104 reVISION platform to run on zcu104 board.

 

From https://github.com/Xilinx/xfopencv

 

 

 

0 项奖励