I just migrated from Ubuntu 10.04 to 11.10 and I am using OpenCV 2.3.1. For some reasons now when I do something like:
Mat_<unsigned> a = Mat_<unsigned>(10,2); Mat_<float> b; a.convertTo(b,CV_32F); I get the following error:
OpenCV Error: Assertion failed (func != 0) in convertTo, file /home/memecs/Desktop/OpenCV-2.3.1/modules/core/src/convert.cpp, line 937 terminate called after throwing an instance of 'cv::Exception' what(): /home/memecs/Desktop/OpenCV-2.3.1/modules/core/src/convert.cpp:937: error: (-215) func != 0 in function convertTo Aborted and the function asserting is:
Mat::convertTo(OutputArray _dst, int _type, double alpha, double beta) const { bool noScale = fabs(alpha-1) < DBL_EPSILON && fabs(beta) < DBL_EPSILON; if( _type < 0 ) _type = _dst.fixedType() ? _dst.type() : type(); else _type = CV_MAKETYPE(CV_MAT_DEPTH(_type), channels()); int sdepth = depth(), ddepth = CV_MAT_DEPTH(_type); if( sdepth == ddepth && noScale ) { copyTo(_dst); return; } Mat src = *this; BinaryFunc func = noScale ? getConvertFunc(sdepth, ddepth) : getConvertScaleFunc(sdepth, ddepth); double scale[] = {alpha, beta}; int cn = channels(); ################### THIS IS THROWING THE ASSERTION ERROR ############### CV_Assert( func != 0 ); if( dims <= 2 ) { _dst.create( size(), _type ); Mat dst = _dst.getMat(); Size sz = getContinuousSize(src, dst, cn); func( src.data, src.step, 0, 0, dst.data, dst.step, sz, scale ); } else { _dst.create( dims, size, _type ); Mat dst = _dst.getMat(); const Mat* arrays[] = {&src, &dst, 0}; uchar* ptrs[2]; NAryMatIterator it(arrays, ptrs); Size sz((int)(it.size*cn), 1); for( size_t i = 0; i < it.nplanes; i++, ++it ) func(ptrs[0], 0, 0, 0, ptrs[1], 0, sz, scale); } } Any help? I really don't know how to solve this problem.