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 theSeamFinder
interface.- See Also:
SeamFinder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
SeamFinderTests.RuntimeExperiments
-
Field Summary
Fields Modifier and Type Field Description private static String
BASE_PATH
The base directory path for the images.private static double
EPSILON
Error tolerance for the minimum-cost seam.private static EnergyFunction
f
TheEnergyFunction
implementation.private SeamFinder
seamFinder
TheSeamFinder
implementation 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 void
checkHorizontal(Picture picture, List<Integer> seam)
Checks that the seam is a valid horizontal seam in the picture.abstract SeamFinder
createSeamFinder()
Returns a new instance of theSeamFinder
interface.private static double
energyHorizontal(Picture picture, List<Integer> seam)
Returns the energy of the horizontal seam by applying the givenEnergyFunction
on thePicture
.private static double
precomputedEnergy(String basename, String orientation)
Returns the expected energy for a minimum-cost seam in the picture corresponding to the file name.(package private) void
precomputedImages(String basename)
(package private) void
setup()
-
-
-
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
TheEnergyFunction
implementation.
-
seamFinder
private SeamFinder seamFinder
TheSeamFinder
implementation to test.
-
-
Method Detail
-
createSeamFinder
public abstract SeamFinder createSeamFinder()
Returns a new instance of theSeamFinder
interface.- Returns:
- a new instance of the
SeamFinder
interface
-
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 givenEnergyFunction
on thePicture
.- Parameters:
picture
- thePicture
.seam
- the seam to remove.- Returns:
- the energy of the horizontal seam by applying the given
EnergyFunction
on thePicture
.
-
-