public static double MSE(Bitmap reference, Bitmap compare) { InputArray referenceArray = InputArray.Create(BitmapConverter.ToMat(reference)); InputArray compareArray = InputArray.Create(BitmapConverter.ToMat(compare)); Scalar scalar = QualityMSE.Compute(referenceArray, compareArray, null); return((scalar[0] + scalar[1] + scalar[2]) / 3); }
public void StaticCompute() { using (var refImage = Image("lenna.png")) using (var targetImage = new Mat()) { Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); var value = QualityMSE.Compute(refImage, targetImage, null); Assert.Equal(83.89224, value[0], 6); Assert.Equal(96.848604, value[1], 6); Assert.Equal(50.611845, value[2], 6); } }
public void StaticCompute() { using (var refImage = Image("lenna.png")) using (var targetImage = new Mat()) { Cv2.GaussianBlur(refImage, targetImage, new Size(5, 5), 15); var value = QualityMSE.Compute(refImage, targetImage, null); Assert.Equal(85.455929, value[0], 6); Assert.Equal(99.077258, value[1], 6); Assert.Equal(53.734322, value[2], 6); } }