private static double TestShapeEnergyCalculationApproachesImpl( ShapeModel model, IEnumerable <Vector> vertices, IEnumerable <double> edgeWidths, Size imageSize, int lengthGridSize, int angleGridSize, double eps) { // Create shape model and calculate energy in normal way Shape shape = new Shape(model.Structure, vertices, edgeWidths); double energy1 = model.CalculateEnergy(shape); // Calculate energy via generalized distance transforms ShapeConstraints constraints = ShapeConstraints.CreateFromShape(shape); ShapeEnergyLowerBoundCalculator calculator = new ShapeEnergyLowerBoundCalculator(lengthGridSize, angleGridSize); double energy2 = calculator.CalculateLowerBound(imageSize, model, constraints); Assert.AreEqual(energy1, energy2, eps); return(energy1); }
private Image CreateStatusImage(Shape shape) { return(this.DrawConstraintsOnTopOfImage( this.segmentedImage, 2, ShapeConstraints.CreateFromShape(shape), false, false, false, true)); }