Matrix Multiplication Values Not Correct [closed]
Matrix multiplication.....
So i am converting some Opencv code to Opencvjs and i cannot get the correct matrix multiplication result.
In C++ which appears to work.
cv::Mat translation = -rotation * S;
Print out of each matrix. (std::cout << cv::Mat() << std::endl)
-rotation = [-0.49347955, -0.015945198; 0.015945198, -0.49347955]
S = [295.79922; 245.82167]
Print out of the result.
Translation [-149.89055; -116.59139]
Then verification via an online Matrix Multiplication tool gives a different answer, as well as opencvjs using GEMM.
Is the cv::Mat * (multiplication) operator the same as GEMM?
This is the opencvjs code i expected to give the same result, but the online matrix calculator gives yet another result.
cv.gemm(rotation, S, -1, emptyMat, 0, translation, 0);
I am missing something obvious, i think.
UPDATE: EDIT ADDED CORRECT VALUES.
The answers is still incorrect....... can somebody please tell me what is METHODOLOGICALLY WRONG WITH WHAT I AM DOING HERE.
Am i taking crazy pills here?
sad, that it is no more maintained since 3 years (so be careful ..)
Nah, this one..... https://github.com/ucisysarch/opencvjs@berak
You are comparing different numbers. You have
-0.49347955
in your C++ rotation matrix and-0.493413
in the online checker, so yeah, different results. And-0.015945198
vs-0.15945198
Bonus: please, dust off you old calculator instead of using an online Matrix Multiplication tool to make such an easy check. It will feel awesome ;)
@LorenaGdL I've updated the numbers and i am still confused,. Any clues?
Now you have changed sign of the numbers. In your C++matrix, 0-row,1-column is
-0.015945198
while in the online tool is0.015945198
. Same with element 1-row, 0-column. Relax, and take your time to review everything. Methodologically everything is fine.