Writing functions accepting inputs of type cv::Mat or cv::UMat

asked 2018-09-05 03:11:09 -0500

csggnn gravatar image

What is the simplest and cleanest way to write a function accepting input arguments of type Mat or UMat? Should i use InputArray, use templates or is there a better alternative? I am currelnlty having functions with identical implementation written for both Mat and UMat.

edit retag flag offensive close merge delete


do you write your own opencl kernels ?

berak gravatar imageberak ( 2018-09-05 03:24:06 -0500 )edit

Not for the moment. I just use a combination of other OpenCV functions supporting both Mat and UMat inputs, typically trough InputArray input arguments. I do use local Mat and UMat variables in my code depending on the input type.

csggnn gravatar imagecsggnn ( 2018-09-05 04:43:41 -0500 )edit