# Product of two matrices

Hi,

I use OpenCV 2.4.4 with Java. I have problem with simple multiplication of two matrices. I define it in my code in following way:

Mat m1 = Mat.ones(3, 3, CvType.CV_16SC1);

Mat m2 = Mat.ones(3, 3, CvType.CV_16SC1);

In case if I multiply:

Mat m3 = m1 * m2;

I achieved error that operator * is undefined.

I know that OpenCv for Java provides function mul and i can use it:

Mat m3 = m1.mul(m2);

but in this way I receive only product of elementwise multiplication what is not my objective.

Is there some replacement function which allow me to multiply two matrices like * operator?

Thanks in advance :)

i think you need float mat's for this

Hi, When I define my matrix like:

Mat m1 = Mat.ones(3, 3, CvType.CV_32FC1);I achieved error that I am not able to use operator * too. There have to be another way to solve it...Thank You

berekfor interest of my problem. The problem was with CvType and used gemm function. Tomorrow I will present final solution, today I am not able because of some rules of forum.