我試圖反轉在OpenCV的矩陣。有沒有生成錯誤,但我不斷收到格式的「不支持的格式或組合()的未知功能,文件.. \ .. \ .. \ .. \ OCV \ OpenCV的\模塊\核心的\ src \ lapack.cpp, 1469行「,這無助於理解我做錯了什麼。 我使用以下代碼:運行時錯誤而使用反轉()或INV()反轉矩陣,在OpenCV中
Mat centerPointsMat = Mat(5, 3, CV_32SC2);
Mat centerPointsMatInv = Mat(5, 3, CV_32SC2);
for(int i=0; i<5; i++)
{
Point p1=Point(0,i);
centerPointsMat.at<float>(p1) = ((CvPoint*)CV_GET_SEQ_ELEM(CvPoint,centerPointsSeq,i))->x^2;
Point p2=Point(1,i);
centerPointsMat.at<float>(p2) = ((CvPoint*)CV_GET_SEQ_ELEM(CvPoint,centerPointsSeq,i))->x;
Point p3=Point(2,i);
centerPointsMat.at<float>(p3) = 1;
}
centerPointsMatInv = centerPointsMat.inv(1);
同樣使用反相()而不是INV()產生相同的結果。
我錯過了什麼?
謝謝。
你只能倒置一個方陣 - 即使這樣你幾乎就不會想要(反演經常在數值上很不穩定,所以即使理論上它應該工作,它產生的結果也會贏得'非常準確)。 – 2012-04-08 15:55:27
您需要一個浮動或雙重方形矩陣 – Sam 2012-04-09 11:32:39
感謝vasile!將CV_32SC2更改爲CV_32FC1似乎解決了這個問題。 – 2012-04-10 07:05:18