private static void SetDelta(
            ref double[] deltas,
            IMagickImage fileImageCompare,
            IMagickImage deltaImage,
            CWatcher cWatcher,
            CWatchImage cWatchImage)
        {
            var metricResult = fileImageCompare.Compare(deltaImage, cWatcher.ErrorMetric);

            deltas[cWatchImage.Index] = cWatcher.ErrorMetric.Standardize(
                cWatchImage.MetricUpperBound,
                metricResult,
                cWatchImage.TransparencyRate);
        }
Beispiel #2
0
            public void ShouldCreateImage()
            {
                using (IMagickImage image = new MagickImage(Files.Builtin.Logo))
                {
                    var channels = image.Separate();

                    using (IMagickImageCollection images = new MagickImageCollection(channels))
                    {
                        var terms = new double[] { 0.30, 1, 0.59, 1, 0.11, 1 };

                        using (IMagickImage polynomial = images.Polynomial(terms))
                        {
                            var distortion = polynomial.Compare(image, ErrorMetric.RootMeanSquared);
                            Assert.AreEqual(0.086, distortion, 0.001);
                        }
                    }
                }
            }
Beispiel #3
0
        private static IEnumerable <object> CompareImages(IMagickImage image1, IMagickImage image2)
        {
            using (image1)
            {
                using (image2)
                {
                    using (var imgWithDiff = new MagickImage())
                    {
                        var compareSettings = new CompareSettings
                        {
                            HighlightColor = new MagickColor(MagickColor.FromRgb(255, 0, 0)),
                            Metric         = ErrorMetric.Absolute
                        };
                        image1.ColorFuzz = new Percentage(3);
                        var doubleRes = image1.Compare(image2, compareSettings, imgWithDiff);
                        yield return(doubleRes);

                        yield return(new MagickImage(imgWithDiff));
                    }
                }
            }
        }