OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Sun, 30 Jun 2013 15:23:27 -0500Is this line code correct?http://answers.opencv.org/question/14123/is-this-line-code-correct/I
I have a Mat object and a bidimensional array. I need to multiply them and have a new Mat object. I had to realize imf=imf.*filt in Matlab
for(m=0;m<rows;m++){
for(n=0;n<cols;n++){
imfft= imfft*filter[m][n];
}
}
Tue, 28 May 2013 11:32:39 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/Comment by SR for <p>I </p>
<p>I have a Mat object and a bidimensional array. I need to multiply them and have a new Mat object. I had to realize imf=imf.*filt in Matlab</p>
<pre><code>for(m=0;m<rows;m++){
for(n=0;n<cols;n++){
imfft= imfft*filter[m][n];
}
}
</code></pre>
http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=15941#post-id-15941-1 for not looking into the documentation.Sun, 30 Jun 2013 15:23:27 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=15941#post-id-15941Comment by Jawaher Khemakhem for <p>I </p>
<p>I have a Mat object and a bidimensional array. I need to multiply them and have a new Mat object. I had to realize imf=imf.*filt in Matlab</p>
<pre><code>for(m=0;m<rows;m++){
for(n=0;n<cols;n++){
imfft= imfft*filter[m][n];
}
}
</code></pre>
http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14126#post-id-14126imfft is the name of Mat object ?Tue, 28 May 2013 12:18:12 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14126#post-id-14126Comment by residentelvio for <p>I </p>
<p>I have a Mat object and a bidimensional array. I need to multiply them and have a new Mat object. I had to realize imf=imf.*filt in Matlab</p>
<pre><code>for(m=0;m<rows;m++){
for(n=0;n<cols;n++){
imfft= imfft*filter[m][n];
}
}
</code></pre>
http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14163#post-id-14163yes it is! in matlab the operation is :
imfft= imfft.*filter
but my filter is a bidimensial double arrayTue, 28 May 2013 20:06:13 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14163#post-id-14163Answer by Jawaher Khemakhem for <p>I </p>
<p>I have a Mat object and a bidimensional array. I need to multiply them and have a new Mat object. I had to realize imf=imf.*filt in Matlab</p>
<pre><code>for(m=0;m<rows;m++){
for(n=0;n<cols;n++){
imfft= imfft*filter[m][n];
}
}
</code></pre>
http://answers.opencv.org/question/14123/is-this-line-code-correct/?answer=14129#post-id-14129There are two possible cases of multiply for matrices .
[Matrix multiplication](http://en.wikipedia.org/wiki/Matrix_multiplication#Matrix_product_.28two_matrices.29) is where two matrices are multiplied directly. This operation multiplies matrix A of size [a x b] with matrix B of size [b x c] to produce matrix C of size [a x c]. In OpenCV it is achieved using the simple * operator:
C = A * B
[Element-wise multiplication](http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-mul) is where each pixel (element) in the output matrix is formed by multiplying that pixel (element) in matrix A by its corresponding entry in matrix B. The input matrices should be the same size, and the output will be the same size as well. This is achieved using the mul() function:
output = A.mul(B);Tue, 28 May 2013 12:30:14 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/?answer=14129#post-id-14129Comment by residentelvio for <p>There are two possible cases of multiply for matrices .</p>
<p><a href="http://en.wikipedia.org/wiki/Matrix_multiplication#Matrix_product_.28two_matrices.29">Matrix multiplication</a> is where two matrices are multiplied directly. This operation multiplies matrix A of size [a x b] with matrix B of size [b x c] to produce matrix C of size [a x c]. In OpenCV it is achieved using the simple * operator:</p>
<p>C = A * B</p>
<p><a href="http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-mul">Element-wise multiplication</a> is where each pixel (element) in the output matrix is formed by multiplying that pixel (element) in matrix A by its corresponding entry in matrix B. The input matrices should be the same size, and the output will be the same size as well. This is achieved using the mul() function:</p>
<p>output = A.mul(B);</p>
http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14248#post-id-14248I voted for you. I have just another line to translate from Matlab to finish my all work.
If you will help I' ll do another question and vote for you again. It' s around cat function.Wed, 29 May 2013 18:30:44 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14248#post-id-14248Comment by Jawaher Khemakhem for <p>There are two possible cases of multiply for matrices .</p>
<p><a href="http://en.wikipedia.org/wiki/Matrix_multiplication#Matrix_product_.28two_matrices.29">Matrix multiplication</a> is where two matrices are multiplied directly. This operation multiplies matrix A of size [a x b] with matrix B of size [b x c] to produce matrix C of size [a x c]. In OpenCV it is achieved using the simple * operator:</p>
<p>C = A * B</p>
<p><a href="http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-mul">Element-wise multiplication</a> is where each pixel (element) in the output matrix is formed by multiplying that pixel (element) in matrix A by its corresponding entry in matrix B. The input matrices should be the same size, and the output will be the same size as well. This is achieved using the mul() function:</p>
<p>output = A.mul(B);</p>
http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14309#post-id-14309hey , with pleasure :) Thu, 30 May 2013 14:41:40 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14309#post-id-14309Comment by residentelvio for <p>There are two possible cases of multiply for matrices .</p>
<p><a href="http://en.wikipedia.org/wiki/Matrix_multiplication#Matrix_product_.28two_matrices.29">Matrix multiplication</a> is where two matrices are multiplied directly. This operation multiplies matrix A of size [a x b] with matrix B of size [b x c] to produce matrix C of size [a x c]. In OpenCV it is achieved using the simple * operator:</p>
<p>C = A * B</p>
<p><a href="http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-mul">Element-wise multiplication</a> is where each pixel (element) in the output matrix is formed by multiplying that pixel (element) in matrix A by its corresponding entry in matrix B. The input matrices should be the same size, and the output will be the same size as well. This is achieved using the mul() function:</p>
<p>output = A.mul(B);</p>
http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14578#post-id-14578This is the link about the question
http://answers.opencv.org/question/13969/cat-function-of-matlab/Mon, 03 Jun 2013 10:14:16 -0500http://answers.opencv.org/question/14123/is-this-line-code-correct/?comment=14578#post-id-14578