Package seamcarving.seamfinding
Class DynamicProgrammingSeamFinder
- java.lang.Object
-
- seamcarving.seamfinding.DynamicProgrammingSeamFinder
-
- All Implemented Interfaces:
SeamFinder
public class DynamicProgrammingSeamFinder extends Object implements SeamFinder
Dynamic programming implementation of theSeamFinder
interface.- See Also:
SeamFinder
,SeamCarver
-
-
Constructor Summary
Constructors Constructor Description DynamicProgrammingSeamFinder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Integer>
findHorizontal(Picture picture, EnergyFunction f)
Returns a minimum-energy horizontal seam in the current image as aList
of integers representing the vertical pixel index to remove from each column in the width of the horizontal seam.private static AbstractMap.SimpleEntry<Integer,Double>
min(double[] values)
Return the minimum value in the values array.private static AbstractMap.SimpleEntry<Integer,Double>
min(double[] values, int y)
Return the minimum value in the values slice [y - 1, y + 2).private static AbstractMap.SimpleEntry<Integer,Double>
min(double[] values, int lo, int hi)
Return the minimum value in the values slice [lo, hi).
-
-
-
Method Detail
-
findHorizontal
public List<Integer> findHorizontal(Picture picture, EnergyFunction f)
Description copied from interface:SeamFinder
Returns a minimum-energy horizontal seam in the current image as aList
of integers representing the vertical pixel index to remove from each column in the width of the horizontal seam.- Specified by:
findHorizontal
in interfaceSeamFinder
- Parameters:
picture
- thePicture
.f
- theEnergyFunction
.- Returns:
- a
List
of integers representing the vertical pixels to remove.
-
min
private static AbstractMap.SimpleEntry<Integer,Double> min(double[] values)
Return the minimum value in the values array.
-
min
private static AbstractMap.SimpleEntry<Integer,Double> min(double[] values, int y)
Return the minimum value in the values slice [y - 1, y + 2).
-
min
private static AbstractMap.SimpleEntry<Integer,Double> min(double[] values, int lo, int hi)
Return the minimum value in the values slice [lo, hi).
-
-