forked from hybridgroup/gocv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtracking.cpp
36 lines (28 loc) · 894 Bytes
/
tracking.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "tracking.h"
#include <opencv2/opencv.hpp>
bool TrackerSubclass_Init(Tracker self, Mat image, Rect boundingBox) {
cv::Rect bb(boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height);
(*self)->init(*image, bb);
return true;
}
bool TrackerSubclass_Update(Tracker self, Mat image, Rect* boundingBox) {
cv::Rect bb;
bool ret = (*self)->update(*image, bb);
boundingBox->x = int(bb.x);
boundingBox->y = int(bb.y);
boundingBox->width = int(bb.width);
boundingBox->height = int(bb.height);
return ret;
}
TrackerKCF TrackerKCF_Create() {
return new cv::Ptr<cv::TrackerKCF>(cv::TrackerKCF::create());
}
void TrackerKCF_Close(TrackerKCF self) {
delete self;
}
TrackerCSRT TrackerCSRT_Create() {
return new cv::Ptr<cv::TrackerCSRT>(cv::TrackerCSRT::create());
}
void TrackerCSRT_Close(TrackerCSRT self) {
delete self;
}