Ask Your Question

Revision history [back]

cv::Mat and cv::cuda::GpuMat containers

I am writing a class that uses PLK optical flow and I want it to be able to use either the CPU cv::Mat version or the GPU cv::cuda::GpuMat version of the PLK optical flow algorithm. I want to "pipeline" my computation and so I need to store an image pyramid to prevent redundant computation.

My question is: How can I store an image pyramid in a polymorphic way? I want a single variable to not care if it is std::vector<cv::Mat> or std::vector<cv::cuda::GpuMat>. I have tried abusing cv::OutputArray, but I am stumped. Is this an impossible task? Do I really need conditional compilation or templates?