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: 
Highlighted
Observer bhavinlapasia
Observer
351 Views
Registered: ‎05-18-2018

How to calculate mean and SD in HLS using openCV

Is  hls::AvgSdv() in HLS-OpenCV domain and meanStdDev() in openCV domain represent the same function? How to use them and verify this in HLS? Has anyone tried?

Thanks & Regards

0 Kudos
3 Replies
Moderator
Moderator
282 Views
Registered: ‎06-24-2015

Re: How to calculate mean and SD in HLS using openCV

@bhavinlapasia 

Yes, they have same functionality, but we have customized openCV functions to work better suited to FPGAs.

The video processing functions included in the HLS Video library are compatible with existing OpenCV functions and are similarly named. They do not directly replace existing OpenCV video library functions. The video processing functions use a data type hls::Mat.This data type allows the functions to be synthesized and implemented as high performance hardware. Refer page age 255 of https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug902-vivado-high-level-synthesis.pdf

Also refer this : https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842499/HLS+AvgSdv

Thanks,
Nupur
--------------------------------------------------------------------------------------------
Google your question before posting. If someone's post answers your question, mark the post as answer with "Accept as solution". If you see a particularly good and informative post, consider giving it Kudos (click on the 'thumbs-up' button).
0 Kudos
Observer bhavinlapasia
Observer
268 Views
Registered: ‎05-18-2018

Re: How to calculate mean and SD in HLS using openCV

Thank you for your reply. 

I have tried to build a demo code where I am calculating mean and standard deviation in HLS scope and openCV also. When comparing it using simulation, I am getting different results. The codes are uploaded at this webpage https://forums.xilinx.com/t5/Vivado-High-Level-Synthesis-HLS/Mean-and-standard-deviation-of-image-using-HLS-and-OpenCV/td-p/953089

When you say that they do not directly replace existing openCV function, does it mean that it will not produce same results? 

Also I feel that there is some mismatch in hls::scalar and cv::scalar data type. I have used these 2 datatypes for mean and SD (as per function requirement) respectively for HLS and openCV. Let me know if you could find bug there.

Regards,

Bhavin

0 Kudos
Xilinx Employee
Xilinx Employee
253 Views
Registered: ‎09-05-2018

Re: How to calculate mean and SD in HLS using openCV

Hey @bhavinlapasia ,

If you're using Vivado HLS 2018.3, you should also consider using the xfOpenCV functions. Moving forward, the Vivado HLS video libraries have been moved to the Xilinx GitHub and can be found here: https://github.com/Xilinx/xfopencv

Nicholas Moellers

Xilinx Worldwide Technical Support
0 Kudos