Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 4615

Resizing an image and applying a Gaussian blur

$
0
0
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 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();}

Viewing all articles
Browse latest Browse all 4615

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>