23 #include <pybind11/pybind11.h>
25 #include <pybind11/stl.h>
32 using namespace py::literals;
39 template <
typename PixelT>
41 using Class = Approximate<PixelT>;
43 py::class_<Class, std::shared_ptr<Class>>
cls(mod, (
"Approximate" + suffix).c_str());
45 cls.def(
"getImage", &Class::getImage,
"orderX"_a = -1,
"orderY"_a = -1);
46 cls.def(
"getMaskedImage", &Class::getMaskedImage,
"orderX"_a = -1,
"orderY"_a = -1);
48 mod.def(
"makeApproximate",
51 ApproximateControl
const &))makeApproximate<PixelT>,
52 "x"_a,
"y"_a,
"im"_a,
"bbox"_a,
"ctrl"_a);
57 py::class_<ApproximateControl, std::shared_ptr<ApproximateControl>> clsApproximateControl(
58 mod,
"ApproximateControl");
60 py::enum_<ApproximateControl::Style>(clsApproximateControl,
"Style")
61 .value(
"UNKNOWN", ApproximateControl::Style::UNKNOWN)
62 .value(
"CHEBYSHEV", ApproximateControl::Style::CHEBYSHEV)
63 .value(
"NUM_STYLES", ApproximateControl::Style::NUM_STYLES)
66 clsApproximateControl.def(py::init<ApproximateControl::Style, int, int, bool>(),
"style"_a,
"orderX"_a,
67 "orderY"_a = -1,
"weighting"_a =
true);
69 clsApproximateControl.def(
"getStyle", &ApproximateControl::getStyle);
70 clsApproximateControl.def(
"setStyle", &ApproximateControl::setStyle);
71 clsApproximateControl.def(
"getOrderX", &ApproximateControl::getOrderX);
72 clsApproximateControl.def(
"setOrderX", &ApproximateControl::setOrderX);
73 clsApproximateControl.def(
"getOrderY", &ApproximateControl::getOrderY);
74 clsApproximateControl.def(
"setOrderY", &ApproximateControl::setOrderY);
75 clsApproximateControl.def(
"getWeighting", &ApproximateControl::getWeighting);
76 clsApproximateControl.def(
"setWeighting", &ApproximateControl::setWeighting);
79 declareApproximate<float>(mod,
"F");