Skip to content
Snippets Groups Projects
Commit 76ee47a7 authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Color of FPs and their statistics

parent b55dbb13
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import cz.fidentis.analyst.icp.RandomStrategy; ...@@ -9,6 +9,7 @@ import cz.fidentis.analyst.icp.RandomStrategy;
import cz.fidentis.analyst.icp.UndersamplingStrategy; import cz.fidentis.analyst.icp.UndersamplingStrategy;
import cz.fidentis.analyst.mesh.core.MeshFacet; import cz.fidentis.analyst.mesh.core.MeshFacet;
import cz.fidentis.analyst.mesh.core.MeshPoint; import cz.fidentis.analyst.mesh.core.MeshPoint;
import cz.fidentis.analyst.scene.DrawableFace;
import cz.fidentis.analyst.scene.DrawableFeaturePoints; import cz.fidentis.analyst.scene.DrawableFeaturePoints;
import java.awt.Color; import java.awt.Color;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
...@@ -37,10 +38,10 @@ public class RegistrationAction extends ControlPanelAction { ...@@ -37,10 +38,10 @@ public class RegistrationAction extends ControlPanelAction {
private double error = 0.3; private double error = 0.3;
private UndersamplingStrategy undersampling = new RandomStrategy(200); private UndersamplingStrategy undersampling = new RandomStrategy(200);
/** /*
* Threshold of feature points showing too far away * Coloring threshold and statistical values of feature point distances:
*/ */
private double featurePointsThreshold = 5.0; private double fpThreshold = 5.0;
private final RegistrationPanel controlPanel; private final RegistrationPanel controlPanel;
...@@ -66,10 +67,7 @@ public class RegistrationAction extends ControlPanelAction { ...@@ -66,10 +67,7 @@ public class RegistrationAction extends ControlPanelAction {
if (((JToggleButton) ae.getSource()).isSelected()) { if (((JToggleButton) ae.getSource()).isSelected()) {
calculateFeaturePoints(); // color points calculateFeaturePoints(); // color points
} else { } else {
for (int i = 0; i < getPrimaryFeaturePoints().getFeaturePoints().size(); i++) { this.getCanvas().getScene().setDefaultColors();
getPrimaryFeaturePoints().setColor(i, DrawableFeaturePoints.DEFAULT_COLOR);
getSecondaryFeaturePoints().setColor(i, DrawableFeaturePoints.DEFAULT_COLOR);
}
} }
break; break;
case RegistrationPanel.ACTION_COMMAND_APPLY_ICP: case RegistrationPanel.ACTION_COMMAND_APPLY_ICP:
...@@ -164,24 +162,22 @@ public class RegistrationAction extends ControlPanelAction { ...@@ -164,24 +162,22 @@ public class RegistrationAction extends ControlPanelAction {
} }
calculateFeaturePoints(); calculateFeaturePoints();
break; break;
case RegistrationPanel.ACTION_COMMAND_RESET_ALL:
getSecondaryDrawableFace().setTranslation(new Vector3d(0, 0, 0));
getSecondaryDrawableFace().setRotation(new Vector3d(0, 0, 0));
getSecondaryDrawableFace().setScale(new Vector3d(0, 0, 0));
calculateFeaturePoints();
break;
case RegistrationPanel.ACTION_COMMAND_APPLY_TRANSFORMATIONS: case RegistrationPanel.ACTION_COMMAND_APPLY_TRANSFORMATIONS:
transformFace(); transformFace();
getSecondaryDrawableFace().setTranslation(new Vector3d(0, 0, 0)); getSecondaryDrawableFace().setTranslation(new Vector3d(0, 0, 0));
getSecondaryDrawableFace().setRotation(new Vector3d(0, 0, 0)); getSecondaryDrawableFace().setRotation(new Vector3d(0, 0, 0));
getSecondaryDrawableFace().setScale(new Vector3d(0, 0, 0)); getSecondaryDrawableFace().setScale(new Vector3d(0, 0, 0));
break; if (getSecondaryFeaturePoints() != null) {
getSecondaryFeaturePoints().setTranslation(new Vector3d(0, 0, 0));
getSecondaryFeaturePoints().setRotation(new Vector3d(0, 0, 0));
getSecondaryFeaturePoints().setScale(new Vector3d(0, 0, 0));
}break;
case RegistrationPanel.ACTION_COMMAND_TRANSPARENCY: case RegistrationPanel.ACTION_COMMAND_TRANSPARENCY:
int transparency = ((JSlider) ae.getSource()).getValue(); int transparency = ((JSlider) ae.getSource()).getValue();
setTransparency(transparency); setTransparency(transparency);
break; break;
case RegistrationPanel.ACTION_COMMAND_FP_CLOSENESS_THRESHOLD: case RegistrationPanel.ACTION_COMMAND_FP_CLOSENESS_THRESHOLD:
featurePointsThreshold = ((Number)(((JFormattedTextField) ae.getSource()).getValue())).doubleValue(); fpThreshold = ((Number)(((JFormattedTextField) ae.getSource()).getValue())).doubleValue();
calculateFeaturePoints(); calculateFeaturePoints();
break; break;
case RegistrationPanel.ACTION_COMMAND_ICP_SCALE: case RegistrationPanel.ACTION_COMMAND_ICP_SCALE:
...@@ -253,7 +249,10 @@ public class RegistrationAction extends ControlPanelAction { ...@@ -253,7 +249,10 @@ public class RegistrationAction extends ControlPanelAction {
getPrimaryFeaturePoints().getFeaturePoints().size() != getSecondaryFeaturePoints().getFeaturePoints().size()) { getPrimaryFeaturePoints().getFeaturePoints().size() != getSecondaryFeaturePoints().getFeaturePoints().size()) {
return; return;
} }
double fpMaxDist = Double.NEGATIVE_INFINITY;
double fpMinDist = Double.POSITIVE_INFINITY;
double distSum = 0.0;
for (int i = 0; i < getPrimaryFeaturePoints().getFeaturePoints().size(); i++) { for (int i = 0; i < getPrimaryFeaturePoints().getFeaturePoints().size(); i++) {
FeaturePoint primary = getPrimaryFeaturePoints().getFeaturePoints().get(i); FeaturePoint primary = getPrimaryFeaturePoints().getFeaturePoints().get(i);
FeaturePoint secondary = getSecondaryFeaturePoints().getFeaturePoints().get(i); FeaturePoint secondary = getSecondaryFeaturePoints().getFeaturePoints().get(i);
...@@ -263,14 +262,19 @@ public class RegistrationAction extends ControlPanelAction { ...@@ -263,14 +262,19 @@ public class RegistrationAction extends ControlPanelAction {
Math.pow(transformed.x - primary.getX(), 2) + Math.pow(transformed.x - primary.getX(), 2) +
Math.pow(transformed.y - primary.getY(), 2) + Math.pow(transformed.y - primary.getY(), 2) +
Math.pow(transformed.z - primary.getZ(), 2)); Math.pow(transformed.z - primary.getZ(), 2));
if (distance > featurePointsThreshold) { if (distance > fpThreshold) {
getPrimaryFeaturePoints().setColor(i, Color.RED); getPrimaryFeaturePoints().resetColorToDefault(i);
getSecondaryFeaturePoints().setColor(i, Color.RED); getSecondaryFeaturePoints().resetColorToDefault(i);
} else { } else {
getPrimaryFeaturePoints().setColor(i, DrawableFeaturePoints.DEFAULT_COLOR); getPrimaryFeaturePoints().setColor(i, Color.GREEN);
getSecondaryFeaturePoints().setColor(i, DrawableFeaturePoints.DEFAULT_COLOR); getSecondaryFeaturePoints().setColor(i, Color.GREEN);
} }
fpMaxDist = Math.max(fpMaxDist, distance);
fpMinDist = Math.min(fpMinDist, distance);
distSum += distance;
} }
double fpAvgDist = distSum / getPrimaryFeaturePoints().getFeaturePoints().size();
this.controlPanel.updateFPStats(fpAvgDist, fpMaxDist, fpMinDist);
} }
/** /**
......
...@@ -18,7 +18,7 @@ import java.util.Map; ...@@ -18,7 +18,7 @@ import java.util.Map;
*/ */
public class DrawableFeaturePoints extends Drawable { public class DrawableFeaturePoints extends Drawable {
public static final Color DEFAULT_COLOR = Color.GREEN; public static final Color DEFAULT_COLOR = Color.LIGHT_GRAY;
private static final GLU GLU_CONTEXT = new GLU(); private static final GLU GLU_CONTEXT = new GLU();
...@@ -51,7 +51,7 @@ public class DrawableFeaturePoints extends Drawable { ...@@ -51,7 +51,7 @@ public class DrawableFeaturePoints extends Drawable {
if (specialColors.containsKey(index)) { if (specialColors.containsKey(index)) {
return specialColors.get(index); return specialColors.get(index);
} else { } else {
return DEFAULT_COLOR; return getColor();
} }
} }
...@@ -64,12 +64,26 @@ public class DrawableFeaturePoints extends Drawable { ...@@ -64,12 +64,26 @@ public class DrawableFeaturePoints extends Drawable {
if (index < 0 || index >= featurePoints.size() || color == null) { if (index < 0 || index >= featurePoints.size() || color == null) {
return; return;
} }
if (color.equals(DEFAULT_COLOR)) { if (color.equals(getColor())) {
specialColors.remove(index); specialColors.remove(index);
} else { } else {
specialColors.put(index, color); specialColors.put(index, color);
} }
} }
/**
* Removes (possible) special color of given feature point.
*/
public void resetColorToDefault(int index) {
setColor(index, getColor());
}
/**
* Removes all individual colors of feature points.
*/
public void resetAllColorsToDefault() {
this.specialColors.clear();
}
@Override @Override
protected void renderObject(GL2 gl) { protected void renderObject(GL2 gl) {
...@@ -111,7 +125,7 @@ public class DrawableFeaturePoints extends Drawable { ...@@ -111,7 +125,7 @@ public class DrawableFeaturePoints extends Drawable {
* @return {@link List} of {@link FeaturePoint} * @return {@link List} of {@link FeaturePoint}
*/ */
public List<FeaturePoint> getFeaturePoints() { public List<FeaturePoint> getFeaturePoints() {
return Collections.unmodifiableList(featurePoints); return featurePoints;
} }
/** /**
......
package cz.fidentis.analyst.scene; package cz.fidentis.analyst.scene;
import cz.fidentis.analyst.face.HumanFace; import cz.fidentis.analyst.face.HumanFace;
import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -35,6 +36,8 @@ public class Scene { ...@@ -35,6 +36,8 @@ public class Scene {
drawableFeaturePoints.add(null); drawableFeaturePoints.add(null);
} }
drawableSymmetryPlanes.add(null); drawableSymmetryPlanes.add(null);
setDefaultColors();
} }
/** /**
...@@ -72,7 +75,22 @@ public class Scene { ...@@ -72,7 +75,22 @@ public class Scene {
drawableSymmetryPlanes.add(null); drawableSymmetryPlanes.add(null);
drawableSymmetryPlanes.add(null); drawableSymmetryPlanes.add(null);
drawableFaces.get(1).setColor(DrawableFace.SKIN_COLOR_SECONDARY); setDefaultColors();
}
/**
* Sets default colors of faces and feature points
*/
public final void setDefaultColors() {
for (int i = 0; i < getNumFaces(); i++) {
if (drawableFaces.get(i) != null) {
drawableFaces.get(i).setColor((i == 0) ? DrawableFace.SKIN_COLOR_PRIMARY : DrawableFace.SKIN_COLOR_SECONDARY);
}
if (drawableFeaturePoints.get(i) != null) {
drawableFeaturePoints.get(i).setColor(getColorOfFeaturePoints((i == 0) ? DrawableFace.SKIN_COLOR_PRIMARY : DrawableFace.SKIN_COLOR_SECONDARY));
drawableFeaturePoints.get(i).resetAllColorsToDefault();
}
}
} }
/** /**
...@@ -138,4 +156,12 @@ public class Scene { ...@@ -138,4 +156,12 @@ public class Scene {
while (ret.remove(null)) {} while (ret.remove(null)) {}
return ret; return ret;
} }
private Color getColorOfFeaturePoints(Color origColor) {
return new Color(
Math.min(255, origColor.getRed() + 40),
Math.min(255, origColor.getGreen() + 40),
Math.min(255, origColor.getBlue() + 40)
);
}
} }
...@@ -4,7 +4,6 @@ RegistrationPanel.rotationButton.text= ...@@ -4,7 +4,6 @@ RegistrationPanel.rotationButton.text=
RegistrationPanel.rotatXLabel.text=X RegistrationPanel.rotatXLabel.text=X
RegistrationPanel.rotatYLabel.text=Y RegistrationPanel.rotatYLabel.text=Y
RegistrationPanel.rotatZLabel.text=Z RegistrationPanel.rotatZLabel.text=Z
RegistrationPanel.transparencySlider.toolTipText=sets model transparency
RegistrationPanel.leftRotationXButton.text= RegistrationPanel.leftRotationXButton.text=
RegistrationPanel.leftRotationYButton.text= RegistrationPanel.leftRotationYButton.text=
RegistrationPanel.leftTranslationZButton.text= RegistrationPanel.leftTranslationZButton.text=
...@@ -13,15 +12,12 @@ RegistrationPanel.rightTranslationZButton.text= ...@@ -13,15 +12,12 @@ RegistrationPanel.rightTranslationZButton.text=
RegistrationPanel.translYLabel.text=vertical RegistrationPanel.translYLabel.text=vertical
RegistrationPanel.translZLabel.text=front-back RegistrationPanel.translZLabel.text=front-back
RegistrationPanel.translXLabel.text=horizontal RegistrationPanel.translXLabel.text=horizontal
RegistrationPanel.transparencyButton.toolTipText=reset transparency
RegistrationPanel.transparencyButton.text=clear
RegistrationPanel.rightTranslationYButton.text= RegistrationPanel.rightTranslationYButton.text=
RegistrationPanel.leftTranslationYButton.text= RegistrationPanel.leftTranslationYButton.text=
RegistrationPanel.translationXFTF.toolTipText= RegistrationPanel.translationXFTF.toolTipText=
RegistrationPanel.applyButton.toolTipText=apply transformations RegistrationPanel.applyButton.toolTipText=apply transformations
RegistrationPanel.applyButton.text=Apply changes RegistrationPanel.applyButton.text=Apply changes
RegistrationPanel.rightTranslationXButton.text= RegistrationPanel.rightTranslationXButton.text=
RegistrationPanel.visualizationLabel.text=Transparency:
RegistrationPanel.jLabel2.text=Translation: RegistrationPanel.jLabel2.text=Translation:
RegistrationPanel.translationButton.toolTipText=reset translation RegistrationPanel.translationButton.toolTipText=reset translation
RegistrationPanel.translationButton.text= RegistrationPanel.translationButton.text=
...@@ -32,34 +28,46 @@ RegistrationPanel.lowShiftRB.toolTipText=set low shifting amount ...@@ -32,34 +28,46 @@ RegistrationPanel.lowShiftRB.toolTipText=set low shifting amount
RegistrationPanel.lowShiftRB.text=low RegistrationPanel.lowShiftRB.text=low
RegistrationPanel.shiftLabel.toolTipText=transformation amount RegistrationPanel.shiftLabel.toolTipText=transformation amount
RegistrationPanel.shiftLabel.text=shift RegistrationPanel.shiftLabel.text=shift
RegistrationPanel.featurePointsLabel.text=FP closeness treshold:
RegistrationPanel.resetAllButton.toolTipText=reset all transformations RegistrationPanel.resetAllButton.toolTipText=reset all transformations
RegistrationPanel.resetAllButton.text=reset all RegistrationPanel.resetAllButton.text=reset all
RegistrationPanel.scaleButton.toolTipText=reset scale RegistrationPanel.scaleButton.toolTipText=reset scale
RegistrationPanel.scaleButton.text= RegistrationPanel.scaleButton.text=
RegistrationPanel.scaleFTF.toolTipText= RegistrationPanel.scaleFTF.toolTipText=
RegistrationPanel.thersholdUpButton.text=
RegistrationPanel.thresholdDownButton.text=
RegistrationPanel.scaleMinusButton.text= RegistrationPanel.scaleMinusButton.text=
RegistrationPanel.scalePlusButton.text= RegistrationPanel.scalePlusButton.text=
RegistrationPanel.jLabel4.text=Scale: RegistrationPanel.jLabel4.text=Scale:
RegistrationPanel.viewLabel.text=View:
RegistrationPanel.jLabel3.text=Rotation: RegistrationPanel.jLabel3.text=Rotation:
RegistrationPanel.frontButton.toolTipText=model front view
RegistrationPanel.frontButton.text=front
RegistrationPanel.rotationXFTF.toolTipText= RegistrationPanel.rotationXFTF.toolTipText=
RegistrationPanel.profileButton.toolTipText=model profile view
RegistrationPanel.profileButton.text=side
# To change this license header, choose License Headers in Project Properties. # To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates # To change this template file, choose Tools | Templates
# and open the template in the editor. # and open the template in the editor.
RegistrationPanel.rightRotationXButton.text= RegistrationPanel.rightRotationXButton.text=
RegistrationPanel.leftRotationZButton.text= RegistrationPanel.leftRotationZButton.text=
RegistrationPanel.rightRotationYButton.text= RegistrationPanel.rightRotationYButton.text=
RegistrationPanel.jButton1.text=(Re)compute RegistrationPanel.jButton1.text=(Re)compute ICP
RegistrationPanel.jLabel1.text=ICP: RegistrationPanel.jCheckBox1.text=
RegistrationPanel.jCheckBox1.text=scale
RegistrationPanel.jFormattedTextField1.text=0,3 RegistrationPanel.jFormattedTextField1.text=0,3
RegistrationPanel.jLabel5.text=error RegistrationPanel.jLabel5.text=error:
RegistrationPanel.jFormattedTextField2.text=10 RegistrationPanel.jFormattedTextField2.text=10
RegistrationPanel.jLabel6.text=max iters RegistrationPanel.jLabel6.text=max iters.:
RegistrationPanel.jLabel7.text=scale:
RegistrationPanel.jLabel8.text=undersampling:
RegistrationPanel.thersholdUpButton.text=
RegistrationPanel.visualizationLabel.text=Transparency:
RegistrationPanel.profileButton.toolTipText=model profile view
RegistrationPanel.profileButton.text=side
RegistrationPanel.frontButton.toolTipText=model front view
RegistrationPanel.frontButton.text=front
RegistrationPanel.viewLabel.text=View:
RegistrationPanel.transparencyButton.toolTipText=reset transparency
RegistrationPanel.transparencyButton.text=clear
RegistrationPanel.transparencySlider.toolTipText=sets model transparency
RegistrationPanel.thresholdDownButton.text=
RegistrationPanel.featurePointsLabel.text=Coloring treshold:
RegistrationPanel.jLabel9.text=Feature points:
RegistrationPanel.jLabel10.text=min:
RegistrationPanel.jLabel11.text=max:
RegistrationPanel.jLabel12.text=avg:
RegistrationPanel.jLabel13.text=0
RegistrationPanel.jLabel14.text=0
RegistrationPanel.jLabel15.text=0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment