I have a std::vector that I want to access on my host. How would I perform one batch memcpy operation (or download operation) to return a vector of cv::Mats? I am running this on the Jetson TX2, so I have the ability to do unified shared memory.
Asked
Active
Viewed 289 times
1 Answers
0
The easiest way is:
std::vector<cv::Mat> host;
// pre-allocate the memory.
host.reserve(devices.size());
cv::Mat tmp;
// Download each image one by one.
for(cv::cuda::GpuMat& d : devices)
{
d.download(tmp);
// Remember that the assignation between two cv::Mat does not do a copy but a reference sharing.
host.push_back(tmp.clone());
}

John_Sharp1318
- 939
- 8
- 19