22 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
25 #include "numpy/arrayobject.h"
26 #include "ndarray/pybind11.h"
30 namespace py = pybind11;
31 using namespace pybind11::literals;
39 template <
typename PixelT>
40 static void declareApplyLookupTable(py::module& mod) {
41 mod.def(
"applyLookupTable", &applyLookupTable<PixelT>,
"image"_a,
"table"_a,
"indOffset"_a);
47 py::module mod(
"applyLookupTable");
50 if (_import_array() < 0) {
51 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
55 declareApplyLookupTable<float>(mod);
56 declareApplyLookupTable<double>(mod);
PYBIND11_PLUGIN(applyLookupTable)
int applyLookupTable(afw::image::Image< PixelT > &image, ndarray::Array< PixelT, 1, 1 > const &table, PixelT indOffset)
Add the values in a lookup table to an image, e.g.