23 #include <pybind11/pybind11.h>
25 #include <pybind11/stl.h>
30 namespace py = pybind11;
32 using namespace py::literals;
39 template <
typename PixelT>
40 void declareApproximate(py::module &mod, std::string
const &suffix) {
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",
49 (std::shared_ptr<Approximate<PixelT>>(*)(std::vector<double>
const &, std::vector<double>
const &,
51 ApproximateControl
const &))makeApproximate<PixelT>,
57 py::module mod(
"_approximate",
"Python wrapper for afw _approximate library");
59 py::class_<ApproximateControl, std::shared_ptr<ApproximateControl>> clsApproximateControl(
60 mod,
"ApproximateControl");
62 py::enum_<ApproximateControl::Style>(clsApproximateControl,
"Style")
64 .value(
"CHEBYSHEV", ApproximateControl::Style::CHEBYSHEV)
65 .value(
"NUM_STYLES", ApproximateControl::Style::NUM_STYLES)
68 clsApproximateControl.def(py::init<ApproximateControl::Style, int, int, bool>(),
"style"_a,
"orderX"_a,
69 "orderY"_a = -1,
"weighting"_a =
true);
71 clsApproximateControl.def(
"getStyle", &ApproximateControl::getStyle);
72 clsApproximateControl.def(
"setStyle", &ApproximateControl::setStyle);
73 clsApproximateControl.def(
"getOrderX", &ApproximateControl::getOrderX);
74 clsApproximateControl.def(
"setOrderX", &ApproximateControl::setOrderX);
75 clsApproximateControl.def(
"getOrderY", &ApproximateControl::getOrderY);
76 clsApproximateControl.def(
"setOrderY", &ApproximateControl::setOrderY);
77 clsApproximateControl.def(
"getWeighting", &ApproximateControl::getWeighting);
78 clsApproximateControl.def(
"setWeighting", &ApproximateControl::setWeighting);
81 declareApproximate<float>(mod,
"F");
PYBIND11_PLUGIN(_cameraPoint)
A class to manipulate images, masks, and variance as a single object.