开发者

OpenCV getMinFilter_GPU

开发者 https://www.devze.com 2023-04-12 09:36 出处:网络
The getMinFilter method takes (int,int,cvSiz开发者_如何转开发e), how is OpenCv expecting me to pass a 2D image in an int?

The getMinFilter method takes (int,int,cvSiz开发者_如何转开发e), how is OpenCv expecting me to pass a 2D image in an int?

srcType – Input image type. Only CV_8UC1 and CV_8UC4 are supported.

dstType – Output image type. It supports only the same type as the source type.

gpu::getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor=Point(-1,-1))

Thanks


Actually getMinFilter_GPU function does not do any any filtering. It just returns a special "processor" object which is able to do filtering.

Convenient way to use gpu filtering functions in OpenCV is:

  • Create a filter object (returned by getMinFilter_GPU and many other functions);
  • Create an engine object (for example with createFilter2D_GPU);
  • Store obtained pointer in your image processing context (you will kill all the performance if recreate the engine/filters object for each frame);
  • For each input frame call apply method of the engine object to make a filtering.

I.e:

 GpuMat src, dst;
 Ptr<FilterEngine_GPU> filter = createFilter2D_GPU(
     getMinFilter_GPU(CV_8UC1, CV_8UC1, Size(3,3)), CV_8UC1, CV_8UC1);
 filter->apply(src, dst);
0

精彩评论

暂无评论...
验证码 换一张
取 消