forked from hybridgroup/gocv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtracking.cpp
76 lines (58 loc) · 1.75 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "tracking.h"
#include <opencv2/opencv.hpp>
bool Tracker_Init(Tracker self, Mat image, Rect boundingBox) {
cv::Rect2d bb(boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height);
bool ret = (*self)->init(*image, bb);
return ret;
}
bool Tracker_Update(Tracker self, Mat image, Rect* boundingBox) {
cv::Rect2d 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;
}
TrackerMIL TrackerMIL_Create() {
return new cv::Ptr<cv::TrackerMIL>(cv::TrackerMIL::create());
}
void TrackerMIL_Close(TrackerMIL self) {
delete self;
}
TrackerBoosting TrackerBoosting_Create() {
return new cv::Ptr<cv::TrackerBoosting>(cv::TrackerBoosting::create());
}
void TrackerBoosting_Close(TrackerBoosting self) {
delete self;
}
TrackerMedianFlow TrackerMedianFlow_Create() {
return new cv::Ptr<cv::TrackerMedianFlow>(cv::TrackerMedianFlow::create());
}
void TrackerMedianFlow_Close(TrackerMedianFlow self) {
delete self;
}
TrackerTLD TrackerTLD_Create() {
return new cv::Ptr<cv::TrackerTLD>(cv::TrackerTLD::create());
}
void TrackerTLD_Close(TrackerTLD self) {
delete self;
}
TrackerKCF TrackerKCF_Create() {
return new cv::Ptr<cv::TrackerKCF>(cv::TrackerKCF::create());
}
void TrackerKCF_Close(TrackerKCF self) {
delete self;
}
TrackerMOSSE TrackerMOSSE_Create() {
return new cv::Ptr<cv::TrackerMOSSE>(cv::TrackerMOSSE::create());
}
void TrackerMOSSE_Close(TrackerMOSSE self) {
delete self;
}
TrackerCSRT TrackerCSRT_Create() {
return new cv::Ptr<cv::TrackerCSRT>(cv::TrackerCSRT::create());
}
void TrackerCSRT_Close(TrackerCSRT self) {
delete self;
}