Skip to content
Snippets Groups Projects
Commit 6c5a8c00 authored by Tristan Walter's avatar Tristan Walter
Browse files

fixed trex executable

parent 1f0509ef
No related branches found
No related tags found
No related merge requests found
......@@ -44,139 +44,7 @@ std::string conda_environment_path(const char* argv) {
#endif
}
const char * FOR_EACH_1 = "#define FOR_EACH_%d(NAM, what, x, ...)\\\n" \
"\twhat(NAM, x)\\\n" \
"\tEXPAND(FOR_EACH_%d(NAM, what, __VA_ARGS__))\n\n";
struct Temp {
enum Variables {
Variable1,
Variable2
};
static constexpr const char* VariableNames[] {
"Variable1",
"Variable2"
};
static inline struct Members {
uint32_t Variable1;
std::string Variable2;
} _detail;
using Variable1_t = uint32_t;
using Variable2_t = std::string;
static inline const std::array<std::function<const cmn::sprite::PropertyType&()>, sizeof(VariableNames)> _getters {
[]() -> const cmn::sprite::PropertyType& { return cmn::GlobalSettings::get("Variable1").get(); },
[]() -> const cmn::sprite::PropertyType& { return cmn::GlobalSettings::get("Variable2").get(); }
};
static Members& impl() {
return _detail;
}
template<Variables M, typename T>
static void set(T v, typename std::enable_if_t<M == Variables::Variable1 && std::is_convertible<T, decltype(Members::Variable1)>::value, void>* = nullptr) {
impl().Variable1 = v;
update<M>();
}
template<Variables M>
static const uint32_t& get(typename std::enable_if_t<M == Variables::Variable1, void>* = nullptr) {
return impl().Variable1;
}
template<Variables M>
static const char* name() {
return VariableNames[M];
}
template<Variables M, typename T>
static void set(T v, typename std::enable_if_t<M == Variables::Variable2 && std::is_convertible<T, decltype(Members::Variable2)>::value, void>* = nullptr) {
impl().Variable2 = v;
update<M>();
}
template<Variables M>
static void update() {
// do nothing
}
};
#include <misc/BlobSizeRange.h>
//#define FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, N, ...) N
//#define FOR_EACH_RSEQ_N() 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0"
using namespace cmn;
CREATE_STRUCT(Test,
(int, Variable1),
(int, Variable2),
(int, Variable3),
(int, frame_rate)
)
//template<> void Test::update<Test::Variable1>() {
// Debug("Custom update<Test::Variable1>()");
//}
//STRUCT_META_EXTENSIONS(Test)
/*template<>
void Temp::update<Temp::Variable1>() {
printf("Updating variable1!\n");
}
uint32_t __attribute__ ((noinline)) getDouble() {
Test::set<Test::Variable1>(1337.0);
return Test::get<Test::Variable1>();
}*/
int main(int argc, char** argv) {
Debug("%d", Test::get(Test::frame_rate).value<Test::frame_rate_t>());
std::stringstream ss;
GlobalSettings::get("").get().type_name();
Test::set_callback(Test::Variable1, [](auto&, auto&){
Debug("Custom callback Variable1");
});
/*typename std::conditional< std::is_same<int, int>::value, int, float>::type v;
Temp::set<Temp::Variable1>(1337);
Temp::set<Temp::Variable2>("abc");
Temp::get<Temp::Variable1>();
getDouble();
printf("Name = %s, Value = %d\n", Temp::name<Temp::Variable1>(), Temp::get<Temp::Variable1>());
Test::set<Test::Variable1>(0.0);
Test::name<Test::Variable1>();
auto d = Test::get<Test::Variable1>();*/
/*{
auto str = Meta::toStr(Test::Variable2);
Debug("%S", &str);
Meta::fromStr<Test::Variables>("Variable1");
}*/
printf("#define FOR_EACH_1(NAM, what, x) what(NAM, x)\n");
for (size_t i=2; i<128; ++i) {
printf(FOR_EACH_1, i, i-1);
}
ss << "#define FOR_EACH_ARG_N( ";
for(size_t i=1; i<128; ++i) {
ss << "_" << std::to_string(i) << ", ";
}
ss << " N, ...) N";
printf("%s\n", ss.str().c_str());
ss.str("");
printf("#define FOR_EACH_RSEQ_N() ");
for(int i=128; i>0; --i) {
printf("%d, ", i);
}
printf("0\n");
exit(0);
std::string target_path = "";
auto conda_prefix = conda_environment_path(argv[0]);
if(!conda_prefix.empty()) {
......
......@@ -34,7 +34,9 @@ extensions = [
'sphinx.ext.autosectionlabel'
]
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 3
autosectionlabel_maxdepth = 4
html_sidebars = { '**': ['globaltoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html'] }
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
......
......@@ -9,6 +9,7 @@ Welcome to TRex's documentation!
install
run
formats
parameters_trex
parameters_tgrabs
......
.. include:: names.rst
.. toctree::
:maxdepth: 2
File formats
============
Export
******
Data
----
Upon hitting the ``S`` key/clicking the export tracking data button in the menu, or when using the ``auto_quit`` option, |trex| will save one file per individual. They are, by default, saved to ``data/[VIDEONAME]_fish[NUMBER].npz`` and contain all of the data fields selected from the export options. These include by default::
X#wcentroid (x-position of the centroid)
Y#wcentroid (y- *)
X (x-position of the head)
Y
SPEED#wcentroid (magnitude of the second derivative of position, based on centroid)
SPEED
AX (x-component of acceleration in cm/s)
AY (y-component *)
...
.. NOTE::
There are a couple hashtags in there -- these simply mean that the data-source for that metric is different. For example, ``wcentroid`` means that this metric is centered on the centroid (weighted by pixel values) of each individual. If no hashtag is provided, the metric centers on the head of each individual. These are usually closely related, but are different from each other e.g. when the individual moves its head independently from other parts of the body. There the head-based metric would show much more wiggling around than the centroid-based metric.
Posture
-------
PreprocessedVideo (pv)
**********************
Videos in the PV format are structured as follows::
**[HEADER SECTION]**
(string) "PV" + (version_nr)
(byte) channels
(uint16) width
(uint16) height
(Rect2i) four ushorts with the mask-offsets left,top,right,bottom
(uchar) sizeof(HorizontalLine)
(uint32) number of frames
(uint64) pointer to index at the end of file
(uint64) timestamp (time since 1970 in microseconds)
(string) project name
(byte*) average img ([width x height] x channels)
(size_t) mask present / mask size in bytes (if 0 no mask)
[byte*] mask, but only present if mask_size != NULL
**[DATA SECTION]**
for each frame:
(uchar) compression flag (if 1, the whole frame is compressed)
if compressed:
(uint32) original size
(uint32) compressed size
(byte*) lzo1x compressed data (see below for uncompressed)
else:
[UNCOMPRESSED DATA PER FRAME] {
(uint64) timestamp (in microseconds) since start of movie
(uint16) number of individual cropped images
for each object/blob:
(uint16) y of first HorizontalLine
(uint16) (n)umber of HorizontalLine structs
(byte*) n * sizeof(HorizontalLine)
(byte*) original image pixels ordered exactly as in HorizontalLines (BGR, CV_8UC(n))
}
**[INDEX TABLE]**
for each frame
(uint64) frame start position in file
**[METADATA]**
(string) JSONized metadata array
Where the HorizontalLine struct is made up of::
(uint16) x0
(uint15) y0
(1 bit ) eol
The last bit (EOL, or "end of line") in this case suggests to the reader that this line is the last on the current y-coordinate, meaning that the y-counter has to be incremented by one. This, together with the "y of first HorizontalLine", is enough to reconstruct the entire object.
\ No newline at end of file
......@@ -90,7 +90,7 @@ You can now clone the repository and change your directory to a build folder::
mkdir build
cd build
Now we have to generate the project files for the given platform and compiler. The following CMake command varies slightly depending on the operating system. Within the environment, go to the ``FishTracker/Application/build`` repository (created previously) and execute:
Now we have to generate the project files for the given platform and compiler. The following CMake command varies slightly depending on the operating system. Within the environment, go to the ``FishTracker/Application/build`` repository (created previously) and execute either the prepared compile scripts for your platform (on a Unix system ``../trex_build_unix.sh``, or on Windows ``../trex_build_windows.bat``) or execute cmake yourself with custom settings:
* **Windows**::
......@@ -152,7 +152,7 @@ Now that your project files are set-up, execute these commands in order (for Uni
&& cmake .. \
&& cmake --build . --config Release
or in PowerShell::
or on Windows, and in PowerShell::
cmake --build . --target CustomOpenCV --config Release `
-and cmake .. `
......
......@@ -55,6 +55,11 @@ The tracker only expects an input file::
Just like with |grabs|, you can attach any number of additional parameters to the command-line, simply using ``-PARAMETER VALUE`` (see :doc:`parameters_trex`).
Batch processing support
========================
Frequently asked questions and solutions to weird problems
==========================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment