Ask Your Question
0

Is this line code correct?

asked 2013-05-28 11:32:39 -0600

residentelvio gravatar image

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 flag offensive close merge delete

Comments

imfft is the name of Mat object ?

Jawaher Khemakhem gravatar imageJawaher Khemakhem ( 2013-05-28 12:18:12 -0600 )edit

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

but my filter is a bidimensial double array

residentelvio gravatar imageresidentelvio ( 2013-05-28 20:06:13 -0600 )edit

-1 for not looking into the documentation.

SR gravatar imageSR ( 2013-06-30 15:23:27 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
4

answered 2013-05-28 12:30:14 -0600

Jawaher Khemakhem gravatar image

updated 2013-06-19 17:18:24 -0600

SR gravatar image

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

edit flag offensive delete link more

Comments

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.

residentelvio gravatar imageresidentelvio ( 2013-05-29 18:30:44 -0600 )edit

hey , with pleasure :)

Jawaher Khemakhem gravatar imageJawaher Khemakhem ( 2013-05-30 14:41:40 -0600 )edit
residentelvio gravatar imageresidentelvio ( 2013-06-03 10:14:16 -0600 )edit

Question Tools

Stats

Asked: 2013-05-28 11:32:39 -0600

Seen: 1,019 times

Last updated: Jun 19 '13