Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::Mat_ && cv::Vec conversion

I use visual studio 2010 with opencv 2.46,while when I convert Mat_(such as Mat1d,not Mat) to Vec or Matx,I meet a strange mistake,vc says that it can't find the return value in function template<typename _tp=""> template<int n=""> inline Mat_<_Tp>::operator Vec<typename datatype<_tp="">::channel_type, n>() const at <mat.hpp>

we try to solve the problem by change the function to this template<typename _tp=""> template<int n=""> inline Mat_<_Tp>::operator Vec<typename datatype<_tp="">::channel_type, n>() const { CV_Assert(n % DataType<_Tp>::channels == 0); Vec<typename datatype<_tp="">::channel_type, n> ret=this->Mat::operator Vec<typename datatype<_tp="">::channel_type, n>();

return ret;

} Then it works well... Can anybody tell me why it can happen ?

cv::Mat_ && cv::Vec conversion

I use visual studio 2010 with opencv 2.46,while when I convert Mat_(such as Mat1d,not Mat) to Vec or Matx,I meet a strange mistake,vc says that it can't find the return value in function

template<typename _tp=""> _Tp> template<int n=""> n> inline Mat_<_Tp>::operator Vec<typename datatype<_tp="">::channel_type, DataType<_Tp>::channel_type, n>() const at <mat.hpp>

<mat.hpp>

we try to solve the problem by change the function to this

template<typename _tp=""> _Tp> template<int n=""> n> inline Mat_<_Tp>::operator Vec<typename datatype<_tp="">::channel_type, DataType<_Tp>::channel_type, n>() const
{
    CV_Assert(n % DataType<_Tp>::channels == 0);
    Vec<typename datatype<_tp="">::channel_type, DataType<_Tp>::channel_type, n> ret=this->Mat::operator Vec<typename datatype<_tp="">::channel_type, n>();

DataType<_Tp>::channel_type, n>();
 return ret;
}

} Then it works well... Can anybody tell me why it can happen ?