public class MinimizeEnergyPrune
extends java.lang.Object
Prunes corners from a pixel level accuracy contour by minizing a penalized energy function. The energy of a line segment is defined as Euclidean distance squared of each point from the line summed plus a penalty divided by the distance between two end points of the line. When a corner is removed the location of its neighbors are optimized again.
Energy of line segment = [Sum( distance points from line squared) + penalty ] / (segment length)
| Constructor and Description |
|---|
MinimizeEnergyPrune(double splitPenalty) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
circularDistance(int start,
int end)
Distance the two points are apart in clockwise direction
|
protected double |
computeSegmentEnergy(org.ddogleg.struct.GrowQueue_I32 corners,
int cornerA,
int cornerB)
Computes the energy for a segment defined by the two corner indexes
|
protected double |
energyRemoveCorner(int removed,
org.ddogleg.struct.GrowQueue_I32 corners)
Returns the total energy after removing a corner
|
protected georegression.struct.point.Point2D_I32 |
getContour(int index) |
boolean |
prune(java.util.List<georegression.struct.point.Point2D_I32> contour,
org.ddogleg.struct.GrowQueue_I32 input,
org.ddogleg.struct.GrowQueue_I32 output)
Given a contour and initial set of corners compute a new set of corner indexes
|
public boolean prune(java.util.List<georegression.struct.point.Point2D_I32> contour,
org.ddogleg.struct.GrowQueue_I32 input,
org.ddogleg.struct.GrowQueue_I32 output)
contour - List of points in the shape's contourinput - Initial set of cornersoutput - Pruned set of cornersprotected double energyRemoveCorner(int removed,
org.ddogleg.struct.GrowQueue_I32 corners)
removed - index of the corner that is being removedcorners - list of corner indexesprotected double computeSegmentEnergy(org.ddogleg.struct.GrowQueue_I32 corners,
int cornerA,
int cornerB)
protected georegression.struct.point.Point2D_I32 getContour(int index)
protected int circularDistance(int start,
int end)