-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.cpp
77 lines (53 loc) · 1.89 KB
/
main.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
// VOT test
#include <opencv2/opencv.hpp>
#include <pthread.h>
#include "kfebtracker.h"
#include "trax.h"
int main(void){
KFebTracker tracker;
tracker.init("AK");
trax_handle* trax;
trax_metadata* config = trax_metadata_create(TRAX_REGION_RECTANGLE, TRAX_IMAGE_PATH, TRAX_CHANNEL_COLOR, "KFebT", "KFebT", "none");
trax_image_list* img = NULL;
trax_region* rect = NULL;
// Call trax_server_setup to initialize trax protocol
trax = trax_server_setup(config, trax_no_log);
cv::Rect region;
cv::Mat image;
bool run = 1;
while (run){
trax_properties* prop = trax_properties_create();
int tr = trax_server_wait(trax, &img, &rect, prop);
if (tr == TRAX_INITIALIZE){
float x, y, width, height;
trax_region_get_rectangle(rect, &x, &y, &width, &height);
region.x = x;
region.y = y;
region.width = width;
region.height = height;
image = cv::imread(img->images[0]->data);
// Initialize trackers
tracker.initTrackers(image, region);
trax_server_reply(trax, rect, NULL);
} else if (tr == TRAX_FRAME) {
// Read image
image = cv::imread(img->images[0]->data);
if(image.empty()){
break;
}
//Report result
cv::Rect output = tracker.track(image);
trax_region* region = trax_region_create_rectangle(output.x, output.y, output.width, output.height);
trax_server_reply(trax, region, NULL);
trax_region_release(®ion);
} else {
run = 0;
}
trax_properties_release(&prop);
trax_metadata_release(&config);
/*cv::rectangle(image, fusion.getResult(), cv::Scalar(255, 0, 0));
cv::imshow("resp", image);
cv::waitKey(0);*/
}
return 0;
}