コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #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);
        }
コード例 #4
0
 protected ColorInterpolatorBase(WeightingFunction weightingFunction)
 {
     WeightingFunction = weightingFunction;
 }
コード例 #5
0
 public ApproximateColorInterpolator(WeightingFunction weightingFunction, int boundaryPixelsSampleSize) : base(weightingFunction)
 {
     m_boundaryPixelsSampleSize = boundaryPixelsSampleSize;
 }
コード例 #6
0
 public virtual void test()
 {
     assertEquals(WeightingFunction.of("Linear"), WeightingFunctions.LINEAR);
     assertEquals(WeightingFunction.of("Sine"), WeightingFunctions.SINE);
 }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void testBadName()
        public virtual void testBadName()
        {
            WeightingFunction.of("Random");
        }
コード例 #8
0
 public NaiveColorInterpolator(WeightingFunction weightingFunction) : base(weightingFunction)
 {
 }