Ask Your Question
0

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

asked 2016-12-22 03:13:33 -0600

Neel Gohel gravatar image

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

edit retag flag offensive close merge delete

Comments

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.

berak gravatar imageberak ( 2016-12-22 03:19:27 -0600 )edit

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

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

Neel Gohel gravatar imageNeel Gohel ( 2016-12-22 03:29:44 -0600 )edit

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

berak gravatar imageberak ( 2016-12-22 03:35:30 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-12-22 03:24:08 -0600

berak gravatar image

updated 2016-12-22 03:27:39 -0600

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.

edit flag offensive delete link more

Comments

But will Core.divide do element wise division?

Neel Gohel gravatar imageNeel Gohel ( 2016-12-22 03:30:59 -0600 )edit

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

berak gravatar imageberak ( 2016-12-22 03:33:25 -0600 )edit

oh I forgot that thing, Thank you for help berak....:D

Neel Gohel gravatar imageNeel Gohel ( 2016-12-22 03:34:36 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-12-22 03:13:33 -0600

Seen: 1,651 times

Last updated: Dec 22 '16