Resizing an image and applying a Gaussian blur
Hello, This seems a bit trivial, but I'm not sure as to why execution isn't working how I'm expecting it to. I want to resize an image and then apply the Gaussian blur to that image, but only one is being done; whichever comes last.
Am I losing the data from the first operation as it goes to the second?
And how could I also do this is parallel with multiple GPUs if I wanted to use streams? If that's at all possible.
All help is appreciated Thank you!
void resizeWithGauss(std::string inputFile, std::string outFile){
Mat inputHost = imread(inputFile, CV_LOAD_IMAGE_COLOR);
cuda::GpuMat inputDevice(inputHost);
cuda::GpuMat outputDevice;
const int ksize = 21;
const int type = CV_64F;
Timer timer;
timer.Start();
cuda::resize(inputDevice, outputDevice, Size(), 2.0, 2.0, CV_INTER_CUBIC);
cv::Ptr<cuda::Filter> gauss = cv::cuda::createGaussianFilter(inputDevice.type(), outputDevice.type(), Size(ksize, ksize), 6.0, 6.0);
gauss->apply(inputDevice, outputDevice);
timer.Stop();
printf("OpenCV GPU code ran in: %f msecs. \n", timer.ElapsedTime());
Mat outputHost;
outputDevice.download(outputHost);
imwrite(outputFile, outputHost);
inputHost.release();
outputDevice.release();}
please add your code as text, not as an image.
i added it at as text. My apologies.
you're not filtering the resized image (which is in
outputDevice
), but the original one