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 whchan
Visitor
862 Views
Registered: ‎02-25-2019

Using xfOpenCV in C++ on PYNQ/Ubuntu

Hello everyone!

My goal is to build xfOpenCV as a C++ library, such that I can call xfOpenCV functions within my C++ program on my PYNQ-Z1, that runs Ubuntu 18.04, as the official PYNQ v2.4 SD card image provides.

The concept should be similar to building an overlay that can be used within Python, except my goal is for C++.

So far from the user manuals (xfOpenCV, SDSoC) I have read about, seems like my closest viable solution is to compile & build my entire C++ program in SDSoC environment, if I am not mistaken.

I do realize that the PYNQ framework is supposed for running Python + overlay to support hardware acceleration.

Therefore, I really wonder if my goal is doable at all?

 

Thank you so much for any advice in advance!

Xavier

0 Kudos
5 Replies
Xilinx Employee
Xilinx Employee
756 Views
Registered: ‎08-02-2013

Re: Using xfOpenCV in C++ on PYNQ/Ubuntu

You may want to check this PYNQ community project:

https://github.com/Xilinx/PYNQ-ComputerVision

 

Cathal

0 Kudos
Visitor whchan
Visitor
748 Views
Registered: ‎02-25-2019

Re: Using xfOpenCV in C++ on PYNQ/Ubuntu

Hi Cathal, 

I was looking at this project too, but it seems like it only provides xfOpenCV usage at Python level as overlays. 

For my project I would need to use C++, so I am looking for a way to use xfOpenCV in C++ on PYNQ-Z1 board. SDSoC seems to be the right path to go, only if I could build to target PYNQ-Z1 board... and I have already tried building the .dsa file for the PYNQ-Z1 board by running the tcl scripts under this repo:

https://github.com/Xilinx/PYNQ/tree/master/boards/Pynq-Z1/base

For my next step, I am trying to create the SDSoC platform for PYNQ-Z1 in 2018.3 

I personally found SDSoC workflow to be quite elegant to use, just write the code in C++, perform hardware acceleration for selected functions, then just build everything and copy everything to SD card, except when it comes to non-default supported platforms, then it becomes quite frastruating to make things compatible, especially for newbie like me... 

Thanks, 

Xavier

0 Kudos
628 Views
Registered: ‎10-17-2017

Re: Using xfOpenCV in C++ on PYNQ/Ubuntu

@whchan I believe you are on the right path. You would have to create a custom Pynq platform to be able to use xfopencv as a C++ library.

Any updates on your attempts ?  

0 Kudos
Visitor whchan
Visitor
620 Views
Registered: ‎02-25-2019

Re: Using xfOpenCV in C++ on PYNQ/Ubuntu

Hi @khareashish_trimble, thanks for reply the thread!

I think I have successfully built the custom platform, and built some basic samples with SDSoC for Zynq-Z1, which all run totally fine. In order to build the custom platform, one would need to build the HW and SW components from the following repos:

https://github.com/Xilinx/PYNQ/tree/master/sdbuild (For building the SW files & sysroot)

https://github.com/yunqu/PYNQ-derivative-overlays (For building the HW files, bare one worked)

Building sysroot is recommended as it would cross compile all the dependency libraries which may be required during SDSoC project compilation, therefore instead of the already built platforms files, I would rather be sharing how to build everything manually if anyone is interested. 

I have also just compiled a couple xfOpenCV sample projects, but I am getting "Bus Error" when running. It only occurs when I have HW accelerated functions toggled, without any HW accelerations it was running fine. I suppose it was becuase I did not copy everything (boot.bin seems to contain the bitstream, I only tried running the .elf) 

By the way, does anyone know how to running the Linux TCF agent? It seems like it does not come with the PYNQ image, or maybe I just could not find it yet, but how could I check if there is an existing one, or install it in linux on the board?

I will give more updates on my progress :)

Xavier

0 Kudos
Moderator
Moderator
495 Views
Registered: ‎08-20-2018

Re: Using xfOpenCV in C++ on PYNQ/Ubuntu

Hi @whchan 

Please refer below AR

https://www.xilinx.com/support/answers/65538.html

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
0 Kudos