-
Notifications
You must be signed in to change notification settings - Fork 5
/
pyStag.cpp
30 lines (28 loc) · 1010 Bytes
/
pyStag.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
#include "pybind11_opencv_numpy/ndarray_converter.h"
#include "src/Marker.h"
#include "src/Quad.h"
#include "src/Stag.h"
#include <pybind11/cast.h>
#include <pybind11/complex.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <sys/types.h>
namespace py = pybind11;
using namespace py::literals;
// this is a simple warpping of the Stag detector.
// you can add your customized function or varialbes interface as fllow.
void declearType_Stag_Detector(py::module &m) {
py::class_<Stag>(m, "Detector")
.def(py::init<>())
.def(py::init<int, int, bool>(), "libraryHD"_a, "errorCorrection"_a,
"inKeepLogs"_a)
.def("detect", &Stag::detectMarkers, "inImage"_a)
.def("log2File", &Stag::logResults, "path"_a)
.def("getContours", &Stag::getContours)
.def("getIds", &Stag::getIds);
}
PYBIND11_MODULE(pyStag, m) {
// this is crucial for convertation between numpy::ndarray and cv::Mat
NDArrayConverter::init_numpy();
declearType_Stag_Detector(m);
}