Package seamfinding
Class SeamFinderTests
- java.lang.Object
-
- seamfinding.SeamFinderTests
-
- Direct Known Subclasses:
AdjacencyListSeamFinderTests.UsingDijkstraSolver,AdjacencyListSeamFinderTests.UsingToposortDAGSolver,DynamicProgrammingSeamFinderTests,GenerativeSeamFinderTests.UsingDijkstraSolver,GenerativeSeamFinderTests.UsingToposortDAGSolver
@TestInstance(PER_CLASS) public abstract class SeamFinderTests extends Object
Abstract class providing test cases for all implementations of theSeamFinderinterface.- See Also:
SeamFinder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classSeamFinderTests.RuntimeExperiments
-
Field Summary
Fields Modifier and Type Field Description private static StringBASE_PATHThe base directory path for the images.private static doubleEPSILONError tolerance for the minimum-cost seam.private static EnergyFunctionfTheEnergyFunctionimplementation.private SeamFinderseamFinderTheSeamFinderimplementation to test.
-
Constructor Summary
Constructors Constructor Description SeamFinderTests()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static voidcheckHorizontal(Picture picture, List<Integer> seam)Checks that the seam is a valid horizontal seam in the picture.abstract SeamFindercreateSeamFinder()Returns a new instance of theSeamFinderinterface.private static doubleenergyHorizontal(Picture picture, List<Integer> seam)Returns the energy of the horizontal seam by applying the givenEnergyFunctionon thePicture.private static doubleprecomputedEnergy(String basename, String orientation)Returns the expected energy for a minimum-cost seam in the picture corresponding to the file name.(package private) voidprecomputedImages(String basename)(package private) voidsetup()
-
-
-
Field Detail
-
EPSILON
private static final double EPSILON
Error tolerance for the minimum-cost seam.- See Also:
- Constant Field Values
-
BASE_PATH
private static final String BASE_PATH
The base directory path for the images.- See Also:
- Constant Field Values
-
f
private static final EnergyFunction f
TheEnergyFunctionimplementation.
-
seamFinder
private SeamFinder seamFinder
TheSeamFinderimplementation to test.
-
-
Method Detail
-
createSeamFinder
public abstract SeamFinder createSeamFinder()
Returns a new instance of theSeamFinderinterface.- Returns:
- a new instance of the
SeamFinderinterface
-
setup
@BeforeAll void setup()
-
precomputedImages
@ParameterizedTest @ValueSource(strings={"HJoceanSmall","stripes","diagonals","diag_test","chameleon","12x10","10x12","10x10","8x3","7x10","7x3","6x5","5x6","4x6","3x8","3x7","3x4","3x3"}) void precomputedImages(String basename) throws IOException- Throws:
IOException
-
precomputedEnergy
private static double precomputedEnergy(String basename, String orientation) throws FileNotFoundException
Returns the expected energy for a minimum-cost seam in the picture corresponding to the file name.- Parameters:
basename- the base file name of the picture.orientation- the seam orientation, either "horizontal" or "vertical".- Returns:
- the expected energy for a minimum-cost seam in the picture corresponding to the file name.
- Throws:
FileNotFoundException- if the expected seam cost file for the given orientation is missing.
-
checkHorizontal
private static void checkHorizontal(Picture picture, List<Integer> seam)
Checks that the seam is a valid horizontal seam in the picture.- Parameters:
picture- thePicture.seam- the seam to remove.
-
energyHorizontal
private static double energyHorizontal(Picture picture, List<Integer> seam)
Returns the energy of the horizontal seam by applying the givenEnergyFunctionon thePicture.- Parameters:
picture- thePicture.seam- the seam to remove.- Returns:
- the energy of the horizontal seam by applying the given
EnergyFunctionon thePicture.
-
-