Package seamfinding

Class SeamFinderTests

    • Constructor Detail

      • SeamFinderTests

        public SeamFinderTests()
    • Method Detail

      • createSeamFinder

        public abstract SeamFinder createSeamFinder()
        Returns a new instance of the SeamFinder 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 - the Picture.
        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 given EnergyFunction on the Picture.
        Parameters:
        picture - the Picture.
        seam - the seam to remove.
        Returns:
        the energy of the horizontal seam by applying the given EnergyFunction on the Picture.