Generated by Cython 0.15.1 on Tue Jan 31 14:40:03 2012
Raw output: features.c
1: import numpy as np
/* "vision/features.pyx":1 * import numpy as np #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import Image * cimport numpy as np */ __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/features.pyx":1 * import numpy as np #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import Image * cimport numpy as np */ __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 Image
/* "vision/features.pyx":2 * import numpy as np * import Image #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cimport numpy as np * cimport cython */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__Image), 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__Image, __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: cimport numpy as np
4: cimport cython
5:
6: cdef extern from "math.h":
7: double sqrt(double i)
8: double fabs(double i)
9: double floor(double i)
10:
11: cpdef hog(im, int sbin = 8):
/* "vision/features.pyx":11 * double floor(double i) * * cpdef hog(im, int sbin = 8): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Computes a histogram of oriented gradient features. */ static PyObject *__pyx_pf_6vision_8features_hog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6vision_8features_hog(PyObject *__pyx_v_im, int __pyx_skip_dispatch, struct __pyx_opt_args_6vision_8features_hog *__pyx_optional_args) { int __pyx_v_sbin = ((int)8); PyArrayObject *__pyx_v_data = 0; PyArrayObject *__pyx_v_feat = 0; PyArrayObject *__pyx_v_hist = 0; PyArrayObject *__pyx_v_norm = 0; int __pyx_v_blocks0; int __pyx_v_blocks1; int __pyx_v_out0; int __pyx_v_out1; int __pyx_v_out2; int __pyx_v_visible0; int __pyx_v_visible1; double __pyx_v_dy; double __pyx_v_dx; double __pyx_v_v; double __pyx_v_dy2; double __pyx_v_dx2; double __pyx_v_v2; double __pyx_v_dy3; double __pyx_v_dx3; double __pyx_v_v3; double __pyx_v_best_dot; double __pyx_v_dot; int __pyx_v_best_o; double __pyx_v_xp; double __pyx_v_yp; double __pyx_v_vx0; double __pyx_v_vy0; double __pyx_v_vx1; double __pyx_v_vy1; int __pyx_v_ixp; int __pyx_v_iyp; double __pyx_v_n1; double __pyx_v_n2; double __pyx_v_n3; double __pyx_v_n4; double __pyx_v_t1; double __pyx_v_t2; double __pyx_v_t3; double __pyx_v_t4; double __pyx_v_h1; double __pyx_v_h2; double __pyx_v_h3; double __pyx_v_h4; int __pyx_v_p; PyArrayObject *__pyx_v_uu = 0; PyArrayObject *__pyx_v_vv = 0; double __pyx_v_eps; unsigned int __pyx_v_cc0; unsigned int __pyx_v_cc1; unsigned int __pyx_v_cc2; int __pyx_v_x; int __pyx_v_y; int __pyx_v_o; int __pyx_v_q; int __pyx_v_dstptr; int __pyx_v_srcptr; PyObject *__pyx_v_width = NULL; PyObject *__pyx_v_height = NULL; Py_buffer __pyx_bstruct_vv; Py_ssize_t __pyx_bstride_0_vv = 0; Py_ssize_t __pyx_bshape_0_vv = 0; Py_buffer __pyx_bstruct_feat; Py_ssize_t __pyx_bstride_0_feat = 0; Py_ssize_t __pyx_bstride_1_feat = 0; Py_ssize_t __pyx_bstride_2_feat = 0; Py_ssize_t __pyx_bshape_0_feat = 0; Py_ssize_t __pyx_bshape_1_feat = 0; Py_ssize_t __pyx_bshape_2_feat = 0; Py_buffer __pyx_bstruct_hist; Py_ssize_t __pyx_bstride_0_hist = 0; Py_ssize_t __pyx_bshape_0_hist = 0; Py_buffer __pyx_bstruct_norm; Py_ssize_t __pyx_bstride_0_norm = 0; Py_ssize_t __pyx_bshape_0_norm = 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_uu; Py_ssize_t __pyx_bstride_0_uu = 0; Py_ssize_t __pyx_bshape_0_uu = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("hog"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_sbin = __pyx_optional_args->sbin; } } __pyx_bstruct_data.buf = NULL; __pyx_bstruct_feat.buf = NULL; __pyx_bstruct_hist.buf = NULL; __pyx_bstruct_norm.buf = NULL; __pyx_bstruct_uu.buf = NULL; __pyx_bstruct_vv.buf = NULL; /* "vision/features.pyx":11 * double floor(double i) * * cpdef hog(im, int sbin = 8): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Computes a histogram of oriented gradient features. */ static PyObject *__pyx_pf_6vision_8features_hog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6vision_8features_hog[] = "hog(im, int sbin=8)\n\n Computes a histogram of oriented gradient features.\n\n Adopted from Pedro Felzenszwalb's features.cc\n "; static PyObject *__pyx_pf_6vision_8features_hog(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_im = 0; int __pyx_v_sbin; PyObject *__pyx_r = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__im,&__pyx_n_s__sbin,0}; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("hog"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { 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__im); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sbin); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "hog")<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_im = values[0]; if (values[1]) { __pyx_v_sbin = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_sbin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_sbin = ((int)8); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("hog", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("vision.features.hog", __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.sbin = __pyx_v_sbin; __pyx_t_1 = __pyx_f_6vision_8features_hog(__pyx_v_im, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __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.features.hog", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "vision/features.pyx":11 * double floor(double i) * * cpdef hog(im, int sbin = 8): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Computes a histogram of oriented gradient features. */ struct __pyx_opt_args_6vision_8features_hog { int __pyx_n; int sbin; };
12: """
13: Computes a histogram of oriented gradient features.
14:
15: Adopted from Pedro Felzenszwalb's features.cc
16: """
17: cdef np.ndarray[np.double_t, ndim=3] data, feat
18: cdef np.ndarray[np.double_t, ndim=1] hist, norm
19:
20: cdef int blocks0, blocks1
21: cdef int out0, out1, out2
22: cdef int visible0, visible1
23:
24: cdef double dy, dx, v
25: cdef double dy2, dx2, v2
26: cdef double dy3, dx3, v3
27: cdef double best_dot, dot
28: cdef int best_o
29:
30: cdef double xp, yp, vx0, vy0, vx1, vy1
31: cdef int ixp, iyp
32: cdef double n1, n2, n3, n4, t1, t2, t3, t4, h1, h2, h3, h4
33: cdef int p
34:
35: cdef np.ndarray[np.double_t, ndim=1] uu
36: uu = np.array([ 1.0000, 0.9397, 0.7660, 0.500, 0.1736,
/* "vision/features.pyx":36 * * cdef np.ndarray[np.double_t, ndim=1] uu * uu = np.array([ 1.0000, 0.9397, 0.7660, 0.500, 0.1736, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* -0.1736, -0.5000, -0.7660, -0.9397]) * cdef np.ndarray[np.double_t, ndim=1] vv */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); 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); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyFloat_FromDouble(1.0000); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyFloat_FromDouble(0.9397); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyFloat_FromDouble(0.7660); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyFloat_FromDouble(0.500); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyFloat_FromDouble(0.1736); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6);
37: -0.1736, -0.5000, -0.7660, -0.9397])
/* "vision/features.pyx":37 * cdef np.ndarray[np.double_t, ndim=1] uu * uu = np.array([ 1.0000, 0.9397, 0.7660, 0.500, 0.1736, * -0.1736, -0.5000, -0.7660, -0.9397]) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef np.ndarray[np.double_t, ndim=1] vv * vv = np.array([0.0000, 0.3420, 0.6428, 0.8660, 0.9848, */ __pyx_t_7 = PyFloat_FromDouble(-0.1736); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyFloat_FromDouble(-0.5000); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyFloat_FromDouble(-0.7660); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyFloat_FromDouble(-0.9397); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyList_New(9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_11, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_11, 3, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_11, 4, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyList_SET_ITEM(__pyx_t_11, 5, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_11, 6, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_11, 7, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_11, 8, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_11)); __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_11); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_uu); __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_uu, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13<
0)) { PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_uu, (PyObject*)__pyx_v_uu, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16); } } __pyx_bstride_0_uu = __pyx_bstruct_uu.strides[0]; __pyx_bshape_0_uu = __pyx_bstruct_uu.shape[0]; if (unlikely(__pyx_t_13<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; __pyx_v_uu = ((PyArrayObject *)__pyx_t_11); __pyx_t_11 = 0;
38: cdef np.ndarray[np.double_t, ndim=1] vv
39: vv = np.array([0.0000, 0.3420, 0.6428, 0.8660, 0.9848,
/* "vision/features.pyx":39 * -0.1736, -0.5000, -0.7660, -0.9397]) * cdef np.ndarray[np.double_t, ndim=1] vv * vv = np.array([0.0000, 0.3420, 0.6428, 0.8660, 0.9848, #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* 0.9848, 0.8660, 0.6428, 0.3420]) * */ __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __pyx_t_10 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__array); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = PyFloat_FromDouble(0.0000); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __pyx_t_2 = PyFloat_FromDouble(0.3420); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = PyFloat_FromDouble(0.6428); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = PyFloat_FromDouble(0.8660); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyFloat_FromDouble(0.9848); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7);
40: 0.9848, 0.8660, 0.6428, 0.3420])
/* "vision/features.pyx":40 * cdef np.ndarray[np.double_t, ndim=1] vv * vv = np.array([0.0000, 0.3420, 0.6428, 0.8660, 0.9848, * 0.9848, 0.8660, 0.6428, 0.3420]) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cdef double eps = 0.0001 # to avoid division by 0 */ __pyx_t_6 = PyFloat_FromDouble(0.9848); 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 = PyFloat_FromDouble(0.8660); 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_t_4 = PyFloat_FromDouble(0.6428); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyFloat_FromDouble(0.3420); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_1, 3, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_1, 4, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_1, 5, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyList_SET_ITEM(__pyx_t_1, 6, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_1, 7, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_1, 8, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_11 = 0; __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_vv); __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_vv, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13<
0)) { PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_vv, (PyObject*)__pyx_v_vv, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14); } } __pyx_bstride_0_vv = __pyx_bstruct_vv.strides[0]; __pyx_bshape_0_vv = __pyx_bstruct_vv.shape[0]; if (unlikely(__pyx_t_13<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __pyx_v_vv = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
41:
42: cdef double eps = 0.0001 # to avoid division by 0
/* "vision/features.pyx":42 * 0.9848, 0.8660, 0.6428, 0.3420]) * * cdef double eps = 0.0001 # to avoid division by 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef unsigned int cc0, cc1, cc2 * */ __pyx_v_eps = 0.0001;
43: cdef unsigned int cc0, cc1, cc2
44:
45: cdef int x, y, o, q
46: cdef int dstptr, srcptr
47:
48: width, height = im.size
/* "vision/features.pyx":48 * cdef int dstptr, srcptr * * width, height = im.size #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* blocks0 = height / sbin * blocks1 = width / sbin */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); } else { if (unlikely(PyList_GET_SIZE(sequence) != 2)) { if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyList_GET_ITEM(sequence, 0); __pyx_t_10 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_18 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_18(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_10 = __pyx_t_18(__pyx_t_4); if (unlikely(!__pyx_t_10)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_4), 2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L4_unpacking_done:; } __pyx_v_width = __pyx_t_3; __pyx_t_3 = 0; __pyx_v_height = __pyx_t_10; __pyx_t_10 = 0;
49: blocks0 = height / sbin
/* "vision/features.pyx":49 * * width, height = im.size * blocks0 = height / sbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* blocks1 = width / sbin * */ __pyx_t_1 = PyInt_FromLong(__pyx_v_sbin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_v_height, __pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_blocks0 = __pyx_t_13;
50: blocks1 = width / sbin
/* "vision/features.pyx":50 * width, height = im.size * blocks0 = height / sbin * blocks1 = width / sbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * out0 = blocks0 - 2 */ __pyx_t_10 = PyInt_FromLong(__pyx_v_sbin); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_width, __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_blocks1 = __pyx_t_13;
51:
52: out0 = blocks0 - 2
/* "vision/features.pyx":52 * blocks1 = width / sbin * * out0 = blocks0 - 2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out1 = blocks1 - 2 * out2 = 9 + 4 */ __pyx_v_out0 = (__pyx_v_blocks0 - 2);
53: out1 = blocks1 - 2
/* "vision/features.pyx":53 * * out0 = blocks0 - 2 * out1 = blocks1 - 2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out2 = 9 + 4 * */ __pyx_v_out1 = (__pyx_v_blocks1 - 2);
54: out2 = 9 + 4
/* "vision/features.pyx":54 * out0 = blocks0 - 2 * out1 = blocks1 - 2 * out2 = 9 + 4 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * visible0 = blocks0 * sbin */ __pyx_v_out2 = 13;
55:
56: visible0 = blocks0 * sbin
/* "vision/features.pyx":56 * out2 = 9 + 4 * * visible0 = blocks0 * sbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* visible1 = blocks1 * sbin * */ __pyx_v_visible0 = (__pyx_v_blocks0 * __pyx_v_sbin);
57: visible1 = blocks1 * sbin
/* "vision/features.pyx":57 * * visible0 = blocks0 * sbin * visible1 = blocks1 * sbin #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * data = np.asarray(im, dtype=np.double) */ __pyx_v_visible1 = (__pyx_v_blocks1 * __pyx_v_sbin);
58:
59: data = np.asarray(im, dtype=np.double)
/* "vision/features.pyx":59 * visible1 = blocks1 * sbin * * data = np.asarray(im, dtype=np.double) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cc0 =<
unsigned int>(0) */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_im); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_im); __Pyx_GIVEREF(__pyx_v_im); __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__double); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_10, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); if (unlikely(__pyx_t_13<
0)) { PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); 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_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16); } } __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_13<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_19 = 0; __pyx_v_data = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0;
60:
61: cc0 = <unsigned int>(0)
/* "vision/features.pyx":61 * data = np.asarray(im, dtype=np.double) * * cc0 =<
unsigned int>(0) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cc1 =<
unsigned int>(1) * cc2 =<
unsigned int>(2) */ __pyx_v_cc0 = ((unsigned int)0);
62: cc1 = <unsigned int>(1)
/* "vision/features.pyx":62 * * cc0 =<
unsigned int>(0) * cc1 =<
unsigned int>(1) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cc2 =<
unsigned int>(2) * */ __pyx_v_cc1 = ((unsigned int)1);
63: cc2 = <unsigned int>(2)
/* "vision/features.pyx":63 * cc0 =<
unsigned int>(0) * cc1 =<
unsigned int>(1) * cc2 =<
unsigned int>(2) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * hist = np.zeros(shape=(blocks0 * blocks1 * 9), dtype=np.double) */ __pyx_v_cc2 = ((unsigned int)2);
64:
65: hist = np.zeros(shape=(blocks0 * blocks1 * 9), dtype=np.double)
/* "vision/features.pyx":65 * cc2 =<
unsigned int>(2) * * hist = np.zeros(shape=(blocks0 * blocks1 * 9), dtype=np.double) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* norm = np.zeros(shape=(blocks0 * blocks1), dtype=np.double) * feat = np.zeros(shape=(out0, out1, out2), dtype=np.double) */ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_1 = PyInt_FromLong(((__pyx_v_blocks0 * __pyx_v_blocks1) * 9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__shape), __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__double); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = ((PyArrayObject *)__pyx_t_10); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hist); __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_hist, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13<
0)) { PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hist, (PyObject*)__pyx_v_hist, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14); } } __pyx_bstride_0_hist = __pyx_bstruct_hist.strides[0]; __pyx_bshape_0_hist = __pyx_bstruct_hist.shape[0]; if (unlikely(__pyx_t_13<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_20 = 0; __pyx_v_hist = ((PyArrayObject *)__pyx_t_10); __pyx_t_10 = 0;
66: norm = np.zeros(shape=(blocks0 * blocks1), dtype=np.double)
/* "vision/features.pyx":66 * * hist = np.zeros(shape=(blocks0 * blocks1 * 9), dtype=np.double) * norm = np.zeros(shape=(blocks0 * blocks1), dtype=np.double) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* feat = np.zeros(shape=(out0, out1, out2), dtype=np.double) * */ __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); __pyx_t_3 = PyInt_FromLong((__pyx_v_blocks0 * __pyx_v_blocks1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__shape), __pyx_t_3)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __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_10)); __pyx_t_10 = 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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_norm); __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_norm, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13<
0)) { PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_norm, (PyObject*)__pyx_v_norm, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16); } } __pyx_bstride_0_norm = __pyx_bstruct_norm.strides[0]; __pyx_bshape_0_norm = __pyx_bstruct_norm.shape[0]; if (unlikely(__pyx_t_13<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_20 = 0; __pyx_v_norm = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
67: feat = np.zeros(shape=(out0, out1, out2), dtype=np.double)
/* "vision/features.pyx":67 * hist = np.zeros(shape=(blocks0 * blocks1 * 9), dtype=np.double) * norm = np.zeros(shape=(blocks0 * blocks1), dtype=np.double) * feat = np.zeros(shape=(out0, out1, out2), dtype=np.double) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * for x from 1<
= x<
visible1 - 1: */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_5 = PyInt_FromLong(__pyx_v_out0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyInt_FromLong(__pyx_v_out1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyInt_FromLong(__pyx_v_out2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_6))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__double); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_feat); __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_feat, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack); if (unlikely(__pyx_t_13<
0)) { PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_feat, (PyObject*)__pyx_v_feat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14); } } __pyx_bstride_0_feat = __pyx_bstruct_feat.strides[0]; __pyx_bstride_1_feat = __pyx_bstruct_feat.strides[1]; __pyx_bstride_2_feat = __pyx_bstruct_feat.strides[2]; __pyx_bshape_0_feat = __pyx_bstruct_feat.shape[0]; __pyx_bshape_1_feat = __pyx_bstruct_feat.shape[1]; __pyx_bshape_2_feat = __pyx_bstruct_feat.shape[2]; if (unlikely(__pyx_t_13<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_19 = 0; __pyx_v_feat = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
68:
69: for x from 1 <= x < visible1 - 1:
/* "vision/features.pyx":69 * feat = np.zeros(shape=(out0, out1, out2), dtype=np.double) * * for x from 1<
= x<
visible1 - 1: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for y from 1<
= y<
visible0 - 1: * dy = data[y + 1, x, cc0] - data[y - 1, x, cc0] */ __pyx_t_21 = (__pyx_v_visible1 - 1); for (__pyx_v_x = 1; __pyx_v_x<
__pyx_t_21; __pyx_v_x++) {
70: for y from 1 <= y < visible0 - 1:
/* "vision/features.pyx":70 * * for x from 1<
= x<
visible1 - 1: * for y from 1<
= y<
visible0 - 1: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dy = data[y + 1, x, cc0] - data[y - 1, x, cc0] * dx = data[y, x + 1, cc0] - data[y, x - 1, cc0] */ __pyx_t_22 = (__pyx_v_visible0 - 1); for (__pyx_v_y = 1; __pyx_v_y<
__pyx_t_22; __pyx_v_y++) {
71: dy = data[y + 1, x, cc0] - data[y - 1, x, cc0]
/* "vision/features.pyx":71 * for x from 1<
= x<
visible1 - 1: * for y from 1<
= y<
visible0 - 1: * dy = data[y + 1, x, cc0] - data[y - 1, x, cc0] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dx = data[y, x + 1, cc0] - data[y, x - 1, cc0] * v = dx * dx + dy * dy */ __pyx_t_23 = (__pyx_v_y + 1); __pyx_t_13 = __pyx_v_x; __pyx_t_24 = __pyx_v_cc0; if (__pyx_t_23<
0) __pyx_t_23 += __pyx_bshape_0_data; if (__pyx_t_13<
0) __pyx_t_13 += __pyx_bshape_1_data; __pyx_t_25 = (__pyx_v_y - 1); __pyx_t_26 = __pyx_v_x; __pyx_t_27 = __pyx_v_cc0; if (__pyx_t_25<
0) __pyx_t_25 += __pyx_bshape_0_data; if (__pyx_t_26<
0) __pyx_t_26 += __pyx_bshape_1_data; __pyx_v_dy = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_23, __pyx_bstride_0_data, __pyx_t_13, __pyx_bstride_1_data, __pyx_t_24, __pyx_bstride_2_data)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_25, __pyx_bstride_0_data, __pyx_t_26, __pyx_bstride_1_data, __pyx_t_27, __pyx_bstride_2_data)));
72: dx = data[y, x + 1, cc0] - data[y, x - 1, cc0]
/* "vision/features.pyx":72 * for y from 1<
= y<
visible0 - 1: * dy = data[y + 1, x, cc0] - data[y - 1, x, cc0] * dx = data[y, x + 1, cc0] - data[y, x - 1, cc0] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* v = dx * dx + dy * dy * */ __pyx_t_28 = __pyx_v_y; __pyx_t_29 = (__pyx_v_x + 1); __pyx_t_30 = __pyx_v_cc0; if (__pyx_t_28<
0) __pyx_t_28 += __pyx_bshape_0_data; if (__pyx_t_29<
0) __pyx_t_29 += __pyx_bshape_1_data; __pyx_t_31 = __pyx_v_y; __pyx_t_32 = (__pyx_v_x - 1); __pyx_t_33 = __pyx_v_cc0; if (__pyx_t_31<
0) __pyx_t_31 += __pyx_bshape_0_data; if (__pyx_t_32<
0) __pyx_t_32 += __pyx_bshape_1_data; __pyx_v_dx = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_28, __pyx_bstride_0_data, __pyx_t_29, __pyx_bstride_1_data, __pyx_t_30, __pyx_bstride_2_data)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_31, __pyx_bstride_0_data, __pyx_t_32, __pyx_bstride_1_data, __pyx_t_33, __pyx_bstride_2_data)));
73: v = dx * dx + dy * dy
/* "vision/features.pyx":73 * dy = data[y + 1, x, cc0] - data[y - 1, x, cc0] * dx = data[y, x + 1, cc0] - data[y, x - 1, cc0] * v = dx * dx + dy * dy #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * dy2 = data[y + 1, x, cc1] - data[y - 1, x, cc1] */ __pyx_v_v = ((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy));
74:
75: dy2 = data[y + 1, x, cc1] - data[y - 1, x, cc1]
/* "vision/features.pyx":75 * v = dx * dx + dy * dy * * dy2 = data[y + 1, x, cc1] - data[y - 1, x, cc1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dx2 = data[y, x + 1, cc1] - data[y, x - 1, cc1] * v2 = dx2 * dx2 + dy2 * dy2 */ __pyx_t_34 = (__pyx_v_y + 1); __pyx_t_35 = __pyx_v_x; __pyx_t_36 = __pyx_v_cc1; if (__pyx_t_34<
0) __pyx_t_34 += __pyx_bshape_0_data; if (__pyx_t_35<
0) __pyx_t_35 += __pyx_bshape_1_data; __pyx_t_37 = (__pyx_v_y - 1); __pyx_t_38 = __pyx_v_x; __pyx_t_39 = __pyx_v_cc1; if (__pyx_t_37<
0) __pyx_t_37 += __pyx_bshape_0_data; if (__pyx_t_38<
0) __pyx_t_38 += __pyx_bshape_1_data; __pyx_v_dy2 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_34, __pyx_bstride_0_data, __pyx_t_35, __pyx_bstride_1_data, __pyx_t_36, __pyx_bstride_2_data)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_37, __pyx_bstride_0_data, __pyx_t_38, __pyx_bstride_1_data, __pyx_t_39, __pyx_bstride_2_data)));
76: dx2 = data[y, x + 1, cc1] - data[y, x - 1, cc1]
/* "vision/features.pyx":76 * * dy2 = data[y + 1, x, cc1] - data[y - 1, x, cc1] * dx2 = data[y, x + 1, cc1] - data[y, x - 1, cc1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* v2 = dx2 * dx2 + dy2 * dy2 * */ __pyx_t_40 = __pyx_v_y; __pyx_t_41 = (__pyx_v_x + 1); __pyx_t_42 = __pyx_v_cc1; if (__pyx_t_40<
0) __pyx_t_40 += __pyx_bshape_0_data; if (__pyx_t_41<
0) __pyx_t_41 += __pyx_bshape_1_data; __pyx_t_43 = __pyx_v_y; __pyx_t_44 = (__pyx_v_x - 1); __pyx_t_45 = __pyx_v_cc1; if (__pyx_t_43<
0) __pyx_t_43 += __pyx_bshape_0_data; if (__pyx_t_44<
0) __pyx_t_44 += __pyx_bshape_1_data; __pyx_v_dx2 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_40, __pyx_bstride_0_data, __pyx_t_41, __pyx_bstride_1_data, __pyx_t_42, __pyx_bstride_2_data)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_43, __pyx_bstride_0_data, __pyx_t_44, __pyx_bstride_1_data, __pyx_t_45, __pyx_bstride_2_data)));
77: v2 = dx2 * dx2 + dy2 * dy2
/* "vision/features.pyx":77 * dy2 = data[y + 1, x, cc1] - data[y - 1, x, cc1] * dx2 = data[y, x + 1, cc1] - data[y, x - 1, cc1] * v2 = dx2 * dx2 + dy2 * dy2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * dy3 = data[y + 1, x, cc2] - data[y - 1, x, cc2] */ __pyx_v_v2 = ((__pyx_v_dx2 * __pyx_v_dx2) + (__pyx_v_dy2 * __pyx_v_dy2));
78:
79: dy3 = data[y + 1, x, cc2] - data[y - 1, x, cc2]
/* "vision/features.pyx":79 * v2 = dx2 * dx2 + dy2 * dy2 * * dy3 = data[y + 1, x, cc2] - data[y - 1, x, cc2] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dx3 = data[y, x + 1, cc2] - data[y, x - 1, cc2] * v3 = dx3 * dx3 + dy3 * dy3 */ __pyx_t_46 = (__pyx_v_y + 1); __pyx_t_47 = __pyx_v_x; __pyx_t_48 = __pyx_v_cc2; if (__pyx_t_46<
0) __pyx_t_46 += __pyx_bshape_0_data; if (__pyx_t_47<
0) __pyx_t_47 += __pyx_bshape_1_data; __pyx_t_49 = (__pyx_v_y - 1); __pyx_t_50 = __pyx_v_x; __pyx_t_51 = __pyx_v_cc2; if (__pyx_t_49<
0) __pyx_t_49 += __pyx_bshape_0_data; if (__pyx_t_50<
0) __pyx_t_50 += __pyx_bshape_1_data; __pyx_v_dy3 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_46, __pyx_bstride_0_data, __pyx_t_47, __pyx_bstride_1_data, __pyx_t_48, __pyx_bstride_2_data)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_49, __pyx_bstride_0_data, __pyx_t_50, __pyx_bstride_1_data, __pyx_t_51, __pyx_bstride_2_data)));
80: dx3 = data[y, x + 1, cc2] - data[y, x - 1, cc2]
/* "vision/features.pyx":80 * * dy3 = data[y + 1, x, cc2] - data[y - 1, x, cc2] * dx3 = data[y, x + 1, cc2] - data[y, x - 1, cc2] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* v3 = dx3 * dx3 + dy3 * dy3 * */ __pyx_t_52 = __pyx_v_y; __pyx_t_53 = (__pyx_v_x + 1); __pyx_t_54 = __pyx_v_cc2; if (__pyx_t_52<
0) __pyx_t_52 += __pyx_bshape_0_data; if (__pyx_t_53<
0) __pyx_t_53 += __pyx_bshape_1_data; __pyx_t_55 = __pyx_v_y; __pyx_t_56 = (__pyx_v_x - 1); __pyx_t_57 = __pyx_v_cc2; if (__pyx_t_55<
0) __pyx_t_55 += __pyx_bshape_0_data; if (__pyx_t_56<
0) __pyx_t_56 += __pyx_bshape_1_data; __pyx_v_dx3 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_52, __pyx_bstride_0_data, __pyx_t_53, __pyx_bstride_1_data, __pyx_t_54, __pyx_bstride_2_data)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_data.buf, __pyx_t_55, __pyx_bstride_0_data, __pyx_t_56, __pyx_bstride_1_data, __pyx_t_57, __pyx_bstride_2_data)));
81: v3 = dx3 * dx3 + dy3 * dy3
/* "vision/features.pyx":81 * dy3 = data[y + 1, x, cc2] - data[y - 1, x, cc2] * dx3 = data[y, x + 1, cc2] - data[y, x - 1, cc2] * v3 = dx3 * dx3 + dy3 * dy3 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * if v2 > v: # pick channel with strongest gradient */ __pyx_v_v3 = ((__pyx_v_dx3 * __pyx_v_dx3) + (__pyx_v_dy3 * __pyx_v_dy3));
82:
83: if v2 > v: # pick channel with strongest gradient
/* "vision/features.pyx":83 * v3 = dx3 * dx3 + dy3 * dy3 * * if v2 > v: # pick channel with strongest gradient #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* v = v2 * dx = dx2 */ __pyx_t_58 = (__pyx_v_v2 > __pyx_v_v); if (__pyx_t_58) {
84: v = v2
/* "vision/features.pyx":84 * * if v2 > v: # pick channel with strongest gradient * v = v2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dx = dx2 * dy = dy2 */ __pyx_v_v = __pyx_v_v2;
85: dx = dx2
/* "vision/features.pyx":85 * if v2 > v: # pick channel with strongest gradient * v = v2 * dx = dx2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dy = dy2 * if v3 > v: */ __pyx_v_dx = __pyx_v_dx2;
86: dy = dy2
/* "vision/features.pyx":86 * v = v2 * dx = dx2 * dy = dy2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if v3 > v: * v = v3 */ __pyx_v_dy = __pyx_v_dy2; goto __pyx_L9; } __pyx_L9:;
87: if v3 > v:
/* "vision/features.pyx":87 * dx = dx2 * dy = dy2 * if v3 > v: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* v = v3 * dx = dx3 */ __pyx_t_58 = (__pyx_v_v3 > __pyx_v_v); if (__pyx_t_58) {
88: v = v3
/* "vision/features.pyx":88 * dy = dy2 * if v3 > v: * v = v3 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dx = dx3 * dy = dy3 */ __pyx_v_v = __pyx_v_v3;
89: dx = dx3
/* "vision/features.pyx":89 * if v3 > v: * v = v3 * dx = dx3 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dy = dy3 * */ __pyx_v_dx = __pyx_v_dx3;
90: dy = dy3
/* "vision/features.pyx":90 * v = v3 * dx = dx3 * dy = dy3 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # snap to one of 9 orientations */ __pyx_v_dy = __pyx_v_dy3; goto __pyx_L10; } __pyx_L10:;
91:
92: # snap to one of 9 orientations
93: best_dot = 0.
/* "vision/features.pyx":93 * * # snap to one of 9 orientations * best_dot = 0. #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* best_o = 0 * for o from 0<
= o<
9: */ __pyx_v_best_dot = 0.;
94: best_o = 0
/* "vision/features.pyx":94 * # snap to one of 9 orientations * best_dot = 0. * best_o = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for o from 0<
= o<
9: * dot = fabs(uu[o] * dx + vv[o] * dy) */ __pyx_v_best_o = 0;
95: for o from 0 <= o < 9:
/* "vision/features.pyx":95 * best_dot = 0. * best_o = 0 * for o from 0<
= o<
9: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dot = fabs(uu[o] * dx + vv[o] * dy) * if dot > best_dot: */ for (__pyx_v_o = 0; __pyx_v_o<
9; __pyx_v_o++) {
96: dot = fabs(uu[o] * dx + vv[o] * dy)
/* "vision/features.pyx":96 * best_o = 0 * for o from 0<
= o<
9: * dot = fabs(uu[o] * dx + vv[o] * dy) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if dot > best_dot: * best_dot = dot */ __pyx_t_59 = __pyx_v_o; if (__pyx_t_59<
0) __pyx_t_59 += __pyx_bshape_0_uu; __pyx_t_60 = __pyx_v_o; if (__pyx_t_60<
0) __pyx_t_60 += __pyx_bshape_0_vv; __pyx_v_dot = fabs((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_uu.buf, __pyx_t_59, __pyx_bstride_0_uu)) * __pyx_v_dx) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_vv.buf, __pyx_t_60, __pyx_bstride_0_vv)) * __pyx_v_dy)));
97: if dot > best_dot:
/* "vision/features.pyx":97 * for o from 0<
= o<
9: * dot = fabs(uu[o] * dx + vv[o] * dy) * if dot > best_dot: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* best_dot = dot * best_o = o */ __pyx_t_58 = (__pyx_v_dot > __pyx_v_best_dot); if (__pyx_t_58) {
98: best_dot = dot
/* "vision/features.pyx":98 * dot = fabs(uu[o] * dx + vv[o] * dy) * if dot > best_dot: * best_dot = dot #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* best_o = o * */ __pyx_v_best_dot = __pyx_v_dot;
99: best_o = o
/* "vision/features.pyx":99 * if dot > best_dot: * best_dot = dot * best_o = o #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # add to 4 histograms around pixel using linear interpolation */ __pyx_v_best_o = __pyx_v_o; goto __pyx_L13; } __pyx_L13:; }
100:
101: # add to 4 histograms around pixel using linear interpolation
102: xp = (<double>(x) + 0.5) / <double>(sbin) - 0.5
/* "vision/features.pyx":102 * * # add to 4 histograms around pixel using linear interpolation * xp = (<
double>(x) + 0.5) /<
double>(sbin) - 0.5 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* yp = (<
double>(y) + 0.5) /<
double>(sbin) - 0.5 * */ __pyx_v_xp = (((((double)__pyx_v_x) + 0.5) / ((double)__pyx_v_sbin)) - 0.5);
103: yp = (<double>(y) + 0.5) / <double>(sbin) - 0.5
/* "vision/features.pyx":103 * # add to 4 histograms around pixel using linear interpolation * xp = (<
double>(x) + 0.5) /<
double>(sbin) - 0.5 * yp = (<
double>(y) + 0.5) /<
double>(sbin) - 0.5 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * ixp =<
int>floor(xp) */ __pyx_v_yp = (((((double)__pyx_v_y) + 0.5) / ((double)__pyx_v_sbin)) - 0.5);
104:
105: ixp = <int>floor(xp)
/* "vision/features.pyx":105 * yp = (<
double>(y) + 0.5) /<
double>(sbin) - 0.5 * * ixp =<
int>floor(xp) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* iyp =<
int>floor(yp) * */ __pyx_v_ixp = ((int)floor(__pyx_v_xp));
106: iyp = <int>floor(yp)
/* "vision/features.pyx":106 * * ixp =<
int>floor(xp) * iyp =<
int>floor(yp) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * vx0 = xp - ixp */ __pyx_v_iyp = ((int)floor(__pyx_v_yp));
107:
108: vx0 = xp - ixp
/* "vision/features.pyx":108 * iyp =<
int>floor(yp) * * vx0 = xp - ixp #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* vy0 = yp - iyp * vx1 = 1.0 - vx0 */ __pyx_v_vx0 = (__pyx_v_xp - __pyx_v_ixp);
109: vy0 = yp - iyp
/* "vision/features.pyx":109 * * vx0 = xp - ixp * vy0 = yp - iyp #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* vx1 = 1.0 - vx0 * vy1 = 1.0 - vy0 */ __pyx_v_vy0 = (__pyx_v_yp - __pyx_v_iyp);
110: vx1 = 1.0 - vx0
/* "vision/features.pyx":110 * vx0 = xp - ixp * vy0 = yp - iyp * vx1 = 1.0 - vx0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* vy1 = 1.0 - vy0 * v = sqrt(v) */ __pyx_v_vx1 = (1.0 - __pyx_v_vx0);
111: vy1 = 1.0 - vy0
/* "vision/features.pyx":111 * vy0 = yp - iyp * vx1 = 1.0 - vx0 * vy1 = 1.0 - vy0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* v = sqrt(v) * */ __pyx_v_vy1 = (1.0 - __pyx_v_vy0);
112: v = sqrt(v)
/* "vision/features.pyx":112 * vx1 = 1.0 - vx0 * vy1 = 1.0 - vy0 * v = sqrt(v) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * if ixp >= 0 and iyp >= 0: */ __pyx_v_v = sqrt(__pyx_v_v);
113:
114: if ixp >= 0 and iyp >= 0:
/* "vision/features.pyx":114 * v = sqrt(v) * * if ixp >= 0 and iyp >= 0: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hist[ixp * blocks0 + iyp + best_o*blocks0*blocks1] += vx1 * vy1 * v * if ixp + 1<
blocks1 and iyp >= 0: */ __pyx_t_58 = (__pyx_v_ixp >= 0); if (__pyx_t_58) { __pyx_t_61 = (__pyx_v_iyp >= 0); __pyx_t_62 = __pyx_t_61; } else { __pyx_t_62 = __pyx_t_58; } if (__pyx_t_62) {
115: hist[ixp * blocks0 + iyp + best_o*blocks0*blocks1] += vx1 * vy1 * v
/* "vision/features.pyx":115 * * if ixp >= 0 and iyp >= 0: * hist[ixp * blocks0 + iyp + best_o*blocks0*blocks1] += vx1 * vy1 * v #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if ixp + 1<
blocks1 and iyp >= 0: * hist[(ixp + 1) * blocks0 + iyp + best_o*blocks0*blocks1] += vx0 * vy1 * v */ __pyx_t_63 = (((__pyx_v_ixp * __pyx_v_blocks0) + __pyx_v_iyp) + ((__pyx_v_best_o * __pyx_v_blocks0) * __pyx_v_blocks1)); if (__pyx_t_63<
0) __pyx_t_63 += __pyx_bshape_0_hist; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_63, __pyx_bstride_0_hist) += ((__pyx_v_vx1 * __pyx_v_vy1) * __pyx_v_v); goto __pyx_L14; } __pyx_L14:;
116: if ixp + 1 < blocks1 and iyp >= 0:
/* "vision/features.pyx":116 * if ixp >= 0 and iyp >= 0: * hist[ixp * blocks0 + iyp + best_o*blocks0*blocks1] += vx1 * vy1 * v * if ixp + 1<
blocks1 and iyp >= 0: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hist[(ixp + 1) * blocks0 + iyp + best_o*blocks0*blocks1] += vx0 * vy1 * v * if ixp >= 0 and iyp + 1<
blocks0: */ __pyx_t_62 = ((__pyx_v_ixp + 1)<
__pyx_v_blocks1); if (__pyx_t_62) { __pyx_t_58 = (__pyx_v_iyp >= 0); __pyx_t_61 = __pyx_t_58; } else { __pyx_t_61 = __pyx_t_62; } if (__pyx_t_61) {
117: hist[(ixp + 1) * blocks0 + iyp + best_o*blocks0*blocks1] += vx0 * vy1 * v
/* "vision/features.pyx":117 * hist[ixp * blocks0 + iyp + best_o*blocks0*blocks1] += vx1 * vy1 * v * if ixp + 1<
blocks1 and iyp >= 0: * hist[(ixp + 1) * blocks0 + iyp + best_o*blocks0*blocks1] += vx0 * vy1 * v #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if ixp >= 0 and iyp + 1<
blocks0: * hist[ixp * blocks0 + (iyp + 1) + best_o*blocks0*blocks1] += vx1 * vy0 * v */ __pyx_t_64 = ((((__pyx_v_ixp + 1) * __pyx_v_blocks0) + __pyx_v_iyp) + ((__pyx_v_best_o * __pyx_v_blocks0) * __pyx_v_blocks1)); if (__pyx_t_64<
0) __pyx_t_64 += __pyx_bshape_0_hist; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_64, __pyx_bstride_0_hist) += ((__pyx_v_vx0 * __pyx_v_vy1) * __pyx_v_v); goto __pyx_L15; } __pyx_L15:;
118: if ixp >= 0 and iyp + 1 < blocks0:
/* "vision/features.pyx":118 * if ixp + 1<
blocks1 and iyp >= 0: * hist[(ixp + 1) * blocks0 + iyp + best_o*blocks0*blocks1] += vx0 * vy1 * v * if ixp >= 0 and iyp + 1<
blocks0: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hist[ixp * blocks0 + (iyp + 1) + best_o*blocks0*blocks1] += vx1 * vy0 * v * if ixp + 1<
blocks1 and iyp + 1<
blocks0: */ __pyx_t_61 = (__pyx_v_ixp >= 0); if (__pyx_t_61) { __pyx_t_62 = ((__pyx_v_iyp + 1)<
__pyx_v_blocks0); __pyx_t_58 = __pyx_t_62; } else { __pyx_t_58 = __pyx_t_61; } if (__pyx_t_58) {
119: hist[ixp * blocks0 + (iyp + 1) + best_o*blocks0*blocks1] += vx1 * vy0 * v
/* "vision/features.pyx":119 * hist[(ixp + 1) * blocks0 + iyp + best_o*blocks0*blocks1] += vx0 * vy1 * v * if ixp >= 0 and iyp + 1<
blocks0: * hist[ixp * blocks0 + (iyp + 1) + best_o*blocks0*blocks1] += vx1 * vy0 * v #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if ixp + 1<
blocks1 and iyp + 1<
blocks0: * hist[(ixp + 1) * blocks0 + (iyp + 1) + best_o * blocks0 * blocks1] += vx0 * vy0 * v */ __pyx_t_65 = (((__pyx_v_ixp * __pyx_v_blocks0) + (__pyx_v_iyp + 1)) + ((__pyx_v_best_o * __pyx_v_blocks0) * __pyx_v_blocks1)); if (__pyx_t_65<
0) __pyx_t_65 += __pyx_bshape_0_hist; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_65, __pyx_bstride_0_hist) += ((__pyx_v_vx1 * __pyx_v_vy0) * __pyx_v_v); goto __pyx_L16; } __pyx_L16:;
120: if ixp + 1 < blocks1 and iyp + 1 < blocks0:
/* "vision/features.pyx":120 * if ixp >= 0 and iyp + 1<
blocks0: * hist[ixp * blocks0 + (iyp + 1) + best_o*blocks0*blocks1] += vx1 * vy0 * v * if ixp + 1<
blocks1 and iyp + 1<
blocks0: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hist[(ixp + 1) * blocks0 + (iyp + 1) + best_o * blocks0 * blocks1] += vx0 * vy0 * v * */ __pyx_t_58 = ((__pyx_v_ixp + 1)<
__pyx_v_blocks1); if (__pyx_t_58) { __pyx_t_61 = ((__pyx_v_iyp + 1)<
__pyx_v_blocks0); __pyx_t_62 = __pyx_t_61; } else { __pyx_t_62 = __pyx_t_58; } if (__pyx_t_62) {
121: hist[(ixp + 1) * blocks0 + (iyp + 1) + best_o * blocks0 * blocks1] += vx0 * vy0 * v
/* "vision/features.pyx":121 * hist[ixp * blocks0 + (iyp + 1) + best_o*blocks0*blocks1] += vx1 * vy0 * v * if ixp + 1<
blocks1 and iyp + 1<
blocks0: * hist[(ixp + 1) * blocks0 + (iyp + 1) + best_o * blocks0 * blocks1] += vx0 * vy0 * v #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # compute energy in each block by summing over orientations */ __pyx_t_66 = ((((__pyx_v_ixp + 1) * __pyx_v_blocks0) + (__pyx_v_iyp + 1)) + ((__pyx_v_best_o * __pyx_v_blocks0) * __pyx_v_blocks1)); if (__pyx_t_66<
0) __pyx_t_66 += __pyx_bshape_0_hist; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_66, __pyx_bstride_0_hist) += ((__pyx_v_vx0 * __pyx_v_vy0) * __pyx_v_v); goto __pyx_L17; } __pyx_L17:; } }
122:
123: # compute energy in each block by summing over orientations
124: for o from 0 <= o < 9:
/* "vision/features.pyx":124 * * # compute energy in each block by summing over orientations * for o from 0<
= o<
9: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for q from 0<
= q<
blocks0 * blocks1: * norm[q] += hist[o * blocks0 * blocks1 + q] * hist[o * blocks0 * blocks1 + q] */ for (__pyx_v_o = 0; __pyx_v_o<
9; __pyx_v_o++) {
125: for q from 0 <= q < blocks0 * blocks1:
/* "vision/features.pyx":125 * # compute energy in each block by summing over orientations * for o from 0<
= o<
9: * for q from 0<
= q<
blocks0 * blocks1: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* norm[q] += hist[o * blocks0 * blocks1 + q] * hist[o * blocks0 * blocks1 + q] * */ __pyx_t_67 = (__pyx_v_blocks0 * __pyx_v_blocks1); for (__pyx_v_q = 0; __pyx_v_q<
__pyx_t_67; __pyx_v_q++) {
126: norm[q] += hist[o * blocks0 * blocks1 + q] * hist[o * blocks0 * blocks1 + q]
/* "vision/features.pyx":126 * for o from 0<
= o<
9: * for q from 0<
= q<
blocks0 * blocks1: * norm[q] += hist[o * blocks0 * blocks1 + q] * hist[o * blocks0 * blocks1 + q] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * # compute normalized values */ __pyx_t_68 = (((__pyx_v_o * __pyx_v_blocks0) * __pyx_v_blocks1) + __pyx_v_q); if (__pyx_t_68<
0) __pyx_t_68 += __pyx_bshape_0_hist; __pyx_t_69 = (((__pyx_v_o * __pyx_v_blocks0) * __pyx_v_blocks1) + __pyx_v_q); if (__pyx_t_69<
0) __pyx_t_69 += __pyx_bshape_0_hist; __pyx_t_70 = __pyx_v_q; if (__pyx_t_70<
0) __pyx_t_70 += __pyx_bshape_0_norm; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_70, __pyx_bstride_0_norm) += ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_68, __pyx_bstride_0_hist)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_69, __pyx_bstride_0_hist))); } }
127:
128: # compute normalized values
129: for x from 0 <= x < out1:
/* "vision/features.pyx":129 * * # compute normalized values * for x from 0<
= x<
out1: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for y from 0<
= y<
out0: * p = (x+1) * blocks0 + y + 1 */ __pyx_t_67 = __pyx_v_out1; for (__pyx_v_x = 0; __pyx_v_x<
__pyx_t_67; __pyx_v_x++) {
130: for y from 0 <= y < out0:
/* "vision/features.pyx":130 * # compute normalized values * for x from 0<
= x<
out1: * for y from 0<
= y<
out0: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* p = (x+1) * blocks0 + y + 1 * n1 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) */ __pyx_t_71 = __pyx_v_out0; for (__pyx_v_y = 0; __pyx_v_y<
__pyx_t_71; __pyx_v_y++) {
131: p = (x+1) * blocks0 + y + 1
/* "vision/features.pyx":131 * for x from 0<
= x<
out1: * for y from 0<
= y<
out0: * p = (x+1) * blocks0 + y + 1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* n1 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = (x+1) * blocks0 + y */ __pyx_v_p = ((((__pyx_v_x + 1) * __pyx_v_blocks0) + __pyx_v_y) + 1);
132: n1 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps)
/* "vision/features.pyx":132 * for y from 0<
= y<
out0: * p = (x+1) * blocks0 + y + 1 * n1 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* p = (x+1) * blocks0 + y * n2 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) */ __pyx_t_72 = __pyx_v_p; if (__pyx_t_72<
0) __pyx_t_72 += __pyx_bshape_0_norm; __pyx_t_21 = (__pyx_v_p + 1); if (__pyx_t_21<
0) __pyx_t_21 += __pyx_bshape_0_norm; __pyx_t_73 = (__pyx_v_p + __pyx_v_blocks0); if (__pyx_t_73<
0) __pyx_t_73 += __pyx_bshape_0_norm; __pyx_t_22 = ((__pyx_v_p + __pyx_v_blocks0) + 1); if (__pyx_t_22<
0) __pyx_t_22 += __pyx_bshape_0_norm; __pyx_v_n1 = (1.0 / sqrt((((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_72, __pyx_bstride_0_norm)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_21, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_73, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_22, __pyx_bstride_0_norm))) + __pyx_v_eps)));
133: p = (x+1) * blocks0 + y
/* "vision/features.pyx":133 * p = (x+1) * blocks0 + y + 1 * n1 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = (x+1) * blocks0 + y #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* n2 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = x * blocks0 + y + 1 */ __pyx_v_p = (((__pyx_v_x + 1) * __pyx_v_blocks0) + __pyx_v_y);
134: n2 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps)
/* "vision/features.pyx":134 * n1 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = (x+1) * blocks0 + y * n2 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* p = x * blocks0 + y + 1 * n3 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) */ __pyx_t_74 = __pyx_v_p; if (__pyx_t_74<
0) __pyx_t_74 += __pyx_bshape_0_norm; __pyx_t_75 = (__pyx_v_p + 1); if (__pyx_t_75<
0) __pyx_t_75 += __pyx_bshape_0_norm; __pyx_t_76 = (__pyx_v_p + __pyx_v_blocks0); if (__pyx_t_76<
0) __pyx_t_76 += __pyx_bshape_0_norm; __pyx_t_77 = ((__pyx_v_p + __pyx_v_blocks0) + 1); if (__pyx_t_77<
0) __pyx_t_77 += __pyx_bshape_0_norm; __pyx_v_n2 = (1.0 / sqrt((((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_74, __pyx_bstride_0_norm)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_75, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_76, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_77, __pyx_bstride_0_norm))) + __pyx_v_eps)));
135: p = x * blocks0 + y + 1
/* "vision/features.pyx":135 * p = (x+1) * blocks0 + y * n2 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = x * blocks0 + y + 1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* n3 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = x * blocks0 + y */ __pyx_v_p = (((__pyx_v_x * __pyx_v_blocks0) + __pyx_v_y) + 1);
136: n3 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps)
/* "vision/features.pyx":136 * n2 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = x * blocks0 + y + 1 * n3 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* p = x * blocks0 + y * n4 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) */ __pyx_t_78 = __pyx_v_p; if (__pyx_t_78<
0) __pyx_t_78 += __pyx_bshape_0_norm; __pyx_t_79 = (__pyx_v_p + 1); if (__pyx_t_79<
0) __pyx_t_79 += __pyx_bshape_0_norm; __pyx_t_80 = (__pyx_v_p + __pyx_v_blocks0); if (__pyx_t_80<
0) __pyx_t_80 += __pyx_bshape_0_norm; __pyx_t_81 = ((__pyx_v_p + __pyx_v_blocks0) + 1); if (__pyx_t_81<
0) __pyx_t_81 += __pyx_bshape_0_norm; __pyx_v_n3 = (1.0 / sqrt((((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_78, __pyx_bstride_0_norm)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_79, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_80, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_81, __pyx_bstride_0_norm))) + __pyx_v_eps)));
137: p = x * blocks0 + y
/* "vision/features.pyx":137 * p = x * blocks0 + y + 1 * n3 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = x * blocks0 + y #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* n4 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * */ __pyx_v_p = ((__pyx_v_x * __pyx_v_blocks0) + __pyx_v_y);
138: n4 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps)
/* "vision/features.pyx":138 * n3 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * p = x * blocks0 + y * n4 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * t1 = 0 */ __pyx_t_82 = __pyx_v_p; if (__pyx_t_82<
0) __pyx_t_82 += __pyx_bshape_0_norm; __pyx_t_83 = (__pyx_v_p + 1); if (__pyx_t_83<
0) __pyx_t_83 += __pyx_bshape_0_norm; __pyx_t_84 = (__pyx_v_p + __pyx_v_blocks0); if (__pyx_t_84<
0) __pyx_t_84 += __pyx_bshape_0_norm; __pyx_t_85 = ((__pyx_v_p + __pyx_v_blocks0) + 1); if (__pyx_t_85<
0) __pyx_t_85 += __pyx_bshape_0_norm; __pyx_v_n4 = (1.0 / sqrt((((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_82, __pyx_bstride_0_norm)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_83, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_84, __pyx_bstride_0_norm))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_norm.buf, __pyx_t_85, __pyx_bstride_0_norm))) + __pyx_v_eps)));
139:
140: t1 = 0
/* "vision/features.pyx":140 * n4 = 1.0 / sqrt(norm[p] + norm[p+1] + norm[p+blocks0] + norm[p+blocks0+1] + eps) * * t1 = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* t2 = 0 * t3 = 0 */ __pyx_v_t1 = 0.0;
141: t2 = 0
/* "vision/features.pyx":141 * * t1 = 0 * t2 = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* t3 = 0 * t4 = 0 */ __pyx_v_t2 = 0.0;
142: t3 = 0
/* "vision/features.pyx":142 * t1 = 0 * t2 = 0 * t3 = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* t4 = 0 * */ __pyx_v_t3 = 0.0;
143: t4 = 0
/* "vision/features.pyx":143 * t2 = 0 * t3 = 0 * t4 = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * srcptr = (x+1) * blocks0 + y + 1 */ __pyx_v_t4 = 0.0;
144:
145: srcptr = (x+1) * blocks0 + y + 1
/* "vision/features.pyx":145 * t4 = 0 * * srcptr = (x+1) * blocks0 + y + 1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for o from 0<
= o<
9: * h1 = hist[srcptr] * n1 */ __pyx_v_srcptr = ((((__pyx_v_x + 1) * __pyx_v_blocks0) + __pyx_v_y) + 1);
146: for o from 0 <= o < 9:
/* "vision/features.pyx":146 * * srcptr = (x+1) * blocks0 + y + 1 * for o from 0<
= o<
9: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h1 = hist[srcptr] * n1 * h2 = hist[srcptr] * n2 */ for (__pyx_v_o = 0; __pyx_v_o<
9; __pyx_v_o++) {
147: h1 = hist[srcptr] * n1
/* "vision/features.pyx":147 * srcptr = (x+1) * blocks0 + y + 1 * for o from 0<
= o<
9: * h1 = hist[srcptr] * n1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h2 = hist[srcptr] * n2 * h3 = hist[srcptr] * n3 */ __pyx_t_86 = __pyx_v_srcptr; if (__pyx_t_86<
0) __pyx_t_86 += __pyx_bshape_0_hist; __pyx_v_h1 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_86, __pyx_bstride_0_hist)) * __pyx_v_n1);
148: h2 = hist[srcptr] * n2
/* "vision/features.pyx":148 * for o from 0<
= o<
9: * h1 = hist[srcptr] * n1 * h2 = hist[srcptr] * n2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h3 = hist[srcptr] * n3 * h4 = hist[srcptr] * n4 */ __pyx_t_87 = __pyx_v_srcptr; if (__pyx_t_87<
0) __pyx_t_87 += __pyx_bshape_0_hist; __pyx_v_h2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_87, __pyx_bstride_0_hist)) * __pyx_v_n2);
149: h3 = hist[srcptr] * n3
/* "vision/features.pyx":149 * h1 = hist[srcptr] * n1 * h2 = hist[srcptr] * n2 * h3 = hist[srcptr] * n3 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h4 = hist[srcptr] * n4 * # for some reason, gcc will not automatically inline */ __pyx_t_88 = __pyx_v_srcptr; if (__pyx_t_88<
0) __pyx_t_88 += __pyx_bshape_0_hist; __pyx_v_h3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_88, __pyx_bstride_0_hist)) * __pyx_v_n3);
150: h4 = hist[srcptr] * n4
/* "vision/features.pyx":150 * h2 = hist[srcptr] * n2 * h3 = hist[srcptr] * n3 * h4 = hist[srcptr] * n4 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* # for some reason, gcc will not automatically inline * # the min function here, so we just do it ourselves */ __pyx_t_89 = __pyx_v_srcptr; if (__pyx_t_89<
0) __pyx_t_89 += __pyx_bshape_0_hist; __pyx_v_h4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_89, __pyx_bstride_0_hist)) * __pyx_v_n4);
151: # for some reason, gcc will not automatically inline
152: # the min function here, so we just do it ourselves
153: # for impressive speedups
154: if h1 > 0.2:
/* "vision/features.pyx":154 * # the min function here, so we just do it ourselves * # for impressive speedups * if h1 > 0.2: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h1 = 0.2 * if h2 > 0.2: */ __pyx_t_62 = (__pyx_v_h1 > 0.2); if (__pyx_t_62) {
155: h1 = 0.2
/* "vision/features.pyx":155 * # for impressive speedups * if h1 > 0.2: * h1 = 0.2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if h2 > 0.2: * h2 = 0.2 */ __pyx_v_h1 = 0.2; goto __pyx_L28; } __pyx_L28:;
156: if h2 > 0.2:
/* "vision/features.pyx":156 * if h1 > 0.2: * h1 = 0.2 * if h2 > 0.2: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h2 = 0.2 * if h3 > 0.2: */ __pyx_t_62 = (__pyx_v_h2 > 0.2); if (__pyx_t_62) {
157: h2 = 0.2
/* "vision/features.pyx":157 * h1 = 0.2 * if h2 > 0.2: * h2 = 0.2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if h3 > 0.2: * h3 = 0.2 */ __pyx_v_h2 = 0.2; goto __pyx_L29; } __pyx_L29:;
158: if h3 > 0.2:
/* "vision/features.pyx":158 * if h2 > 0.2: * h2 = 0.2 * if h3 > 0.2: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h3 = 0.2 * if h4 > 0.2: */ __pyx_t_62 = (__pyx_v_h3 > 0.2); if (__pyx_t_62) {
159: h3 = 0.2
/* "vision/features.pyx":159 * h2 = 0.2 * if h3 > 0.2: * h3 = 0.2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if h4 > 0.2: * h4 = 0.2 */ __pyx_v_h3 = 0.2; goto __pyx_L30; } __pyx_L30:;
160: if h4 > 0.2:
/* "vision/features.pyx":160 * if h3 > 0.2: * h3 = 0.2 * if h4 > 0.2: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* h4 = 0.2 * feat[y, x, o] = 0.5 * (h1 + h2 + h3 + h4) */ __pyx_t_62 = (__pyx_v_h4 > 0.2); if (__pyx_t_62) {
161: h4 = 0.2
/* "vision/features.pyx":161 * h3 = 0.2 * if h4 > 0.2: * h4 = 0.2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* feat[y, x, o] = 0.5 * (h1 + h2 + h3 + h4) * t1 += h1 */ __pyx_v_h4 = 0.2; goto __pyx_L31; } __pyx_L31:;
162: feat[y, x, o] = 0.5 * (h1 + h2 + h3 + h4)
/* "vision/features.pyx":162 * if h4 > 0.2: * h4 = 0.2 * feat[y, x, o] = 0.5 * (h1 + h2 + h3 + h4) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* t1 += h1 * t2 += h2 */ __pyx_t_90 = __pyx_v_y; __pyx_t_91 = __pyx_v_x; __pyx_t_92 = __pyx_v_o; if (__pyx_t_90<
0) __pyx_t_90 += __pyx_bshape_0_feat; if (__pyx_t_91<
0) __pyx_t_91 += __pyx_bshape_1_feat; if (__pyx_t_92<
0) __pyx_t_92 += __pyx_bshape_2_feat; *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_feat.buf, __pyx_t_90, __pyx_bstride_0_feat, __pyx_t_91, __pyx_bstride_1_feat, __pyx_t_92, __pyx_bstride_2_feat) = (0.5 * (((__pyx_v_h1 + __pyx_v_h2) + __pyx_v_h3) + __pyx_v_h4));
163: t1 += h1
/* "vision/features.pyx":163 * h4 = 0.2 * feat[y, x, o] = 0.5 * (h1 + h2 + h3 + h4) * t1 += h1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* t2 += h2 * t3 += h3 */ __pyx_v_t1 = (__pyx_v_t1 + __pyx_v_h1);
164: t2 += h2
/* "vision/features.pyx":164 * feat[y, x, o] = 0.5 * (h1 + h2 + h3 + h4) * t1 += h1 * t2 += h2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* t3 += h3 * t4 += h4 */ __pyx_v_t2 = (__pyx_v_t2 + __pyx_v_h2);
165: t3 += h3
/* "vision/features.pyx":165 * t1 += h1 * t2 += h2 * t3 += h3 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* t4 += h4 * srcptr += blocks0 * blocks1 */ __pyx_v_t3 = (__pyx_v_t3 + __pyx_v_h3);
166: t4 += h4
/* "vision/features.pyx":166 * t2 += h2 * t3 += h3 * t4 += h4 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* srcptr += blocks0 * blocks1 * */ __pyx_v_t4 = (__pyx_v_t4 + __pyx_v_h4);
167: srcptr += blocks0 * blocks1
/* "vision/features.pyx":167 * t3 += h3 * t4 += h4 * srcptr += blocks0 * blocks1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * feat[y, x, 9] = 0.2357 * t1 */ __pyx_v_srcptr = (__pyx_v_srcptr + (__pyx_v_blocks0 * __pyx_v_blocks1)); }
168:
169: feat[y, x, 9] = 0.2357 * t1
/* "vision/features.pyx":169 * srcptr += blocks0 * blocks1 * * feat[y, x, 9] = 0.2357 * t1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dstptr += out0 * out1 * feat[y, x, 10] = 0.2357 * t2 */ __pyx_t_93 = __pyx_v_y; __pyx_t_94 = __pyx_v_x; __pyx_t_95 = 9; if (__pyx_t_93<
0) __pyx_t_93 += __pyx_bshape_0_feat; if (__pyx_t_94<
0) __pyx_t_94 += __pyx_bshape_1_feat; if (__pyx_t_95<
0) __pyx_t_95 += __pyx_bshape_2_feat; *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_feat.buf, __pyx_t_93, __pyx_bstride_0_feat, __pyx_t_94, __pyx_bstride_1_feat, __pyx_t_95, __pyx_bstride_2_feat) = (0.2357 * __pyx_v_t1);
170: dstptr += out0 * out1
/* "vision/features.pyx":170 * * feat[y, x, 9] = 0.2357 * t1 * dstptr += out0 * out1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* feat[y, x, 10] = 0.2357 * t2 * dstptr += out0 * out1 */ __pyx_v_dstptr = (__pyx_v_dstptr + (__pyx_v_out0 * __pyx_v_out1));
171: feat[y, x, 10] = 0.2357 * t2
/* "vision/features.pyx":171 * feat[y, x, 9] = 0.2357 * t1 * dstptr += out0 * out1 * feat[y, x, 10] = 0.2357 * t2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dstptr += out0 * out1 * feat[y, x, 11] = 0.2357 * t3 */ __pyx_t_96 = __pyx_v_y; __pyx_t_97 = __pyx_v_x; __pyx_t_98 = 10; if (__pyx_t_96<
0) __pyx_t_96 += __pyx_bshape_0_feat; if (__pyx_t_97<
0) __pyx_t_97 += __pyx_bshape_1_feat; if (__pyx_t_98<
0) __pyx_t_98 += __pyx_bshape_2_feat; *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_feat.buf, __pyx_t_96, __pyx_bstride_0_feat, __pyx_t_97, __pyx_bstride_1_feat, __pyx_t_98, __pyx_bstride_2_feat) = (0.2357 * __pyx_v_t2);
172: dstptr += out0 * out1
/* "vision/features.pyx":172 * dstptr += out0 * out1 * feat[y, x, 10] = 0.2357 * t2 * dstptr += out0 * out1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* feat[y, x, 11] = 0.2357 * t3 * dstptr += out0 * out1 */ __pyx_v_dstptr = (__pyx_v_dstptr + (__pyx_v_out0 * __pyx_v_out1));
173: feat[y, x, 11] = 0.2357 * t3
/* "vision/features.pyx":173 * feat[y, x, 10] = 0.2357 * t2 * dstptr += out0 * out1 * feat[y, x, 11] = 0.2357 * t3 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dstptr += out0 * out1 * feat[y, x, 12] = 0.2357 * t4 */ __pyx_t_99 = __pyx_v_y; __pyx_t_100 = __pyx_v_x; __pyx_t_101 = 11; if (__pyx_t_99<
0) __pyx_t_99 += __pyx_bshape_0_feat; if (__pyx_t_100<
0) __pyx_t_100 += __pyx_bshape_1_feat; if (__pyx_t_101<
0) __pyx_t_101 += __pyx_bshape_2_feat; *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_feat.buf, __pyx_t_99, __pyx_bstride_0_feat, __pyx_t_100, __pyx_bstride_1_feat, __pyx_t_101, __pyx_bstride_2_feat) = (0.2357 * __pyx_v_t3);
174: dstptr += out0 * out1
/* "vision/features.pyx":174 * dstptr += out0 * out1 * feat[y, x, 11] = 0.2357 * t3 * dstptr += out0 * out1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* feat[y, x, 12] = 0.2357 * t4 * */ __pyx_v_dstptr = (__pyx_v_dstptr + (__pyx_v_out0 * __pyx_v_out1));
175: feat[y, x, 12] = 0.2357 * t4
/* "vision/features.pyx":175 * feat[y, x, 11] = 0.2357 * t3 * dstptr += out0 * out1 * feat[y, x, 12] = 0.2357 * t4 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * return feat */ __pyx_t_102 = __pyx_v_y; __pyx_t_103 = __pyx_v_x; __pyx_t_104 = 12; if (__pyx_t_102<
0) __pyx_t_102 += __pyx_bshape_0_feat; if (__pyx_t_103<
0) __pyx_t_103 += __pyx_bshape_1_feat; if (__pyx_t_104<
0) __pyx_t_104 += __pyx_bshape_2_feat; *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_feat.buf, __pyx_t_102, __pyx_bstride_0_feat, __pyx_t_103, __pyx_bstride_1_feat, __pyx_t_104, __pyx_bstride_2_feat) = (0.2357 * __pyx_v_t4); } }
176:
177: return feat
/* "vision/features.pyx":177 * feat[y, x, 12] = 0.2357 * t4 * * return feat #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cpdef hogpad(np.ndarray[np.double_t, ndim=3] hog): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_feat)); __pyx_r = ((PyObject *)__pyx_v_feat); 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_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_vv); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_feat); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hist); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_norm); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_uu); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("vision.features.hog", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_vv); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_feat); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hist); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_norm); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_uu); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_data); __Pyx_XDECREF((PyObject *)__pyx_v_feat); __Pyx_XDECREF((PyObject *)__pyx_v_hist); __Pyx_XDECREF((PyObject *)__pyx_v_norm); __Pyx_XDECREF((PyObject *)__pyx_v_uu); __Pyx_XDECREF((PyObject *)__pyx_v_vv); __Pyx_XDECREF(__pyx_v_width); __Pyx_XDECREF(__pyx_v_height); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
178:
179: cpdef hogpad(np.ndarray[np.double_t, ndim=3] hog):
/* "vision/features.pyx":179 * return feat * * cpdef hogpad(np.ndarray[np.double_t, ndim=3] hog): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef np.ndarray[np.double_t, ndim=3] out * cdef int i, j, k */ static PyObject *__pyx_pf_6vision_8features_1hogpad(PyObject *__pyx_self, PyObject *__pyx_v_hog); /*proto*/ static PyObject *__pyx_f_6vision_8features_hogpad(PyArrayObject *__pyx_v_hog, int __pyx_skip_dispatch) { PyArrayObject *__pyx_v_out = 0; int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; int __pyx_v_w; int __pyx_v_h; int __pyx_v_z; Py_buffer __pyx_bstruct_hog; Py_ssize_t __pyx_bstride_0_hog = 0; Py_ssize_t __pyx_bstride_1_hog = 0; Py_ssize_t __pyx_bstride_2_hog = 0; Py_ssize_t __pyx_bshape_0_hog = 0; Py_ssize_t __pyx_bshape_1_hog = 0; Py_ssize_t __pyx_bshape_2_hog = 0; Py_buffer __pyx_bstruct_out; Py_ssize_t __pyx_bstride_0_out = 0; Py_ssize_t __pyx_bstride_1_out = 0; Py_ssize_t __pyx_bstride_2_out = 0; Py_ssize_t __pyx_bshape_0_out = 0; Py_ssize_t __pyx_bshape_1_out = 0; Py_ssize_t __pyx_bshape_2_out = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("hogpad"); __pyx_bstruct_out.buf = NULL; __pyx_bstruct_hog.buf = NULL; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hog, (PyObject*)__pyx_v_hog, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_hog = __pyx_bstruct_hog.strides[0]; __pyx_bstride_1_hog = __pyx_bstruct_hog.strides[1]; __pyx_bstride_2_hog = __pyx_bstruct_hog.strides[2]; __pyx_bshape_0_hog = __pyx_bstruct_hog.shape[0]; __pyx_bshape_1_hog = __pyx_bstruct_hog.shape[1]; __pyx_bshape_2_hog = __pyx_bstruct_hog.shape[2]; /* "vision/features.pyx":179 * return feat * * cpdef hogpad(np.ndarray[np.double_t, ndim=3] hog): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef np.ndarray[np.double_t, ndim=3] out * cdef int i, j, k */ static PyObject *__pyx_pf_6vision_8features_1hogpad(PyObject *__pyx_self, PyObject *__pyx_v_hog); /*proto*/ static char __pyx_doc_6vision_8features_1hogpad[] = "hogpad(ndarray hog)"; static PyObject *__pyx_pf_6vision_8features_1hogpad(PyObject *__pyx_self, PyObject *__pyx_v_hog) { Py_buffer __pyx_bstruct_hog; Py_ssize_t __pyx_bstride_0_hog = 0; Py_ssize_t __pyx_bstride_1_hog = 0; Py_ssize_t __pyx_bstride_2_hog = 0; Py_ssize_t __pyx_bshape_0_hog = 0; Py_ssize_t __pyx_bshape_1_hog = 0; Py_ssize_t __pyx_bshape_2_hog = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("hogpad"); __pyx_self = __pyx_self; __pyx_bstruct_hog.buf = NULL; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hog), __pyx_ptype_5numpy_ndarray, 1, "hog", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hog, (PyObject*)__pyx_v_hog, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_hog = __pyx_bstruct_hog.strides[0]; __pyx_bstride_1_hog = __pyx_bstruct_hog.strides[1]; __pyx_bstride_2_hog = __pyx_bstruct_hog.strides[2]; __pyx_bshape_0_hog = __pyx_bstruct_hog.shape[0]; __pyx_bshape_1_hog = __pyx_bstruct_hog.shape[1]; __pyx_bshape_2_hog = __pyx_bstruct_hog.shape[2]; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6vision_8features_hogpad(((PyArrayObject *)__pyx_v_hog), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __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); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hog); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("vision.features.hogpad", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hog); __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
180: cdef np.ndarray[np.double_t, ndim=3] out
181: cdef int i, j, k
182: cdef int w = hog.shape[0], h = hog.shape[1], z = hog.shape[2]
/* "vision/features.pyx":182 * cdef np.ndarray[np.double_t, ndim=3] out * cdef int i, j, k * cdef int w = hog.shape[0], h = hog.shape[1], z = hog.shape[2] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out = np.zeros((w + 2, h + 2, z)) * */ __pyx_v_w = (__pyx_v_hog->dimensions[0]); __pyx_v_h = (__pyx_v_hog->dimensions[1]); __pyx_v_z = (__pyx_v_hog->dimensions[2]);
183: out = np.zeros((w + 2, h + 2, z))
/* "vision/features.pyx":183 * cdef int i, j, k * cdef int w = hog.shape[0], h = hog.shape[1], z = hog.shape[2] * out = np.zeros((w + 2, h + 2, z)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * for i in range(w): */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __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_w + 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong((__pyx_v_h + 2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyInt_FromLong(__pyx_v_z); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack); if (unlikely(__pyx_t_7<
0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 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_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bstride_2_out = __pyx_bstruct_out.strides[2]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; __pyx_bshape_2_out = __pyx_bstruct_out.shape[2]; if (unlikely(__pyx_t_7<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __pyx_v_out = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0;
184:
185: for i in range(w):
/* "vision/features.pyx":185 * out = np.zeros((w + 2, h + 2, z)) * * for i in range(w): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for j in range(h): * for k in range(z): */ __pyx_t_7 = __pyx_v_w; for (__pyx_t_11 = 0; __pyx_t_11<
__pyx_t_7; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11;
186: for j in range(h):
/* "vision/features.pyx":186 * * for i in range(w): * for j in range(h): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for k in range(z): * out[i+1, j+1, k] = hog[i, j, k] */ __pyx_t_12 = __pyx_v_h; for (__pyx_t_13 = 0; __pyx_t_13<
__pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13;
187: for k in range(z):
/* "vision/features.pyx":187 * for i in range(w): * for j in range(h): * for k in range(z): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out[i+1, j+1, k] = hog[i, j, k] * return out */ __pyx_t_14 = __pyx_v_z; for (__pyx_t_15 = 0; __pyx_t_15<
__pyx_t_14; __pyx_t_15+=1) { __pyx_v_k = __pyx_t_15;
188: out[i+1, j+1, k] = hog[i, j, k]
/* "vision/features.pyx":188 * for j in range(h): * for k in range(z): * out[i+1, j+1, k] = hog[i, j, k] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return out * */ __pyx_t_16 = __pyx_v_i; __pyx_t_17 = __pyx_v_j; __pyx_t_18 = __pyx_v_k; if (__pyx_t_16<
0) __pyx_t_16 += __pyx_bshape_0_hog; if (__pyx_t_17<
0) __pyx_t_17 += __pyx_bshape_1_hog; if (__pyx_t_18<
0) __pyx_t_18 += __pyx_bshape_2_hog; __pyx_t_19 = (__pyx_v_i + 1); __pyx_t_20 = (__pyx_v_j + 1); __pyx_t_21 = __pyx_v_k; if (__pyx_t_19<
0) __pyx_t_19 += __pyx_bshape_0_out; if (__pyx_t_20<
0) __pyx_t_20 += __pyx_bshape_1_out; if (__pyx_t_21<
0) __pyx_t_21 += __pyx_bshape_2_out; *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_19, __pyx_bstride_0_out, __pyx_t_20, __pyx_bstride_1_out, __pyx_t_21, __pyx_bstride_2_out) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hog.buf, __pyx_t_16, __pyx_bstride_0_hog, __pyx_t_17, __pyx_bstride_1_hog, __pyx_t_18, __pyx_bstride_2_hog)); } } }
189: return out
/* "vision/features.pyx":189 * for k in range(z): * out[i+1, j+1, k] = hog[i, j, k] * return out #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cpdef rgbhist(im, int binsize = 8): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_out)); __pyx_r = ((PyObject *)__pyx_v_out); 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_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hog); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("vision.features.hogpad", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hog); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
190:
191: cpdef rgbhist(im, int binsize = 8):
/* "vision/features.pyx":191 * return out * * cpdef rgbhist(im, int binsize = 8): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Computes an RGB color histogram with a binsize. */ static PyObject *__pyx_pf_6vision_8features_2rgbhist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6vision_8features_rgbhist(PyObject *__pyx_v_im, int __pyx_skip_dispatch, struct __pyx_opt_args_6vision_8features_rgbhist *__pyx_optional_args) { int __pyx_v_binsize = ((int)8); int __pyx_v_w; int __pyx_v_h; PyArrayObject *__pyx_v_data = 0; PyArrayObject *__pyx_v_hist = 0; long __pyx_v_i; long __pyx_v_j; long __pyx_v_bin; Py_buffer __pyx_bstruct_hist; Py_ssize_t __pyx_bstride_0_hist = 0; Py_ssize_t __pyx_bshape_0_hist = 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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rgbhist"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_binsize = __pyx_optional_args->binsize; } } __pyx_bstruct_data.buf = NULL; __pyx_bstruct_hist.buf = NULL; /* "vision/features.pyx":191 * return out * * cpdef rgbhist(im, int binsize = 8): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Computes an RGB color histogram with a binsize. */ static PyObject *__pyx_pf_6vision_8features_2rgbhist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6vision_8features_2rgbhist[] = "rgbhist(im, int binsize=8)\n\n Computes an RGB color histogram with a binsize.\n "; static PyObject *__pyx_pf_6vision_8features_2rgbhist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_im = 0; int __pyx_v_binsize; PyObject *__pyx_r = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__im,&__pyx_n_s__binsize,0}; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rgbhist"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { 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__im); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__binsize); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rgbhist")<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_im = values[0]; if (values[1]) { __pyx_v_binsize = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_binsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_binsize = ((int)8); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("rgbhist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("vision.features.rgbhist", __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.binsize = __pyx_v_binsize; __pyx_t_1 = __pyx_f_6vision_8features_rgbhist(__pyx_v_im, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __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.features.rgbhist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
192: """
193: Computes an RGB color histogram with a binsize.
194: """
195: cdef int w = im.size[0], h = im.size[1]
/* "vision/features.pyx":195 * Computes an RGB color histogram with a binsize. * """ * cdef int w = im.size[0], h = im.size[1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im) * cdef np.ndarray[np.double_t, ndim=1] hist */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __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 = 195; __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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_w = __pyx_t_3; __pyx_t_2 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __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 = 195; __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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_h = __pyx_t_3;
196: cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im)
/* "vision/features.pyx":196 * """ * cdef int w = im.size[0], h = im.size[1] * cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef np.ndarray[np.double_t, ndim=1] hist * hist = np.zeros(binsize * binsize * binsize) */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __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 = 196; __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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_im); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_im); __Pyx_GIVEREF(__pyx_v_im); __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_data.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__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]; } } __pyx_t_5 = 0; __pyx_v_data = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
197: cdef np.ndarray[np.double_t, ndim=1] hist
198: hist = np.zeros(binsize * binsize * binsize)
/* "vision/features.pyx":198 * cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im) * cdef np.ndarray[np.double_t, ndim=1] hist * hist = np.zeros(binsize * binsize * binsize) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * for i from 0<
= i<
w: */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(((__pyx_v_binsize * __pyx_v_binsize) * __pyx_v_binsize)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hist); __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_hist, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_3<
0)) { PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_hist, (PyObject*)__pyx_v_hist, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); } } __pyx_bstride_0_hist = __pyx_bstruct_hist.strides[0]; __pyx_bshape_0_hist = __pyx_bstruct_hist.shape[0]; if (unlikely(__pyx_t_3<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __pyx_v_hist = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
199:
200: for i from 0 <= i < w:
/* "vision/features.pyx":200 * hist = np.zeros(binsize * binsize * binsize) * * for i from 0<
= i<
w: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for j from 0<
= j<
h: * bin = (<
int>data[j,i,0]) / (256/binsize) */ __pyx_t_3 = __pyx_v_w; for (__pyx_v_i = 0; __pyx_v_i<
__pyx_t_3; __pyx_v_i++) {
201: for j from 0 <= j < h:
/* "vision/features.pyx":201 * * for i from 0<
= i<
w: * for j from 0<
= j<
h: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* bin = (<
int>data[j,i,0]) / (256/binsize) * bin += (<
int>data[j,i,1]) / (256/binsize) * binsize */ __pyx_t_10 = __pyx_v_h; for (__pyx_v_j = 0; __pyx_v_j<
__pyx_t_10; __pyx_v_j++) {
202: bin = (<int>data[j,i,0]) / (256/binsize)
/* "vision/features.pyx":202 * for i from 0<
= i<
w: * for j from 0<
= j<
h: * bin = (<
int>data[j,i,0]) / (256/binsize) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* bin += (<
int>data[j,i,1]) / (256/binsize) * binsize * bin += (<
int>data[j,i,2]) / (256/binsize) * binsize * binsize */ __pyx_t_11 = __pyx_v_j; __pyx_t_12 = __pyx_v_i; __pyx_t_13 = 0; if (__pyx_t_11<
0) __pyx_t_11 += __pyx_bshape_0_data; if (__pyx_t_12<
0) __pyx_t_12 += __pyx_bshape_1_data; if (__pyx_t_13<
0) __pyx_t_13 += __pyx_bshape_2_data; __pyx_v_bin = (((int)(*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_data.buf, __pyx_t_11, __pyx_bstride_0_data, __pyx_t_12, __pyx_bstride_1_data, __pyx_t_13, __pyx_bstride_2_data))) / (256 / __pyx_v_binsize));
203: bin += (<int>data[j,i,1]) / (256/binsize) * binsize
/* "vision/features.pyx":203 * for j from 0<
= j<
h: * bin = (<
int>data[j,i,0]) / (256/binsize) * bin += (<
int>data[j,i,1]) / (256/binsize) * binsize #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* bin += (<
int>data[j,i,2]) / (256/binsize) * binsize * binsize * hist[bin] += 1 */ __pyx_t_14 = __pyx_v_j; __pyx_t_15 = __pyx_v_i; __pyx_t_16 = 1; if (__pyx_t_14<
0) __pyx_t_14 += __pyx_bshape_0_data; if (__pyx_t_15<
0) __pyx_t_15 += __pyx_bshape_1_data; if (__pyx_t_16<
0) __pyx_t_16 += __pyx_bshape_2_data; __pyx_v_bin = (__pyx_v_bin + ((((int)(*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_data.buf, __pyx_t_14, __pyx_bstride_0_data, __pyx_t_15, __pyx_bstride_1_data, __pyx_t_16, __pyx_bstride_2_data))) / (256 / __pyx_v_binsize)) * __pyx_v_binsize));
204: bin += (<int>data[j,i,2]) / (256/binsize) * binsize * binsize
/* "vision/features.pyx":204 * bin = (<
int>data[j,i,0]) / (256/binsize) * bin += (<
int>data[j,i,1]) / (256/binsize) * binsize * bin += (<
int>data[j,i,2]) / (256/binsize) * binsize * binsize #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hist[bin] += 1 * return hist */ __pyx_t_17 = __pyx_v_j; __pyx_t_18 = __pyx_v_i; __pyx_t_19 = 2; if (__pyx_t_17<
0) __pyx_t_17 += __pyx_bshape_0_data; if (__pyx_t_18<
0) __pyx_t_18 += __pyx_bshape_1_data; if (__pyx_t_19<
0) __pyx_t_19 += __pyx_bshape_2_data; __pyx_v_bin = (__pyx_v_bin + (((((int)(*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_data.buf, __pyx_t_17, __pyx_bstride_0_data, __pyx_t_18, __pyx_bstride_1_data, __pyx_t_19, __pyx_bstride_2_data))) / (256 / __pyx_v_binsize)) * __pyx_v_binsize) * __pyx_v_binsize));
205: hist[bin] += 1
/* "vision/features.pyx":205 * bin += (<
int>data[j,i,1]) / (256/binsize) * binsize * bin += (<
int>data[j,i,2]) / (256/binsize) * binsize * binsize * hist[bin] += 1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return hist * */ __pyx_t_20 = __pyx_v_bin; if (__pyx_t_20<
0) __pyx_t_20 += __pyx_bshape_0_hist; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_hist.buf, __pyx_t_20, __pyx_bstride_0_hist) += 1; } }
206: return hist
/* "vision/features.pyx":206 * bin += (<
int>data[j,i,2]) / (256/binsize) * binsize * binsize * hist[bin] += 1 * return hist #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * cpdef rgbmean(im): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_hist)); __pyx_r = ((PyObject *)__pyx_v_hist); 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); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hist); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("vision.features.rgbhist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_hist); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_data); __Pyx_XDECREF((PyObject *)__pyx_v_hist); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
207:
208: cpdef rgbmean(im):
/* "vision/features.pyx":208 * return hist * * cpdef rgbmean(im): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Computes mean and covariances of RGB colors. */ static PyObject *__pyx_pf_6vision_8features_3rgbmean(PyObject *__pyx_self, PyObject *__pyx_v_im); /*proto*/ static PyObject *__pyx_f_6vision_8features_rgbmean(PyObject *__pyx_v_im, int __pyx_skip_dispatch) { int __pyx_v_w; int __pyx_v_h; double __pyx_v_r; double __pyx_v_g; double __pyx_v_b; PyArrayObject *__pyx_v_data = 0; PyArrayObject *__pyx_v_out = 0; int __pyx_v_i; int __pyx_v_j; 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_out; Py_ssize_t __pyx_bstride_0_out = 0; Py_ssize_t __pyx_bshape_0_out = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rgbmean"); __pyx_bstruct_data.buf = NULL; __pyx_bstruct_out.buf = NULL; /* "vision/features.pyx":208 * return hist * * cpdef rgbmean(im): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Computes mean and covariances of RGB colors. */ static PyObject *__pyx_pf_6vision_8features_3rgbmean(PyObject *__pyx_self, PyObject *__pyx_v_im); /*proto*/ static char __pyx_doc_6vision_8features_3rgbmean[] = "rgbmean(im)\n\n Computes mean and covariances of RGB colors.\n "; static PyObject *__pyx_pf_6vision_8features_3rgbmean(PyObject *__pyx_self, PyObject *__pyx_v_im) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rgbmean"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6vision_8features_rgbmean(__pyx_v_im, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __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.features.rgbmean", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
209: """
210: Computes mean and covariances of RGB colors.
211: """
212: cdef int w = im.size[0], h = im.size[1]
/* "vision/features.pyx":212 * Computes mean and covariances of RGB colors. * """ * cdef int w = im.size[0], h = im.size[1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef double r, g, b * cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im) */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __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 = 212; __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 = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_w = __pyx_t_3; __pyx_t_2 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __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 = 212; __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 = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_h = __pyx_t_3;
213: cdef double r, g, b
214: cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im)
/* "vision/features.pyx":214 * cdef int w = im.size[0], h = im.size[1] * cdef double r, g, b * cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef np.ndarray[np.double_t, ndim=1] out = np.zeros(9) * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __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 = 214; __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_im); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_im); __Pyx_GIVEREF(__pyx_v_im); __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_data.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__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]; } } __pyx_t_5 = 0; __pyx_v_data = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
215: cdef np.ndarray[np.double_t, ndim=1] out = np.zeros(9)
/* "vision/features.pyx":215 * cdef double r, g, b * cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im) * cdef np.ndarray[np.double_t, ndim=1] out = np.zeros(9) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * for i in range(w): */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_out.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; } } __pyx_t_6 = 0; __pyx_v_out = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "vision/features.pyx":215 * cdef double r, g, b * cdef np.ndarray[np.uint8_t, ndim=3] data = np.asarray(im) * cdef np.ndarray[np.double_t, ndim=1] out = np.zeros(9) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * for i in range(w): */ __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1)); __Pyx_INCREF(__pyx_int_9); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_9); __Pyx_GIVEREF(__pyx_int_9); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
216:
217: for i in range(w):
/* "vision/features.pyx":217 * cdef np.ndarray[np.double_t, ndim=1] out = np.zeros(9) * * for i in range(w): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* for j in range(h): * r = data[j, i, 0] / 255. */ __pyx_t_3 = __pyx_v_w; for (__pyx_t_7 = 0; __pyx_t_7<
__pyx_t_3; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7;
218: for j in range(h):
/* "vision/features.pyx":218 * * for i in range(w): * for j in range(h): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* r = data[j, i, 0] / 255. * g = data[j, i, 1] / 255. */ __pyx_t_8 = __pyx_v_h; for (__pyx_t_9 = 0; __pyx_t_9<
__pyx_t_8; __pyx_t_9+=1) { __pyx_v_j = __pyx_t_9;
219: r = data[j, i, 0] / 255.
/* "vision/features.pyx":219 * for i in range(w): * for j in range(h): * r = data[j, i, 0] / 255. #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* g = data[j, i, 1] / 255. * b = data[j, i, 2] / 255. */ __pyx_t_10 = __pyx_v_j; __pyx_t_11 = __pyx_v_i; __pyx_t_12 = 0; if (__pyx_t_10<
0) __pyx_t_10 += __pyx_bshape_0_data; if (__pyx_t_11<
0) __pyx_t_11 += __pyx_bshape_1_data; if (__pyx_t_12<
0) __pyx_t_12 += __pyx_bshape_2_data; __pyx_v_r = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_data.buf, __pyx_t_10, __pyx_bstride_0_data, __pyx_t_11, __pyx_bstride_1_data, __pyx_t_12, __pyx_bstride_2_data)) / 255.);
220: g = data[j, i, 1] / 255.
/* "vision/features.pyx":220 * for j in range(h): * r = data[j, i, 0] / 255. * g = data[j, i, 1] / 255. #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* b = data[j, i, 2] / 255. * */ __pyx_t_13 = __pyx_v_j; __pyx_t_14 = __pyx_v_i; __pyx_t_15 = 1; if (__pyx_t_13<
0) __pyx_t_13 += __pyx_bshape_0_data; if (__pyx_t_14<
0) __pyx_t_14 += __pyx_bshape_1_data; if (__pyx_t_15<
0) __pyx_t_15 += __pyx_bshape_2_data; __pyx_v_g = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_data.buf, __pyx_t_13, __pyx_bstride_0_data, __pyx_t_14, __pyx_bstride_1_data, __pyx_t_15, __pyx_bstride_2_data)) / 255.);
221: b = data[j, i, 2] / 255.
/* "vision/features.pyx":221 * r = data[j, i, 0] / 255. * g = data[j, i, 1] / 255. * b = data[j, i, 2] / 255. #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * out[0] += r */ __pyx_t_16 = __pyx_v_j; __pyx_t_17 = __pyx_v_i; __pyx_t_18 = 2; 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_b = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_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)) / 255.);
222:
223: out[0] += r
/* "vision/features.pyx":223 * b = data[j, i, 2] / 255. * * out[0] += r #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out[1] += g * out[2] += b */ __pyx_t_19 = 0; if (__pyx_t_19<
0) __pyx_t_19 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_19, __pyx_bstride_0_out) += __pyx_v_r;
224: out[1] += g
/* "vision/features.pyx":224 * * out[0] += r * out[1] += g #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out[2] += b * */ __pyx_t_20 = 1; if (__pyx_t_20<
0) __pyx_t_20 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_20, __pyx_bstride_0_out) += __pyx_v_g;
225: out[2] += b
/* "vision/features.pyx":225 * out[0] += r * out[1] += g * out[2] += b #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * out[3] += r * r */ __pyx_t_21 = 2; if (__pyx_t_21<
0) __pyx_t_21 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_21, __pyx_bstride_0_out) += __pyx_v_b;
226:
227: out[3] += r * r
/* "vision/features.pyx":227 * out[2] += b * * out[3] += r * r #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out[4] += r * g * out[5] += r * b */ __pyx_t_22 = 3; if (__pyx_t_22<
0) __pyx_t_22 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_22, __pyx_bstride_0_out) += (__pyx_v_r * __pyx_v_r);
228: out[4] += r * g
/* "vision/features.pyx":228 * * out[3] += r * r * out[4] += r * g #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out[5] += r * b * */ __pyx_t_23 = 4; if (__pyx_t_23<
0) __pyx_t_23 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_23, __pyx_bstride_0_out) += (__pyx_v_r * __pyx_v_g);
229: out[5] += r * b
/* "vision/features.pyx":229 * out[3] += r * r * out[4] += r * g * out[5] += r * b #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * out[6] += g * g */ __pyx_t_24 = 5; if (__pyx_t_24<
0) __pyx_t_24 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_24, __pyx_bstride_0_out) += (__pyx_v_r * __pyx_v_b);
230:
231: out[6] += g * g
/* "vision/features.pyx":231 * out[5] += r * b * * out[6] += g * g #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* out[7] += g * b * */ __pyx_t_25 = 6; if (__pyx_t_25<
0) __pyx_t_25 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_25, __pyx_bstride_0_out) += (__pyx_v_g * __pyx_v_g);
232: out[7] += g * b
/* "vision/features.pyx":232 * * out[6] += g * g * out[7] += g * b #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * out[8] += b * b */ __pyx_t_26 = 7; if (__pyx_t_26<
0) __pyx_t_26 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_26, __pyx_bstride_0_out) += (__pyx_v_g * __pyx_v_b);
233:
234: out[8] += b * b
/* "vision/features.pyx":234 * out[7] += g * b * * out[8] += b * b #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return out / (w * h) */ __pyx_t_27 = 8; if (__pyx_t_27<
0) __pyx_t_27 += __pyx_bshape_0_out; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_out.buf, __pyx_t_27, __pyx_bstride_0_out) += (__pyx_v_b * __pyx_v_b); } }
235: return out / (w * h)
/* "vision/features.pyx":235 * * out[8] += b * b * return out / (w * h) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
*/ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyInt_FromLong((__pyx_v_w * __pyx_v_h)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_out), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __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_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("vision.features.rgbmean", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_data); __Pyx_XDECREF((PyObject *)__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }