# How to calcuate the beta metrics?

I am working on Speckle reduction in ultrasound images. I read a paper (snapshot of that paper is included below) where they have used a metric called beta metric which indicates the edge preserving capability of the filters. I tried to implement it using the equation (7) provided in the below snapshot.

This is the code.

 %---Beta Calculation
h = fspecial('laplacian');
I1 = imfilter(Orig_Image,h);
I2 = imfilter(Esti_Image,h);
I_1 = mean2(I1);
I_2 = mean2(I2);
metrics.Beta = sum(sum((I1 - I_1).*(I2 - I_2)))./(sqrt(sum(((I1 - I_1).^2).*((I2 - I_2).^2))));


As you can see that the beta value is a single value [1x1] vector in Table 2 inside the snapshot. But when I run my code, I get beta value of size 1x256 for a 256x256 image. Is my code wrong? How to implement the given equation (7) correctly in MATLAB? Please help.

metrics.Beta = sum(sum((I1 - I_1).*(I2 - I_2)))./(sqrt(sum(sum((I1 - I_1).^2))).*(sum(sum((I2 - I_2).^2))));