-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use xfopencv in vivado HLS 2018.2 #17
Comments
Hello @tangjie77wd , Will moving the operations Scaling and Color-Conversion, out of the FindTarget function, work for you? If yes, you can perform these operations using OpenCV equivalent functions (Since you have OpenCV includes) , copy the output of the resultant cv::Mat into xf::Mat using copyTO() and send that xf::Mat to the FindTarget function with xf::Mat arguments. See below psuedo code:
|
@bgouthamb Thanks for your reply ! I have replaced hls video functions with opencv functions and a error information occurs----
How can i get xf::Scalar from xf::Mat ? |
Please post any coding related questions on the SDSoC forum. |
@bgouthamb Thank you very much ! Do you mind if i ask the first question the first time i asked ----Can hls video function be used in the same source file with xfOpenCV function ? The reason i want to get the reply is that i have to replace hls video function with opencv function to avoid the error and you have not used hls video function in /xfOpenCV/example/dilation/xf_dilation_tb.cpp according to /xfopencv/HLS_Use_Model/HLS_UseModel_Usage_Doc.pdf ---section "Usage Example with interface functions" |
I am so sorry to bother you. The following error will come to me when synthesis |
All of these has been solved by changing xfopencv/include/common/xf_axi_sdata.h . |
What change to the xfopencv/include/common/xf_axi_sdata.h fixed the problem? |
I have rebuilt your example--Standalone_HLS_Example according to "HLS_UseModel_Usage_Doc.pdf " successfully in Vivado HLS 2018.2 GUI . I noticed that there is no direct and easy function to convert BRG model to GRAY in xfOpenCV but there is hls::CvtColor() in HLS video library . Therefore, I want to use hls::Cvtcolor() to get gray image and use hls::Mat2AXIvideo() to get stream and then use xf::AXIvideo2xfMat() to do other works that can be done with xfOpenCV API library. But, error occurs ---"common/xf_axi_sdata.h:90:10: error: redefinition of ‘struct ap_axis<D, U, TI, TD>" !!! There is definition of ap_axis in "xf_axi_sdata.h" and there is the same definition of ap_axis "in hls_video.h" which i have to include it because i want to use functions like hls::Cvtcolor() and hls::Scale() which they are very complex in xfOpenCV but easy in hls video library . Can you provide me with some advices ?
`#include "hls_video.h"
#include <ap_int.h>
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "/home/jumper/FPGA_projects/HLS2018.2/xiangAn_wd/xfOpenCV/include/common/xf_sw_utils.h"
#include "/home/jumper/FPGA_projects/HLS2018.2/xiangAn_wd/xfOpenCV/include/common/xf_axi.h"
#include "/home/jumper/FPGA_projects/HLS2018.2/xiangAn_wd/xfOpenCV/include/common/xf_infra.h"
typedef ap_uint<1> uint1;
typedef ap_uint<11> uint11;
// maximum image size
#define MAX_WIDTH 1936
#define MAX_HEIGHT 1456
// typedef video library core structures
typedef hls::stream<ap_axiu<24,1,1,1> > AXI_STREAM;
typedef hls::stream<ap_axiu<8,1,1,1> > AXI_STREAM_GRAY;
typedef xf::Scalar<3, unsigned char> RGB_PIXEL;
typedef xf::Scalar<1, unsigned char> GRAY_PIXEL;
#if NO
#define NPC1 XF_NPPC1
#else
#define NPC1 XF_NPPC8
#endif
typedef xf::Mat<XF_8UC3, MAX_HEIGHT, MAX_WIDTH, NPC1> RGB_IMAGE;
typedef xf::Mat<XF_8UC1, MAX_HEIGHT, MAX_WIDTH, NPC1> GRAY_IMAGE;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> HLS_RGB_IMAGE;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC1> HLS_GRAY_IMAGE;
void FindTarget(HLS_RGB_IMAGE& srcImage,GRAY_IMAGE& dstImage)
{
HLS_RGB_IMAGE img(MAX_HEIGHT, MAX_WIDTH);
HLS_GRAY_IMAGE img1(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img1_1(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img2(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img3(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img4(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img5(MAX_HEIGHT, MAX_WIDTH);
}
`
The text was updated successfully, but these errors were encountered: