Skip to content

Commit

Permalink
Renaming and another potential fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRisenPhoenix committed Nov 8, 2023
1 parent 36d4cfe commit 2f74007
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
14 changes: 10 additions & 4 deletions src/main/java/controller/AutoTrackController.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ private void updateTrackingData(){
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));

data.add(new XYChart.Data<>(shifted_points[0],shifted_points[1]));
data.add(new XYChart.Data<>(shifted_points[0], shifted_points[1]));

if(data.size() > max_num_points){
data.remove(0);
}
Expand Down Expand Up @@ -442,7 +443,12 @@ public void on_generateMatrix(){
transformationMatrix.trackingPoints = new float[4][];
for(int i = 0;i<clicked_image_points.size();i++){
transformationMatrix.imagePoints[i] = new float[]{(float) clicked_image_points.get(i).x, (float) clicked_image_points.get(i).y, (float) clicked_image_points.get(i).z};
transformationMatrix.trackingPoints[i] = new float[]{(float) clicked_tracker_points.get(i).x, (float) clicked_tracker_points.get(i).y, (float) clicked_tracker_points.get(i).z};

if(userPreferencesGlobal.getBoolean("verticalFieldGenerator", false)) {
transformationMatrix.trackingPoints[i] = new float[]{(float) clicked_tracker_points.get(i).x, (float) clicked_tracker_points.get(i).z, (float) clicked_tracker_points.get(i).y};
}else {
transformationMatrix.trackingPoints[i] = new float[]{(float) clicked_tracker_points.get(i).x, (float) clicked_tracker_points.get(i).y, (float) clicked_tracker_points.get(i).z};
}
}

FileChooser fileChooser = new FileChooser();
Expand Down Expand Up @@ -522,7 +528,7 @@ private double[] applyTrackingTransformation2d(double x, double y, double z){
var matrix = transformationMatrix.getTransformMatOpenCvEstimated2d();
var vector = new Mat(3,1, CvType.CV_64F);
vector.put(0,0,x);
if(userPreferencesGlobal.getBoolean("exchangeYZ", false)){
if(userPreferencesGlobal.getBoolean("verticalFieldGenerator", false)){
vector.put(1,0,z);
}else{
vector.put(1, 0, y);
Expand Down Expand Up @@ -579,7 +585,7 @@ private void onImageClicked(double x, double y){
}

clicked_image_points.add(new Point3(x, y, 0.0));
if(userPreferencesGlobal.getBoolean("exchangeYZ", false)) {
if(userPreferencesGlobal.getBoolean("verticalFieldGenerator", false)) {
clicked_tracker_points.add(new Point3(trackingData.get(0).x_raw, trackingData.get(0).z_raw, trackingData.get(0).y_raw));
}else {
clicked_tracker_points.add(new Point3(trackingData.get(0).x_raw, trackingData.get(0).y_raw, trackingData.get(0).z_raw));
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/controller/SettingsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import java.util.ResourceBundle;
import java.util.prefs.Preferences;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ListView;
import javafx.scene.control.Tooltip;
import util.CustomLogger;

Expand All @@ -17,7 +14,7 @@ public class SettingsController implements Controller {

@FXML public CheckBox consoleOutput;
@FXML public CheckBox searchForMoreVideos;
@FXML public CheckBox exchangeYZ;
@FXML public CheckBox verticalFG;

@FXML
private void changeConsoleOutput() {
Expand All @@ -31,8 +28,8 @@ private void onSearchForMoreVideosClicked() {
}

@FXML
private void onExchangeYZClicked(){
userPreferences.putBoolean("exchangeYZ", exchangeYZ.isSelected());
private void onVerticalFGClicked(){
userPreferences.putBoolean("verticalFieldGenerator", verticalFG.isSelected());
}

@Override
Expand All @@ -52,7 +49,7 @@ public void initialize(URL location, ResourceBundle resources) {
searchForMoreVideos.setTooltip(tooltip);

var exchangeYZPreference = userPreferences.getBoolean("exchangeYZ", false);
exchangeYZ.setSelected(exchangeYZPreference);
verticalFG.setSelected(exchangeYZPreference);
}

@FXML
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/SettingsView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<CheckBox fx:id="searchForMoreVideos" mnemonicParsing="false" onAction="#onSearchForMoreVideosClicked"
text="Search for more video devices"/>

<CheckBox fx:id="exchangeYZ" mnemonicParsing="false" onAction="#onExchangeYZClicked"
<CheckBox fx:id="Vertical Fieldgenerator" mnemonicParsing="false" onAction="#onVerticalFGClicked"
text="2d transform: replace y by z"/>
</VBox>
</TitledPane>
Expand Down

0 comments on commit 2f74007

Please sign in to comment.