-
Notifications
You must be signed in to change notification settings - Fork 41
/
utils.cc
44 lines (37 loc) · 1.1 KB
/
utils.cc
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
#include <opencv2/core.hpp>
#include <vector>
#include "common.h"
#include "utils.h"
void cv_to_ffi(const cv::Rect& source, Rect* dest) {
dest->x = source.x;
dest->y = source.y;
dest->width = source.width;
dest->height = source.height;
}
void cv_to_ffi(const cv::Point& source, Point2i* dest) {
dest->x = source.x;
dest->y = source.y;
};
void cv_to_ffi(const cv::KeyPoint& source, KeyPoint* dest) {
dest->pt.x = dest->pt.x;
dest->pt.y = dest->pt.y;
dest->size = source.size;
dest->angle = source.angle;
dest->response = source.response;
dest->octave = source.octave;
dest->class_id = source.class_id;
}
void cv_to_ffi(const cv::DMatch& source, DMatch* dest) {
dest->distance = dest->distance;
dest->imgIdx = dest->imgIdx;
dest->queryIdx = source.queryIdx;
dest->trainIdx = source.trainIdx;
}
void cv_to_ffi(const std::string& source, CDisposableString* dest) {
char* result = new char[source.length() + 1];
strcpy(result, source.c_str());
dest->value = result;
}
void ffi_to_cv(const cv::Mat& source, cv::Mat* dest) {
*dest = source;
}