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

Registration panel extended with Hausdorff distance

parent 6424c694
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,6 @@ import cz.fidentis.analyst.canvas.Canvas;
import cz.fidentis.analyst.scene.DrawableFace;
import cz.fidentis.analyst.scene.DrawableFeaturePoints;
import cz.fidentis.analyst.scene.Scene;
import java.awt.Color;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JTabbedPane;
......
......@@ -26,10 +26,10 @@ public class FaceToFaceTab extends TopComponent {
* @param name Tab name
*/
public FaceToFaceTab(HumanFace primary, HumanFace secondary, String name) {
controlPanel = new TopControlPanel();
canvas = new Canvas();
renderingToolBar = new FaceToFaceToolBar(canvas, controlPanel);
canvas.initScene(primary, secondary);
controlPanel = new TopControlPanel();
renderingToolBar = new FaceToFaceToolBar(canvas, controlPanel);
setName(name);
initComponents();
}
......
......@@ -25,10 +25,10 @@ public final class SingleFaceTab extends TopComponent {
* @param name Tab name
*/
public SingleFaceTab(HumanFace face, String name) {
controlPanel = new TopControlPanel();
canvas = new Canvas();
renderingToolBar = new SingleFaceToolBar(canvas, controlPanel);
canvas.initScene(face);
controlPanel = new TopControlPanel();
renderingToolBar = new SingleFaceToolBar(canvas, controlPanel);
setName(name);
initComponents();
}
......
......@@ -9,7 +9,6 @@ import cz.fidentis.analyst.icp.NoUndersampling;
import cz.fidentis.analyst.icp.RandomStrategy;
import cz.fidentis.analyst.icp.UndersamplingStrategy;
import cz.fidentis.analyst.mesh.core.MeshFacet;
import cz.fidentis.analyst.mesh.core.MeshModel;
import cz.fidentis.analyst.mesh.core.MeshPoint;
import cz.fidentis.analyst.visitors.mesh.HausdorffDistance;
import java.awt.Color;
......@@ -39,6 +38,9 @@ public class RegistrationAction extends ControlPanelAction {
private int maxIterations = 10;
private double error = 0.3;
private UndersamplingStrategy undersampling = new RandomStrategy(200);
private HausdorffDistance hdVisitor = null;
private String strategy = RegistrationPanel.STRATEGY_POINT_TO_POINT;
private boolean relativeDist = false;
/*
* Coloring threshold and statistical values of feature point distances:
......@@ -218,6 +220,25 @@ public class RegistrationAction extends ControlPanelAction {
throw new UnsupportedOperationException(item);
}
break;
case RegistrationPanel.ACTION_COMMAND_HD_HEATMAP:
if (((JToggleButton) ae.getSource()).isSelected()) {
calculateHausdorffDistance();
setHeatmap();
getSecondaryDrawableFace().setRenderHeatmap(true);
} else {
getSecondaryDrawableFace().setRenderHeatmap(false);
}
break;
case RegistrationPanel.ACTION_COMMAND_HD_STRATEGY:
strategy = (String) ((JComboBox) ae.getSource()).getSelectedItem();
this.hdVisitor = null; // recompute
setHeatmap();
break;
case RegistrationPanel.ACTION_COMMAND_HD_RELATIVE_DIST:
this.relativeDist = ((JToggleButton) ae.getSource()).isSelected();
this.hdVisitor = null; // recompute
setHeatmap();
break;
default:
// to nothing
}
......@@ -391,4 +412,26 @@ public class RegistrationAction extends ControlPanelAction {
point.y *= 1 + getSecondaryDrawableFace().getScale().y;
point.z *= 1 + getSecondaryDrawableFace().getScale().z;
}
protected void setHeatmap() {
HausdorffDistance.Strategy useStrategy;
switch (strategy) {
case RegistrationPanel.STRATEGY_POINT_TO_POINT:
useStrategy = HausdorffDistance.Strategy.POINT_TO_POINT;
break;
case RegistrationPanel.STRATEGY_POINT_TO_TRIANGLE:
useStrategy = HausdorffDistance.Strategy.POINT_TO_TRIANGLE_APPROXIMATE;
break;
default:
throw new UnsupportedOperationException(strategy);
}
if (hdVisitor == null) {
this.hdVisitor = new HausdorffDistance(getPrimaryDrawableFace().getModel(), useStrategy, relativeDist, true);
getSecondaryDrawableFace().getModel().compute(hdVisitor);
}
getSecondaryDrawableFace().setHeatMap(hdVisitor.getDistances());
}
}
......@@ -39,6 +39,7 @@ public class FaceToFaceToolBar extends RenderingToolBar {
button.setIcon(DistancePanel.getStaticIcon());
button.setToolTipText(NbBundle.getMessage(RenderingToolBar.class, "FaceToFaceToolBar.distance.text"));
add(button);
button.doClick(); // show
}
private void addRegistrationButton(JTabbedPane controlPanel) {
......@@ -48,5 +49,6 @@ public class FaceToFaceToolBar extends RenderingToolBar {
button.setIcon(RegistrationPanel.getStaticIcon());
button.setToolTipText(NbBundle.getMessage(RenderingToolBar.class, "FaceToFaceToolBar.registration.text"));
add(button);
button.doClick(); // show
}
}
RegistrationPanel.jButton1.text=(Re)compute ICP
RegistrationPanel.jButton1.text=(Re)compute
RegistrationPanel.jCheckBox1.text=
RegistrationPanel.jFormattedTextField1.text=0,3
RegistrationPanel.jLabel5.text=minimal error:
RegistrationPanel.jFormattedTextField2.text=10
RegistrationPanel.jFormattedTextField2.text=50
RegistrationPanel.jLabel6.text=max. iteration.:
RegistrationPanel.jLabel7.text=scale face:
RegistrationPanel.jLabel8.text=undersampling:
......@@ -76,12 +76,13 @@ RegistrationPanel.leftTranslationYButton.text=
RegistrationPanel.translationXFTF.toolTipText=
RegistrationPanel.rightTranslationXButton.text=
RegistrationPanel.translationButton.toolTipText=reset translation
RegistrationPanel.jLabel3.text=Automatic registration
RegistrationPanel.jLabel4.text=Distance
RegistrationPanel.jLabel3.text=ICP registration
RegistrationPanel.jLabel4.text=Hausdorff distance
RegistrationPanel.jPanel3.border.title=Hausdorff distance
RegistrationPanel.jLabel22.text=relative distance:
RegistrationPanel.jCheckBox2.text=
RegistrationPanel.jLabel23.text=distance strategy:
RegistrationPanel.jLabel23.text=strategy:
RegistrationPanel.jToggleButton1.text=Show heatmap
RegistrationPanel.jLabel1.text=View
RegistrationPanel.jPanel5.border.title=distance of feature points
RegistrationPanel.jLabel9.text=Stats
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