I'd like to write a template function to copy data referenced by pointer T* image to cv::Mat. I am confusing how to generalize T and cv_type matching.
template<typename T>
cv::Mat convert_mat(T *image, int rows, int cols) {
// Here we need to match T to cv_types like CV_32F, CV_8U and etc.
// The key point is how to connect these two
cv::Mat mat(rows, cols, cv_types, image);
return mat;
}
I am new to template programming, I am quite confused how to implement T-cv_types correspondence.
Anyone has any idea? Thank you!!!