mirror of
https://github.com/storytold/LiveScan3D.git
synced 2026-10-09 00:09:58 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,285 @@
|
||||
// Copyright (C) 2015 Marek Kowalski (M.Kowalski@ire.pw.edu.pl), Jacek Naruniec (J.Naruniec@ire.pw.edu.pl)
|
||||
// License: MIT Software License See LICENSE.txt for the full license.
|
||||
|
||||
// If you use this software in your research, then please use the following citation:
|
||||
|
||||
// Kowalski, M.; Naruniec, J.; Daniluk, M.: "LiveScan3D: A Fast and Inexpensive 3D Data
|
||||
// Acquisition System for Multiple Kinect v2 Sensors". in 3D Vision (3DV), 2015 International Conference on, Lyon, France, 2015
|
||||
|
||||
// @INPROCEEDINGS{Kowalski15,
|
||||
// author={Kowalski, M. and Naruniec, J. and Daniluk, M.},
|
||||
// booktitle={3D Vision (3DV), 2015 International Conference on},
|
||||
// title={LiveScan3D: A Fast and Inexpensive 3D Data Acquisition System for Multiple Kinect v2 Sensors},
|
||||
// year={2015},
|
||||
// }
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Globalization;
|
||||
|
||||
namespace KinectServer
|
||||
{
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
public KinectSettings oSettings;
|
||||
public KinectServer oServer;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SettingsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
txtMinX.Text = oSettings.aMinBounds[0].ToString(CultureInfo.InvariantCulture);
|
||||
txtMinY.Text = oSettings.aMinBounds[1].ToString(CultureInfo.InvariantCulture);
|
||||
txtMinZ.Text = oSettings.aMinBounds[2].ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
txtMaxX.Text = oSettings.aMaxBounds[0].ToString(CultureInfo.InvariantCulture);
|
||||
txtMaxY.Text = oSettings.aMaxBounds[1].ToString(CultureInfo.InvariantCulture);
|
||||
txtMaxZ.Text = oSettings.aMaxBounds[2].ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
chFilter.Checked = oSettings.bFilter;
|
||||
txtFilterNeighbors.Text = oSettings.nFilterNeighbors.ToString();
|
||||
txtFilterDistance.Text = oSettings.fFilterThreshold.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
lisMarkers.DataSource = oSettings.lMarkerPoses;
|
||||
|
||||
|
||||
chMerge.Checked = oSettings.bMergeScansForSave;
|
||||
txtICPIters.Text = oSettings.nNumICPIterations.ToString();
|
||||
txtRefinIters.Text = oSettings.nMaxNumRefineIters.ToString();
|
||||
}
|
||||
|
||||
void UpdateClients()
|
||||
{
|
||||
oServer.SendSettings();
|
||||
}
|
||||
|
||||
void UpdateMarkerFields()
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
|
||||
float X, Y, Z;
|
||||
pose.GetOrientation(out X, out Y, out Z);
|
||||
|
||||
txtOrientationX.Text = X.ToString(CultureInfo.InvariantCulture);
|
||||
txtOrientationY.Text = Y.ToString(CultureInfo.InvariantCulture);
|
||||
txtOrientationZ.Text = Z.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
txtTranslationX.Text = pose.pose.t[0].ToString(CultureInfo.InvariantCulture);
|
||||
txtTranslationY.Text = pose.pose.t[1].ToString(CultureInfo.InvariantCulture);
|
||||
txtTranslationZ.Text = pose.pose.t[2].ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
txtId.Text = pose.id.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
txtOrientationX.Text = "";
|
||||
txtOrientationY.Text = "";
|
||||
txtOrientationZ.Text = "";
|
||||
|
||||
txtTranslationX.Text = "";
|
||||
txtTranslationY.Text = "";
|
||||
txtTranslationZ.Text = "";
|
||||
|
||||
txtId.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void txtMinX_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Single.TryParse(txtMinX.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out oSettings.aMinBounds[0]);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtMinY_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Single.TryParse(txtMinY.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out oSettings.aMinBounds[1]);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtMinZ_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Single.TryParse(txtMinZ.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out oSettings.aMinBounds[2]);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtMaxX_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Single.TryParse(txtMaxX.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out oSettings.aMaxBounds[0]);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtMaxY_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Single.TryParse(txtMaxY.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out oSettings.aMaxBounds[1]);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtMaxZ_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Single.TryParse(txtMaxZ.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out oSettings.aMaxBounds[2]);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void chFilter_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
oSettings.bFilter = chFilter.Checked;
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtFilterNeighbors_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Int32.TryParse(txtFilterNeighbors.Text, out oSettings.nFilterNeighbors);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtFilterDistance_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Single.TryParse(txtFilterDistance.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out oSettings.fFilterThreshold);
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
private void txtICPIters_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Int32.TryParse(txtICPIters.Text, out oSettings.nNumICPIterations);
|
||||
}
|
||||
|
||||
private void txtRefinIters_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Int32.TryParse(txtRefinIters.Text, out oSettings.nMaxNumRefineIters);
|
||||
}
|
||||
|
||||
private void chMerge_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
oSettings.bMergeScansForSave = chMerge.Checked;
|
||||
}
|
||||
|
||||
private void btAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
lock (oSettings)
|
||||
oSettings.lMarkerPoses.Add(new MarkerPose());
|
||||
lisMarkers.SelectedIndex = oSettings.lMarkerPoses.Count - 1;
|
||||
UpdateMarkerFields();
|
||||
UpdateClients();
|
||||
}
|
||||
private void btRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (oSettings.lMarkerPoses.Count > 0)
|
||||
{
|
||||
oSettings.lMarkerPoses.RemoveAt(lisMarkers.SelectedIndex);
|
||||
lisMarkers.SelectedIndex = oSettings.lMarkerPoses.Count - 1;
|
||||
UpdateMarkerFields();
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void lisMarkers_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMarkerFields();
|
||||
}
|
||||
|
||||
private void txtOrientationX_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
float X, Y, Z;
|
||||
pose.GetOrientation(out X, out Y, out Z);
|
||||
Single.TryParse(txtOrientationX.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out X);
|
||||
|
||||
pose.SetOrientation(X, Y, Z);
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtOrientationY_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
float X, Y, Z;
|
||||
pose.GetOrientation(out X, out Y, out Z);
|
||||
Single.TryParse(txtOrientationY.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out Y);
|
||||
|
||||
pose.SetOrientation(X, Y, Z);
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtOrientationZ_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
float X, Y, Z;
|
||||
pose.GetOrientation(out X, out Y, out Z);
|
||||
Single.TryParse(txtOrientationZ.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out Z);
|
||||
|
||||
pose.SetOrientation(X, Y, Z);
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtTranslationX_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
float X;
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
Single.TryParse(txtTranslationX.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out X);
|
||||
|
||||
pose.pose.t[0] = X;
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtTranslationY_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
float Y;
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
Single.TryParse(txtTranslationY.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out Y);
|
||||
|
||||
pose.pose.t[1] = Y;
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtTranslationZ_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
float Z;
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
Single.TryParse(txtTranslationZ.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out Z);
|
||||
|
||||
pose.pose.t[2] = Z;
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtId_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lisMarkers.SelectedIndex >= 0)
|
||||
{
|
||||
int id;
|
||||
MarkerPose pose = oSettings.lMarkerPoses[lisMarkers.SelectedIndex];
|
||||
Int32.TryParse(txtId.Text, out id);
|
||||
|
||||
pose.id = id;
|
||||
UpdateClients();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user