Ask Your Question

Revision history [back]

Trying to write MSSIM method in Java. Getting error

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?

click to hide/show revision 2
retagged

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

berak gravatar image

Trying to write MSSIM method in Java. Getting error

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?