Opencv gpu 3 channel blur example

There is no 3 channel blur in gpu function.

gpu::blur is support CV_8UC1 and CV_8UC4  channel only.
gpu::gaussianblur is also not suitable often.

So one of idea is split channel.
split 3 channel and perform blur function for each channel.
and then merge to a blur 3channel image.

this is faster than cpu code(lager image will be faster).

In my case, the process takes cpu :0.0126sec gpu:0.0035sec in 800x600 image.

refer to example source code.


...
//gpu case
gpu::resize(o_frame_gpu, r_frame_gpu, Size(RWIDTH, RHEIGHT) );
vector< gpu::GpuMat> gpurgb(3);
vector< gpu::GpuMat> gpurgb2(3);
gpu::split(r_frame_gpu, gpurgb);
gpu::blur(gpurgb[0], gpurgb2[0], Size(3,3) );
gpu::blur(gpurgb[1], gpurgb2[1], Size(3,3) );
gpu::blur(gpurgb[2], gpurgb2[2], Size(3,3) );
gpu::merge(gpurgb2, r_frame_blur_gpu);

//cpu case
resize(o_frame, rFrame, Size(RWIDTH, RHEIGHT) );
blur(rFrame, blurFrame, Size(3,3));



...


Comments

Popular posts from this blog

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

OpenCV Stitching example (Stitcher class, Panorama)

AMP dose run on my pc?, AMP(Accelerated Massive Parallelism)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Optical Flow sample source code using OpenCV

Real-time N camera stitching Class.

OpenCV meanShiftFiltering example source code ( cpu: pyrMeanShiftFiltering, gpu:meanShiftFiltering, gpu:meanShiftSegmentation )

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Image warping (using opencv findHomography, warpPerspective)

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)