OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 15 May 2013 09:14:07 -0500Matrix multiplicationhttp://answers.opencv.org/question/13399/matrix-multiplication/Hi,
I have to reimplement some methods from opencv for real time operations. But some of these are using gemm for "simple" matrix multiplication.
Looking in the sources I can't find the operator* for cv::Mat.
When I write something like C = A*B (with A, B, C cv::Mat). Does it call `gemm(A, B, 1.0, Mat(), 0.0, C);` ?Wed, 15 May 2013 08:04:23 -0500http://answers.opencv.org/question/13399/matrix-multiplication/Answer by Entreco for <p>Hi, </p>
<p>I have to reimplement some methods from opencv for real time operations. But some of these are using gemm for "simple" matrix multiplication. </p>
<p>Looking in the sources I can't find the operator* for cv::Mat.</p>
<p>When I write something like C = A*B (with A, B, C cv::Mat). Does it call <code>gemm(A, B, 1.0, Mat(), 0.0, C);</code> ?</p>
http://answers.opencv.org/question/13399/matrix-multiplication/?answer=13401#post-id-13401The * operator is available by this function:
cvMul(<#const CvArr *src1#>, <#const CvArr *src2#>, <#CvArr *dst#>)
For documentation look here: http://opencv.willowgarage.com/documentation/operations_on_arrays.html#mul
Wed, 15 May 2013 08:29:34 -0500http://answers.opencv.org/question/13399/matrix-multiplication/?answer=13401#post-id-13401Answer by Guanta for <p>Hi, </p>
<p>I have to reimplement some methods from opencv for real time operations. But some of these are using gemm for "simple" matrix multiplication. </p>
<p>Looking in the sources I can't find the operator* for cv::Mat.</p>
<p>When I write something like C = A*B (with A, B, C cv::Mat). Does it call <code>gemm(A, B, 1.0, Mat(), 0.0, C);</code> ?</p>
http://answers.opencv.org/question/13399/matrix-multiplication/?answer=13406#post-id-13406The *operator is overloaded, see [http://docs.opencv.org/modules/core/doc/basic_structures.html#matrix-expressions](http://docs.opencv.org/modules/core/doc/basic_structures.html#matrix-expressions) and it works as expected (and as you wrote it). Please also use the newer C++ interface instead of the C-interface (as Entreco suggested).Wed, 15 May 2013 09:14:07 -0500http://answers.opencv.org/question/13399/matrix-multiplication/?answer=13406#post-id-13406