2015-04-29 124 views
3

我越來越OpenCV的矩陣乘法斷言

OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type == CV_64FC1 || type == CV_32FC2 || type == CV_64FC2)) in gemm, file /build/buildd 
/opencv-2.4.9+dfsg/modules/core/src/matmul.cpp, line 711 
terminate called after throwing an instance of 'cv::Exception' 
    what(): /build/buildd/opencv-2.4.9+dfsg/modules/core/src/matmul.cpp:711: error: (-215) type == B.type() && (type == CV_32FC1 || type == CV_64FC1 || type == 
CV_32FC2 || type == CV_64FC2) in function gemm 

我想知道在文檔中它提到的矩陣乘法浮點矩陣僅支持?我只能在SO中找到這樣的人講這個,但沒有什麼可以與標準文檔相媲美。

+0

請做什麼錯誤提示的,並檢查*確切*您類型輸入以下EG,CV_64F(6)= CV_32F(5) – berak

+0

@berak謝謝,你一言我檢查和我意識到代碼中存在一個錯誤,一次矩陣類型中的一個出現意外。儘管如此,我想了解更多關於這個問題的信息,儘管這些信息無關,但是有用。 –

+0

我不知道這是否足夠,但[gemm](http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#gemm)的文檔確實聲明只接受浮點類型。 – beaker

回答

1

你沒有提到你正在使用,但你可以嘗試mat1.mul(MAT2)運營商,MAT1 * MAT2,乘(MAT1,MAT2,DST),或做:

mat1.convertTo(mat1, CV_32FC1); 
mat2.convertTo(mat2, CV_32FC1); 

,如果需要, !

mat1.convertTo(mat1, CV_8UC1); 
mat2.convertTo(mat2, CV_8UC1); 
+0

我正在使用'*'。在這個問題中,我只對支持該信息的文檔感興趣,因爲它在其他SO答案中被提及。我已經解決了我的錯誤。 –