Reputation: 7564
I need to access the element type T of an opencv matrix Mat_<\T> at compile time; Is there any way to do it? I am trying to achieve the following:
template <typename T>
void foo(const T& mat) {
// T::type* ptr = (T::type*)mat.data;
}
foo(Mat_<float>::ones(5,5));
The following declaration is not an option:
template <typename T>
void foo(const Mat_<T>& mat);
Upvotes: 0
Views: 194
Reputation: 7202
It looks like there is a typedef called value_type that does what you want.
template <typename T>
void foo(const T& mat) {
T::value_type* ptr = ...;
}
Upvotes: 1