¿Cómo crear cv :: Mat desde el búfer (matriz de datos T *) usando una función de plantilla?
Me gustaría escribir una función de plantilla para copiar datos referenciados por punteroT* image
acv::Mat
. Estoy confundiendo cómo generalizar T y cv_type.
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;
}
Soy nuevo en la programación de plantillas, estoy bastante confundido sobre cómo implementar la correspondencia T-cv_types.
Alguien tiene alguna idea? ¡¡¡Gracias!!!