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)); }
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 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); }
protected ColorInterpolatorBase(WeightingFunction weightingFunction) { WeightingFunction = weightingFunction; }
public ApproximateColorInterpolator(WeightingFunction weightingFunction, int boundaryPixelsSampleSize) : base(weightingFunction) { m_boundaryPixelsSampleSize = boundaryPixelsSampleSize; }
public virtual void test() { assertEquals(WeightingFunction.of("Linear"), WeightingFunctions.LINEAR); assertEquals(WeightingFunction.of("Sine"), WeightingFunctions.SINE); }
//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"); }
public NaiveColorInterpolator(WeightingFunction weightingFunction) : base(weightingFunction) { }