mat.hpp:1137: undefined reference to `vtable for cv::_InputArray'

asked 2020-01-16 14:15:33 -0500

I keep seeing this error

/usr/include/opencv2/core/mat.hpp:1137: undefined reference to `vtable for cv::_InputArray'

at various locations. The below code is an excerpt from the DFT tutorial

 cv::Mat magI = planes[0];
 magI += cv::Scalar::all(1);

If I replace that line with magI = magI + cv::Scalar::all(1);

it works fine. Seems the += operator is not overloaded properly?

I guess this is a bug in my cv version? LL 1137 in that file is

template<typename _Tp> inline _InputArray::_InputArray(const _Tp* vec, int n)
    : flags(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type), obj((void*)vec), sz(n, 1) {}
//Below is 1137
inline _InputArray::_InputArray(const Scalar& s)
    : flags(FIXED_TYPE + FIXED_SIZE + MATX + CV_64F), obj((void*)&s), sz(1, 4) {}

template<typename _Tp> inline _InputArray::_InputArray(const Mat_<_Tp>& m)
    : flags(FIXED_TYPE + MAT + DataType<_Tp>::type), obj((void*)&m) {}

That returns not a template by a fixed type. Could that be the issue?

edit retag flag offensive close merge delete



What version of OpenCV are you using? 3.4?

MaxD gravatar imageMaxD ( 2020-01-16 21:42:31 -0500 )edit