Hello i am trying to resize an image in cuda/openCV.
Basically i am getting an image that is way bigger than i need and i wish to downscale it before processing. right now i am using the cpu to do so but i feel like that the whole thing would run way better if i would do it on the gpu before downloading to cpu.
Here is the line that works with CPU Mat:
//get the img into a gpu mat ...
// download (copy) to cpu mat
cv::UMat cpuFrame;
gpuFrame.download(cpuFrame);
cv::UMat cpuFrameResized(w, h, CV_8UC1);
cv::resize(cpuFrame, cpuFrameResized, cv::Size(w,h), 0, 0, cv::INTER_NEAREST);
// etc ...
but for this i need to download my gpu mat to cpu space. It works but is slow.
Here is what i tried in gpu space:
//resizing the images
#include "opencv2/cudawarping.hpp"
//get the img into a gpu mat ...
//use gpu downscaling
cv::cuda::resize(gpuFrame,gpuFrameResized, cv::Size(w, h), 0, 0, cv::INTER_NEAREST);
// download (copy) to cpu mat
cv::UMat cpuFrame;
gpuFrame.download(cpuFrame);
// etc ...
i am getting the informative error of:
Illegal instruction
What is missing to make the gpu resizing legal?
the cuda definition states i need some sort of stream but that the default is just null. I don’t understand if i do need a ‘stream’ and what is it for? I don’t think i need it …
the following doesn’t work either:
);
cv::cuda::resize(gpuFrame,gpuFrameResized, cv::Size(w, h), 0, 0, cv::INTER_NEAREST, cv::cuda::Stream::Null() );