C API

The C API of bob::sp allows users to leverage from automatic converters for classes in bob.sp. To use the C API, you should first include the header file <bob.sp/api.h> on their compilation units and then make sure to call once import_bob_sp() at their module instantiation, as explained at the Python manual.

Here is a dummy C example showing how to include the header and where to call the import function:

#include <bob.sp/api.h>

PyMODINIT_FUNC initclient(void) {

  PyObject* m Py_InitModule("client", ClientMethods);

  if (!m) return;

  /* imports dependencies */
  if (import_bob_blitz() < 0) {
    PyErr_Print();
    PyErr_SetString(PyExc_ImportError, "cannot import extension");
    return 0;
  }

  if (import_bob_sp() < 0) {
    PyErr_Print();
    PyErr_SetString(PyExc_ImportError, "cannot import extension");
    return 0;
  }

}

BorderType Interface

PyObject* PyBobSpExtrapolationBorder_Type

An enumeration type that defines several ways to handle the border of an image during convolution.

PyBobSpExtrapolationBorder_Converter(PyObject*, bob::sp::Extrapolation::BorderType*)

This function is meant to be used with PyArg_ParseTupleAndKeywords() family of functions in the Python C-API. It converts an arbitrary input object into a bob::sp::Extrapolation::BorderType object.

Returns 0 if an error is detected, 1 on success.