public void WeightingFunction_IsCorrect()
        {
            WeightingFunction function = new WeightingFunction(m_region, string.Empty, 4, EPSILON);
            Pixel             a        = new Pixel(m_region, 480, 0);
            Pixel             b        = new Pixel(m_region, 640, 0);

            Assert.AreEqual(0.0000000015258789062267169356f, function.Calculate(a, b));
        }
        public void WeightingFunction_IsCorrect_Z0_X0_Y0()
        {
            WeightingFunction function = new WeightingFunction(m_region, string.Empty, 0, EPSILON);
            Pixel             a        = new Pixel(m_region, 0, 0);
            Pixel             b        = new Pixel(m_region, 0, 0);

            Assert.AreEqual(1f, function.Calculate(a, b));
        }
예제 #3
0
        public override float InterpolateColor(Pixel missingPixel, ICollection <Pixel> boundaryPixels)
        {
            float numerator   = 0f;
            float denominator = 0f;

            GetRandomSubset(boundaryPixels)
            .All(boundaryPixel =>
            {
                float weight = WeightingFunction.Calculate(boundaryPixel, missingPixel);

                numerator   += (weight * boundaryPixel.Color);
                denominator += weight;
                return(true);
            });
            return(numerator / denominator);
        }