# 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];

}
}

edit retag close merge delete

imfft is the name of Mat object ?

( 2013-05-28 12:18:12 -0500 )edit

yes it is! in matlab the operation is : imfft= imfft.*filter

but my filter is a bidimensial double array

( 2013-05-28 20:06:13 -0500 )edit

-1 for not looking into the documentation.

( 2013-06-30 15:23:27 -0500 )edit

Sort by ยป oldest newest most voted

There are two possible cases of multiply for matrices .

Matrix multiplication 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 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);

more

I 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.

( 2013-05-29 18:30:44 -0500 )edit

hey , with pleasure :)

( 2013-05-30 14:41:40 -0500 )edit

( 2013-06-03 10:14:16 -0500 )edit

Official site

GitHub

Wiki

Documentation