I do the following
Mat xOld,xNew;
for(uint i=0;i<inliers.size();i++){
if(inliers[i]){
double xOld_arr[3]={kpOld[i].pt.x,kpOld[i].pt.y,1};
double xNew_arr[3]={kpNew[i].pt.x,kpNew[i].pt.y,1};
Mat xo(1,3,CV_64FC1,xOld_arr),xn(1,3,CV_64FC1,xNew_arr);
xNew.push_back(xn);
xOld.push_back(xo);
}
}
xNew=xNew.t();
cout<<F.size()<<" "<<xNew.size();
Mat t=xNew*F;
Output is
[3 x 3] [24 x 3]OpenCV Error: Assertion failed (a_size.width == len) in gemm, file /home/flex/test/opencv/modules/core/src/matmul.cpp, line 1537
terminate called after throwing an instance of 'cv::Exception'
what(): /home/flex/test/opencv/modules/core/src/matmul.cpp:1537: error: (-215) a_size.width == len in function gemm
What am I missing? when I multiply matrix shouldn't it be correct. Cause xNew has same colums and F same Rows?
what type is F?
so F is 3 rows, 3 cols. xNew (after transpose) is 3 rows, 24 cols. Now you try to multiply (matrix notation: rows x columns) 3x24 * 3x3 which is not defined. Matrix multiplication is size: N x M * M x O => NxO matrix. So you should be able to multiply both matrices if you don't transpose, but I can't tell you whether that is the multiplication you want.
Maybe the confusion is in this line: xn(1,3,CV_64FC1,xNew_arr)
here you create a matrix with 1 row and 3 columns and later add this row to xNew.