27#include <QDirIterator>
28#include <QElapsedTimer>
34#include <QSqlDatabase>
45#include <opencv2/calib3d.hpp>
46#include <opencv2/core/types.hpp>
47#include <opencv2/highgui/highgui.hpp>
48#include <opencv2/imgproc/imgproc.hpp>
49#include <opencv2/video/tracking.hpp>
54#include "opencv2/features2d/features2d.hpp"
55#include "videoreader.h"
111 Tracking(
string path,
string background,
int startImage = 0,
int stopImage = -1);
112 Tracking(
string path, UMat background,
int startImage = 0,
int stopImage = -1);
117 Point2d
curvatureCenter(
const Point3d &tail,
const Point3d &head)
const;
118 double curvature(Point2d center,
const Mat &image)
const;
119 static double modul(
double angle);
120 double divide(
double a,
double b)
const;
122 bool objectDirection(
const UMat &image, vector<double> &information)
const;
124 vector<Point3d>
reassignment(
const vector<Point3d> &past,
const vector<Point3d> &input,
const vector<int> &assignment)
const;
126 void registration(UMat imageReference, UMat &frame,
int method)
const;
127 void binarisation(UMat &frame,
char backgroundColor,
int value)
const;
128 vector<vector<Point3d>>
objectPosition(
const UMat &frame,
int minSize,
int maxSize)
const;
129 vector<int>
costFunc(
const vector<vector<Point3d>> &prevPos,
const vector<vector<Point3d>> &pos,
double LENGHT,
double ANGLE,
double LO,
double AREA,
double PERIMETER)
const;
130 void cleaning(
const vector<int> &occluded, vector<int> &lostCounter, vector<int> &
id, vector<vector<Point3d>> &input,
double param_maximalTime)
const;
131 vector<Point3d>
prevision(vector<Point3d> past, vector<Point3d> present)
const;
This class is intended to execute a tracking analysis on an image sequence. It is initialized with th...
Definition: tracking.h:60
UMat backgroundExtraction(VideoReader &video, int n, const int method, const int registrationMethod) const
Computes the background of an image sequence by averaging n images.
Definition: tracking.cpp:218
void binarisation(UMat &frame, char backgroundColor, int value) const
Binarizes the image by thresholding.
Definition: tracking.cpp:383
virtual void startProcess()
Initializes a tracking analysis and triggers its execution. Constructs from the path to a folder wher...
Definition: tracking.cpp:828
static double modul(double angle)
Computes the usual mathematical modulo 2*PI of an angle.
Definition: tracking.cpp:109
static bool importTrackingResult(const QString path, QSqlDatabase db)
Imports the tracking data from a text file to the database.
Definition: tracking.cpp:1058
int param_y2
Definition: tracking.h:103
int param_registration
Definition: tracking.h:99
double param_to
Definition: tracking.h:94
int m_startImage
Definition: tracking.h:76
~Tracking()
Destructs the tracking object.
Definition: tracking.cpp:1015
static bool exportTrackingResult(const QString path, QSqlDatabase db)
Exports the tracking data from the database to a text file.
Definition: tracking.cpp:1025
int param_spot
Definition: tracking.h:88
string m_path
Definition: tracking.h:67
void statistic(long long int time) const
Emitted at the end of the analysis.
UMat m_background
Definition: tracking.h:69
vector< int > m_lost
Definition: tracking.h:82
vector< vector< Point3d > > objectPosition(const UMat &frame, int minSize, int maxSize) const
Computes the positions of the objects and extracts the object's features.
Definition: tracking.cpp:402
double curvature(Point2d center, const Mat &image) const
Computes the radius of curvature of the object defined as the inverse of the mean distance between ea...
Definition: tracking.cpp:90
void progress(int) const
Emitted when an image is processed.
int m_displayTime
Definition: tracking.h:70
void forceFinished(QString message) const
Emitted when a crash occurs during the analysis.
double param_area
Definition: tracking.h:91
int m_im
Definition: tracking.h:74
vector< vector< Point3d > > m_outPrev
Definition: tracking.h:139
int param_x2
Definition: tracking.h:102
QFile m_logFile
Definition: tracking.h:79
QElapsedTimer * timer
Definition: tracking.h:63
double param_len
Definition: tracking.h:89
int param_kernelSize
Definition: tracking.h:104
int param_x1
Definition: tracking.h:100
vector< cv::String > m_files
Definition: tracking.h:80
UMat m_binaryFrame
Definition: tracking.h:136
int param_methodBackground
Definition: tracking.h:97
int param_minArea
Definition: tracking.h:87
int param_thresh
Definition: tracking.h:95
int m_stopImage
Definition: tracking.h:77
vector< Point3d > prevision(vector< Point3d > past, vector< Point3d > present) const
Predicts the next position of an object from the previous position.
Definition: tracking.cpp:680
vector< int > costFunc(const vector< vector< Point3d > > &prevPos, const vector< vector< Point3d > > &pos, double LENGHT, double ANGLE, double LO, double AREA, double PERIMETER) const
Computes a cost function and use a global optimization association to associate targets between image...
Definition: tracking.cpp:540
static double angleDifference(double alpha, double beta)
Computes the least difference between two angles, alpha - beta. The difference is oriented in the tri...
Definition: tracking.cpp:134
QMap< QString, QString > parameters
Definition: tracking.h:107
vector< Point3d > reassignment(const vector< Point3d > &past, const vector< Point3d > &input, const vector< int > &assignment) const
Sorts a vector accordingly to a new set of indexes. The sorted vector at index i is the input at inde...
Definition: tracking.cpp:615
Point2d curvatureCenter(const Point3d &tail, const Point3d &head) const
Computes the center of the curvature, defined as the intersection of the minor axis of the head ellip...
Definition: tracking.cpp:47
vector< int > m_id
Definition: tracking.h:81
int param_maxArea
Definition: tracking.h:86
vector< double > objectInformation(const UMat &image) const
Computes the equivalent ellipse of an object by computing the moments of the image....
Definition: tracking.cpp:146
int param_n
Definition: tracking.h:85
int param_kernelType
Definition: tracking.h:105
void finishedProcessFrame() const
Emitted when the first image has been processed to trigger the starting of the analysis.
virtual void imageProcessing()
Processes an image from an images sequence and tracks and matchs objects according to the previous im...
Definition: tracking.cpp:701
void updatingParameters(const QMap< QString, QString > &)
Updates the private members from the external parameters. This function links the tracking logic with...
Definition: tracking.cpp:984
void finished() const
Emitted when all images have been processed.
QString m_savingPath
Definition: tracking.h:71
string m_backgroundPath
Definition: tracking.h:68
Rect m_ROI
Definition: tracking.h:78
UMat m_visuFrame
Definition: tracking.h:137
bool objectDirection(const UMat &image, vector< double > &information) const
Computes the direction of the object from the object parameter (coordinate of the center of mass and ...
Definition: tracking.cpp:175
vector< int > findOcclusion(vector< int > assignment) const
Finds the objects that are occluded during the tracking.
Definition: tracking.cpp:596
bool statusBinarisation
Definition: tracking.h:65
double divide(double a, double b) const
Computes the float division and handle the division by 0 by returning 0.
Definition: tracking.cpp:119
QString m_error
Definition: tracking.h:75
void cleaning(const vector< int > &occluded, vector< int > &lostCounter, vector< int > &id, vector< vector< Point3d > > &input, double param_maximalTime) const
Cleans the data if an object is lost more than a certain time.
Definition: tracking.cpp:652
int param_y1
Definition: tracking.h:101
void registration(UMat imageReference, UMat &frame, int method) const
Register two images. To speed-up, the registration is made in a pyramidal way: the images are downsam...
Definition: tracking.cpp:296
int param_methodRegistrationBackground
Definition: tracking.h:98
double param_perimeter
Definition: tracking.h:92
double param_nBackground
Definition: tracking.h:96
void backgroundProgress(int) const
Emitted when an image to compute the background is processed.
vector< vector< Point3d > > m_out
Definition: tracking.h:138
double param_angle
Definition: tracking.h:90
int param_morphOperation
Definition: tracking.h:106
double param_lo
Definition: tracking.h:93
This class is intended to abstract the opening of a video, it can load image sequence and video with ...
Definition: videoreader.h:34