I am working on a simple example using visual studio 2015 with opencv 4.1.0. i am not able to set value for iterator from cv::Mat sample code is shown below.
cv::Mat inputImg = cv::imread(argv[1]);
//convert to float image cv::Mat flaotImg; inputImg.convertTo(flaotImg, CV_32FC3, 2.0 / 255.0, -1.0); cv::MatIterator_<float> it;
try { // ... Contents of your main
it = (flaotImg.begin<float>());
} catch (cv::Exception & e) { cerr << e.msg << endl; // output exception message }
Error:
OpenCV(4.1.0) Error: Assertion failed (elemSize() == sizeof(_Tp)) in cv::Mat::begin, file c:\opencv\opencv\build\include\opencv2\core\mat.inl.hpp, line 1273 OpenCV(4.1.0) c:\opencv\opencv\build\include\opencv2\core\mat.inl.hpp:1273: error: (-215:Assertion failed) elemSize() == sizeof(_Tp) in function 'cv::Mat::begin'