Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi tracking file support #293

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Documentation/shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ These shortcuts only apply to the currently selected volume. See [](./user-inter
| `Right` | Select next DOF. |
| `Up` | Increment selected DOF. |
| `Down` | Decrement selected DOF. |
| `J` | Swap to the previous tracking set if it exists. |
| `K` | Swap to the next tracking set if it exists. |
3 changes: 3 additions & 0 deletions autoscoper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(autoscoper_FORMS_HEADERS
src/ui/TimelineDockWidget.h
src/ui/ImportExportTrackingOptionsDialog.h
src/ui/TrackingOptionsDialog.h
src/ui/TrackingSetDockWidget.h
src/ui/AdvancedOptionsDialog.h
src/ui/FilterTreeWidgetParameter.h
src/ui/GLWidget.h
Expand Down Expand Up @@ -50,6 +51,7 @@ set(autoscoper_FORMS_SOURCES
src/ui/TimelineDockWidget.cpp
src/ui/ImportExportTrackingOptionsDialog.cpp
src/ui/TrackingOptionsDialog.cpp
src/ui/TrackingSetDockWidget.cpp
src/ui/AdvancedOptionsDialog.cpp
src/ui/AboutAutoscoper.cpp
src/ui/FilterTreeWidgetParameter.cpp
Expand All @@ -75,6 +77,7 @@ set(autoscoper_FORMS
src/ui/ui-files/TimelineDockWidget.ui
src/ui/ui-files/ImportExportTrackingOptionsDialog.ui
src/ui/ui-files/TrackingOptionsDialog.ui
src/ui/ui-files/TrackingSetDockWidget.ui
src/ui/ui-files/AdvancedOptionsDialog.ui
src/ui/ui-files/OpenCLPlatformSelectDialog.ui
src/ui/ui-files/CameraBox.ui
Expand Down
53 changes: 53 additions & 0 deletions autoscoper/src/ui/AutoscoperMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@
#include "ui/CameraViewWidget.h"
#include "ui/TimelineDockWidget.h"
#include "ui/TrackingOptionsDialog.h"
#include "ui/TrackingSetDockWidget.h"
#include "ui/AdvancedOptionsDialog.h"

#include "ui/GLTracker.h"
#include "ui/ImportExportTrackingOptionsDialog.h"
#include "ui_ImportExportTrackingOptionsDialog.h"
#include "ui_TrackingOptionsDialog.h"
#include "ui_TrackingSetDockWidget.h"
#include "ui/AboutAutoscoper.h"
#include "ui/OpenCLPlatformSelectDialog.h"
#include "Manip3D.hpp"
Expand Down Expand Up @@ -127,6 +129,11 @@ AutoscoperMainWindow::AutoscoperMainWindow(bool skipGpuDevice, QWidget* parent)
// Create filter widget and put it on the left
filters_widget = new FilterDockWidget(this);
this->addDockWidget(Qt::LeftDockWidgetArea, filters_widget);
this->setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);

// Create the tracking set widget
tracking_set_widget = new TrackingSetDockWidget(this);
this->addDockWidget(Qt::LeftDockWidgetArea, tracking_set_widget);

// Create volume idwget and put it on the bottom-left
volumes_widget = new VolumeDockWidget(this);
Expand Down Expand Up @@ -180,6 +187,7 @@ AutoscoperMainWindow::~AutoscoperMainWindow()
delete ui;

delete filters_widget;
delete tracking_set_widget;
delete volumes_widget;
delete worldview;
delete tracker;
Expand Down Expand Up @@ -598,6 +606,11 @@ void AutoscoperMainWindow::setupUI()
}
// Setup the default view

// Add tracking sets - Needs to happen after textures get binded
for (unsigned int i = 0; i < tracker->trial()->numberOfCurveSets(); i++) {
tracking_set_widget->addTrackingSet(tracker->trial()->volumes.size());
}

// Update the number of frames
timeline_widget->setFramesRange(0, tracker->trial()->num_frames - 1);
reset_graph();
Expand Down Expand Up @@ -2089,6 +2102,34 @@ void AutoscoperMainWindow::on_toolButtonTrackCurrent_clicked()
tracking_dialog->retrack();
}*/

void AutoscoperMainWindow::on_toolButtonPreviousCurveSet_clicked()
{
if (tracker) {
tracker->trial()->setCurrentCurveSetToPrevious();
}
redrawGL();
frame_changed();
}

void AutoscoperMainWindow::on_toolButtonAddNewCurveSet_clicked()
{
if (tracker) {
tracker->trial()->addCurveSet();
tracking_set_widget->addTrackingSet(tracker->trial()->volumes.size());
}
redrawGL();
frame_changed();
}

void AutoscoperMainWindow::on_toolButtonNextCurveSet_clicked()
{
if (tracker) {
tracker->trial()->setCurrentCurveSetToNext();
}
redrawGL();
frame_changed();
}

void AutoscoperMainWindow::on_actionExport_NCC_as_csv_triggered(bool checked)
{
QString filename = get_filename(true, "*.ncc");
Expand Down Expand Up @@ -2389,6 +2430,14 @@ void AutoscoperMainWindow::key_t_pressed()
{
ui->toolButtonTrack->click();
}
void AutoscoperMainWindow::key_j_pressed()
{
ui->toolButtonPreviousCurveSet->click();
}
void AutoscoperMainWindow::key_k_pressed()
{
ui->toolButtonNextCurveSet->click();
}
/*void AutoscoperMainWindow::key_p_pressed(){
ui->toolButtonRetrack->click();
} */
Expand Down Expand Up @@ -2467,6 +2516,10 @@ void AutoscoperMainWindow::setupShortcuts()
new QShortcut(QKeySequence(Qt::Key_L), this, SLOT(key_l_pressed()));
// T - Opens the tracking dialog
new QShortcut(QKeySequence(Qt::Key_T), this, SLOT(key_t_pressed()));
// J - Goes to the previous tracking set if there is one
new QShortcut(QKeySequence(Qt::Key_J), this, SLOT(key_j_pressed()));
// K - Goes to the next tracking set if there is one
new QShortcut(QKeySequence(Qt::Key_K), this, SLOT(key_k_pressed()));
// P - Retrack - not enabled
// new QShortcut(QKeySequence(Qt::Key_P), this, SLOT(key_p_pressed()));
// C - Track current frame
Expand Down
8 changes: 8 additions & 0 deletions autoscoper/src/ui/AutoscoperMainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TimelineDockWidget;
class VolumeDockWidget;
class AboutAutoscoper;
class TrackingOptionsDialog;
class TrackingSetDockWidget;
class AdvancedOptionsDialog;
class WorldViewWindow;
class QOpenGLContext;
Expand Down Expand Up @@ -169,6 +170,7 @@ class AutoscoperMainWindow : public QMainWindow
TimelineDockWidget* timeline_widget;
VolumeDockWidget* volumes_widget;
TrackingOptionsDialog* tracking_dialog;
TrackingSetDockWidget* tracking_set_widget;
AdvancedOptionsDialog* advanced_dialog;
AboutAutoscoper* about_autoscoper;

Expand Down Expand Up @@ -318,13 +320,19 @@ public slots:
void on_toolButtonTrackCurrent_clicked();
// void on_toolButtonRetrack_clicked();

void on_toolButtonPreviousCurveSet_clicked();
void on_toolButtonAddNewCurveSet_clicked();
void on_toolButtonNextCurveSet_clicked();

// Shortcuts
void key_w_pressed();
void key_e_pressed();
void key_d_pressed();
void key_h_pressed();
void key_l_pressed();
void key_t_pressed();
void key_j_pressed();
void key_k_pressed();
// void key_r_pressed();
// void key_p_pressed();
void key_c_pressed();
Expand Down
47 changes: 47 additions & 0 deletions autoscoper/src/ui/TrackingSetDockWidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifdef _MSC_VER
# define _CRT_SECURE_NO_WARNINGS
#endif

#include "ui_TrackingSetDockWidget.h"
#include "ui/TrackingSetDockWidget.h"
#include "ui/AutoscoperMainWindow.h"

#include "Tracker.hpp"
#include "Trial.hpp"

TrackingSetDockWidget::TrackingSetDockWidget(QWidget* parent)
: QDockWidget(parent)
, dock(new Ui::TrackingSetDockWidget)
{
dock->setupUi(this);
mainwindow = dynamic_cast<AutoscoperMainWindow*>(parent);
}

TrackingSetDockWidget::~TrackingSetDockWidget()
{
delete dock;
}

void TrackingSetDockWidget::addTrackingSet(const int& num_volumes)
{
this->tracking_sets.push_back("Tracking set " + std::to_string(dock->listWidget->count()));
QListWidgetItem* item = new QListWidgetItem();
int currentSet = this->mainwindow->getTracker()->trial()->numberOfCurveSets() - 1;
item->setText(QString::fromStdString(this->tracking_sets[currentSet]));
dock->listWidget->addItem(item);
dock->listWidget->setCurrentItem(item);
}

void TrackingSetDockWidget::setCurrentSet(const int& idx)
{
dock->listWidget->setCurrentRow(idx);
}

void TrackingSetDockWidget::on_listWidget_currentItemChanged(QListWidgetItem* current, QListWidgetItem* previous)
{
if (current != NULL) {
mainwindow->getTracker()->trial()->setCurrentCurveSet(dock->listWidget->row(current));
mainwindow->redrawGL();
mainwindow->frame_changed();
}
}
40 changes: 40 additions & 0 deletions autoscoper/src/ui/TrackingSetDockWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef TRACKINGSETDOCKWIDGET_H
#define TRACKINGSETDOCKWIDGET_H

#include <QDockWidget>

// forward declarations
namespace Ui {
class TrackingSetDockWidget;
}

class AutoscoperMainWindow;
class QListWidgetItem;

class TrackingSetDockWidget : public QDockWidget
{

Q_OBJECT

public:
explicit TrackingSetDockWidget(QWidget* parent = 0);
~TrackingSetDockWidget();

AutoscoperMainWindow* getMainWindow() { return mainwindow; };

void addTrackingSet(const int& num_volumes);
void setCurrentSet(const int& idx);

private:
Ui::TrackingSetDockWidget* dock;

AutoscoperMainWindow* mainwindow;

std::vector<std::string> tracking_sets;

protected:
public slots:
void on_listWidget_currentItemChanged(QListWidgetItem* current, QListWidgetItem* previous);
};

#endif // TRACKINGSETDOCKWIDGET_H
49 changes: 46 additions & 3 deletions autoscoper/src/ui/ui-files/AutoscoperMainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>1283</width>
<height>632</height>
</rect>
</property>
<property name="minimumSize">
Expand Down Expand Up @@ -384,6 +384,49 @@ Dialog</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPreviousCurveSet">
<property name="text">
<string>Previous
Tracking
Set (J)</string>
jcfr marked this conversation as resolved.
Show resolved Hide resolved
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonAddNewCurveSet">
<property name="text">
<string>Add New
Tracking
Set</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonNextCurveSet">
<property name="text">
<string>Next
Tracking
Set (K)</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
Expand All @@ -410,7 +453,7 @@ Dialog</string>
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<width>1283</width>
<height>25</height>
</rect>
</property>
Expand Down
32 changes: 32 additions & 0 deletions autoscoper/src/ui/ui-files/TrackingSetDockWidget.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TrackingSetDockWidget</class>
<widget class="QDockWidget" name="TrackingSetDockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>250</width>
<height>115</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>91</width>
<height>50</height>
</size>
</property>
<property name="windowTitle">
<string>Tracking Sets</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listWidget"/>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
1 change: 0 additions & 1 deletion libautoscoper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ set(libautoscoper_SOURCES
src/CoordFrame.cpp
src/DownhillSimplex.cpp
src/PSO.cpp
src/KeyCurve.cpp
src/TiffImage.cpp
src/Tracker.cpp
src/Trial.cpp
Expand Down
Loading
Loading