0

I'm looking at optimising some code with NVidia's OpenVX, and from previous experience with the CUDA API, GPU memory allocation is always a significant overhead.

So, I have a series of cv::Mat from video that I want to copy into an image; the naive code is of course:

vxImage = nvx_cv::createVXImageFromCVMat(context, cvMat);

The optimisation would be to allocate a single image, then just copy the bits on top. Looking at the header files (documentation is rather scant) I find:

nvx_cv::copyCVMatToVXMatrix(vxImage, cvMat);

However, the name is VXMatrix, so the compiler complains about a mismatch between the vx_matrix and vx_image types, of course. As far as I can tell, there is no copyCVMatToVXImage API; am I missing something, or is there another way to do this?

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
  • 1
    Maybe you can find something in the [OpenCV - OpenVX samples](https://github.com/opencv/opencv/tree/3.4.1/samples/openvx). – Catree Apr 23 '18 at 10:20
  • Turns out that `nvx_cv::createVXImageFromCVMat()` avoids memory copies, so there's no allocation to try to optimise away! Thanks for the samples, anyway. – Ken Y-N Apr 25 '18 at 01:09

0 Answers0