# How to do element wise division in java using Mat.mul?

Suppose I have to Mat,i want to do element wise division(m1./m2), Then how to do it using Mat.mul method?

How to do element wise division in java using Mat.mul?

0

i guess, the problem is, that you found a Mat.mul() member function, but there is no Mat.div() or similar.

use Core.divide(src1, src2, dst) in that case.

yes, that's element-wise. (there is a matrix *multiplication* in maths, but no such counterpart for division).

Asked: **
2016-12-22 03:13:33 -0500
**

Seen: **681 times**

Last updated: **Dec 22 '16**

OpenCV setup on Mac Java opencv2.4.9

Mat to Byte[] conversion not working in java

how to display the grabbed video frame inside JFrame

opencv java 2.4.9 pixel operations

How can I use opencv-java get the values of the channel in a mat

building a Mat image from different 1-column Mat images

How to create Mat from rgb 2d arrays?????

Opencv3.4 with extra module and java wrapper

OpenCv 3.3.1 Java FaceRecognizer prediction labels and confidence values are wrong.

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.

what are m1, m2, exactly ? why do you want to use mult() for division ?

you can replace division by multiplication only, if m2 is a scalar.

Mat m1=new Mat(); Mat m2=new Mat();

Now I want to divide m1 & m2 elementwise, So what should be scalar value?

ok, let me clarify, if m is a matrix, and you have a number, like 5, you can replace the m/5 division by multiplying by 0.2. (but this is only valid for

single numbers(Scalars))