From 02a275099e8e2518f63cb1a6c912f20ea0181974 Mon Sep 17 00:00:00 2001 From: Timo <43245438+TheRisenPhoenix@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:52:57 +0100 Subject: [PATCH] [WIP] --- .../java/controller/AutoTrackController.java | 38 +++++++++++-------- src/main/resources/view/SettingsView.fxml | 2 +- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/main/java/controller/AutoTrackController.java b/src/main/java/controller/AutoTrackController.java index ab3cce1f..4fc1f2f5 100644 --- a/src/main/java/controller/AutoTrackController.java +++ b/src/main/java/controller/AutoTrackController.java @@ -101,6 +101,8 @@ public class AutoTrackController implements Controller { private final ObservableList clicked_image_points = FXCollections.observableArrayList(); private final ObservableList clicked_tracker_points = FXCollections.observableArrayList(); + private Mat cachedTransformMatrix = null; + private boolean useVerticalFieldGenerator = false; @Override public void initialize(URL location, ResourceBundle resources) { @@ -125,6 +127,8 @@ public void initialize(URL location, ResourceBundle resources) { videoImagePlot.setData(dataSeries); videoImagePlot.registerImageClickedHandler(this::onImageClicked); + useVerticalFieldGenerator = userPreferencesGlobal.getBoolean("verticalFieldGenerator", false); + loadAvailableVideoDevicesAsync(); } @@ -288,6 +292,7 @@ private void updateTrackingData(){ var x_normalized = shifted_points[0] / currentShowingImage.getWidth(); var y_normalized = shifted_points[1] / currentShowingImage.getHeight(); lastTrackingData.add(new ExportMeasurement(tool.getName(), point.getX(), point.getY(), point.getZ(), shifted_points[0], shifted_points[1], shifted_points[2], x_normalized, y_normalized)); + System.out.println("x: " + shifted_points[0] + " y: " + shifted_points[1] + " z: " + shifted_points[2]); data.add(new XYChart.Data<>(shifted_points[0], shifted_points[1])); @@ -412,6 +417,7 @@ public void on_importMatrix() { transformationMatrix = TransformationMatrix.loadFromJSON(path); roiDirty = true; regMatrixStatusBox.setSelected(true); + cachedTransformMatrix = null; userPreferences.put("matrixDirectory", inputFile.getAbsoluteFile().getParent()); }catch (FileNotFoundException e) { logger.log(java.util.logging.Level.SEVERE, "Error loading matrix", e); @@ -429,6 +435,7 @@ public void on_reloadMatrix(){ transformationMatrix = TransformationMatrix.loadFromJSON(lastMatrixPath); roiDirty = true; regMatrixStatusBox.setSelected(true); + cachedTransformMatrix = null; }catch (FileNotFoundException e) { logger.log(java.util.logging.Level.SEVERE, "Error loading matrix", e); e.printStackTrace(); @@ -443,12 +450,7 @@ public void on_generateMatrix(){ transformationMatrix.trackingPoints = new float[4][]; for(int i = 0;i -