cvMulTransposed and Dimensions of output Matrix?
this might seem as a stupid question but I am having trouble with the output size of the matrix after multiplication.. according to basics, if matrix A has is m*n and matrix B is J*k.. then their product will be of the size m*k..
so according to my code below:
CvMat *meh, *meh2;
meh = cvCreateMat(2, 9, CV_32FC1);
meh2 = cvCreateMat(2, 2, CV_32FC1);
cvMulTransposed(meh, meh2, 1);
cvSave( "meh.txt", meh2 );
meh is a 2 row, 9 column matrix, so its transpose will be a 9 row 2 column matrix right? and their multiplication will give a 2 row 2 column matrix ( 2*9 multiplied with 9*2).
and that is what I created as my output matrix, meh2.. this is the output is saved to text:
%YAML:1.0
meh: !!opencv-matrix
rows: 2
cols: 2
dt: f
data: [ -431602080., -431602080., -431602080., -431602080. ]
as can be seen its filled with junk values..
but when I change the code to make the output 9*9 matrix then I开发者_开发百科 can see actual multiplied values in the saved file..
here, doesnt the output matrix after multiplication have the rows of first matrix and columns of second?
Cheers
This is the declaration of the function:
void cvMulTransposed(const CvArr* src, CvArr* dst, int order, const CvArr* delta=NULL, double scale=1.0)
You used order = 1, then it means the multiplication is done like this :
dst = scale* transpose[(src-delta)] * (src-delta)
If you use order 0 then the multiplication is :
dst = scale* (src-delta) * transpose[(src-delta)]
In your case as you use order=1, the final matrix is :
(9,2) x (2,9) = (9,9)
transpose not transpose result
This is where you can get the documentation of the function
精彩评论