The main class. More...
#include <MultiObjectTLD.h>
Public Member Functions | |
void | addObject (ObjectBox b) |
Marks a new object in the previously passed frame. | |
void | addObjects (std::vector< ObjectBox > obs) |
Adds multiple objects in the previously passed frame. | |
void | enableLearning (bool enable=true) |
En/Disables learning (i.e. updating the classifiers) at runtime. | |
void | getDebugImage (unsigned char *src, Matrix &rMat, Matrix &gMat, Matrix &bMat, int mode=255) const |
Writes a colored debug image into the given rgb matrices. Details see writeDebugImage(). | |
ObjectBox | getObjectBox () const |
Returns the location of the first object. | |
std::vector< ObjectBox > | getObjectBoxes () const |
Returns the current object positions. | |
int | getStatus (const int objId=0) const |
Returns current status of object objId . | |
bool | getValid () const |
Returns if the first object is valid (equivalent to getStatus(0) returning STATUS_OK ) | |
MultiObjectTLD (const int width, const int height, const MOTLDSettings &settings=MOTLDSettings()) | |
Default constructor. | |
void | processFrame (unsigned char *img) |
Processes the current frame (tracking - detecting - learning) | |
void | saveClassifier (const char *filename) const |
Saves the classifier to a (binary) file. | |
void | writeDebugImage (unsigned char *src, char *filename, int mode=255) const |
Saves an output image to file in PPM format. | |
Static Public Member Functions | |
static MultiObjectTLD | loadClassifier (const char *filename) |
Returns an instance of MultiObjectTLD while loading the classifier from file. | |
Private Member Functions | |
void | clusterDetections (float threshold) |
MultiObjectTLD (int width, int height, int colorMode, int patchSize, int bbMin, bool useColor, bool fastRotation, NNClassifier nnc, FernFilter ff, int nObjects, float aspectRatio, bool learningEnabled) | |
Private Attributes | |
float | ivAspectRatio |
int | ivBBmin |
int | ivColorMode |
Matrix | ivCurImage |
unsigned char * | ivCurImagePtr |
std::vector< ObjectBox > | ivCurrentBoxes |
std::vector< NNPatch > | ivCurrentPatches |
std::vector< bool > | ivDefined |
bool | ivEnableFastRotation |
FernFilter | ivFernFilter |
int | ivHeight |
std::vector< FernDetection > | ivLastDetectionClusters |
std::vector< FernDetection > | ivLastDetections |
bool | ivLearningEnabled |
LKTracker | ivLKTracker |
int | ivNLastDetections |
NNClassifier | ivNNClassifier |
int | ivNObjects |
int | ivPatchSize |
bool | ivUseColor |
std::vector< bool > | ivValid |
int | ivWidth |
The main class.
Definition at line 92 of file MultiObjectTLD.h.
motld::MultiObjectTLD::MultiObjectTLD | ( | const int | width, |
const int | height, | ||
const MOTLDSettings & | settings = MOTLDSettings() |
||
) | [inline] |
Default constructor.
width | width... |
height | ...and height of the images in the sequence |
settings | configuration structure (see class MOTLDSettings for more details) |
Definition at line 100 of file MultiObjectTLD.h.
motld::MultiObjectTLD::MultiObjectTLD | ( | int | width, |
int | height, | ||
int | colorMode, | ||
int | patchSize, | ||
int | bbMin, | ||
bool | useColor, | ||
bool | fastRotation, | ||
NNClassifier | nnc, | ||
FernFilter | ff, | ||
int | nObjects, | ||
float | aspectRatio, | ||
bool | learningEnabled | ||
) | [private] |
Definition at line 756 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::addObject | ( | ObjectBox | b | ) |
Marks a new object in the previously passed frame.
Definition at line 201 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::addObjects | ( | std::vector< ObjectBox > | obs | ) |
Adds multiple objects in the previously passed frame.
Definition at line 208 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::clusterDetections | ( | float | threshold | ) | [private] |
Definition at line 538 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::enableLearning | ( | bool | enable = true | ) | [inline] |
En/Disables learning (i.e. updating the classifiers) at runtime.
Definition at line 127 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::getDebugImage | ( | unsigned char * | src, |
Matrix & | rMat, | ||
Matrix & | gMat, | ||
Matrix & | bMat, | ||
int | mode = 255 |
||
) | const |
Writes a colored debug image into the given rgb matrices. Details see writeDebugImage().
Definition at line 660 of file MultiObjectTLD.h.
ObjectBox motld::MultiObjectTLD::getObjectBox | ( | ) | const [inline] |
Returns the location of the first object.
Definition at line 139 of file MultiObjectTLD.h.
std::vector<ObjectBox> motld::MultiObjectTLD::getObjectBoxes | ( | ) | const [inline] |
Returns the current object positions.
Definition at line 141 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::getStatus | ( | const int | objId = 0 | ) | const |
Returns current status of object objId
.
STATUS_OK:
the object is considered to be found correctly in the current frame STATUS_UNSURE:
the object may be lost, but is still tracked STATUS_LOST:
the object is definitely lost (the corresponding box returned by getObjectBoxes() is invalid) Definition at line 264 of file MultiObjectTLD.h.
bool motld::MultiObjectTLD::getValid | ( | ) | const [inline] |
Returns if the first object is valid (equivalent to getStatus(0)
returning STATUS_OK
)
Definition at line 137 of file MultiObjectTLD.h.
MultiObjectTLD motld::MultiObjectTLD::loadClassifier | ( | const char * | filename | ) | [static] |
Returns an instance of MultiObjectTLD while loading the classifier from file.
Definition at line 805 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::processFrame | ( | unsigned char * | img | ) |
Processes the current frame (tracking - detecting - learning)
img | The image passed as an unsigned char array. The pixels are assumed to be given row by row from top left to bottom right with the image width and height passed to the constructor (see MultiObjectTLD()). In case of COLOR_MODE_RGB the array should have the form [r_0, r_1, ..., r_n, g_0, g_1, ..., g_n, b_0, b_1, ..., b_n]. |
Definition at line 275 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::saveClassifier | ( | const char * | filename | ) | const |
Saves the classifier to a (binary) file.
Definition at line 777 of file MultiObjectTLD.h.
void motld::MultiObjectTLD::writeDebugImage | ( | unsigned char * | src, |
char * | filename, | ||
int | mode = 255 |
||
) | const |
Saves an output image to file in PPM format.
src | the same as passed to processFrame() |
filename | the filename, suggested ending: ".ppm" |
mode | controls which components are drawn, bitwise or of DEBUG_DRAW_DETECTIONS, DEBUG_DRAW_PATCHES, DEBUG_DRAW_CROSSES. |
The patches on the left side represent negative examples, positive examples are on the right side, starting a new column for each object. The red bars next to the patches sketch the corresponding color histograms. Green boxes represent detections shortlisted by the filtering process (see FernFilter). Blue boxes represent cluster means (if enabled). Blue crosses represent tracking points that are considered as inliers (see LKTracker). A red box stands for STATUS_OK, a yellow box means STATUS_UNSURE (cf. getStatus()).
Definition at line 651 of file MultiObjectTLD.h.
float motld::MultiObjectTLD::ivAspectRatio [private] |
Definition at line 178 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::ivBBmin [private] |
Definition at line 170 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::ivColorMode [private] |
Definition at line 168 of file MultiObjectTLD.h.
Matrix motld::MultiObjectTLD::ivCurImage [private] |
Definition at line 185 of file MultiObjectTLD.h.
unsigned char* motld::MultiObjectTLD::ivCurImagePtr [private] |
Definition at line 186 of file MultiObjectTLD.h.
Definition at line 179 of file MultiObjectTLD.h.
Definition at line 182 of file MultiObjectTLD.h.
std::vector<bool> motld::MultiObjectTLD::ivDefined [private] |
Definition at line 180 of file MultiObjectTLD.h.
Definition at line 172 of file MultiObjectTLD.h.
Definition at line 175 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::ivHeight [private] |
Definition at line 166 of file MultiObjectTLD.h.
Definition at line 188 of file MultiObjectTLD.h.
Definition at line 187 of file MultiObjectTLD.h.
bool motld::MultiObjectTLD::ivLearningEnabled [private] |
Definition at line 183 of file MultiObjectTLD.h.
LKTracker motld::MultiObjectTLD::ivLKTracker [private] |
Definition at line 173 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::ivNLastDetections [private] |
Definition at line 189 of file MultiObjectTLD.h.
Definition at line 174 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::ivNObjects [private] |
Definition at line 177 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::ivPatchSize [private] |
Definition at line 169 of file MultiObjectTLD.h.
bool motld::MultiObjectTLD::ivUseColor [private] |
Definition at line 171 of file MultiObjectTLD.h.
std::vector<bool> motld::MultiObjectTLD::ivValid [private] |
Definition at line 181 of file MultiObjectTLD.h.
int motld::MultiObjectTLD::ivWidth [private] |
Definition at line 165 of file MultiObjectTLD.h.