Commit d342ce30 authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

CurvatureAlg put into SymmetryConfig

parent 094efa03
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -7,8 +7,7 @@ import cz.fidentis.analyst.icp.IcpTransformer;
import cz.fidentis.analyst.icp.UndersamplingStrategy;
import cz.fidentis.analyst.kdtree.KdTree;
import cz.fidentis.analyst.mesh.core.MeshFacet;
import cz.fidentis.analyst.symmetry.SignificantPoints;
import static cz.fidentis.analyst.symmetry.SignificantPoints.CurvatureAlg.GAUSSIAN;
import cz.fidentis.analyst.symmetry.CurvatureAlg;
import cz.fidentis.analyst.symmetry.SymmetryConfig;
import cz.fidentis.analyst.symmetry.SymmetryEstimator;
import java.io.File;
@@ -30,7 +29,6 @@ public class BatchProcessor {
    private double avgIcpIterations = 0.0;
    
    private SymmetryConfig symmetryConfig;
    private SignificantPoints.CurvatureAlg symmetryCurvArg = GAUSSIAN;
    
    /**
     * Constructor.
@@ -72,7 +70,7 @@ public class BatchProcessor {
        for (String facePath: faceIDs) {
            String faceId = HumanFaceFactory.instance().loadFace(new File(facePath));
            HumanFace face = HumanFaceFactory.instance().getFace(faceId);
            SymmetryEstimator se = new SymmetryEstimator(this.symmetryConfig, this.symmetryCurvArg);
            SymmetryEstimator se = new SymmetryEstimator(this.symmetryConfig);
            face.getMeshModel().compute(se);
            face.setSymmetryPlane(se.getSymmetryPlane(), se.getSymmetryPlaneMesh());
        }
+13 −0
Original line number Diff line number Diff line
package cz.fidentis.analyst.symmetry;

/**
 * Curvature algorithm used for the selection of the top X significant points.
 * 
 * @author Radek Oslejsek
 */
public enum CurvatureAlg {
    MEAN,
    GAUSSIAN,
    MAX,
    MIN
}
+0 −11
Original line number Diff line number Diff line
@@ -24,17 +24,6 @@ import javax.vecmath.Vector3d;
 */
public class SignificantPoints extends MeshVisitor {
    
    /**
     * Curvature algorithm used for the selection of the top X significant points.
     * @author Radek Oslejsek
     */
    public enum CurvatureAlg {
        MEAN,
        GAUSSIAN,
        MAX,
        MIN
    };
    
    private final int maxPoints;
    
    private final Curvature curvatureVisitor;
+20 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ public class SymmetryConfig {
    private static final double DEFAULT_MAX_REL_DISTANCE = 1.0 / 100.0;
    private static final int DEFAULT_SIGNIFICANT_POINT_COUNT = 200;
    private static final boolean DEFAULT_AVERAGING = true;
    private static final CurvatureAlg DEFAULT_CURVATURE_ALGORITHM = CurvatureAlg.GAUSSIAN;
    
    private double minCurvRatio;
    private double minAngleCos;
@@ -23,6 +24,7 @@ public class SymmetryConfig {
    private double maxRelDistance;
    private int significantPointCount;
    private boolean averaging;
    private CurvatureAlg curvatureAlg;
    
    /**
     * Creates configuration with default values 
@@ -34,6 +36,7 @@ public class SymmetryConfig {
        maxRelDistance = DEFAULT_MAX_REL_DISTANCE;
        significantPointCount = DEFAULT_SIGNIFICANT_POINT_COUNT;
        averaging = DEFAULT_AVERAGING;
        curvatureAlg = DEFAULT_CURVATURE_ALGORITHM;
    }
    
    /**
@@ -148,6 +151,22 @@ public class SymmetryConfig {
        this.averaging = averaging;
    }
    
    /**
     * Returns curvature algorithm.
     * @return curvature algorithm 
     */
    public CurvatureAlg getCurvatureAlg() {
        return this.curvatureAlg;
    }
    
    /**
     * Sets  curvature algorithm.
     * @param alg curvature algorithm
     */
    public void setCurvatureAlg(CurvatureAlg alg) {
        this.curvatureAlg = alg;
    }

    /**
     * 
     * @return String representation of configuration
@@ -162,6 +181,7 @@ public class SymmetryConfig {
        str += "Max relative distance: " + maxRelDistance + "\n";
        str += "Significant points: " + significantPointCount + "\n";
        str += "Averaging: " + averaging + "\n";
        str += "Curvature: " + curvatureAlg + "\n";
        return str;
    }
}
 No newline at end of file
+2 −5
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ import cz.fidentis.analyst.mesh.core.CornerTableRow;
import cz.fidentis.analyst.mesh.core.MeshFacet;
import cz.fidentis.analyst.mesh.core.MeshFacetImpl;
import cz.fidentis.analyst.mesh.core.MeshPointImpl;
import cz.fidentis.analyst.symmetry.SignificantPoints.CurvatureAlg;
import cz.fidentis.analyst.visitors.mesh.BoundingBox;
import cz.fidentis.analyst.visitors.mesh.BoundingBox.BBox;
import cz.fidentis.analyst.visitors.mesh.Curvature;
@@ -46,16 +45,14 @@ public class SymmetryEstimator extends MeshVisitor {
     * Constructor.
     * 
     * @param config Algorithm options
     * @param curvatureAlg Curvature algorithm used for the selection of significant points.
     *        See {@link Curvature} for more details.
     * @throws IllegalArgumentException if some input parameter is missing
     */
    public SymmetryEstimator(SymmetryConfig config, CurvatureAlg curvatureAlg) {
    public SymmetryEstimator(SymmetryConfig config) {
        if (config == null) {
            throw new IllegalArgumentException("config");
        }
        this.config = config;
        this.sigPointsVisitor = new SignificantPoints(curvatureAlg, config.getSignificantPointCount());
        this.sigPointsVisitor = new SignificantPoints(config.getCurvatureAlg(), config.getSignificantPointCount());
    }
    
    @Override
Loading