我是opencv及其開發人員的新手。我想將無符號數據的兩個二維矩陣推回到Mat類型的對象中。並使用imshow(opencv函數)顯示該Mat請找到我試過的下面的代碼snippit。但我收到錯誤。任何幫助都得到了認可。將數據壓回矩陣並使用imshow顯示矩陣
Mat finaldata(20, 10000, CV_8UC1);
unsigned char test[20][10000]={"0"};// test having values i checked it.
for (int coloumns=0 ;coloumns <20;coloumns++)
{
for (int row=0 ;row <10000;row++)
{
finaldata.push_back(test[coloumns][row]);
}
}
imshow("window ", finaldata);
waitKey(0);
錯誤
OpenCV Error: Assertion failed (DataType<_Tp>::type == type() && cols == 1) in push_back, file /usr/local/include/opencv2/core/mat.hpp, line 690
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /usr/local/include/opencv2/core/mat.hpp:690: error: (-215) DataType<_Tp>::type == type() && cols == 1 in function push_back
Program ended with exit code: 9
你得到什麼錯誤? – wizurd
可能不是問題,但Mat finaldata(20,10000,CV_8UC1)意味着20個ROWS和10000個列 – Micka
@Micka我改變了它,但仍然得到相同的錯誤。任何想法 ? –