Trying to write MSSIM method in Java. Getting error

asked 2013-11-26 23:04:45 -0600

Nitin Gupta gravatar image

updated 2013-11-27 02:03:38 -0600

berak gravatar image

Hi,

I am trying to write getMSSIM method in java. getMSSIM method is already written in C++ in opencv tutorial. Please follow given link.

http://docs.opencv.org/doc/tutorials/highgui/video-input-psnr-ssim/video-input-psnr-ssim.html

However, I am finding hard time to understand below lines of code.

const double C1 = 6.5025, C2 = 58.5225; Mat t1, t2, t3;

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

Here mu1_mu2 and sigma12 is of Mat type. How Mat type can be multiplied with 2 and then how can C1 add to a Mat data type.

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

Here also mu1_2 and mu2_2 are of Mat data type and C1 is double. How can this addition possible.

Is it a bug in code?

edit retag flag offensive close merge delete

Comments

no, not a bug. c++ has overloaded operators for this.

in java, there's an add method for this: http://docs.opencv.org/java/org/opencv/core/Core.html#add(org.opencv.core.Mat,%20org.opencv.core.Scalar,%20org.opencv.core.Mat)

berak gravatar imageberak ( 2013-11-27 05:46:27 -0600 )edit

Hi did you solve the problem or not, I also have the same problem. If you solved please tell me also. Thanks

BAHRAMUDIN ADIL gravatar imageBAHRAMUDIN ADIL ( 2015-07-31 22:32:28 -0600 )edit