對於我允許的類型使用任何類型的墊子,我得到一個類似下面的錯誤,當我嘗試做一些分配或寫入流等它發生在MSVC++ 2010 Express編譯器,它不會發生在gnu g ++編譯器中。OpenCV的錯誤訪問CV ::墊數據
例如有缺陷的用法:
Mat M = Mat::zeros(image.size(), DataType<int>::type );
std::cout << M.at<int>(0,0) << std::endl; // error
// OR
int x = M.at<int>(0,0); // error
兩個錯誤一起燒製:
彈出窗口Unhandled exception at <some hex adress> in test.exe:Microsoft C++ exception: cv:xception at memory location <some hex adress>
並在控制檯窗口
OpenCV Error: Assertion failed ... \mat.hpp, line 537
任何建議
上?
我做了以下(已經和現在一次),但它不工作... Mat M = Mat :: zeros(image.size(), CV_16S); std :: cout << M.at(0,0)<< std :: endl; –
Zoran
沒錯,但是你把事物稱爲int而不是簡短。根據您的編譯器,它們可能會無縫地解決,而且可能不會。不要假設在你的矩陣引用 – Chris
Thanx中隱式轉換。顯式投射是關鍵。儘管如此,我還沒有完全解決我的問題。如果我想要從mat分配值,該怎麼辦? M1.at(0,0)= M2.at (I,J)假設他們都是CV_32F或在當M2是CV_32S –
Zoran