summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-05 19:55:05 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-05 19:55:05 +0200
commitf4754d23984126de847279f4abad4ae713d9e386 (patch)
tree78757d55b07887da427058853d88718ce27c2028
parentcfffa29e29db6b2234c7f534b1ebcd612b7f4914 (diff)
flush and push
-rwxr-xr-xfacetracknoir/clientfiles/make-csv.pl72
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c)7
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/tester/main.cpp (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/tester/npifc.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/tester/npifc.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in)0
-rw-r--r--facetracknoir/clientfiles/very-important-source-code/tester/resource.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h)0
l---------facetracknoir/clientfiles/very-important-source-code/tester/rest.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c)0
l---------facetracknoir/clientfiles/very-important-source-code/tester/rest.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h)0
-rw-r--r--facetracknoir/plugin-qt-api.hpp1
-rw-r--r--facetracknoir/pose.hpp (renamed from facetracknoir/tracker_types.h)22
-rw-r--r--facetracknoir/quat.hpp26
-rw-r--r--facetracknoir/tracker.cpp40
-rw-r--r--facetracknoir/tracker.h9
-rw-r--r--freetrackclient/build-msvc.sh33
-rw-r--r--freetrackclient/freetrackclient.c4
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp11
-rw-r--r--ftnoir_tracker_aruco/include/aruco.h29
-rw-r--r--ftnoir_tracker_aruco/include/arucofidmarkers.h15
-rw-r--r--ftnoir_tracker_aruco/include/board.h168
-rw-r--r--ftnoir_tracker_aruco/include/boarddetector.h139
-rw-r--r--ftnoir_tracker_aruco/include/cvdrawingutils.h21
-rw-r--r--ftnoir_tracker_aruco/include/exports.h4
-rw-r--r--ftnoir_tracker_aruco/include/markerdetector.h16
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra.h19
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.h33
39 files changed, 541 insertions, 128 deletions
diff --git a/facetracknoir/clientfiles/make-csv.pl b/facetracknoir/clientfiles/make-csv.pl
new file mode 100755
index 00000000..ee60364e
--- /dev/null
+++ b/facetracknoir/clientfiles/make-csv.pl
@@ -0,0 +1,72 @@
+#!/usr/bin/env perl
+
+use strict;
+use List::Util qw'reduce';
+
+sub get_games_1 {
+ my @games;
+
+ open my $fd, "<", $ARGV[1] or die "open: $!";
+ <$fd>;
+
+ while (defined(my $line = <$fd>)) {
+ chomp $line;
+ if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) {
+ warn "Broken line";
+ next;
+ }
+ push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef};
+ }
+
+ [@games];
+}
+
+sub get_games_2 {
+ open my $fd, "<", $ARGV[0] or die "open: $!";
+ <$fd>;
+ my @games;
+ while (defined(my $line = <$fd>)) {
+ chomp $line;
+ my @line = split/;/, $line;
+ if (@line != 8) {
+ warn "Broken line";
+ next;
+ }
+ my @cols = qw'no name proto since verified by id key';
+ push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols };
+ }
+ [@games];
+}
+
+sub merge {
+ my ($new_games, $old_games) = @_;
+ my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1;
+ my %game_hash = map { $_->{name} => $_ } @$old_games;
+ my %ids = map { $_->{id} => 1 } @$old_games;
+ for my $g (@$new_games) {
+ if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) {
+ $game_hash{$g->{name}} = +{
+ no => $no++,
+ name => $g->{name},
+ proto => 'FreeTrack20',
+ since => (defined $g->{key} ? 'V170' : 'V160'),
+ verified => '',
+ by => '',
+ id => $g->{id},
+ key => $g->{key}
+ };
+ }
+ }
+ print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n";
+ for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) {
+ my $g = {%$_};
+ if (!defined $g->{key}) {
+ $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00';
+ }
+ my @cols = qw'no name proto since verified by id key';
+ print join";", map { $g->{$_} } @cols;
+ print "\n";
+ }
+}
+
+merge(get_games_1(), get_games_2());
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt
index 82214139..82214139 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt
+++ b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am
index 02747edb..02747edb 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am
+++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in
index d1fff34d..d1fff34d 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in
+++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in
index 332f3c73..332f3c73 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in
+++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp
index a737f88f..a737f88f 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp
+++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h b/facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h
index 8bba17b4..8bba17b4 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h
+++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h
index 770e1c71..770e1c71 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h
+++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec
index 7fe5f1b4..7fe5f1b4 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec
+++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h
index b0bab5db..b0bab5db 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h
+++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c
index f892f89e..f892f89e 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c
+++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c
index 3197ba37..f80a7d44 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c
+++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c
@@ -6,8 +6,6 @@
#include <stdint.h>
#include <sys/stat.h>
#include <string.h>
-#include <utils.h>
-
//First 5 bytes is MD5 hash of "NaturalPoint"
static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@@ -114,10 +112,12 @@ static void game_data_close()
free(decoded);
}
+#define ltr_int_log_message(...) fprintf(stderr, __VA_ARGS__)
+
bool get_game_data(const char *input_fname, const char *output_fname, bool from_update)
{
FILE *outfile = NULL;
- if((outfile = fopen(output_fname, "w")) == NULL){
+ if((outfile = (output_fname ? fopen(output_fname, "w") : stdout)) == NULL){
ltr_int_log_message("Can't open the output file '%s'!\n", output_fname);
return false;
}
@@ -147,3 +147,4 @@ bool get_game_data(const char *input_fname, const char *output_fname, bool from_
return true;
}
+int main(int argc, char** argv) { return argc > 1 && get_game_data(argv[1], NULL, false); }
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h
index b71f7a15..b71f7a15 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h
+++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am
index e025209a..e025209a 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in
index cc49d754..cc49d754 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp
index 95ca0d9b..95ca0d9b 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c
index b036464e..b036464e 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h
index d580e16d..d580e16d 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in
index 231002f1..231002f1 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h
index 328d9cb7..328d9cb7 100644
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c
index 663c21a9..663c21a9 120000
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c
diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h
index 6dca182a..6dca182a 120000
--- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h
+++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h
diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp
index 0e2e3c32..1697d8e7 100644
--- a/facetracknoir/plugin-qt-api.hpp
+++ b/facetracknoir/plugin-qt-api.hpp
@@ -56,7 +56,6 @@ struct ITracker
virtual ~ITracker() = 0;
virtual void StartTracker( QFrame* frame ) = 0;
virtual void GetHeadPoseData(double *data) = 0;
- virtual int preferredHz() { return 200; }
};
inline ITracker::~ITracker() {}
diff --git a/facetracknoir/tracker_types.h b/facetracknoir/pose.hpp
index 02aacdcf..ec9faaa3 100644
--- a/facetracknoir/tracker_types.h
+++ b/facetracknoir/pose.hpp
@@ -5,7 +5,7 @@
#include "./quat.hpp"
#include "./plugin-api.hpp"
-struct T6DOF {
+class Pose {
private:
static constexpr double pi = 3.141592653;
static constexpr double d2r = pi/180.0;
@@ -13,7 +13,7 @@ private:
double axes[6];
public:
- T6DOF() : axes {0,0,0, 0,0,0 } {}
+ Pose() : axes {0,0,0, 0,0,0 } {}
inline operator double*() { return axes; }
inline operator const double*() const { return axes; }
@@ -26,34 +26,34 @@ public:
return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r);
}
- static T6DOF fromQuat(const Quat& q)
+ static Pose fromQuat(const Quat& q)
{
- T6DOF ret;
- q.to_euler_rads(ret(Yaw), ret(Pitch), ret(Roll));
+ Pose ret;
+ q.to_euler_degrees(ret(Yaw), ret(Pitch), ret(Roll));
return ret;
}
- T6DOF operator-(const T6DOF& B) const
+ Pose operator-(const Pose& B) const
{
const Quat q = (quat() * B.quat().inv());
- T6DOF ret = fromQuat(q);
+ Pose ret = fromQuat(q);
for (int i = TX; i < Yaw; i++)
ret(i) = B(i);
return ret;
}
- T6DOF operator+(const T6DOF& B) const
+ Pose operator+(const Pose& B) const
{
const Quat q = (quat() * B.quat().inv());
- T6DOF ret = fromQuat(q);
+ Pose ret = fromQuat(q);
for (int i = TX; i < Yaw; i++)
ret(i) = B(i);
return ret;
}
- T6DOF operator|(const T6DOF& replacement) const
+ Pose operator|(const Pose& replacement) const
{
- T6DOF ret = *this;
+ Pose ret = *this;
for (int i = 0; i < 6; i++)
{
static constexpr double eps = 1e-5;
diff --git a/facetracknoir/quat.hpp b/facetracknoir/quat.hpp
index 1e268963..6d777b28 100644
--- a/facetracknoir/quat.hpp
+++ b/facetracknoir/quat.hpp
@@ -14,7 +14,7 @@ private:
static constexpr double r2d = 180./pi;
double a,b,c,d; // quaternion coefficients
public:
- Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {}
+ Quat() : a(1.),b(0.),c(0.),d(0.) {}
Quat(double yaw, double pitch, double roll) { from_euler_rads(yaw, pitch, roll); }
Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {}
@@ -27,12 +27,12 @@ public:
void from_euler_rads(double yaw, double pitch, double roll)
{
- double sin_phi = sin(roll/2.0);
- double cos_phi = cos(roll/2.0);
- double sin_the = sin(pitch/2.0);
- double cos_the = cos(pitch/2.0);
- double sin_psi = sin(yaw/2.0);
- double cos_psi = cos(yaw/2.0);
+ const double sin_phi = sin(roll/2.);
+ const double cos_phi = cos(roll/2.);
+ const double sin_the = sin(pitch/2.);
+ const double cos_the = cos(pitch/2.);
+ const double sin_psi = sin(yaw/2.);
+ const double cos_psi = cos(yaw/2.);
a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi;
b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi;
@@ -42,9 +42,9 @@ public:
void to_euler_rads(double& yaw, double& pitch, double& roll) const
{
- roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c));
- pitch = asin(2.0*(a*c - b*d));
- yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d));
+ roll = atan2(2.*(a*b + c*d), 1. - 2.*(b*b + c*c));
+ pitch = asin(2.*(a*c - b*d));
+ yaw = atan2(2.*(a*d + b*c), 1. - 2.*(c*c + d*d));
}
void to_euler_degrees(double& yaw, double& pitch, double& roll) const
@@ -59,8 +59,8 @@ public:
{
const Quat& A = *this;
return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication
- A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c,
- A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b,
- A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a);
+ A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c,
+ A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b,
+ A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a);
}
};
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index 0c2d289f..e1f86294 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -12,8 +12,7 @@
* originally written by Wim Vriend.
*/
-#include "tracker.h"
-#include "facetracknoir.h"
+#include "./tracker.h"
#include <opencv2/core/core.hpp>
#include <cmath>
#include <algorithm>
@@ -49,9 +48,10 @@ void Tracker::get_curve(double pos, double& out, Mapping& axis) {
static void t_compensate(double* input, double* output, bool rz)
{
- const auto H = input[Yaw] * M_PI / -180;
- const auto P = input[Pitch] * M_PI / -180;
- const auto B = input[Roll] * M_PI / 180;
+ static constexpr double pi = 3.141592653;
+ const auto H = input[Yaw] * pi / -180;
+ const auto P = input[Pitch] * pi / -180;
+ const auto B = input[Roll] * pi / 180;
const auto cosH = cos(H);
const auto sinH = sin(H);
@@ -83,15 +83,10 @@ static void t_compensate(double* input, double* output, bool rz)
}
void Tracker::run() {
- T6DOF pose_offset, unstopped_pose;
+ Pose pose_offset, unstopped_pose;
double newpose[6] = {0};
- int sleep_ms = 15;
-
- if (Libraries->pTracker)
- sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz());
-
- qDebug() << "tracker Hz:" << 1000 / sleep_ms;
+ const int sleep_ms = 3;
#if defined(_WIN32)
(void) timeBeginPeriod(1);
@@ -104,9 +99,7 @@ void Tracker::run() {
if (should_quit)
break;
- if (Libraries->pTracker) {
- Libraries->pTracker->GetHeadPoseData(newpose);
- }
+ Libraries->pTracker->GetHeadPoseData(newpose);
{
QMutexLocker foo(&mtx);
@@ -130,15 +123,12 @@ void Tracker::run() {
if (enabledp)
unstopped_pose = raw_6dof;
- {
+ if (Libraries->pFilter)
+ Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose);
+ else
+ output_pose = unstopped_pose;
- if (Libraries->pFilter)
- Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose);
- else
- output_pose = unstopped_pose;
-
- output_pose = output_pose - pose_offset;
- }
+ output_pose = output_pose - pose_offset;
for (int i = 0; i < 6; i++)
get_curve(output_pose(i), output_pose(i), m(i));
@@ -147,9 +137,7 @@ void Tracker::run() {
if (s.tcomp_p)
t_compensate(output_pose, output_pose, s.tcomp_tz);
- if (Libraries->pProtocol) {
- Libraries->pProtocol->sendHeadposeToGame(output_pose);
- }
+ Libraries->pProtocol->sendHeadposeToGame(output_pose);
}
const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed()));
diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h
index 3d9a3858..8a4ecb1f 100644
--- a/facetracknoir/tracker.h
+++ b/facetracknoir/tracker.h
@@ -10,14 +10,15 @@
#include <QPainterPath>
#include <QDebug>
#include <QMutex>
-#include "plugin-support.h"
-#include "mappings.hpp"
+#include "./plugin-support.h"
+#include "./mappings.hpp"
+#include "./pose.hpp"
#include <vector>
#include <atomic>
#include <qfunctionconfigurator/functionconfig.h>
-#include "tracker_types.h"
+#include "./quat.hpp"
#include "facetracknoir/main-settings.hpp"
#include "facetracknoir/options.h"
#include "facetracknoir/timer.hpp"
@@ -30,7 +31,7 @@ private:
// XXX can be const-cast when functionconfig const-correct -sh 20141004
Mappings& m;
Timer t;
- T6DOF output_pose, raw_6dof;
+ Pose output_pose, raw_6dof;
std::atomic<bool> centerp;
std::atomic<bool> enabledp;
std::atomic<bool> should_quit;
diff --git a/freetrackclient/build-msvc.sh b/freetrackclient/build-msvc.sh
new file mode 100644
index 00000000..4fd303a0
--- /dev/null
+++ b/freetrackclient/build-msvc.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+export PATH="/bin:/usr/bin:$PATH"
+
+case "$(uname -s 2>/dev/null)" in
+*CYG*|*MING*|'') wrap= ;;
+*) wrap=wine ;;
+esac
+
+c_src=".\\freetrackclient.c"
+c_bin="..\\facetracknoir\\clientfiles\\freetrackclient.dll"
+opt_link="-nologo -LTCG -SAFESEH:NO -OPT:REF,ICF"
+opt_cl="
+-nologo -arch:SSE2 -fp:fast -EHc -EH- -GL -GR- -GS- -Gw -LD -MT -O1
+-Ob2 -Og -Oi -Ot -Oy -QIfist -volatile:iso -Ze -Fe\"${c_bin}\"
+"
+
+MSVC="VS140COMNTOOLS"
+
+test -z "$MSVC" && {
+ echo "uh-oh, no MSVC" >&2
+ exit 1
+}
+
+sep="\&"
+
+cd "$(dirname "$0")"
+
+$wrap cmd.exe /C $(echo "
+ del /F /Q $c_bin $sep
+ call %${MSVC}%/vsvars32.bat 2>nul >nul $sep
+ cl $opt_cl $c_src -link $opt_link
+ " | tr '\n' ' ')
diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c
index 200242b9..4bc39d67 100644
--- a/freetrackclient/freetrackclient.c
+++ b/freetrackclient/freetrackclient.c
@@ -18,6 +18,10 @@
* * created by the FreeTrack developers. *
*/
+#ifndef _MSC_VER
+# warning "expect misnamed symbols"
+#endif
+
#pragma GCC diagnostic ignored "-Wvariadic-macros"
#pragma GCC diagnostic ignored "-Wunused-parameter"
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
index a1e15721..1787ef2b 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
@@ -5,16 +5,15 @@
* copyright notice and this permission notice appear in all copies.
*/
+#include <vector>
+#include <cstdio>
+#include <cmath>
+#include <QMutexLocker>
+#include "./include/markerdetector.h"
#include "ftnoir_tracker_aruco.h"
-#include "ui_aruco-trackercontrols.h"
#include "facetracknoir/plugin-api.hpp"
-#include <QMutexLocker>
-#include "include/markerdetector.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
-#include <vector>
-#include <cstdio>
-#include <cmath>
#if defined(_WIN32)
# undef NOMINMAX
diff --git a/ftnoir_tracker_aruco/include/aruco.h b/ftnoir_tracker_aruco/include/aruco.h
index 8ea583a8..569b95fb 100644
--- a/ftnoir_tracker_aruco/include/aruco.h
+++ b/ftnoir_tracker_aruco/include/aruco.h
@@ -26,12 +26,12 @@ The views and conclusions contained in the software and documentation are those
authors and should not be interpreted as representing official policies, either expressed
or implied, of Rafael Muñoz Salinas.
-
-
+
+
\mainpage ArUco: Augmented Reality library from the University of Cordoba
-ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively.
+ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively.
It is an educational project to show student how to detect augmented reality markers and it is provided under BSD license.
@@ -54,11 +54,11 @@ Aruco allows the possibility to employ board. Boards are markers composed by an
The library comes with five applications that will help you to learn how to use the library:
- aruco_create_marker: which creates marker and saves it in a jpg file you can print.
- - aruco_simple : simple test aplication that detects the markers in a image
+ - aruco_simple : simple test aplication that detects the markers in a image
- aruco_test: this is the main application for detection. It reads images either from the camera of from a video and detect markers. Additionally, if you provide the intrinsics of the camera(obtained by OpenCv calibration) and the size of the marker in meters, the library calculates the marker intrinsics so that you can easily create your AR applications.
- aruco_test_gl: shows how to use the library AR applications using OpenGL for rendering
- aruco_create_board: application that helps you to create a board
- - aruco_simple_board: simple test aplication that detects a board of markers in a image
+ - aruco_simple_board: simple test aplication that detects a board of markers in a image
- aruco_test_board: application that detects boards
- aruco_test_board_gl: application that detects boards and uses OpenGL to draw
@@ -66,7 +66,7 @@ The library comes with five applications that will help you to learn how to use
The ArUco library contents are divided in two main directories. The src directory, which contains the library itself. And the utils directory which contains the applications.
-The library main classes are:
+The library main classes are:
- aruco::CameraParameters: represent the information of the camera that captures the images. Here you must set the calibration info.
- aruco::Marker: which represent a marker detected in the image
- aruco::MarkerDetector: that is in charge of deteting the markers in a image Detection is done by simple calling the member funcion ArMarkerDetector::detect(). Additionally, the classes contain members to create the required matrices for rendering using OpenGL. See aruco_test_gl for details
@@ -101,33 +101,34 @@ The library has been compiled using MinGW and codeblocks. Below I describe the b
-# Download the source code and compile it using cmake and codeblocks. Note: install the library in C:\ if you want it to be easily detected by cmake afterwards
- step 4) aruco
-# Download and decompress.
- -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built.
+ -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built.
-# Generate the codeblock project.
-# Open the project with codeblock and compile then, install. The programs will be probably generated into the bin directory
OpenGL: by default, the mingw version installed has not the glut library. So, the opengl programs are not compiled. If you want to compile with OpenGL support, you must install glut, or prefereably freeglut.
-Thus,
- - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw.
- - Decompress in a directory X.
+Thus,
+ - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw.
+ - Decompress in a directory X.
- Then, rerun cmake setting the variable GLU_PATH to that directory (>cmake .. -DGLUT_PATH="C:\X")
- Finally, recompile and test. Indeed, you should move the freeglut.dll to the directory with the binaries or to any other place in the PATH.
CONCLUSION: Move to Linux, things are simpler :P
-
-\section Testing
+
+\section Testing
For testing the applications, the library provides videos and the corresponding camera parameters of these videos. Into the directories you will find information on how to run the examples.
-
+
\section Final Notes
- REQUIREMENTS: OpenCv >= 2.1.0. and OpenGL for (aruco_test_gl and aruco_test_board_gl)
- CONTACT: Rafael Munoz-Salinas: rmsalinas@uco.es
- This libary is free software and come with no guaratee!
-
+
*/
#include "markerdetector.h"
+#include "boarddetector.h"
#include "cvdrawingutils.h"
diff --git a/ftnoir_tracker_aruco/include/arucofidmarkers.h b/ftnoir_tracker_aruco/include/arucofidmarkers.h
index 15eb8e4c..7dad4672 100644
--- a/ftnoir_tracker_aruco/include/arucofidmarkers.h
+++ b/ftnoir_tracker_aruco/include/arucofidmarkers.h
@@ -31,6 +31,7 @@ or implied, of Rafael Muñoz Salinas.
#include <opencv2/core/core.hpp>
#include "exports.h"
#include "marker.h"
+#include "board.h"
namespace aruco {
class ARUCO_EXPORTS FiducidalMarkers {
@@ -79,7 +80,7 @@ public:
* @param gridSize grid layout (numer of sqaures in x and Y)
* @param MarkerSize size of markers sides in pixels
* @param MarkerDistance distance between the markers
- * @param TInfo output
+ * @param TInfo output
* @param excludedIds set of ids excluded from the board
*/
static cv::Mat createBoardImage( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,vector<int> *excludedIds=NULL ) throw (cv::Exception);
@@ -88,24 +89,24 @@ public:
/**Creates a printable image of a board in chessboard_like manner
* @param gridSize grid layout (numer of sqaures in x and Y)
* @param MarkerSize size of markers sides in pixels
- * @param TInfo output
+ * @param TInfo output
* @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner
- *
+ *
*/
static cv::Mat createBoardImage_ChessBoard( cv::Size gridSize,int MarkerSize, BoardConfiguration& TInfo ,bool setDataCentered=true ,vector<int> *excludedIds=NULL) throw (cv::Exception);
- /**Creates a printable image of a board in a frame fashion
+ /**Creates a printable image of a board in a frame fashion
* @param gridSize grid layout (numer of sqaures in x and Y)
* @param MarkerSize size of markers sides in pixels
* @param MarkerDistance distance between the markers
- * @param TInfo output
+ * @param TInfo output
* @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner
- *
+ *
*/
static cv::Mat createBoardImage_Frame( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,bool setDataCentered=true,vector<int> *excludedIds=NULL ) throw (cv::Exception);
private:
-
+
static vector<int> getListOfValidMarkersIds_random(int nMarkers,vector<int> *excluded) throw (cv::Exception);
static cv::Mat rotate(const cv::Mat & in);
static int hammDistMarker(cv::Mat bits);
diff --git a/ftnoir_tracker_aruco/include/board.h b/ftnoir_tracker_aruco/include/board.h
new file mode 100644
index 00000000..c1d79292
--- /dev/null
+++ b/ftnoir_tracker_aruco/include/board.h
@@ -0,0 +1,168 @@
+/*****************************
+Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those of the
+authors and should not be interpreted as representing official policies, either expressed
+or implied, of Rafael Muñoz Salinas.
+********************************/
+#ifndef _Aruco_board_h
+#define _Aruco_board_h
+#include <opencv2/opencv.hpp>
+#include <string>
+#include <vector>
+#include "exports.h"
+#include "marker.h"
+using namespace std;
+namespace aruco {
+/**
+ * 3d representation of a marker
+ */
+struct ARUCO_EXPORTS MarkerInfo:public vector<cv::Point3f> {
+ MarkerInfo() {}
+ MarkerInfo(int _id) {id=_id; }
+ MarkerInfo(const MarkerInfo&MI): vector<cv::Point3f>(MI){id=MI.id; }
+ MarkerInfo & operator=(const MarkerInfo&MI){
+ vector<cv::Point3f> ::operator=(MI);
+ id=MI.id;
+ return *this;
+ }
+ int id;//maker id
+};
+
+/**\brief This class defines a board with several markers.
+ * A Board contains several markers so that they are more robustly detected.
+ *
+ * In general, a board is a set of markers. So BoardConfiguration is only a list
+ * of the id of the markers along with the position of their corners.
+ *
+ * The position of the corners can be specified either in pixels (in a non-specific size) or in meters.
+ * The first is the typical case in which you generate the image of board and the print it. Since you do not know in advance the real
+ * size of the markers, their corners are specified in pixels, and then, the translation to meters can be made once you know the real size.
+ *
+ * On the other hand, you may want to have the information of your boards in meters. The BoardConfiguration allows you to do so.
+ *
+ * The point is in the mInfoType variable. It can be either PIX or METERS according to your needs.
+ *
+*/
+
+
+class ARUCO_EXPORTS BoardConfiguration: public vector<MarkerInfo>
+{
+ friend class Board;
+public:
+ enum MarkerInfoType {NONE=-1,PIX=0,METERS=1};//indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
+ //variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
+ int mInfoType;
+ /**
+ */
+ BoardConfiguration();
+
+ /**
+ */
+ BoardConfiguration(const BoardConfiguration &T);
+
+ /**
+ */
+ BoardConfiguration & operator=(const BoardConfiguration &T);
+ /**Saves the board info to a file
+ */
+ void saveToFile(string sfile)throw (cv::Exception);
+ /**Reads board info from a file
+ */
+ void readFromFile(string sfile)throw (cv::Exception);
+ /**Indicates if the corners are expressed in meters
+ */
+ bool isExpressedInMeters()const {
+ return mInfoType==METERS;
+ }
+ /**Indicates if the corners are expressed in meters
+ */
+ bool isExpressedInPixels()const {
+ return mInfoType==PIX;
+ }
+ /**Returns the index of the marker with id indicated, if is in the list
+ */
+ int getIndexOfMarkerId(int id)const;
+ /**Returns the Info of the marker with id specified. If not in the set, throws exception
+ */
+ const MarkerInfo& getMarkerInfo(int id)const throw (cv::Exception);
+ /**Set in the list passed the set of the ids
+ */
+ void getIdList(vector<int> &ids,bool append=true)const;
+private:
+ /**Saves the board info to a file
+ */
+ void saveToFile(cv::FileStorage &fs)throw (cv::Exception);
+ /**Reads board info from a file
+ */
+ void readFromFile(cv::FileStorage &fs)throw (cv::Exception);
+};
+
+/**
+*/
+class ARUCO_EXPORTS Board:public vector<Marker>
+{
+
+public:
+ BoardConfiguration conf;
+ //matrices of rotation and translation respect to the camera
+ cv::Mat Rvec,Tvec;
+ /**
+ */
+ Board()
+ {
+ Rvec.create(3,1,CV_32FC1);
+ Tvec.create(3,1,CV_32FC1);
+ for (int i=0;i<3;i++)
+ Tvec.at<float>(i,0)=Rvec.at<float>(i,0)=-999999;
+ }
+
+ /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl.
+ * Setting this matrix, the reference corrdinate system will be set in this board
+ */
+ void glGetModelViewMatrix(double modelview_matrix[16])throw(cv::Exception);
+
+ /**
+ * Returns position vector and orientation quaternion for an Ogre scene node or entity.
+ * Use:
+ * ...
+ * Ogre::Vector3 ogrePos (position[0], position[1], position[2]);
+ * Ogre::Quaternion ogreOrient (orientation[0], orientation[1], orientation[2], orientation[3]);
+ * mySceneNode->setPosition( ogrePos );
+ * mySceneNode->setOrientation( ogreOrient );
+ * ...
+ */
+ void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception);
+
+
+ /**Save this from a file
+ */
+ void saveToFile(string filePath)throw(cv::Exception);
+ /**Read this from a file
+ */
+ void readFromFile(string filePath)throw(cv::Exception);
+
+};
+}
+
+#endif
diff --git a/ftnoir_tracker_aruco/include/boarddetector.h b/ftnoir_tracker_aruco/include/boarddetector.h
new file mode 100644
index 00000000..a0ee2361
--- /dev/null
+++ b/ftnoir_tracker_aruco/include/boarddetector.h
@@ -0,0 +1,139 @@
+/*****************************
+Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those of the
+authors and should not be interpreted as representing official policies, either expressed
+or implied, of Rafael Muñoz Salinas.
+********************************/
+#ifndef _Aruco_BoardDetector_H
+#define _Aruco_BoardDetector_H
+#include <opencv2/opencv.hpp>
+#include "exports.h"
+#include "board.h"
+#include "cameraparameters.h"
+#include "markerdetector.h"
+using namespace std;
+
+namespace aruco
+{
+
+/**\brief This class detects AR boards
+ * Version 1.2
+ * There are two modes for board detection.
+ * First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class.
+ *
+ * Second: New mode, marker detection is included in the class
+ * \code
+
+ CameraParameters CP;
+ CP.readFromFile(path_cp)
+ BoardConfiguration BC;
+ BC.readFromFile(path_bc);
+ BoardDetector BD;
+ BD.setParams(BC,CP); //or only BD.setParams(BC)
+ //capture image
+ cv::Mat im;
+ capture_image(im);
+
+ float prob=BD.detect(im);
+ if (prob>0.3)
+ CvDrawingUtils::draw3DAxis(im,BD.getDetectedBoard(),CP);
+
+ \endcode
+ *
+*/
+class ARUCO_EXPORTS BoardDetector
+{
+public:
+ /** See discussion in @see enableRotateXAxis.
+ * Do not change unless you know what you are doing
+ */
+ BoardDetector(bool setYPerperdicular=true);
+
+
+ /**
+ * Use if you plan to let this class to perform marker detection too
+ */
+ void setParams(const BoardConfiguration &bc,const CameraParameters &cp, float markerSizeMeters=-1);
+ void setParams(const BoardConfiguration &bc);
+ /**
+ * Detect markers, and then, look for the board indicated in setParams()
+ * @return value indicating the likelihood of having found the marker
+ */
+ float detect(const cv::Mat &im)throw (cv::Exception);
+ /**Returns a reference to the board detected
+ */
+ Board & getDetectedBoard(){return _boardDetected;}
+ /**Returns a reference to the internal marker detector
+ */
+ MarkerDetector &getMarkerDetector(){return _mdetector;}
+ /**Returns the vector of markers detected
+ */
+ vector<Marker> &getDetectedMarkers(){return _vmarkers;}
+
+
+ //ALTERNATIVE DETECTION METHOD, BASED ON MARKERS PREVIOUSLY DETECTED
+
+ /** Given the markers detected, determines if there is the board passed
+ * @param detectedMarkers result provided by aruco::ArMarkerDetector
+ * @param BConf the board you want to see if is present
+ * @param Bdetected output information of the detected board
+ * @param camMatrix camera matrix with intrinsics
+ * @param distCoeff camera distorsion coeff
+ * @param camMatrix intrinsic camera information.
+ * @param distCoeff camera distorsion coefficient. If set Mat() if is assumed no camera distorion
+ * @param markerSizeMeters size of the marker sides expressed in meters
+ * @return value indicating the likelihood of having found the marker
+ */
+ float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, cv::Mat camMatrix=cv::Mat(),cv::Mat distCoeff=cv::Mat(), float markerSizeMeters=-1 )throw (cv::Exception);
+ float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected,const CameraParameters &cp, float markerSizeMeters=-1 )throw (cv::Exception);
+
+
+ /**
+ * By default, the Y axis is set to point up. However this is not the default
+ * operation mode of opencv, which produces the Z axis pointing up instead.
+ * So, to achieve this change, we have to rotate the X axis.
+ */
+ void setYPerperdicular(bool enable){_setYPerperdicular=enable;}
+
+
+
+
+private:
+ void rotateXAxis(cv::Mat &rotation);
+ bool _setYPerperdicular;
+
+ //-- Functionality to detect markers inside
+ bool _areParamsSet;
+ BoardConfiguration _bconf;
+ Board _boardDetected;
+ float _markerSize;
+ CameraParameters _camParams;
+ MarkerDetector _mdetector;//internal markerdetector
+ vector<Marker> _vmarkers;//markers detected in the call to : float detect(const cv::Mat &im);
+
+};
+
+};
+#endif
+
diff --git a/ftnoir_tracker_aruco/include/cvdrawingutils.h b/ftnoir_tracker_aruco/include/cvdrawingutils.h
index 24bfe630..ff67242f 100644
--- a/ftnoir_tracker_aruco/include/cvdrawingutils.h
+++ b/ftnoir_tracker_aruco/include/cvdrawingutils.h
@@ -33,13 +33,20 @@ namespace aruco
{
/**\brief A set of functions to draw in opencv images
*/
- class ARUCO_EXPORTS CvDrawingUtils
- {
- public:
- static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP);
- static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP);
- };
-}
+ class ARUCO_EXPORTS CvDrawingUtils
+ {
+ public:
+
+ static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP);
+
+ static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP);
+
+ static void draw3dAxis(cv::Mat &Image,Board &m,const CameraParameters &CP);
+
+ static void draw3dCube(cv::Mat &Image,Board &m,const CameraParameters &CP);
+
+ };
+};
#endif
diff --git a/ftnoir_tracker_aruco/include/exports.h b/ftnoir_tracker_aruco/include/exports.h
index 044a1367..aaeb94e4 100644
--- a/ftnoir_tracker_aruco/include/exports.h
+++ b/ftnoir_tracker_aruco/include/exports.h
@@ -37,9 +37,9 @@ or implied, of Rafael Muñoz Salinas.
#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined DSO_EXPORTS
- #define ARUCO_EXPORTS __declspec(dllexport) __attribute__((visibility ("default")))
+ #define ARUCO_EXPORTS __declspec(dllexport)
#else
- #define ARUCO_EXPORTS __attribute__((visibility ("default")))
+ #define ARUCO_EXPORTS __attribute__ ((visibility ("default")))
#endif
diff --git a/ftnoir_tracker_aruco/include/markerdetector.h b/ftnoir_tracker_aruco/include/markerdetector.h
index a4656527..6f489c34 100644
--- a/ftnoir_tracker_aruco/include/markerdetector.h
+++ b/ftnoir_tracker_aruco/include/markerdetector.h
@@ -52,13 +52,11 @@ class ARUCO_EXPORTS MarkerDetector
contour=M.contour;
idx=M.idx;
}
- MarkerCandidate operator=(const MarkerCandidate &M){
- if (this == &M)
- return *this;
+ MarkerCandidate & operator=(const MarkerCandidate &M){
(*(Marker*)this)=(*(Marker*)&M);
contour=M.contour;
idx=M.idx;
- return M;
+ return *this;
}
vector<cv::Point> contour;//all the points of its contour
@@ -69,11 +67,11 @@ public:
/**
* See
*/
- MarkerDetector() {}
+ MarkerDetector();
/**
*/
- ~MarkerDetector() {}
+ ~MarkerDetector();
/**Detects the markers in the image passed
*
@@ -353,5 +351,9 @@ private:
void draw(cv::Mat out,const std::vector<Marker> &markers );
};
-}
+
+
+
+
+};
#endif
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h
index 1e4c6683..672efa28 100644
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h
+++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h
@@ -13,11 +13,10 @@ struct settings {
class Hydra_Tracker : public ITracker
{
public:
- Hydra_Tracker();
+ Hydra_Tracker();
~Hydra_Tracker();
void StartTracker(QFrame *) override;
void GetHeadPoseData(double *data) override;
- int preferredHz() override { return 250; }
volatile bool should_quit;
private:
settings s;
@@ -28,23 +27,23 @@ class TrackerControls: public QWidget, public ITrackerDialog
{
Q_OBJECT
public:
- explicit TrackerControls();
+ explicit TrackerControls();
void registerTracker(ITracker *) {}
void unRegisterTracker() {}
private:
settings s;
- Ui::UIHydraControls ui;
+ Ui::UIHydraControls ui;
private slots:
- void doOK();
- void doCancel();
+ void doOK();
+ void doCancel();
};
class FTNoIR_TrackerDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
+ void getIcon(QIcon *icon);
};
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h
index eb21f7bc..158229a6 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h
@@ -25,15 +25,14 @@ struct settings {
class Rift_Tracker : public ITracker
{
public:
- Rift_Tracker();
+ Rift_Tracker();
~Rift_Tracker() override;
void StartTracker(QFrame *) override;
void GetHeadPoseData(double *data) override;
- int preferredHz() override { return 250; }
volatile bool should_quit;
protected:
- void run(); // qthread override run method
+ void run(); // qthread override run method
private:
double old_yaw;
@@ -45,32 +44,32 @@ class TrackerControls: public QWidget, public ITrackerDialog
{
Q_OBJECT
public:
- explicit TrackerControls();
+ explicit TrackerControls();
void registerTracker(ITracker *) {}
- void unRegisterTracker() {}
+ void unRegisterTracker() {}
private:
- Ui::UIRiftControls ui;
+ Ui::UIRiftControls ui;
settings s;
private slots:
- void doOK();
- void doCancel();
+ void doOK();
+ void doCancel();
};
class FTNoIR_TrackerDll : public Metadata
{
public:
- FTNoIR_TrackerDll();
- ~FTNoIR_TrackerDll();
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ FTNoIR_TrackerDll();
+ ~FTNoIR_TrackerDll();
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
+ void getIcon(QIcon *icon);
private:
- QString trackerFullName; // Trackers' name and description
- QString trackerShortName;
- QString trackerDescription;
+ QString trackerFullName; // Trackers' name and description
+ QString trackerShortName;
+ QString trackerDescription;
};