예제 #1
0
        public void ApplyTest()
        {
            Bitmap input = Accord.Imaging.Image.Clone(Properties.Resources.lena_color);

            Logarithm log    = new Logarithm();
            Bitmap    output = log.Apply(input);

            Exponential exp            = new Exponential();
            Bitmap      reconstruction = exp.Apply(output);

            //ImageBox.Show("input", input);
            //ImageBox.Show("output", output);
            //ImageBox.Show("reconstruction", reconstruction);
        }
예제 #2
0
        protected virtual Expression VisitExponential(MethodCallExpression term, ExponentialFunction function)
        {
            ReadOnlyCollection <Expression> newArguments = VisitExpressionList(term.Arguments);

            if (newArguments != term.Arguments)
            {
                if (newArguments.Count != 1)
                {
                    throw new InvalidOperationException("Single Argument Expected.");
                }

                return(Exponential.Apply(function, newArguments[0]));
            }

            return(term);
        }
예제 #3
0
        public void ProcessImageTest()
        {
            double[,] diag = Matrix.Magic(5);

            Bitmap input;

            new MatrixToImage(0, 100).Convert(diag, out input);

            Logarithm log    = new Logarithm();
            Bitmap    output = log.Apply(input);

            Exponential exp            = new Exponential();
            Bitmap      reconstruction = exp.Apply(output);


            double[,] actual;
            new ImageToMatrix(0, 100).Convert(reconstruction, out actual);

            double[,] expected = diag;

            Assert.IsTrue(expected.IsEqual(actual, 1.5));
        }