Sridhar Boganathan
Sridhar Boganathan

Reputation: 399

OpenCV existing C++ code in Java

I am trying to create java code by using existing C++ code. Please see this link for C++ code.

Everything looks fine expect arithmetic operations on Mat objects. I don't know what is java equivalent of those C++ code. I tried with google. I could not get anything regarding this.

 t1 = 2 * mu1_mu2 + C1;
 t2 = 2 * sigma12 + C2;
 t3 = t1.mul(t2);              // t3 = ((2*mu1_mu2 + C1).*(2*sigma12 + C2))

 t1 = mu1_2 + mu2_2 + C1;
 t2 = sigma1_2 + sigma2_2 + C2;
 t1 = t1.mul(t2);     

Do you what is the java code for these. Here, the variables are Mat objects

Upvotes: 0

Views: 68

Answers (1)

Haris
Haris

Reputation: 14053

For addition you can use

add(Mat src1, Mat src2, Mat dst)

And for multiplication use

multiply(Mat src1, Scalar src2, Mat dst)

See more option on OpenCV Java Documentation

Upvotes: 2

Related Questions