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);
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 = ...;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.