I have a template method in which a Mat object is constructed. The type of this matrix depends on the template implementation:
template <typename T>
void createMatrixAndDoStuff(int rows, int cols){
// ...
Mat A(rows,cols,getCVtype<T>::value);
// ...
}
In this case I use a basic trait, getCVType<T>::value will return CV_32F if T=float, etc. I know this is silly, because I could have used Mat_<T>(rows,cols) and forget about using traits for this. But it made me think: is there any available trait (or any template stuff) in OpenCV to infer type macros (CV_32F,CV_8U,...) in compile time from types?
getCVtypetrait thingy :) But still, it is strange that no methods are provided in the OpenCV API, isn't it?