Generated by Cython 0.15.1 on Tue Jan 31 14:40:08 2012

Raw output: convolution.c

 1: import numpy as np
  /* "vision/convolution.pyx":1
 * import numpy as np             # <<<<<<<<<<<<<<
 * import features
 * import logging
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vision/convolution.pyx":1
 * import numpy as np             # <<<<<<<<<<<<<<
 * import features
 * import logging
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 2: import features
  /* "vision/convolution.pyx":2
 * import numpy as np
 * import features             # <<<<<<<<<<<<<<
 * import logging
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__features), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__features, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 3: import logging
  /* "vision/convolution.pyx":3
 * import numpy as np
 * import features
 * import logging             # <<<<<<<<<<<<<<
 * 
 * cimport numpy as np
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 4: 
 5: cimport numpy as np
 6: cimport cython
 7: 
 8: log = logging.getLogger("vision.convolution")
  /* "vision/convolution.pyx":8
 * cimport cython
 * 
 * log = logging.getLogger("vision.convolution")             # <<<<<<<<<<<<<<
 * 
 * cpdef hogrgb(image, filtersize, hogfilter, rgbfilter,
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__log, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 9: 
 10: cpdef hogrgb(image, filtersize, hogfilter, rgbfilter,
/* "vision/convolution.pyx":10
 * log = logging.getLogger("vision.convolution")
 * 
 * cpdef hogrgb(image, filtersize, hogfilter, rgbfilter,             # <<<<<<<<<<<<<<
 *              int hogbin = 8, int rgbbin = 8):
 *     """
 */

static PyObject *__pyx_pf_6vision_11convolution_hogrgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6vision_11convolution_hogrgb(PyObject *__pyx_v_image, PyObject *__pyx_v_filtersize, PyObject *__pyx_v_hogfilter, PyObject *__pyx_v_rgbfilter, int __pyx_skip_dispatch, struct __pyx_opt_args_6vision_11convolution_hogrgb *__pyx_optional_args) {
  int __pyx_v_hogbin = ((int)8);
  int __pyx_v_rgbbin = ((int)8);
  int __pyx_v_width;
  int __pyx_v_height;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_filterwidth;
  int __pyx_v_filterheight;
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_hogfeat = 0;
  PyArrayObject *__pyx_v_hogfiltert = 0;
  PyArrayObject *__pyx_v_sumrgb = 0;
  PyArrayObject *__pyx_v_rgbfiltert = 0;
  double __pyx_v_localrgbscore;
  long __pyx_v_localrgbbin;
  int __pyx_v_hfwidth;
  int __pyx_v_hfheight;
  double __pyx_v_hogscore;
  double __pyx_v_rgbscore;
  double __pyx_v_hogfeatvalue;
  double __pyx_v_hogfiltervalue;
  PyArrayObject *__pyx_v_output = 0;
  long __pyx_v_hfi;
  long __pyx_v_hfj;
  long __pyx_v_hfk;
  Py_buffer __pyx_bstruct_sumrgb;
  Py_ssize_t __pyx_bstride_0_sumrgb = 0;
  Py_ssize_t __pyx_bstride_1_sumrgb = 0;
  Py_ssize_t __pyx_bshape_0_sumrgb = 0;
  Py_ssize_t __pyx_bshape_1_sumrgb = 0;
  Py_buffer __pyx_bstruct_rgbfiltert;
  Py_ssize_t __pyx_bstride_0_rgbfiltert = 0;
  Py_ssize_t __pyx_bshape_0_rgbfiltert = 0;
  Py_buffer __pyx_bstruct_hogfiltert;
  Py_ssize_t __pyx_bstride_0_hogfiltert = 0;
  Py_ssize_t __pyx_bstride_1_hogfiltert = 0;
  Py_ssize_t __pyx_bstride_2_hogfiltert = 0;
  Py_ssize_t __pyx_bshape_0_hogfiltert = 0;
  Py_ssize_t __pyx_bshape_1_hogfiltert = 0;
  Py_ssize_t __pyx_bshape_2_hogfiltert = 0;
  Py_buffer __pyx_bstruct_hogfeat;
  Py_ssize_t __pyx_bstride_0_hogfeat = 0;
  Py_ssize_t __pyx_bstride_1_hogfeat = 0;
  Py_ssize_t __pyx_bstride_2_hogfeat = 0;
  Py_ssize_t __pyx_bshape_0_hogfeat = 0;
  Py_ssize_t __pyx_bshape_1_hogfeat = 0;
  Py_ssize_t __pyx_bshape_2_hogfeat = 0;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bstride_1_data = 0;
  Py_ssize_t __pyx_bstride_2_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  Py_ssize_t __pyx_bshape_1_data = 0;
  Py_ssize_t __pyx_bshape_2_data = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bstride_1_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_ssize_t __pyx_bshape_1_output = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hogrgb");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_hogbin = __pyx_optional_args->hogbin;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_rgbbin = __pyx_optional_args->rgbbin;
      }
    }
  }
  __pyx_bstruct_data.buf = NULL;
  __pyx_bstruct_hogfeat.buf = NULL;
  __pyx_bstruct_hogfiltert.buf = NULL;
  __pyx_bstruct_sumrgb.buf = NULL;
  __pyx_bstruct_rgbfiltert.buf = NULL;
  __pyx_bstruct_output.buf = NULL;

/* "vision/convolution.pyx":10
 * log = logging.getLogger("vision.convolution")
 * 
 * cpdef hogrgb(image, filtersize, hogfilter, rgbfilter,             # <<<<<<<<<<<<<<
 *              int hogbin = 8, int rgbbin = 8):
 *     """
 */

static PyObject *__pyx_pf_6vision_11convolution_hogrgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6vision_11convolution_hogrgb[] = "hogrgb(image, filtersize, hogfilter, rgbfilter, int hogbin=8, int rgbbin=8)\n\n    Efficiently convolves a filter around an image for HOG and RGB filters.\n\n    Only computes features in the valid region of the image and returns a score\n    matrix. The filtersize should be the size of the templated to score with,\n    and must match with hogfilter.\n\n    - image should be an Python Image Library image.\n    - filtersize should be a 2-tuple of (width,height) sizes for the template\n      filter.\n    - hogfilter should be a (width/hogbin-2, height/hogbin-2, 13) numpy array\n      of the learned HOG weights.\n    - rgbfilter should be a rgbin^3 length matrix of the learned RGB histogram\n      weights.\n    ";
static PyObject *__pyx_pf_6vision_11convolution_hogrgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_image = 0;
  PyObject *__pyx_v_filtersize = 0;
  PyObject *__pyx_v_hogfilter = 0;
  PyObject *__pyx_v_rgbfilter = 0;
  int __pyx_v_hogbin;
  int __pyx_v_rgbbin;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__image,&__pyx_n_s__filtersize,&__pyx_n_s__hogfilter,&__pyx_n_s__rgbfilter,&__pyx_n_s__hogbin,&__pyx_n_s__rgbbin,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hogrgb");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filtersize);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hogrgb", 0, 4, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hogfilter);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hogrgb", 0, 4, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rgbfilter);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hogrgb", 0, 4, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hogbin);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rgbbin);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "hogrgb") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_image = values[0];
    __pyx_v_filtersize = values[1];
    __pyx_v_hogfilter = values[2];
    __pyx_v_rgbfilter = values[3];
    if (values[4]) {
      __pyx_v_hogbin = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_hogbin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_hogbin = ((int)8);
    }
    if (values[5]) {
      __pyx_v_rgbbin = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_rgbbin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_rgbbin = ((int)8);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hogrgb", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("vision.convolution.hogrgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.hogbin = __pyx_v_hogbin;
  __pyx_t_2.rgbbin = __pyx_v_rgbbin;
  __pyx_t_1 = __pyx_f_6vision_11convolution_hogrgb(__pyx_v_image, __pyx_v_filtersize, __pyx_v_hogfilter, __pyx_v_rgbfilter, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("vision.convolution.hogrgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vision/convolution.pyx":10
 * log = logging.getLogger("vision.convolution")
 * 
 * cpdef hogrgb(image, filtersize, hogfilter, rgbfilter,             # <<<<<<<<<<<<<<
 *              int hogbin = 8, int rgbbin = 8):
 *     """
 */
struct __pyx_opt_args_6vision_11convolution_hogrgb {
  int __pyx_n;
  int hogbin;
  int rgbbin;
};
 11:              int hogbin = 8, int rgbbin = 8):
 12:     """
 13:     Efficiently convolves a filter around an image for HOG and RGB filters.
 14: 
 15:     Only computes features in the valid region of the image and returns a score
 16:     matrix. The filtersize should be the size of the templated to score with,
 17:     and must match with hogfilter.
 18: 
 19:     - image should be an Python Image Library image.
 20:     - filtersize should be a 2-tuple of (width,height) sizes for the template
 21:       filter.
 22:     - hogfilter should be a (width/hogbin-2, height/hogbin-2, 13) numpy array
 23:       of the learned HOG weights.
 24:     - rgbfilter should be a rgbin^3 length matrix of the learned RGB histogram
 25:       weights.
 26:     """
 27: 
 28:     # initialize some useful stuff
 29:     cdef int width = image.size[0], height = image.size[1], i = 0, j = 0
  /* "vision/convolution.pyx":29
 * 
 *     # initialize some useful stuff
 *     cdef int width = image.size[0], height = image.size[1], i = 0, j = 0             # <<<<<<<<<<<<<<
 *     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]
 *     cdef np.ndarray[np.double_t, ndim=3] data
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_width = __pyx_t_3;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_height = __pyx_t_3;
  __pyx_v_i = 0;
  __pyx_v_j = 0;
 30:     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]
  /* "vision/convolution.pyx":30
 *     # initialize some useful stuff
 *     cdef int width = image.size[0], height = image.size[1], i = 0, j = 0
 *     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.double_t, ndim=3] data
 *     data = np.asarray(image, dtype=np.double)
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_filtersize, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_filterwidth = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_filtersize, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_filterheight = __pyx_t_3;
 31:     cdef np.ndarray[np.double_t, ndim=3] data
 32:     data = np.asarray(image, dtype=np.double)
  /* "vision/convolution.pyx":32
 *     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]
 *     cdef np.ndarray[np.double_t, ndim=3] data
 *     data = np.asarray(image, dtype=np.double)             # <<<<<<<<<<<<<<
 * 
 *     log.debug("Convolving {width} x {height} image with "
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_image);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_image);
  __Pyx_GIVEREF(__pyx_v_image);
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2];
    __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_data = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
 33: 
 34:     log.debug("Convolving {width} x {height} image with "
  /* "vision/convolution.pyx":34
 *     data = np.asarray(image, dtype=np.double)
 * 
 *     log.debug("Convolving {width} x {height} image with "             # <<<<<<<<<<<<<<
 *               "{filter[0]} x {filter[1]} filter".format(width=width,
 *                                                         height=height,
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 35:               "{filter[0]} x {filter[1]} filter".format(width=width,
  /* "vision/convolution.pyx":35
 * 
 *     log.debug("Convolving {width} x {height} image with "
 *               "{filter[0]} x {filter[1]} filter".format(width=width,             # <<<<<<<<<<<<<<
 *                                                         height=height,
 *                                                         filter=filtersize))
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__width), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 36:                                                         height=height,
  /* "vision/convolution.pyx":36
 *     log.debug("Convolving {width} x {height} image with "
 *               "{filter[0]} x {filter[1]} filter".format(width=width,
 *                                                         height=height,             # <<<<<<<<<<<<<<
 *                                                         filter=filtersize))
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__height), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 37:                                                         filter=filtersize))
  /* "vision/convolution.pyx":37
 *               "{filter[0]} x {filter[1]} filter".format(width=width,
 *                                                         height=height,
 *                                                         filter=filtersize))             # <<<<<<<<<<<<<<
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 *                                                            hogbin))
 */
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__filter), __pyx_v_filtersize) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 38:     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
  /* "vision/convolution.pyx":38
 *                                                         height=height,
 *                                                         filter=filtersize))
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,             # <<<<<<<<<<<<<<
 *                                                            hogbin))
 *     log.debug("RGB filter is {0} with bin size {1}".format(rgbfilter.shape,
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_hogfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
 39:                                                            hogbin))
  /* "vision/convolution.pyx":39
 *                                                         filter=filtersize))
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 *                                                            hogbin))             # <<<<<<<<<<<<<<
 *     log.debug("RGB filter is {0} with bin size {1}".format(rgbfilter.shape,
 *                                                            rgbbin))
 */
  __pyx_t_6 = PyInt_FromLong(__pyx_v_hogbin); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 40:     log.debug("RGB filter is {0} with bin size {1}".format(rgbfilter.shape,
  /* "vision/convolution.pyx":40
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 *                                                            hogbin))
 *     log.debug("RGB filter is {0} with bin size {1}".format(rgbfilter.shape,             # <<<<<<<<<<<<<<
 *                                                            rgbbin))
 * 
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_3), __pyx_n_s__format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_rgbfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
 41:                                                            rgbbin))
  /* "vision/convolution.pyx":41
 *                                                            hogbin))
 *     log.debug("RGB filter is {0} with bin size {1}".format(rgbfilter.shape,
 *                                                            rgbbin))             # <<<<<<<<<<<<<<
 * 
 *     # efficiently precompute hog features
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_rgbbin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 42: 
 43:     # efficiently precompute hog features
 44:     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfeat
 45:     hogfeat = features.hog(image, hogbin)
  /* "vision/convolution.pyx":45
 *     # efficiently precompute hog features
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfeat
 *     hogfeat = features.hog(image, hogbin)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfiltert = hogfilter
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__hog); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_hogbin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_image);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_image);
  __Pyx_GIVEREF(__pyx_v_image);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfeat);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfeat, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfeat, (PyObject*)__pyx_v_hogfeat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_bstride_0_hogfeat = __pyx_bstruct_hogfeat.strides[0]; __pyx_bstride_1_hogfeat = __pyx_bstruct_hogfeat.strides[1]; __pyx_bstride_2_hogfeat = __pyx_bstruct_hogfeat.strides[2];
    __pyx_bshape_0_hogfeat = __pyx_bstruct_hogfeat.shape[0]; __pyx_bshape_1_hogfeat = __pyx_bstruct_hogfeat.shape[1]; __pyx_bshape_2_hogfeat = __pyx_bstruct_hogfeat.shape[2];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_hogfeat = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 46:     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfiltert = hogfilter
  /* "vision/convolution.pyx":46
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfeat
 *     hogfeat = features.hog(image, hogbin)
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfiltert = hogfilter             # <<<<<<<<<<<<<<
 * 
 *     # efficiently precompute integral rgb score image
 */
  if (!(likely(((__pyx_v_hogfilter) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_hogfilter, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_v_hogfilter);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfiltert, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
      __pyx_v_hogfiltert = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_hogfiltert.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_hogfiltert = __pyx_bstruct_hogfiltert.strides[0]; __pyx_bstride_1_hogfiltert = __pyx_bstruct_hogfiltert.strides[1]; __pyx_bstride_2_hogfiltert = __pyx_bstruct_hogfiltert.strides[2];
      __pyx_bshape_0_hogfiltert = __pyx_bstruct_hogfiltert.shape[0]; __pyx_bshape_1_hogfiltert = __pyx_bstruct_hogfiltert.shape[1]; __pyx_bshape_2_hogfiltert = __pyx_bstruct_hogfiltert.shape[2];
    }
  }
  __pyx_t_12 = 0;
  __Pyx_INCREF(__pyx_v_hogfilter);
  __pyx_v_hogfiltert = ((PyArrayObject *)__pyx_v_hogfilter);
 47: 
 48:     # efficiently precompute integral rgb score image
 49:     cdef np.ndarray[np.double_t, ndim=2] sumrgb = np.zeros((width, height))
  /* "vision/convolution.pyx":49
 * 
 *     # efficiently precompute integral rgb score image
 *     cdef np.ndarray[np.double_t, ndim=2] sumrgb = np.zeros((width, height))             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter
 *     cdef double localrgbscore
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sumrgb, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_sumrgb = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_sumrgb.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_sumrgb = __pyx_bstruct_sumrgb.strides[0]; __pyx_bstride_1_sumrgb = __pyx_bstruct_sumrgb.strides[1];
      __pyx_bshape_0_sumrgb = __pyx_bstruct_sumrgb.shape[0]; __pyx_bshape_1_sumrgb = __pyx_bstruct_sumrgb.shape[1];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_sumrgb = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
 50:     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter
  /* "vision/convolution.pyx":50
 *     # efficiently precompute integral rgb score image
 *     cdef np.ndarray[np.double_t, ndim=2] sumrgb = np.zeros((width, height))
 *     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter             # <<<<<<<<<<<<<<
 *     cdef double localrgbscore
 *     for i from 0 <= i < width:
 */
  if (!(likely(((__pyx_v_rgbfilter) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rgbfilter, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_v_rgbfilter);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_rgbfiltert, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_rgbfiltert = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_rgbfiltert.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_rgbfiltert = __pyx_bstruct_rgbfiltert.strides[0];
      __pyx_bshape_0_rgbfiltert = __pyx_bstruct_rgbfiltert.shape[0];
    }
  }
  __pyx_t_14 = 0;
  __Pyx_INCREF(__pyx_v_rgbfilter);
  __pyx_v_rgbfiltert = ((PyArrayObject *)__pyx_v_rgbfilter);
 51:     cdef double localrgbscore
 52:     for i from 0 <= i < width:
  /* "vision/convolution.pyx":52
 *     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter
 *     cdef double localrgbscore
 *     for i from 0 <= i < width:             # <<<<<<<<<<<<<<
 *         for j from 0 <= j < height:
 *             # we cannot manipulate the algebra below because we are taking
 */
  __pyx_t_3 = __pyx_v_width;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
 53:         for j from 0 <= j < height:
    /* "vision/convolution.pyx":53
 *     cdef double localrgbscore
 *     for i from 0 <= i < width:
 *         for j from 0 <= j < height:             # <<<<<<<<<<<<<<
 *             # we cannot manipulate the algebra below because we are taking
 *             # advantage of rounding
 */
    __pyx_t_15 = __pyx_v_height;
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {
 54:             # we cannot manipulate the algebra below because we are taking
 55:             # advantage of rounding
 56:             localrgbbin  = (<int>data[j,i,0]) / (256/rgbbin)
      /* "vision/convolution.pyx":56
 *             # we cannot manipulate the algebra below because we are taking
 *             # advantage of rounding
 *             localrgbbin  = (<int>data[j,i,0]) / (256/rgbbin)             # <<<<<<<<<<<<<<
 *             localrgbbin += (<int>data[j,i,1]) / (256/rgbbin) * rgbbin
 *             localrgbbin += (<int>data[j,i,2]) / (256/rgbbin) * rgbbin * rgbbin
 */
      __pyx_t_16 = __pyx_v_j;
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_18 = 0;
      if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_data;
      if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_data;
      if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_2_data;
      __pyx_v_localrgbbin = (((int)(*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_16, __pyx_bstride_0_data, __pyx_t_17, __pyx_bstride_1_data, __pyx_t_18, __pyx_bstride_2_data))) / (256 / __pyx_v_rgbbin));
 57:             localrgbbin += (<int>data[j,i,1]) / (256/rgbbin) * rgbbin
      /* "vision/convolution.pyx":57
 *             # advantage of rounding
 *             localrgbbin  = (<int>data[j,i,0]) / (256/rgbbin)
 *             localrgbbin += (<int>data[j,i,1]) / (256/rgbbin) * rgbbin             # <<<<<<<<<<<<<<
 *             localrgbbin += (<int>data[j,i,2]) / (256/rgbbin) * rgbbin * rgbbin
 *             localrgbscore = rgbfiltert[localrgbbin]
 */
      __pyx_t_19 = __pyx_v_j;
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = 1;
      if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_data;
      if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_1_data;
      if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_2_data;
      __pyx_v_localrgbbin = (__pyx_v_localrgbbin + ((((int)(*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_19, __pyx_bstride_0_data, __pyx_t_20, __pyx_bstride_1_data, __pyx_t_21, __pyx_bstride_2_data))) / (256 / __pyx_v_rgbbin)) * __pyx_v_rgbbin));
 58:             localrgbbin += (<int>data[j,i,2]) / (256/rgbbin) * rgbbin * rgbbin
      /* "vision/convolution.pyx":58
 *             localrgbbin  = (<int>data[j,i,0]) / (256/rgbbin)
 *             localrgbbin += (<int>data[j,i,1]) / (256/rgbbin) * rgbbin
 *             localrgbbin += (<int>data[j,i,2]) / (256/rgbbin) * rgbbin * rgbbin             # <<<<<<<<<<<<<<
 *             localrgbscore = rgbfiltert[localrgbbin]
 *             # lookup recursive scores
 */
      __pyx_t_22 = __pyx_v_j;
      __pyx_t_23 = __pyx_v_i;
      __pyx_t_24 = 2;
      if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_data;
      if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_data;
      if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_data;
      __pyx_v_localrgbbin = (__pyx_v_localrgbbin + (((((int)(*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_22, __pyx_bstride_0_data, __pyx_t_23, __pyx_bstride_1_data, __pyx_t_24, __pyx_bstride_2_data))) / (256 / __pyx_v_rgbbin)) * __pyx_v_rgbbin) * __pyx_v_rgbbin));
 59:             localrgbscore = rgbfiltert[localrgbbin]
      /* "vision/convolution.pyx":59
 *             localrgbbin += (<int>data[j,i,1]) / (256/rgbbin) * rgbbin
 *             localrgbbin += (<int>data[j,i,2]) / (256/rgbbin) * rgbbin * rgbbin
 *             localrgbscore = rgbfiltert[localrgbbin]             # <<<<<<<<<<<<<<
 *             # lookup recursive scores
 *             if i > 0:
 */
      __pyx_t_25 = __pyx_v_localrgbbin;
      if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_rgbfiltert;
      __pyx_v_localrgbscore = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_25, __pyx_bstride_0_rgbfiltert));
 60:             # lookup recursive scores
 61:             if i > 0:
      /* "vision/convolution.pyx":61
 *             localrgbscore = rgbfiltert[localrgbbin]
 *             # lookup recursive scores
 *             if i > 0:             # <<<<<<<<<<<<<<
 *                 localrgbscore += sumrgb[i-1, j]
 *             if j > 0:
 */
      __pyx_t_26 = (__pyx_v_i > 0);
      if (__pyx_t_26) {
 62:                 localrgbscore += sumrgb[i-1, j]
        /* "vision/convolution.pyx":62
 *             # lookup recursive scores
 *             if i > 0:
 *                 localrgbscore += sumrgb[i-1, j]             # <<<<<<<<<<<<<<
 *             if j > 0:
 *                 localrgbscore += sumrgb[i, j-1]
 */
        __pyx_t_27 = (__pyx_v_i - 1);
        __pyx_t_28 = __pyx_v_j;
        if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_sumrgb;
        if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_1_sumrgb;
        __pyx_v_localrgbscore = (__pyx_v_localrgbscore + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_27, __pyx_bstride_0_sumrgb, __pyx_t_28, __pyx_bstride_1_sumrgb)));
        goto __pyx_L7;
      }
      __pyx_L7:;
 63:             if j > 0:
      /* "vision/convolution.pyx":63
 *             if i > 0:
 *                 localrgbscore += sumrgb[i-1, j]
 *             if j > 0:             # <<<<<<<<<<<<<<
 *                 localrgbscore += sumrgb[i, j-1]
 *                 if i > 0: # do not count twice
 */
      __pyx_t_26 = (__pyx_v_j > 0);
      if (__pyx_t_26) {
 64:                 localrgbscore += sumrgb[i, j-1]
        /* "vision/convolution.pyx":64
 *                 localrgbscore += sumrgb[i-1, j]
 *             if j > 0:
 *                 localrgbscore += sumrgb[i, j-1]             # <<<<<<<<<<<<<<
 *                 if i > 0: # do not count twice
 *                     localrgbscore -= sumrgb[i-1, j-1]
 */
        __pyx_t_29 = __pyx_v_i;
        __pyx_t_30 = (__pyx_v_j - 1);
        if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_sumrgb;
        if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_1_sumrgb;
        __pyx_v_localrgbscore = (__pyx_v_localrgbscore + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_29, __pyx_bstride_0_sumrgb, __pyx_t_30, __pyx_bstride_1_sumrgb)));
 65:                 if i > 0: # do not count twice
        /* "vision/convolution.pyx":65
 *             if j > 0:
 *                 localrgbscore += sumrgb[i, j-1]
 *                 if i > 0: # do not count twice             # <<<<<<<<<<<<<<
 *                     localrgbscore -= sumrgb[i-1, j-1]
 *             sumrgb[i, j] = localrgbscore
 */
        __pyx_t_26 = (__pyx_v_i > 0);
        if (__pyx_t_26) {
 66:                     localrgbscore -= sumrgb[i-1, j-1]
          /* "vision/convolution.pyx":66
 *                 localrgbscore += sumrgb[i, j-1]
 *                 if i > 0: # do not count twice
 *                     localrgbscore -= sumrgb[i-1, j-1]             # <<<<<<<<<<<<<<
 *             sumrgb[i, j] = localrgbscore
 * 
 */
          __pyx_t_31 = (__pyx_v_i - 1);
          __pyx_t_32 = (__pyx_v_j - 1);
          if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_sumrgb;
          if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_sumrgb;
          __pyx_v_localrgbscore = (__pyx_v_localrgbscore - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_31, __pyx_bstride_0_sumrgb, __pyx_t_32, __pyx_bstride_1_sumrgb)));
          goto __pyx_L9;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }
      __pyx_L8:;
 67:             sumrgb[i, j] = localrgbscore
      /* "vision/convolution.pyx":67
 *                 if i > 0: # do not count twice
 *                     localrgbscore -= sumrgb[i-1, j-1]
 *             sumrgb[i, j] = localrgbscore             # <<<<<<<<<<<<<<
 * 
 *     # convolve
 */
      __pyx_t_33 = __pyx_v_i;
      __pyx_t_34 = __pyx_v_j;
      if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_1_sumrgb;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_33, __pyx_bstride_0_sumrgb, __pyx_t_34, __pyx_bstride_1_sumrgb) = __pyx_v_localrgbscore;
    }
  }
 68: 
 69:     # convolve
 70:     cdef int hfwidth = hogfilter.shape[0], hfheight = hogfilter.shape[1]
  /* "vision/convolution.pyx":70
 * 
 *     # convolve
 *     cdef int hfwidth = hogfilter.shape[0], hfheight = hogfilter.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double hogscore, rgbscore, hogfeatvalue, hogfiltervalue
 *     cdef np.ndarray[ndim=2, dtype=np.double_t] output
 */
  __pyx_t_6 = PyObject_GetAttr(__pyx_v_hogfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_hfwidth = __pyx_t_3;
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_hogfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_hfheight = __pyx_t_3;
 71:     cdef double hogscore, rgbscore, hogfeatvalue, hogfiltervalue
 72:     cdef np.ndarray[ndim=2, dtype=np.double_t] output
 73:     output = np.zeros((width - filterwidth, height - filterheight))
  /* "vision/convolution.pyx":73
 *     cdef double hogscore, rgbscore, hogfeatvalue, hogfiltervalue
 *     cdef np.ndarray[ndim=2, dtype=np.double_t] output
 *     output = np.zeros((width - filterwidth, height - filterheight))             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < width - filterwidth:
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromLong((__pyx_v_width - __pyx_v_filterwidth)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyInt_FromLong((__pyx_v_height - __pyx_v_filterheight)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_35 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_35, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; __pyx_bstride_1_output = __pyx_bstruct_output.strides[1];
    __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; __pyx_bshape_1_output = __pyx_bstruct_output.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_35 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 74: 
 75:     for i from 0 <= i < width - filterwidth:
  /* "vision/convolution.pyx":75
 *     output = np.zeros((width - filterwidth, height - filterheight))
 * 
 *     for i from 0 <= i < width - filterwidth:             # <<<<<<<<<<<<<<
 *         for j from 0 <= j < height - filterheight:
 *             # compute hog score
 */
  __pyx_t_3 = (__pyx_v_width - __pyx_v_filterwidth);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
 76:         for j from 0 <= j < height - filterheight:
    /* "vision/convolution.pyx":76
 * 
 *     for i from 0 <= i < width - filterwidth:
 *         for j from 0 <= j < height - filterheight:             # <<<<<<<<<<<<<<
 *             # compute hog score
 *             hogscore = 0.
 */
    __pyx_t_15 = (__pyx_v_height - __pyx_v_filterheight);
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {
 77:             # compute hog score
 78:             hogscore = 0.
      /* "vision/convolution.pyx":78
 *         for j from 0 <= j < height - filterheight:
 *             # compute hog score
 *             hogscore = 0.             # <<<<<<<<<<<<<<
 *             for hfi from 0 <= hfi < hfwidth:
 *                 for hfj from 0 <= hfj < hfheight:
 */
      __pyx_v_hogscore = 0.;
 79:             for hfi from 0 <= hfi < hfwidth:
      /* "vision/convolution.pyx":79
 *             # compute hog score
 *             hogscore = 0.
 *             for hfi from 0 <= hfi < hfwidth:             # <<<<<<<<<<<<<<
 *                 for hfj from 0 <= hfj < hfheight:
 *                     for hfk from 0 <= hfk < 13:
 */
      __pyx_t_36 = __pyx_v_hfwidth;
      for (__pyx_v_hfi = 0; __pyx_v_hfi < __pyx_t_36; __pyx_v_hfi++) {
 80:                 for hfj from 0 <= hfj < hfheight:
        /* "vision/convolution.pyx":80
 *             hogscore = 0.
 *             for hfi from 0 <= hfi < hfwidth:
 *                 for hfj from 0 <= hfj < hfheight:             # <<<<<<<<<<<<<<
 *                     for hfk from 0 <= hfk < 13:
 *                         hogfeatvalue = hogfeat[j/8+hfj, i/8+hfi, hfk]
 */
        __pyx_t_37 = __pyx_v_hfheight;
        for (__pyx_v_hfj = 0; __pyx_v_hfj < __pyx_t_37; __pyx_v_hfj++) {
 81:                     for hfk from 0 <= hfk < 13:
          /* "vision/convolution.pyx":81
 *             for hfi from 0 <= hfi < hfwidth:
 *                 for hfj from 0 <= hfj < hfheight:
 *                     for hfk from 0 <= hfk < 13:             # <<<<<<<<<<<<<<
 *                         hogfeatvalue = hogfeat[j/8+hfj, i/8+hfi, hfk]
 *                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]
 */
          for (__pyx_v_hfk = 0; __pyx_v_hfk < 13; __pyx_v_hfk++) {
 82:                         hogfeatvalue = hogfeat[j/8+hfj, i/8+hfi, hfk]
            /* "vision/convolution.pyx":82
 *                 for hfj from 0 <= hfj < hfheight:
 *                     for hfk from 0 <= hfk < 13:
 *                         hogfeatvalue = hogfeat[j/8+hfj, i/8+hfi, hfk]             # <<<<<<<<<<<<<<
 *                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]
 *                         hogscore += hogfeatvalue * hogfiltervalue
 */
            __pyx_t_38 = ((__pyx_v_j / 8) + __pyx_v_hfj);
            __pyx_t_39 = ((__pyx_v_i / 8) + __pyx_v_hfi);
            __pyx_t_40 = __pyx_v_hfk;
            if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_0_hogfeat;
            if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_1_hogfeat;
            if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_2_hogfeat;
            __pyx_v_hogfeatvalue = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hogfeat.buf, __pyx_t_38, __pyx_bstride_0_hogfeat, __pyx_t_39, __pyx_bstride_1_hogfeat, __pyx_t_40, __pyx_bstride_2_hogfeat));
 83:                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]
            /* "vision/convolution.pyx":83
 *                     for hfk from 0 <= hfk < 13:
 *                         hogfeatvalue = hogfeat[j/8+hfj, i/8+hfi, hfk]
 *                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]             # <<<<<<<<<<<<<<
 *                         hogscore += hogfeatvalue * hogfiltervalue
 * 
 */
            __pyx_t_41 = __pyx_v_hfj;
            __pyx_t_42 = __pyx_v_hfi;
            __pyx_t_43 = __pyx_v_hfk;
            if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_0_hogfiltert;
            if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_bshape_1_hogfiltert;
            if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_bshape_2_hogfiltert;
            __pyx_v_hogfiltervalue = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hogfiltert.buf, __pyx_t_41, __pyx_bstride_0_hogfiltert, __pyx_t_42, __pyx_bstride_1_hogfiltert, __pyx_t_43, __pyx_bstride_2_hogfiltert));
 84:                         hogscore += hogfeatvalue * hogfiltervalue
            /* "vision/convolution.pyx":84
 *                         hogfeatvalue = hogfeat[j/8+hfj, i/8+hfi, hfk]
 *                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]
 *                         hogscore += hogfeatvalue * hogfiltervalue             # <<<<<<<<<<<<<<
 * 
 *             # compute rgb score using summed area tables
 */
            __pyx_v_hogscore = (__pyx_v_hogscore + (__pyx_v_hogfeatvalue * __pyx_v_hogfiltervalue));
          }
        }
      }
 85: 
 86:             # compute rgb score using summed area tables
 87:             rgbscore  = sumrgb[i+filterwidth, j+filterheight] + sumrgb[i, j]
      /* "vision/convolution.pyx":87
 * 
 *             # compute rgb score using summed area tables
 *             rgbscore  = sumrgb[i+filterwidth, j+filterheight] + sumrgb[i, j]             # <<<<<<<<<<<<<<
 *             rgbscore -= sumrgb[i, j+filterheight] + sumrgb[i+filterwidth, j]
 *             rgbscore  = rgbscore / (filterwidth * filterheight)
 */
      __pyx_t_36 = (__pyx_v_i + __pyx_v_filterwidth);
      __pyx_t_37 = (__pyx_v_j + __pyx_v_filterheight);
      if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_1_sumrgb;
      __pyx_t_44 = __pyx_v_i;
      __pyx_t_45 = __pyx_v_j;
      if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_1_sumrgb;
      __pyx_v_rgbscore = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_36, __pyx_bstride_0_sumrgb, __pyx_t_37, __pyx_bstride_1_sumrgb)) + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_44, __pyx_bstride_0_sumrgb, __pyx_t_45, __pyx_bstride_1_sumrgb)));
 88:             rgbscore -= sumrgb[i, j+filterheight] + sumrgb[i+filterwidth, j]
      /* "vision/convolution.pyx":88
 *             # compute rgb score using summed area tables
 *             rgbscore  = sumrgb[i+filterwidth, j+filterheight] + sumrgb[i, j]
 *             rgbscore -= sumrgb[i, j+filterheight] + sumrgb[i+filterwidth, j]             # <<<<<<<<<<<<<<
 *             rgbscore  = rgbscore / (filterwidth * filterheight)
 * 
 */
      __pyx_t_46 = __pyx_v_i;
      __pyx_t_47 = (__pyx_v_j + __pyx_v_filterheight);
      if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_bshape_1_sumrgb;
      __pyx_t_48 = (__pyx_v_i + __pyx_v_filterwidth);
      __pyx_t_49 = __pyx_v_j;
      if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_bshape_1_sumrgb;
      __pyx_v_rgbscore = (__pyx_v_rgbscore - ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_46, __pyx_bstride_0_sumrgb, __pyx_t_47, __pyx_bstride_1_sumrgb)) + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_48, __pyx_bstride_0_sumrgb, __pyx_t_49, __pyx_bstride_1_sumrgb))));
 89:             rgbscore  = rgbscore / (filterwidth * filterheight)
      /* "vision/convolution.pyx":89
 *             rgbscore  = sumrgb[i+filterwidth, j+filterheight] + sumrgb[i, j]
 *             rgbscore -= sumrgb[i, j+filterheight] + sumrgb[i+filterwidth, j]
 *             rgbscore  = rgbscore / (filterwidth * filterheight)             # <<<<<<<<<<<<<<
 * 
 *             # store final score
 */
      __pyx_v_rgbscore = (__pyx_v_rgbscore / (__pyx_v_filterwidth * __pyx_v_filterheight));
 90: 
 91:             # store final score
 92:             output[i,j] = hogscore + rgbscore
      /* "vision/convolution.pyx":92
 * 
 *             # store final score
 *             output[i,j] = hogscore + rgbscore             # <<<<<<<<<<<<<<
 *     return output
 * 
 */
      __pyx_t_50 = __pyx_v_i;
      __pyx_t_51 = __pyx_v_j;
      if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_bshape_0_output;
      if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_bshape_1_output;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_50, __pyx_bstride_0_output, __pyx_t_51, __pyx_bstride_1_output) = (__pyx_v_hogscore + __pyx_v_rgbscore);
    }
  }
 93:     return output
  /* "vision/convolution.pyx":93
 *             # store final score
 *             output[i,j] = hogscore + rgbscore
 *     return output             # <<<<<<<<<<<<<<
 * 
 * cpdef hogrgbmean(image, filtersize, hogfilter, rgbfilter, int hogbin = 8):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sumrgb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rgbfiltert);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfiltert);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfeat);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("vision.convolution.hogrgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sumrgb);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rgbfiltert);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfiltert);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfeat);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_hogfeat);
  __Pyx_XDECREF((PyObject *)__pyx_v_hogfiltert);
  __Pyx_XDECREF((PyObject *)__pyx_v_sumrgb);
  __Pyx_XDECREF((PyObject *)__pyx_v_rgbfiltert);
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 94: 
 95: cpdef hogrgbmean(image, filtersize, hogfilter, rgbfilter, int hogbin = 8):
/* "vision/convolution.pyx":95
 *     return output
 * 
 * cpdef hogrgbmean(image, filtersize, hogfilter, rgbfilter, int hogbin = 8):             # <<<<<<<<<<<<<<
 *     """
 *     Efficiently convolves a filter around an image for HOG and RGB filters.
 */

static PyObject *__pyx_pf_6vision_11convolution_1hogrgbmean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6vision_11convolution_hogrgbmean(PyObject *__pyx_v_image, PyObject *__pyx_v_filtersize, PyObject *__pyx_v_hogfilter, PyObject *__pyx_v_rgbfilter, int __pyx_skip_dispatch, struct __pyx_opt_args_6vision_11convolution_hogrgbmean *__pyx_optional_args) {
  int __pyx_v_hogbin = ((int)8);
  int __pyx_v_width;
  int __pyx_v_height;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_filterwidth;
  int __pyx_v_filterheight;
  PyArrayObject *__pyx_v_data = 0;
  PyArrayObject *__pyx_v_hogfeat = 0;
  PyArrayObject *__pyx_v_hogfiltert = 0;
  PyArrayObject *__pyx_v_sumrgb = 0;
  PyArrayObject *__pyx_v_rgbfiltert = 0;
  double __pyx_v_localrgbscore;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_g = NULL;
  PyObject *__pyx_v_b = NULL;
  int __pyx_v_hfwidth;
  int __pyx_v_hfheight;
  double __pyx_v_hogscore;
  double __pyx_v_rgbscore;
  double __pyx_v_hogfeatvalue;
  double __pyx_v_hogfiltervalue;
  PyArrayObject *__pyx_v_output = 0;
  long __pyx_v_hfi;
  long __pyx_v_hfj;
  long __pyx_v_hfk;
  Py_buffer __pyx_bstruct_sumrgb;
  Py_ssize_t __pyx_bstride_0_sumrgb = 0;
  Py_ssize_t __pyx_bstride_1_sumrgb = 0;
  Py_ssize_t __pyx_bshape_0_sumrgb = 0;
  Py_ssize_t __pyx_bshape_1_sumrgb = 0;
  Py_buffer __pyx_bstruct_rgbfiltert;
  Py_ssize_t __pyx_bstride_0_rgbfiltert = 0;
  Py_ssize_t __pyx_bshape_0_rgbfiltert = 0;
  Py_buffer __pyx_bstruct_hogfiltert;
  Py_ssize_t __pyx_bstride_0_hogfiltert = 0;
  Py_ssize_t __pyx_bstride_1_hogfiltert = 0;
  Py_ssize_t __pyx_bstride_2_hogfiltert = 0;
  Py_ssize_t __pyx_bshape_0_hogfiltert = 0;
  Py_ssize_t __pyx_bshape_1_hogfiltert = 0;
  Py_ssize_t __pyx_bshape_2_hogfiltert = 0;
  Py_buffer __pyx_bstruct_hogfeat;
  Py_ssize_t __pyx_bstride_0_hogfeat = 0;
  Py_ssize_t __pyx_bstride_1_hogfeat = 0;
  Py_ssize_t __pyx_bstride_2_hogfeat = 0;
  Py_ssize_t __pyx_bshape_0_hogfeat = 0;
  Py_ssize_t __pyx_bshape_1_hogfeat = 0;
  Py_ssize_t __pyx_bshape_2_hogfeat = 0;
  Py_buffer __pyx_bstruct_data;
  Py_ssize_t __pyx_bstride_0_data = 0;
  Py_ssize_t __pyx_bstride_1_data = 0;
  Py_ssize_t __pyx_bstride_2_data = 0;
  Py_ssize_t __pyx_bshape_0_data = 0;
  Py_ssize_t __pyx_bshape_1_data = 0;
  Py_ssize_t __pyx_bshape_2_data = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bstride_1_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_ssize_t __pyx_bshape_1_output = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hogrgbmean");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_hogbin = __pyx_optional_args->hogbin;
    }
  }
  __pyx_bstruct_data.buf = NULL;
  __pyx_bstruct_hogfeat.buf = NULL;
  __pyx_bstruct_hogfiltert.buf = NULL;
  __pyx_bstruct_sumrgb.buf = NULL;
  __pyx_bstruct_rgbfiltert.buf = NULL;
  __pyx_bstruct_output.buf = NULL;

/* "vision/convolution.pyx":95
 *     return output
 * 
 * cpdef hogrgbmean(image, filtersize, hogfilter, rgbfilter, int hogbin = 8):             # <<<<<<<<<<<<<<
 *     """
 *     Efficiently convolves a filter around an image for HOG and RGB filters.
 */

static PyObject *__pyx_pf_6vision_11convolution_1hogrgbmean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6vision_11convolution_1hogrgbmean[] = "hogrgbmean(image, filtersize, hogfilter, rgbfilter, int hogbin=8)\n\n    Efficiently convolves a filter around an image for HOG and RGB filters.\n\n    Only computes features in the valid region of the image and returns a score\n    matrix. The filtersize should be the size of the templated to score with,\n    and must match with hogfilter.\n\n    - image should be an Python Image Library image.\n    - filtersize should be a 2-tuple of (width,height) sizes for the template\n      filter.\n    - hogfilter should be a (width/hogbin-2, height/hogbin-2, 13) numpy array\n      of the learned HOG weights.\n    ";
static PyObject *__pyx_pf_6vision_11convolution_1hogrgbmean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_image = 0;
  PyObject *__pyx_v_filtersize = 0;
  PyObject *__pyx_v_hogfilter = 0;
  PyObject *__pyx_v_rgbfilter = 0;
  int __pyx_v_hogbin;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__image,&__pyx_n_s__filtersize,&__pyx_n_s__hogfilter,&__pyx_n_s__rgbfilter,&__pyx_n_s__hogbin,0};
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hogrgbmean");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filtersize);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hogrgbmean", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hogfilter);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hogrgbmean", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rgbfilter);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hogrgbmean", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hogbin);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "hogrgbmean") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_image = values[0];
    __pyx_v_filtersize = values[1];
    __pyx_v_hogfilter = values[2];
    __pyx_v_rgbfilter = values[3];
    if (values[4]) {
      __pyx_v_hogbin = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_hogbin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_hogbin = ((int)8);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hogrgbmean", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("vision.convolution.hogrgbmean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.hogbin = __pyx_v_hogbin;
  __pyx_t_1 = __pyx_f_6vision_11convolution_hogrgbmean(__pyx_v_image, __pyx_v_filtersize, __pyx_v_hogfilter, __pyx_v_rgbfilter, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("vision.convolution.hogrgbmean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 96:     """
 97:     Efficiently convolves a filter around an image for HOG and RGB filters.
 98: 
 99:     Only computes features in the valid region of the image and returns a score
 100:     matrix. The filtersize should be the size of the templated to score with,
 101:     and must match with hogfilter.
 102: 
 103:     - image should be an Python Image Library image.
 104:     - filtersize should be a 2-tuple of (width,height) sizes for the template
 105:       filter.
 106:     - hogfilter should be a (width/hogbin-2, height/hogbin-2, 13) numpy array
 107:       of the learned HOG weights.
 108:     """
 109: 
 110:     # initialize some useful stuff
 111:     cdef int width = image.size[0], height = image.size[1], i = 0, j = 0
  /* "vision/convolution.pyx":111
 * 
 *     # initialize some useful stuff
 *     cdef int width = image.size[0], height = image.size[1], i = 0, j = 0             # <<<<<<<<<<<<<<
 *     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]
 *     cdef np.ndarray[np.double_t, ndim=3] data
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_width = __pyx_t_3;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_height = __pyx_t_3;
  __pyx_v_i = 0;
  __pyx_v_j = 0;
 112:     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]
  /* "vision/convolution.pyx":112
 *     # initialize some useful stuff
 *     cdef int width = image.size[0], height = image.size[1], i = 0, j = 0
 *     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.double_t, ndim=3] data
 *     data = np.asarray(image, dtype=np.double)
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_filtersize, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_filterwidth = __pyx_t_3;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_filtersize, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_filterheight = __pyx_t_3;
 113:     cdef np.ndarray[np.double_t, ndim=3] data
 114:     data = np.asarray(image, dtype=np.double)
  /* "vision/convolution.pyx":114
 *     cdef int filterwidth = filtersize[0], filterheight = filtersize[1]
 *     cdef np.ndarray[np.double_t, ndim=3] data
 *     data = np.asarray(image, dtype=np.double)             # <<<<<<<<<<<<<<
 * 
 *     log.debug("Convolving {width} x {height} image with "
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_image);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_image);
  __Pyx_GIVEREF(__pyx_v_image);
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2];
    __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_data = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
 115: 
 116:     log.debug("Convolving {width} x {height} image with "
  /* "vision/convolution.pyx":116
 *     data = np.asarray(image, dtype=np.double)
 * 
 *     log.debug("Convolving {width} x {height} image with "             # <<<<<<<<<<<<<<
 *               "{filter[0]} x {filter[1]} filter".format(width=width,
 *                                                         height=height,
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 117:               "{filter[0]} x {filter[1]} filter".format(width=width,
  /* "vision/convolution.pyx":117
 * 
 *     log.debug("Convolving {width} x {height} image with "
 *               "{filter[0]} x {filter[1]} filter".format(width=width,             # <<<<<<<<<<<<<<
 *                                                         height=height,
 *                                                         filter=filtersize))
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__width), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 118:                                                         height=height,
  /* "vision/convolution.pyx":118
 *     log.debug("Convolving {width} x {height} image with "
 *               "{filter[0]} x {filter[1]} filter".format(width=width,
 *                                                         height=height,             # <<<<<<<<<<<<<<
 *                                                         filter=filtersize))
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__height), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 119:                                                         filter=filtersize))
  /* "vision/convolution.pyx":119
 *               "{filter[0]} x {filter[1]} filter".format(width=width,
 *                                                         height=height,
 *                                                         filter=filtersize))             # <<<<<<<<<<<<<<
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 *                                                            hogbin))
 */
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__filter), __pyx_v_filtersize) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 120:     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
  /* "vision/convolution.pyx":120
 *                                                         height=height,
 *                                                         filter=filtersize))
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,             # <<<<<<<<<<<<<<
 *                                                            hogbin))
 *     log.debug("RGB filter is {0}".format(rgbfilter.shape))
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_hogfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
 121:                                                            hogbin))
  /* "vision/convolution.pyx":121
 *                                                         filter=filtersize))
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 *                                                            hogbin))             # <<<<<<<<<<<<<<
 *     log.debug("RGB filter is {0}".format(rgbfilter.shape))
 * 
 */
  __pyx_t_6 = PyInt_FromLong(__pyx_v_hogbin); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 122:     log.debug("RGB filter is {0}".format(rgbfilter.shape))
  /* "vision/convolution.pyx":122
 *     log.debug("HOG filter is {0} with bin size {1}".format(hogfilter.shape,
 *                                                            hogbin))
 *     log.debug("RGB filter is {0}".format(rgbfilter.shape))             # <<<<<<<<<<<<<<
 * 
 *     # efficiently precompute hog features
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_4), __pyx_n_s__format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_rgbfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 123: 
 124:     # efficiently precompute hog features
 125:     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfeat
 126:     hogfeat = features.hog(image, hogbin)
  /* "vision/convolution.pyx":126
 *     # efficiently precompute hog features
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfeat
 *     hogfeat = features.hog(image, hogbin)             # <<<<<<<<<<<<<<
 *     hogfeat = features.hogpad(hogfeat)
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfiltert = hogfilter
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__hog); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_hogbin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_image);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_image);
  __Pyx_GIVEREF(__pyx_v_image);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfeat);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfeat, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfeat, (PyObject*)__pyx_v_hogfeat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_bstride_0_hogfeat = __pyx_bstruct_hogfeat.strides[0]; __pyx_bstride_1_hogfeat = __pyx_bstruct_hogfeat.strides[1]; __pyx_bstride_2_hogfeat = __pyx_bstruct_hogfeat.strides[2];
    __pyx_bshape_0_hogfeat = __pyx_bstruct_hogfeat.shape[0]; __pyx_bshape_1_hogfeat = __pyx_bstruct_hogfeat.shape[1]; __pyx_bshape_2_hogfeat = __pyx_bstruct_hogfeat.shape[2];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_hogfeat = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
 127:     hogfeat = features.hogpad(hogfeat)
  /* "vision/convolution.pyx":127
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfeat
 *     hogfeat = features.hog(image, hogbin)
 *     hogfeat = features.hogpad(hogfeat)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfiltert = hogfilter
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__hogpad); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_hogfeat));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_hogfeat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_hogfeat));
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfeat);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfeat, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfeat, (PyObject*)__pyx_v_hogfeat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_bstride_0_hogfeat = __pyx_bstruct_hogfeat.strides[0]; __pyx_bstride_1_hogfeat = __pyx_bstruct_hogfeat.strides[1]; __pyx_bstride_2_hogfeat = __pyx_bstruct_hogfeat.strides[2];
    __pyx_bshape_0_hogfeat = __pyx_bstruct_hogfeat.shape[0]; __pyx_bshape_1_hogfeat = __pyx_bstruct_hogfeat.shape[1]; __pyx_bshape_2_hogfeat = __pyx_bstruct_hogfeat.shape[2];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_hogfeat));
  __pyx_v_hogfeat = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 128:     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfiltert = hogfilter
  /* "vision/convolution.pyx":128
 *     hogfeat = features.hog(image, hogbin)
 *     hogfeat = features.hogpad(hogfeat)
 *     cdef np.ndarray[ndim=3, dtype=np.double_t] hogfiltert = hogfilter             # <<<<<<<<<<<<<<
 * 
 *     # efficiently precompute integral rgb score image
 */
  if (!(likely(((__pyx_v_hogfilter) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_hogfilter, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_v_hogfilter);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hogfiltert, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
      __pyx_v_hogfiltert = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_hogfiltert.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_hogfiltert = __pyx_bstruct_hogfiltert.strides[0]; __pyx_bstride_1_hogfiltert = __pyx_bstruct_hogfiltert.strides[1]; __pyx_bstride_2_hogfiltert = __pyx_bstruct_hogfiltert.strides[2];
      __pyx_bshape_0_hogfiltert = __pyx_bstruct_hogfiltert.shape[0]; __pyx_bshape_1_hogfiltert = __pyx_bstruct_hogfiltert.shape[1]; __pyx_bshape_2_hogfiltert = __pyx_bstruct_hogfiltert.shape[2];
    }
  }
  __pyx_t_12 = 0;
  __Pyx_INCREF(__pyx_v_hogfilter);
  __pyx_v_hogfiltert = ((PyArrayObject *)__pyx_v_hogfilter);
 129: 
 130:     # efficiently precompute integral rgb score image
 131:     cdef np.ndarray[np.double_t, ndim=2] sumrgb = np.zeros((width, height))
  /* "vision/convolution.pyx":131
 * 
 *     # efficiently precompute integral rgb score image
 *     cdef np.ndarray[np.double_t, ndim=2] sumrgb = np.zeros((width, height))             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter
 *     cdef double localrgbscore
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_width); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_height); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sumrgb, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_sumrgb = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_sumrgb.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_sumrgb = __pyx_bstruct_sumrgb.strides[0]; __pyx_bstride_1_sumrgb = __pyx_bstruct_sumrgb.strides[1];
      __pyx_bshape_0_sumrgb = __pyx_bstruct_sumrgb.shape[0]; __pyx_bshape_1_sumrgb = __pyx_bstruct_sumrgb.shape[1];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_sumrgb = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
 132:     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter
  /* "vision/convolution.pyx":132
 *     # efficiently precompute integral rgb score image
 *     cdef np.ndarray[np.double_t, ndim=2] sumrgb = np.zeros((width, height))
 *     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter             # <<<<<<<<<<<<<<
 *     cdef double localrgbscore
 *     for i from 0 <= i < width:
 */
  if (!(likely(((__pyx_v_rgbfilter) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rgbfilter, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_v_rgbfilter);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_rgbfiltert, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_rgbfiltert = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_rgbfiltert.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_rgbfiltert = __pyx_bstruct_rgbfiltert.strides[0];
      __pyx_bshape_0_rgbfiltert = __pyx_bstruct_rgbfiltert.shape[0];
    }
  }
  __pyx_t_14 = 0;
  __Pyx_INCREF(__pyx_v_rgbfilter);
  __pyx_v_rgbfiltert = ((PyArrayObject *)__pyx_v_rgbfilter);
 133:     cdef double localrgbscore
 134:     for i from 0 <= i < width:
  /* "vision/convolution.pyx":134
 *     cdef np.ndarray[ndim=1, dtype=np.double_t] rgbfiltert = rgbfilter
 *     cdef double localrgbscore
 *     for i from 0 <= i < width:             # <<<<<<<<<<<<<<
 *         for j from 0 <= j < height:
 *             r = data[j, i, 0] / <double>(255)
 */
  __pyx_t_3 = __pyx_v_width;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
 135:         for j from 0 <= j < height:
    /* "vision/convolution.pyx":135
 *     cdef double localrgbscore
 *     for i from 0 <= i < width:
 *         for j from 0 <= j < height:             # <<<<<<<<<<<<<<
 *             r = data[j, i, 0] / <double>(255)
 *             g = data[j, i, 1] / <double>(255)
 */
    __pyx_t_15 = __pyx_v_height;
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {
 136:             r = data[j, i, 0] / <double>(255)
      /* "vision/convolution.pyx":136
 *     for i from 0 <= i < width:
 *         for j from 0 <= j < height:
 *             r = data[j, i, 0] / <double>(255)             # <<<<<<<<<<<<<<
 *             g = data[j, i, 1] / <double>(255)
 *             b = data[j, i, 2] / <double>(255)
 */
      __pyx_t_16 = __pyx_v_j;
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_18 = 0;
      if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_data;
      if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_data;
      if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_2_data;
      __pyx_t_6 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_16, __pyx_bstride_0_data, __pyx_t_17, __pyx_bstride_1_data, __pyx_t_18, __pyx_bstride_2_data)) / ((double)255))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_v_r);
      __pyx_v_r = __pyx_t_6;
      __pyx_t_6 = 0;
 137:             g = data[j, i, 1] / <double>(255)
      /* "vision/convolution.pyx":137
 *         for j from 0 <= j < height:
 *             r = data[j, i, 0] / <double>(255)
 *             g = data[j, i, 1] / <double>(255)             # <<<<<<<<<<<<<<
 *             b = data[j, i, 2] / <double>(255)
 *             localrgbscore = 0
 */
      __pyx_t_19 = __pyx_v_j;
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = 1;
      if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_data;
      if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_1_data;
      if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_2_data;
      __pyx_t_6 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_19, __pyx_bstride_0_data, __pyx_t_20, __pyx_bstride_1_data, __pyx_t_21, __pyx_bstride_2_data)) / ((double)255))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_v_g);
      __pyx_v_g = __pyx_t_6;
      __pyx_t_6 = 0;
 138:             b = data[j, i, 2] / <double>(255)
      /* "vision/convolution.pyx":138
 *             r = data[j, i, 0] / <double>(255)
 *             g = data[j, i, 1] / <double>(255)
 *             b = data[j, i, 2] / <double>(255)             # <<<<<<<<<<<<<<
 *             localrgbscore = 0
 *             localrgbscore += r * rgbfiltert[0]
 */
      __pyx_t_22 = __pyx_v_j;
      __pyx_t_23 = __pyx_v_i;
      __pyx_t_24 = 2;
      if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_data;
      if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_data;
      if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_data;
      __pyx_t_6 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_22, __pyx_bstride_0_data, __pyx_t_23, __pyx_bstride_1_data, __pyx_t_24, __pyx_bstride_2_data)) / ((double)255))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_v_b);
      __pyx_v_b = __pyx_t_6;
      __pyx_t_6 = 0;
 139:             localrgbscore = 0
      /* "vision/convolution.pyx":139
 *             g = data[j, i, 1] / <double>(255)
 *             b = data[j, i, 2] / <double>(255)
 *             localrgbscore = 0             # <<<<<<<<<<<<<<
 *             localrgbscore += r * rgbfiltert[0]
 *             localrgbscore += g * rgbfiltert[1]
 */
      __pyx_v_localrgbscore = 0.0;
 140:             localrgbscore += r * rgbfiltert[0]
      /* "vision/convolution.pyx":140
 *             b = data[j, i, 2] / <double>(255)
 *             localrgbscore = 0
 *             localrgbscore += r * rgbfiltert[0]             # <<<<<<<<<<<<<<
 *             localrgbscore += g * rgbfiltert[1]
 *             localrgbscore += b * rgbfiltert[2]
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_25 = 0;
      if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_5 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_25, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyNumber_Multiply(__pyx_v_r, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 141:             localrgbscore += g * rgbfiltert[1]
      /* "vision/convolution.pyx":141
 *             localrgbscore = 0
 *             localrgbscore += r * rgbfiltert[0]
 *             localrgbscore += g * rgbfiltert[1]             # <<<<<<<<<<<<<<
 *             localrgbscore += b * rgbfiltert[2]
 *             localrgbscore += r * r * rgbfiltert[3]
 */
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_27 = 1;
      if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_27, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyNumber_Multiply(__pyx_v_g, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 142:             localrgbscore += b * rgbfiltert[2]
      /* "vision/convolution.pyx":142
 *             localrgbscore += r * rgbfiltert[0]
 *             localrgbscore += g * rgbfiltert[1]
 *             localrgbscore += b * rgbfiltert[2]             # <<<<<<<<<<<<<<
 *             localrgbscore += r * r * rgbfiltert[3]
 *             localrgbscore += r * g * rgbfiltert[4]
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_28 = 2;
      if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_6 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_28, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyNumber_Multiply(__pyx_v_b, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 143:             localrgbscore += r * r * rgbfiltert[3]
      /* "vision/convolution.pyx":143
 *             localrgbscore += g * rgbfiltert[1]
 *             localrgbscore += b * rgbfiltert[2]
 *             localrgbscore += r * r * rgbfiltert[3]             # <<<<<<<<<<<<<<
 *             localrgbscore += r * g * rgbfiltert[4]
 *             localrgbscore += r * b * rgbfiltert[5]
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyNumber_Multiply(__pyx_v_r, __pyx_v_r); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_29 = 3;
      if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_29, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 144:             localrgbscore += r * g * rgbfiltert[4]
      /* "vision/convolution.pyx":144
 *             localrgbscore += b * rgbfiltert[2]
 *             localrgbscore += r * r * rgbfiltert[3]
 *             localrgbscore += r * g * rgbfiltert[4]             # <<<<<<<<<<<<<<
 *             localrgbscore += r * b * rgbfiltert[5]
 *             localrgbscore += g * g * rgbfiltert[6]
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_v_r, __pyx_v_g); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_30 = 4;
      if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_6 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_30, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 145:             localrgbscore += r * b * rgbfiltert[5]
      /* "vision/convolution.pyx":145
 *             localrgbscore += r * r * rgbfiltert[3]
 *             localrgbscore += r * g * rgbfiltert[4]
 *             localrgbscore += r * b * rgbfiltert[5]             # <<<<<<<<<<<<<<
 *             localrgbscore += g * g * rgbfiltert[6]
 *             localrgbscore += g * b * rgbfiltert[7]
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyNumber_Multiply(__pyx_v_r, __pyx_v_b); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_31 = 5;
      if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_31, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 146:             localrgbscore += g * g * rgbfiltert[6]
      /* "vision/convolution.pyx":146
 *             localrgbscore += r * g * rgbfiltert[4]
 *             localrgbscore += r * b * rgbfiltert[5]
 *             localrgbscore += g * g * rgbfiltert[6]             # <<<<<<<<<<<<<<
 *             localrgbscore += g * b * rgbfiltert[7]
 *             localrgbscore += b * b * rgbfiltert[8]
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_v_g, __pyx_v_g); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_32 = 6;
      if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_6 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_32, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 147:             localrgbscore += g * b * rgbfiltert[7]
      /* "vision/convolution.pyx":147
 *             localrgbscore += r * b * rgbfiltert[5]
 *             localrgbscore += g * g * rgbfiltert[6]
 *             localrgbscore += g * b * rgbfiltert[7]             # <<<<<<<<<<<<<<
 *             localrgbscore += b * b * rgbfiltert[8]
 * 
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyNumber_Multiply(__pyx_v_g, __pyx_v_b); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_33 = 7;
      if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_33, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 148:             localrgbscore += b * b * rgbfiltert[8]
      /* "vision/convolution.pyx":148
 *             localrgbscore += g * g * rgbfiltert[6]
 *             localrgbscore += g * b * rgbfiltert[7]
 *             localrgbscore += b * b * rgbfiltert[8]             # <<<<<<<<<<<<<<
 * 
 *             # lookup recursive scores
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_localrgbscore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_v_b, __pyx_v_b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_34 = 8;
      if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_rgbfiltert;
      __pyx_t_6 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_rgbfiltert.buf, __pyx_t_34, __pyx_bstride_0_rgbfiltert))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_localrgbscore = __pyx_t_26;
 149: 
 150:             # lookup recursive scores
 151:             if i > 0:
      /* "vision/convolution.pyx":151
 * 
 *             # lookup recursive scores
 *             if i > 0:             # <<<<<<<<<<<<<<
 *                 localrgbscore += sumrgb[i-1, j]
 *             if j > 0:
 */
      __pyx_t_35 = (__pyx_v_i > 0);
      if (__pyx_t_35) {
 152:                 localrgbscore += sumrgb[i-1, j]
        /* "vision/convolution.pyx":152
 *             # lookup recursive scores
 *             if i > 0:
 *                 localrgbscore += sumrgb[i-1, j]             # <<<<<<<<<<<<<<
 *             if j > 0:
 *                 localrgbscore += sumrgb[i, j-1]
 */
        __pyx_t_36 = (__pyx_v_i - 1);
        __pyx_t_37 = __pyx_v_j;
        if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_0_sumrgb;
        if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_1_sumrgb;
        __pyx_v_localrgbscore = (__pyx_v_localrgbscore + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_36, __pyx_bstride_0_sumrgb, __pyx_t_37, __pyx_bstride_1_sumrgb)));
        goto __pyx_L7;
      }
      __pyx_L7:;
 153:             if j > 0:
      /* "vision/convolution.pyx":153
 *             if i > 0:
 *                 localrgbscore += sumrgb[i-1, j]
 *             if j > 0:             # <<<<<<<<<<<<<<
 *                 localrgbscore += sumrgb[i, j-1]
 *                 if i > 0: # do not count twice
 */
      __pyx_t_35 = (__pyx_v_j > 0);
      if (__pyx_t_35) {
 154:                 localrgbscore += sumrgb[i, j-1]
        /* "vision/convolution.pyx":154
 *                 localrgbscore += sumrgb[i-1, j]
 *             if j > 0:
 *                 localrgbscore += sumrgb[i, j-1]             # <<<<<<<<<<<<<<
 *                 if i > 0: # do not count twice
 *                     localrgbscore -= sumrgb[i-1, j-1]
 */
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = (__pyx_v_j - 1);
        if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_0_sumrgb;
        if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_1_sumrgb;
        __pyx_v_localrgbscore = (__pyx_v_localrgbscore + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_38, __pyx_bstride_0_sumrgb, __pyx_t_39, __pyx_bstride_1_sumrgb)));
 155:                 if i > 0: # do not count twice
        /* "vision/convolution.pyx":155
 *             if j > 0:
 *                 localrgbscore += sumrgb[i, j-1]
 *                 if i > 0: # do not count twice             # <<<<<<<<<<<<<<
 *                     localrgbscore -= sumrgb[i-1, j-1]
 *             sumrgb[i, j] = localrgbscore
 */
        __pyx_t_35 = (__pyx_v_i > 0);
        if (__pyx_t_35) {
 156:                     localrgbscore -= sumrgb[i-1, j-1]
          /* "vision/convolution.pyx":156
 *                 localrgbscore += sumrgb[i, j-1]
 *                 if i > 0: # do not count twice
 *                     localrgbscore -= sumrgb[i-1, j-1]             # <<<<<<<<<<<<<<
 *             sumrgb[i, j] = localrgbscore
 * 
 */
          __pyx_t_40 = (__pyx_v_i - 1);
          __pyx_t_41 = (__pyx_v_j - 1);
          if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_0_sumrgb;
          if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_1_sumrgb;
          __pyx_v_localrgbscore = (__pyx_v_localrgbscore - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_40, __pyx_bstride_0_sumrgb, __pyx_t_41, __pyx_bstride_1_sumrgb)));
          goto __pyx_L9;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }
      __pyx_L8:;
 157:             sumrgb[i, j] = localrgbscore
      /* "vision/convolution.pyx":157
 *                 if i > 0: # do not count twice
 *                     localrgbscore -= sumrgb[i-1, j-1]
 *             sumrgb[i, j] = localrgbscore             # <<<<<<<<<<<<<<
 * 
 *     # convolve
 */
      __pyx_t_42 = __pyx_v_i;
      __pyx_t_43 = __pyx_v_j;
      if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_bshape_1_sumrgb;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_42, __pyx_bstride_0_sumrgb, __pyx_t_43, __pyx_bstride_1_sumrgb) = __pyx_v_localrgbscore;
    }
  }
 158: 
 159:     # convolve
 160:     cdef int hfwidth = hogfilter.shape[0], hfheight = hogfilter.shape[1]
  /* "vision/convolution.pyx":160
 * 
 *     # convolve
 *     cdef int hfwidth = hogfilter.shape[0], hfheight = hogfilter.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double hogscore, rgbscore, hogfeatvalue, hogfiltervalue
 *     cdef np.ndarray[ndim=2, dtype=np.double_t] output
 */
  __pyx_t_6 = PyObject_GetAttr(__pyx_v_hogfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_hfwidth = __pyx_t_3;
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_hogfilter, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_hfheight = __pyx_t_3;
 161:     cdef double hogscore, rgbscore, hogfeatvalue, hogfiltervalue
 162:     cdef np.ndarray[ndim=2, dtype=np.double_t] output
 163:     output = np.zeros((width - filterwidth,
  /* "vision/convolution.pyx":163
 *     cdef double hogscore, rgbscore, hogfeatvalue, hogfiltervalue
 *     cdef np.ndarray[ndim=2, dtype=np.double_t] output
 *     output = np.zeros((width - filterwidth,             # <<<<<<<<<<<<<<
 *                        height - filterheight))
 * 
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromLong((__pyx_v_width - __pyx_v_filterwidth)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
 164:                        height - filterheight))
  /* "vision/convolution.pyx":164
 *     cdef np.ndarray[ndim=2, dtype=np.double_t] output
 *     output = np.zeros((width - filterwidth,
 *                        height - filterheight))             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < width - filterwidth:
 */
  __pyx_t_1 = PyInt_FromLong((__pyx_v_height - __pyx_v_filterheight)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_6 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_44 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; __pyx_bstride_1_output = __pyx_bstruct_output.strides[1];
    __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; __pyx_bshape_1_output = __pyx_bstruct_output.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_44 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 165: 
 166:     for i from 0 <= i < width - filterwidth:
  /* "vision/convolution.pyx":166
 *                        height - filterheight))
 * 
 *     for i from 0 <= i < width - filterwidth:             # <<<<<<<<<<<<<<
 *         for j from 0 <= j < height - filterheight:
 *             # compute hog score
 */
  __pyx_t_3 = (__pyx_v_width - __pyx_v_filterwidth);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
 167:         for j from 0 <= j < height - filterheight:
    /* "vision/convolution.pyx":167
 * 
 *     for i from 0 <= i < width - filterwidth:
 *         for j from 0 <= j < height - filterheight:             # <<<<<<<<<<<<<<
 *             # compute hog score
 *             hogscore = 0.
 */
    __pyx_t_15 = (__pyx_v_height - __pyx_v_filterheight);
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {
 168:             # compute hog score
 169:             hogscore = 0.
      /* "vision/convolution.pyx":169
 *         for j from 0 <= j < height - filterheight:
 *             # compute hog score
 *             hogscore = 0.             # <<<<<<<<<<<<<<
 *             for hfi from 0 <= hfi < hfwidth:
 *                 for hfj from 0 <= hfj < hfheight:
 */
      __pyx_v_hogscore = 0.;
 170:             for hfi from 0 <= hfi < hfwidth:
      /* "vision/convolution.pyx":170
 *             # compute hog score
 *             hogscore = 0.
 *             for hfi from 0 <= hfi < hfwidth:             # <<<<<<<<<<<<<<
 *                 for hfj from 0 <= hfj < hfheight:
 *                     for hfk from 0 <= hfk < 13:
 */
      __pyx_t_45 = __pyx_v_hfwidth;
      for (__pyx_v_hfi = 0; __pyx_v_hfi < __pyx_t_45; __pyx_v_hfi++) {
 171:                 for hfj from 0 <= hfj < hfheight:
        /* "vision/convolution.pyx":171
 *             hogscore = 0.
 *             for hfi from 0 <= hfi < hfwidth:
 *                 for hfj from 0 <= hfj < hfheight:             # <<<<<<<<<<<<<<
 *                     for hfk from 0 <= hfk < 13:
 *                         hogfeatvalue = hogfeat[j/hogbin+hfj,
 */
        __pyx_t_46 = __pyx_v_hfheight;
        for (__pyx_v_hfj = 0; __pyx_v_hfj < __pyx_t_46; __pyx_v_hfj++) {
 172:                     for hfk from 0 <= hfk < 13:
          /* "vision/convolution.pyx":172
 *             for hfi from 0 <= hfi < hfwidth:
 *                 for hfj from 0 <= hfj < hfheight:
 *                     for hfk from 0 <= hfk < 13:             # <<<<<<<<<<<<<<
 *                         hogfeatvalue = hogfeat[j/hogbin+hfj,
 *                                                i/hogbin+hfi, hfk]
 */
          for (__pyx_v_hfk = 0; __pyx_v_hfk < 13; __pyx_v_hfk++) {
 173:                         hogfeatvalue = hogfeat[j/hogbin+hfj,
 174:                                                i/hogbin+hfi, hfk]
            /* "vision/convolution.pyx":174
 *                     for hfk from 0 <= hfk < 13:
 *                         hogfeatvalue = hogfeat[j/hogbin+hfj,
 *                                                i/hogbin+hfi, hfk]             # <<<<<<<<<<<<<<
 *                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]
 *                         hogscore += hogfeatvalue * hogfiltervalue
 */
            __pyx_t_47 = ((__pyx_v_j / __pyx_v_hogbin) + __pyx_v_hfj);
            __pyx_t_48 = ((__pyx_v_i / __pyx_v_hogbin) + __pyx_v_hfi);
            __pyx_t_49 = __pyx_v_hfk;
            if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_bshape_0_hogfeat;
            if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_bshape_1_hogfeat;
            if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_bshape_2_hogfeat;
            __pyx_v_hogfeatvalue = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hogfeat.buf, __pyx_t_47, __pyx_bstride_0_hogfeat, __pyx_t_48, __pyx_bstride_1_hogfeat, __pyx_t_49, __pyx_bstride_2_hogfeat));
 175:                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]
            /* "vision/convolution.pyx":175
 *                         hogfeatvalue = hogfeat[j/hogbin+hfj,
 *                                                i/hogbin+hfi, hfk]
 *                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]             # <<<<<<<<<<<<<<
 *                         hogscore += hogfeatvalue * hogfiltervalue
 * 
 */
            __pyx_t_50 = __pyx_v_hfj;
            __pyx_t_51 = __pyx_v_hfi;
            __pyx_t_52 = __pyx_v_hfk;
            if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_bshape_0_hogfiltert;
            if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_bshape_1_hogfiltert;
            if (__pyx_t_52 < 0) __pyx_t_52 += __pyx_bshape_2_hogfiltert;
            __pyx_v_hogfiltervalue = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hogfiltert.buf, __pyx_t_50, __pyx_bstride_0_hogfiltert, __pyx_t_51, __pyx_bstride_1_hogfiltert, __pyx_t_52, __pyx_bstride_2_hogfiltert));
 176:                         hogscore += hogfeatvalue * hogfiltervalue
            /* "vision/convolution.pyx":176
 *                                                i/hogbin+hfi, hfk]
 *                         hogfiltervalue = hogfiltert[hfj, hfi, hfk]
 *                         hogscore += hogfeatvalue * hogfiltervalue             # <<<<<<<<<<<<<<
 * 
 *             # compute rgb score using summed area tables
 */
            __pyx_v_hogscore = (__pyx_v_hogscore + (__pyx_v_hogfeatvalue * __pyx_v_hogfiltervalue));
          }
        }
      }
 177: 
 178:             # compute rgb score using summed area tables
 179:             rgbscore  = sumrgb[i, j]
      /* "vision/convolution.pyx":179
 * 
 *             # compute rgb score using summed area tables
 *             rgbscore  = sumrgb[i, j]             # <<<<<<<<<<<<<<
 *             rgbscore += sumrgb[i+filterwidth, j+filterheight]
 *             rgbscore -= sumrgb[i, j+filterheight]
 */
      __pyx_t_45 = __pyx_v_i;
      __pyx_t_46 = __pyx_v_j;
      if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_1_sumrgb;
      __pyx_v_rgbscore = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_45, __pyx_bstride_0_sumrgb, __pyx_t_46, __pyx_bstride_1_sumrgb));
 180:             rgbscore += sumrgb[i+filterwidth, j+filterheight]
      /* "vision/convolution.pyx":180
 *             # compute rgb score using summed area tables
 *             rgbscore  = sumrgb[i, j]
 *             rgbscore += sumrgb[i+filterwidth, j+filterheight]             # <<<<<<<<<<<<<<
 *             rgbscore -= sumrgb[i, j+filterheight]
 *             rgbscore -= sumrgb[i+filterwidth, j]
 */
      __pyx_t_53 = (__pyx_v_i + __pyx_v_filterwidth);
      __pyx_t_54 = (__pyx_v_j + __pyx_v_filterheight);
      if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_bshape_1_sumrgb;
      __pyx_v_rgbscore = (__pyx_v_rgbscore + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_53, __pyx_bstride_0_sumrgb, __pyx_t_54, __pyx_bstride_1_sumrgb)));
 181:             rgbscore -= sumrgb[i, j+filterheight]
      /* "vision/convolution.pyx":181
 *             rgbscore  = sumrgb[i, j]
 *             rgbscore += sumrgb[i+filterwidth, j+filterheight]
 *             rgbscore -= sumrgb[i, j+filterheight]             # <<<<<<<<<<<<<<
 *             rgbscore -= sumrgb[i+filterwidth, j]
 * 
 */
      __pyx_t_55 = __pyx_v_i;
      __pyx_t_56 = (__pyx_v_j + __pyx_v_filterheight);
      if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_bshape_1_sumrgb;
      __pyx_v_rgbscore = (__pyx_v_rgbscore - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_55, __pyx_bstride_0_sumrgb, __pyx_t_56, __pyx_bstride_1_sumrgb)));
 182:             rgbscore -= sumrgb[i+filterwidth, j]
      /* "vision/convolution.pyx":182
 *             rgbscore += sumrgb[i+filterwidth, j+filterheight]
 *             rgbscore -= sumrgb[i, j+filterheight]
 *             rgbscore -= sumrgb[i+filterwidth, j]             # <<<<<<<<<<<<<<
 * 
 *             rgbscore = rgbscore / (filterwidth * filterheight)
 */
      __pyx_t_57 = (__pyx_v_i + __pyx_v_filterwidth);
      __pyx_t_58 = __pyx_v_j;
      if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_bshape_0_sumrgb;
      if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_bshape_1_sumrgb;
      __pyx_v_rgbscore = (__pyx_v_rgbscore - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_sumrgb.buf, __pyx_t_57, __pyx_bstride_0_sumrgb, __pyx_t_58, __pyx_bstride_1_sumrgb)));
 183: 
 184:             rgbscore = rgbscore / (filterwidth * filterheight)
      /* "vision/convolution.pyx":184
 *             rgbscore -= sumrgb[i+filterwidth, j]
 * 
 *             rgbscore = rgbscore / (filterwidth * filterheight)             # <<<<<<<<<<<<<<
 * 
 *             # store final score
 */
      __pyx_v_rgbscore = (__pyx_v_rgbscore / (__pyx_v_filterwidth * __pyx_v_filterheight));
 185: 
 186:             # store final score
 187:             output[i,j] = hogscore + rgbscore
      /* "vision/convolution.pyx":187
 * 
 *             # store final score
 *             output[i,j] = hogscore + rgbscore             # <<<<<<<<<<<<<<
 *     return output
 */
      __pyx_t_59 = __pyx_v_i;
      __pyx_t_60 = __pyx_v_j;
      if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_bshape_0_output;
      if (__pyx_t_60 < 0) __pyx_t_60 += __pyx_bshape_1_output;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_59, __pyx_bstride_0_output, __pyx_t_60, __pyx_bstride_1_output) = (__pyx_v_hogscore + __pyx_v_rgbscore);
    }
  }
 188:     return output
  /* "vision/convolution.pyx":188
 *             # store final score
 *             output[i,j] = hogscore + rgbscore
 *     return output             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sumrgb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rgbfiltert);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfiltert);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfeat);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("vision.convolution.hogrgbmean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sumrgb);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rgbfiltert);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfiltert);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hogfeat);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_hogfeat);
  __Pyx_XDECREF((PyObject *)__pyx_v_hogfiltert);
  __Pyx_XDECREF((PyObject *)__pyx_v_sumrgb);
  __Pyx_XDECREF((PyObject *)__pyx_v_rgbfiltert);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}