diff --git a/.gitignore b/.gitignore index faff26b8..a4ae5eba 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ doc/source/api doc/build source/api +scikits/image/opencv/*.so +scikits/image/opencv/*.bak diff --git a/scikits/image/data/lena.png b/scikits/image/data/lena.png new file mode 100644 index 00000000..6b5473fe Binary files /dev/null and b/scikits/image/data/lena.png differ diff --git a/scikits/image/data/lena_GRAY_U8.npy b/scikits/image/data/lena_GRAY_U8.npy new file mode 100644 index 00000000..f6b9ba26 Binary files /dev/null and b/scikits/image/data/lena_GRAY_U8.npy differ diff --git a/scikits/image/data/lena_RGB_U8.npy b/scikits/image/data/lena_RGB_U8.npy new file mode 100644 index 00000000..13653f90 Binary files /dev/null and b/scikits/image/data/lena_RGB_U8.npy differ diff --git a/scikits/image/data/lenagray.png b/scikits/image/data/lenagray.png new file mode 100644 index 00000000..b59ecc1f Binary files /dev/null and b/scikits/image/data/lenagray.png differ diff --git a/scikits/image/opencv/INSTALL.txt b/scikits/image/opencv/INSTALL.txt new file mode 100644 index 00000000..02d5eefc --- /dev/null +++ b/scikits/image/opencv/INSTALL.txt @@ -0,0 +1,8 @@ +Using the setup.py in this directory will work. +But the setup.py in the main scikits.image does not (it uses setuptools) +this will be changed in the future. + + + + + diff --git a/scikits/image/opencv/LICENSE.txt b/scikits/image/opencv/LICENSE.txt new file mode 100644 index 00000000..da93603f --- /dev/null +++ b/scikits/image/opencv/LICENSE.txt @@ -0,0 +1,28 @@ +Copyright (C) 2009 Steven C. Colbert +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of scikits.image nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/scikits/image/opencv/__init__.py b/scikits/image/opencv/__init__.py new file mode 100644 index 00000000..b3193b74 --- /dev/null +++ b/scikits/image/opencv/__init__.py @@ -0,0 +1,22 @@ +import ctypes + +# try to open the opencv libs +# raise an exception if the libs are not found + +# linux +try: + ctypes.CDLL('libcv.so') +except: + # windows + try: + ctypes.CDLL('cv.dll') + except: + raise RuntimeError('The opencv libraries were not found. Please make sure they are installed and available on the system path.') + +from opencv_constants import * +from opencv_cv import * + +#def test(level=1, verbosity=1): +# from numpy.testing import Tester +# return Tester().test(level, verbosity) + diff --git a/scikits/image/opencv/opencv_backend.c b/scikits/image/opencv/opencv_backend.c new file mode 100644 index 00000000..8398c38c --- /dev/null +++ b/scikits/image/opencv/opencv_backend.c @@ -0,0 +1,5550 @@ +/* Generated by Cython 0.11.3 on Wed Oct 14 17:34:08 2009 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +#include +#define __PYX_HAVE_API__scikits__image__opencv__opencv_backend +#include "stdlib.h" +#include "stdio.h" +#include "numpy/arrayobject.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; +static const char **__pyx_f; + + +#ifdef CYTHON_REFNANNY +typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#define __Pyx_INCREF(r) Py_INCREF(r) +#define __Pyx_DECREF(r) Py_DECREF(r) +#define __Pyx_GOTREF(r) +#define __Pyx_GIVEREF(r) +#define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +#if __PYX_USE_C99_COMPLEX + #define __Pyx_REAL_PART(z) __real__(z) + #define __Pyx_IMAG_PART(z) __imag__(z) +#else + #define __Pyx_REAL_PART(z) ((z).real) + #define __Pyx_IMAG_PART(z) ((z).imag) +#endif + +#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z)) + +#if __PYX_USE_C99_COMPLEX + + typedef float _Complex __pyx_t_float_complex; + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + + #define __pyx_t_float_complex_is_zero(a) ((a) == 0) + #define __pyx_t_float_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_float_complex_add(a, b) ((a)+(b)) + #define __pyx_t_float_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_float_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_float_complex_div(a, b) ((a)/(b)) + #define __pyx_t_float_complex_neg(a) (-(a)) + +#else + + typedef struct { float real, imag; } __pyx_t_float_complex; + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real*b.real + b.imag*b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +#if __PYX_USE_C99_COMPLEX + + typedef double _Complex __pyx_t_double_complex; + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + + #define __pyx_t_double_complex_is_zero(a) ((a) == 0) + #define __pyx_t_double_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_double_complex_add(a, b) ((a)+(b)) + #define __pyx_t_double_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_double_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_double_complex_div(a, b) ((a)/(b)) + #define __pyx_t_double_complex_neg(a) (-(a)) + +#else + + typedef struct { double real, imag; } __pyx_t_double_complex; + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real*b.real + b.imag*b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +#if __PYX_USE_C99_COMPLEX + + typedef long double _Complex __pyx_t_long__double_complex; + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long__double_complex)_Complex_I; + } + + #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0) + #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_long__double_complex_add(a, b) ((a)+(b)) + #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_long__double_complex_div(a, b) ((a)/(b)) + #define __pyx_t_long__double_complex_neg(a) (-(a)) + +#else + + typedef struct { long double real, imag; } __pyx_t_long__double_complex; + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { + __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + long double denom = b.real*b.real + b.imag*b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) { + __pyx_t_long__double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/ + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Type declarations */ + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef __pyx_t_float_complex __pyx_t_5numpy_complex64_t; + +typedef __pyx_t_double_complex __pyx_t_5numpy_complex128_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":5 + * # available at build time. + * + * cdef struct _IplImage: # <<<<<<<<<<<<<< + * int nSize # sizeof(_IplImage) + * int ID # must be 0 + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type__IplImage { + int nSize; + int ID; + int nChannels; + int alphaChannel; + int depth; + char colorModel[4]; + char channelSeq[4]; + int dataOrder; + int origin; + int align; + int width; + int height; + void *roi; + void *maskROI; + void *imageId; + void *tileInfo; + int imageSize; + char *imageData; + int widthStep; + int BorderMode[4]; + int BorderConst[4]; + char *imageDataOrigin; +}; + +typedef struct __pyx_t_7scikits_5image_6opencv_11opencv_type__IplImage __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":38 + * ctypedef _IplImage IplImage + * + * cdef struct CvPoint2D32f: # <<<<<<<<<<<<<< + * float x + * float y + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f { + float x; + float y; +}; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":42 + * float y + * + * cdef struct CvSize: # <<<<<<<<<<<<<< + * int width + * int height + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvSize { + int width; + int height; +}; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":46 + * int height + * + * cdef struct CvTermCriteria: # <<<<<<<<<<<<<< + * int type + * int max_iter + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria { + int type; + int max_iter; + double epsilon; +}; + +typedef __pyx_t_5numpy_uint8_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_UINT8_t; + +typedef __pyx_t_5numpy_int8_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_INT8_t; + +typedef __pyx_t_5numpy_int16_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_INT16_t; + +typedef __pyx_t_5numpy_int32_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_INT32_t; + +typedef __pyx_t_5numpy_float32_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_FLOAT32_t; + +typedef __pyx_t_5numpy_float64_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_FLOAT64_t; +/* Module declarations from python_buffer */ + +/* Module declarations from stdlib */ + +/* Module declarations from stdio */ + +/* Module declarations from numpy */ + +/* Module declarations from numpy */ + +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +/* Module declarations from scikits.image.opencv.opencv_type */ + +/* Module declarations from python_version */ + +/* Module declarations from python_ref */ + +/* Module declarations from python_exc */ + +/* Module declarations from python_module */ + +/* Module declarations from python_mem */ + +/* Module declarations from python_tuple */ + +/* Module declarations from python_list */ + +/* Module declarations from python_object */ + +/* Module declarations from python_sequence */ + +/* Module declarations from python_mapping */ + +/* Module declarations from python_iterator */ + +/* Module declarations from python_type */ + +/* Module declarations from python_number */ + +/* Module declarations from python_int */ + +/* Module declarations from python_bool */ + +/* Module declarations from python_long */ + +/* Module declarations from python_float */ + +/* Module declarations from python_complex */ + +/* Module declarations from python_string */ + +/* Module declarations from python_unicode */ + +/* Module declarations from python_dict */ + +/* Module declarations from python_instance */ + +/* Module declarations from python_function */ + +/* Module declarations from python_method */ + +/* Module declarations from python_set */ + +/* Module declarations from python */ + +/* Module declarations from scikits.image.opencv.opencv_backend */ + +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_SIGN; +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8U; +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8S; +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_16S; +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32S; +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32F; +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_64F; +static int __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPLIMAGE_SIZE; +static void __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(PyArrayObject *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(PyArrayObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(PyArrayObject *, PyObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_ndims(PyArrayObject *, PyObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(PyArrayObject *, PyObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_dtype(PyArrayObject *, PyArrayObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(PyArrayObject *, PyArrayObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_width_and_height(PyArrayObject *, PyArrayObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_like(PyArrayObject *, PyArrayObject *); /*proto*/ +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data(PyArrayObject *, PyArrayObject *); /*proto*/ +static PyArrayObject *__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array(int, npy_intp *, PyObject *); /*proto*/ +static PyArrayObject *__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(PyArrayObject *); /*proto*/ +static PyArrayObject *__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(PyArrayObject *, PyObject *); /*proto*/ +static npy_intp __pyx_f_7scikits_5image_6opencv_14opencv_backend_get_array_nbytes(PyArrayObject *); /*proto*/ +static npy_intp *__pyx_f_7scikits_5image_6opencv_14opencv_backend_clone_array_shape(PyArrayObject *); /*proto*/ +static struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *__pyx_f_7scikits_5image_6opencv_14opencv_backend_array_as_cvPoint2D32f_ptr(PyArrayObject *); /*proto*/ +static struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria __pyx_f_7scikits_5image_6opencv_14opencv_backend_get_cvTermCriteria(int, double); /*proto*/ +#define __Pyx_MODULE_NAME "scikits.image.opencv.opencv_backend" +int __pyx_module_is_main_scikits__image__opencv__opencv_backend = 0; + +/* Implementation of scikits.image.opencv.opencv_backend */ +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k_numpy[] = "numpy"; +static PyObject *__pyx_kp_numpy; +static char __pyx_k_np[] = "np"; +static PyObject *__pyx_kp_np; +static char __pyx_k_opencv_constants[] = "opencv_constants"; +static PyObject *__pyx_kp_opencv_constants; +static char __pyx_k_31[] = "*"; +static PyObject *__pyx_kp_31; +static char __pyx_k_32[] = "uint8"; +static PyObject *__pyx_kp_32; +static char __pyx_k_33[] = "UINT8"; +static PyObject *__pyx_kp_33; +static char __pyx_k_34[] = "int8"; +static PyObject *__pyx_kp_34; +static char __pyx_k_35[] = "INT8"; +static PyObject *__pyx_kp_35; +static char __pyx_k_36[] = "int16"; +static PyObject *__pyx_kp_36; +static char __pyx_k_37[] = "INT16"; +static PyObject *__pyx_kp_37; +static char __pyx_k_38[] = "int32"; +static PyObject *__pyx_kp_38; +static char __pyx_k_39[] = "INT32"; +static PyObject *__pyx_kp_39; +static char __pyx_k_40[] = "float32"; +static PyObject *__pyx_kp_40; +static char __pyx_k_41[] = "FLOAT32"; +static PyObject *__pyx_kp_41; +static char __pyx_k_42[] = "float64"; +static PyObject *__pyx_kp_42; +static char __pyx_k_43[] = "FLOAT64"; +static PyObject *__pyx_kp_43; +static char __pyx_k__ipltypes[] = "_ipltypes"; +static PyObject *__pyx_kp__ipltypes; +static char __pyx_k_dtype[] = "dtype"; +static PyObject *__pyx_kp_dtype; +static char __pyx_k_nbytes[] = "nbytes"; +static PyObject *__pyx_kp_nbytes; +static char __pyx_k_ValueError[] = "ValueError"; +static PyObject *__pyx_kp_ValueError; +static char __pyx_k_range[] = "range"; +static PyObject *__pyx_kp_range; +static char __pyx_k_CV_TERMCRIT_ITER[] = "CV_TERMCRIT_ITER"; +static PyObject *__pyx_kp_CV_TERMCRIT_ITER; +static char __pyx_k_CV_TERMCRIT_EPS[] = "CV_TERMCRIT_EPS"; +static PyObject *__pyx_kp_CV_TERMCRIT_EPS; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_kp_44; +static PyObject *__pyx_kp_45; +static PyObject *__pyx_kp_46; +static char __pyx_k_44[] = "Arrays must have either 2 or 3 dimensions"; +static char __pyx_k_45[] = "A 3D array must have 4 or less channels"; +static char __pyx_k_46[] = "Arrays must have one of the following dtypes: uint8, int8, int16, int32, float32, float64"; +static PyObject *__pyx_kp_47; +static char __pyx_k_47[] = "Unsupported dtype for this operation. Supported dtypes are %s"; +static PyObject *__pyx_kp_48; +static char __pyx_k_48[] = "Incorrect number of dimensions"; +static PyObject *__pyx_kp_49; +static char __pyx_k_49[] = "Incorrect number of channels"; +static PyObject *__pyx_kp_50; +static char __pyx_k_50[] = "dtypes not same"; +static PyObject *__pyx_kp_51; +static char __pyx_k_51[] = "arrays not same shape"; +static PyObject *__pyx_kp_52; +static char __pyx_k_52[] = "Arrays must have same width and height"; +static PyObject *__pyx_kp_53; +static char __pyx_k_53[] = "In place operation not supported. Make sure the out array is not just a view of src array"; +static PyObject *__pyx_int_15; +static char __pyx_k___getbuffer__[] = "__getbuffer__"; +static PyObject *__pyx_kp___getbuffer__; +static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; +static PyObject *__pyx_kp___releasebuffer__; +static char __pyx_k_info[] = "info"; +static PyObject *__pyx_kp_info; +static char __pyx_k_flags[] = "flags"; +static PyObject *__pyx_kp_flags; +static char __pyx_k_RuntimeError[] = "RuntimeError"; +static PyObject *__pyx_kp_RuntimeError; +static PyObject *__pyx_kp_1; +static PyObject *__pyx_kp_2; +static PyObject *__pyx_kp_5; +static PyObject *__pyx_kp_23; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_1[] = "ndarray is not C contiguous"; +static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_3[] = ">"; +static char __pyx_k_4[] = "<"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_6[] = "b"; +static char __pyx_k_7[] = "B"; +static char __pyx_k_8[] = "h"; +static char __pyx_k_9[] = "H"; +static char __pyx_k_10[] = "i"; +static char __pyx_k_11[] = "I"; +static char __pyx_k_12[] = "l"; +static char __pyx_k_13[] = "L"; +static char __pyx_k_14[] = "q"; +static char __pyx_k_15[] = "Q"; +static char __pyx_k_16[] = "f"; +static char __pyx_k_17[] = "d"; +static char __pyx_k_18[] = "g"; +static char __pyx_k_19[] = "Zf"; +static char __pyx_k_20[] = "Zd"; +static char __pyx_k_21[] = "Zg"; +static char __pyx_k_22[] = "O"; +static char __pyx_k_23[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_24[] = "^"; +static PyObject *__pyx_kp_25; +static PyObject *__pyx_kp_28; +static PyObject *__pyx_kp_29; +static PyObject *__pyx_kp_30; +static char __pyx_k_25[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_26[] = ">"; +static char __pyx_k_27[] = "<"; +static char __pyx_k_28[] = "Non-native byte order not supported"; +static char __pyx_k_29[] = "Format string allocated too short."; +static char __pyx_k_30[] = "unknown dtype code in numpy.pxd (%d)"; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":46 + * cdef int IPLIMAGE_SIZE = sizeof(IplImage) + * + * cdef void populate_iplimage(np.ndarray arr, IplImage* img): # <<<<<<<<<<<<<< + * # The numpy array should be validated with the validate_array + * # function before using this function. + */ + +static void __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(PyArrayObject *__pyx_v_arr, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *__pyx_v_img) { + int __pyx_v_ndim; + npy_intp *__pyx_v_shape; + npy_intp *__pyx_v_strides; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("populate_iplimage"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":53 + * + * # everything that will never change + * img.nSize = IPLIMAGE_SIZE # <<<<<<<<<<<<<< + * img.ID = 0 + * img.dataOrder = 0 + */ + __pyx_v_img->nSize = __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPLIMAGE_SIZE; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":54 + * # everything that will never change + * img.nSize = IPLIMAGE_SIZE + * img.ID = 0 # <<<<<<<<<<<<<< + * img.dataOrder = 0 + * img.origin = 0 + */ + __pyx_v_img->ID = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":55 + * img.nSize = IPLIMAGE_SIZE + * img.ID = 0 + * img.dataOrder = 0 # <<<<<<<<<<<<<< + * img.origin = 0 + * img.roi = NULL + */ + __pyx_v_img->dataOrder = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":56 + * img.ID = 0 + * img.dataOrder = 0 + * img.origin = 0 # <<<<<<<<<<<<<< + * img.roi = NULL + * img.maskROI = NULL + */ + __pyx_v_img->origin = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":57 + * img.dataOrder = 0 + * img.origin = 0 + * img.roi = NULL # <<<<<<<<<<<<<< + * img.maskROI = NULL + * img.imageId = NULL + */ + __pyx_v_img->roi = NULL; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":58 + * img.origin = 0 + * img.roi = NULL + * img.maskROI = NULL # <<<<<<<<<<<<<< + * img.imageId = NULL + * img.tileInfo = NULL + */ + __pyx_v_img->maskROI = NULL; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":59 + * img.roi = NULL + * img.maskROI = NULL + * img.imageId = NULL # <<<<<<<<<<<<<< + * img.tileInfo = NULL + * + */ + __pyx_v_img->imageId = NULL; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":60 + * img.maskROI = NULL + * img.imageId = NULL + * img.tileInfo = NULL # <<<<<<<<<<<<<< + * + * cdef int channels + */ + __pyx_v_img->tileInfo = NULL; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":63 + * + * cdef int channels + * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< + * cdef np.npy_intp* shape = arr.shape + * cdef np.npy_intp* strides = arr.strides + */ + __pyx_v_ndim = __pyx_v_arr->nd; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":64 + * cdef int channels + * cdef int ndim = arr.ndim + * cdef np.npy_intp* shape = arr.shape # <<<<<<<<<<<<<< + * cdef np.npy_intp* strides = arr.strides + * + */ + __pyx_v_shape = __pyx_v_arr->dimensions; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":65 + * cdef int ndim = arr.ndim + * cdef np.npy_intp* shape = arr.shape + * cdef np.npy_intp* strides = arr.strides # <<<<<<<<<<<<<< + * + * # nChannels is essentially the value of np.shape[2] of a 3D numpy array + */ + __pyx_v_strides = __pyx_v_arr->strides; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":69 + * # nChannels is essentially the value of np.shape[2] of a 3D numpy array + * # for a 2D array, nChannels is 1 + * if ndim == 2: # <<<<<<<<<<<<<< + * img.nChannels = 1 + * else: + */ + __pyx_t_1 = (__pyx_v_ndim == 2); + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":70 + * # for a 2D array, nChannels is 1 + * if ndim == 2: + * img.nChannels = 1 # <<<<<<<<<<<<<< + * else: + * img.nChannels = shape[2] + */ + __pyx_v_img->nChannels = 1; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":72 + * img.nChannels = 1 + * else: + * img.nChannels = shape[2] # <<<<<<<<<<<<<< + * + * img.depth = _ipltypes[arr.dtype] + */ + __pyx_v_img->nChannels = (__pyx_v_shape[2]); + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":74 + * img.nChannels = shape[2] + * + * img.depth = _ipltypes[arr.dtype] # <<<<<<<<<<<<<< + * img.width = shape[1] + * img.height = shape[0] + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__ipltypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_2 = PyObject_GetItem(__pyx_1, __pyx_t_2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_v_img->depth = __pyx_t_3; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":75 + * + * img.depth = _ipltypes[arr.dtype] + * img.width = shape[1] # <<<<<<<<<<<<<< + * img.height = shape[0] + * img.imageSize = arr.nbytes + */ + __pyx_v_img->width = (__pyx_v_shape[1]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":76 + * img.depth = _ipltypes[arr.dtype] + * img.width = shape[1] + * img.height = shape[0] # <<<<<<<<<<<<<< + * img.imageSize = arr.nbytes + * img.imageData = arr.data + */ + __pyx_v_img->height = (__pyx_v_shape[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":77 + * img.width = shape[1] + * img.height = shape[0] + * img.imageSize = arr.nbytes # <<<<<<<<<<<<<< + * img.imageData = arr.data + * img.widthStep = strides[0] + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_nbytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_img->imageSize = __pyx_t_3; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":78 + * img.height = shape[0] + * img.imageSize = arr.nbytes + * img.imageData = arr.data # <<<<<<<<<<<<<< + * img.widthStep = strides[0] + * + */ + __pyx_v_img->imageData = ((char *)__pyx_v_arr->data); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":79 + * img.imageSize = arr.nbytes + * img.imageData = arr.data + * img.widthStep = strides[0] # <<<<<<<<<<<<<< + * + * # really doesn't matter what this is set to, because opencv only uses it to + */ + __pyx_v_img->widthStep = (__pyx_v_strides[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":84 + * # deallocate images, but it will never attempt to deallocate images we + * # create ourselves. + * img.imageDataOrigin = NULL # <<<<<<<<<<<<<< + * + * cdef int validate_array(np.ndarray arr) except -1: + */ + __pyx_v_img->imageDataOrigin = ((char *)NULL); + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("scikits.image.opencv.opencv_backend.populate_iplimage"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":86 + * img.imageDataOrigin = NULL + * + * cdef int validate_array(np.ndarray arr) except -1: # <<<<<<<<<<<<<< + * if arr.ndim != 2 and arr.ndim != 3: + * raise ValueError('Arrays must have either 2 or 3 dimensions') + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(PyArrayObject *__pyx_v_arr) { + int __pyx_r; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("validate_array"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":87 + * + * cdef int validate_array(np.ndarray arr) except -1: + * if arr.ndim != 2 and arr.ndim != 3: # <<<<<<<<<<<<<< + * raise ValueError('Arrays must have either 2 or 3 dimensions') + * if arr.ndim == 3: + */ + if ((__pyx_v_arr->nd != 2)) { + __pyx_t_1 = (__pyx_v_arr->nd != 3); + } else { + __pyx_t_1 = (__pyx_v_arr->nd != 2); + } + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":88 + * cdef int validate_array(np.ndarray arr) except -1: + * if arr.ndim != 2 and arr.ndim != 3: + * raise ValueError('Arrays must have either 2 or 3 dimensions') # <<<<<<<<<<<<<< + * if arr.ndim == 3: + * if arr.shape[2] > 4: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_44); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_44); + __Pyx_GIVEREF(__pyx_kp_44); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":89 + * if arr.ndim != 2 and arr.ndim != 3: + * raise ValueError('Arrays must have either 2 or 3 dimensions') + * if arr.ndim == 3: # <<<<<<<<<<<<<< + * if arr.shape[2] > 4: + * raise ValueError('A 3D array must have 4 or less channels') + */ + __pyx_t_1 = (__pyx_v_arr->nd == 3); + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":90 + * raise ValueError('Arrays must have either 2 or 3 dimensions') + * if arr.ndim == 3: + * if arr.shape[2] > 4: # <<<<<<<<<<<<<< + * raise ValueError('A 3D array must have 4 or less channels') + * if arr.dtype not in _ipltypes: + */ + __pyx_t_1 = ((__pyx_v_arr->dimensions[2]) > 4); + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":91 + * if arr.ndim == 3: + * if arr.shape[2] > 4: + * raise ValueError('A 3D array must have 4 or less channels') # <<<<<<<<<<<<<< + * if arr.dtype not in _ipltypes: + * raise ValueError('Arrays must have one of the following dtypes: uint8, int8, int16, int32, float32, float64') + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_kp_45); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_45); + __Pyx_GIVEREF(__pyx_kp_45); + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":92 + * if arr.shape[2] > 4: + * raise ValueError('A 3D array must have 4 or less channels') + * if arr.dtype not in _ipltypes: # <<<<<<<<<<<<<< + * raise ValueError('Arrays must have one of the following dtypes: uint8, int8, int16, int32, float32, float64') + * return 1 + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__ipltypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = (!PySequence_Contains(__pyx_1, __pyx_t_2)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":93 + * raise ValueError('A 3D array must have 4 or less channels') + * if arr.dtype not in _ipltypes: + * raise ValueError('Arrays must have one of the following dtypes: uint8, int8, int16, int32, float32, float64') # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_46); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_46); + __Pyx_GIVEREF(__pyx_kp_46); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":94 + * if arr.dtype not in _ipltypes: + * raise ValueError('Arrays must have one of the following dtypes: uint8, int8, int16, int32, float32, float64') + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_dtype(np.ndarray arr, dtypes) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.validate_array"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":96 + * return 1 + * + * cdef int assert_dtype(np.ndarray arr, dtypes) except -1: # <<<<<<<<<<<<<< + * if arr.dtype not in dtypes: + * raise ValueError('Unsupported dtype for this operation. \ + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_dtypes) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("assert_dtype"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":97 + * + * cdef int assert_dtype(np.ndarray arr, dtypes) except -1: + * if arr.dtype not in dtypes: # <<<<<<<<<<<<<< + * raise ValueError('Unsupported dtype for this operation. \ + * Supported dtypes are %s' % str(dtypes)) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (!PySequence_Contains(__pyx_v_dtypes, __pyx_t_1)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":99 + * if arr.dtype not in dtypes: + * raise ValueError('Unsupported dtype for this operation. \ + * Supported dtypes are %s' % str(dtypes)) # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_dtypes); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dtypes); + __Pyx_GIVEREF(__pyx_v_dtypes); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(__pyx_kp_47, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":100 + * raise ValueError('Unsupported dtype for this operation. \ + * Supported dtypes are %s' % str(dtypes)) + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_ndims(np.ndarray arr, dims) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_dtype"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":102 + * return 1 + * + * cdef int assert_ndims(np.ndarray arr, dims) except -1: # <<<<<<<<<<<<<< + * if arr.ndim not in dims: + * raise ValueError('Incorrect number of dimensions') + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_ndims(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_dims) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("assert_ndims"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":103 + * + * cdef int assert_ndims(np.ndarray arr, dims) except -1: + * if arr.ndim not in dims: # <<<<<<<<<<<<<< + * raise ValueError('Incorrect number of dimensions') + * return 1 + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_arr->nd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (!PySequence_Contains(__pyx_v_dims, __pyx_t_1)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":104 + * cdef int assert_ndims(np.ndarray arr, dims) except -1: + * if arr.ndim not in dims: + * raise ValueError('Incorrect number of dimensions') # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_48); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_48); + __Pyx_GIVEREF(__pyx_kp_48); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":105 + * if arr.ndim not in dims: + * raise ValueError('Incorrect number of dimensions') + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_nchannels(np.ndarray arr, channels) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_ndims"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":107 + * return 1 + * + * cdef int assert_nchannels(np.ndarray arr, channels) except -1: # <<<<<<<<<<<<<< + * cdef int nchannels + * if arr.ndim == 2: + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_channels) { + int __pyx_v_nchannels; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("assert_nchannels"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":109 + * cdef int assert_nchannels(np.ndarray arr, channels) except -1: + * cdef int nchannels + * if arr.ndim == 2: # <<<<<<<<<<<<<< + * nchannels = 1 + * else: + */ + __pyx_t_1 = (__pyx_v_arr->nd == 2); + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":110 + * cdef int nchannels + * if arr.ndim == 2: + * nchannels = 1 # <<<<<<<<<<<<<< + * else: + * nchannels = arr.shape[2] + */ + __pyx_v_nchannels = 1; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":112 + * nchannels = 1 + * else: + * nchannels = arr.shape[2] # <<<<<<<<<<<<<< + * if nchannels not in channels: + * raise ValueError('Incorrect number of channels') + */ + __pyx_v_nchannels = (__pyx_v_arr->dimensions[2]); + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":113 + * else: + * nchannels = arr.shape[2] + * if nchannels not in channels: # <<<<<<<<<<<<<< + * raise ValueError('Incorrect number of channels') + * return 1 + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_nchannels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (!PySequence_Contains(__pyx_v_channels, __pyx_t_2)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":114 + * nchannels = arr.shape[2] + * if nchannels not in channels: + * raise ValueError('Incorrect number of channels') # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_49); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_49); + __Pyx_GIVEREF(__pyx_kp_49); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":115 + * if nchannels not in channels: + * raise ValueError('Incorrect number of channels') + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_same_dtype(np.ndarray arr1, np.ndarray arr2) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_nchannels"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":117 + * return 1 + * + * cdef int assert_same_dtype(np.ndarray arr1, np.ndarray arr2) except -1: # <<<<<<<<<<<<<< + * if arr1.dtype != arr2.dtype: + * raise ValueError('dtypes not same') + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_dtype(PyArrayObject *__pyx_v_arr1, PyArrayObject *__pyx_v_arr2) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_SetupRefcountContext("assert_same_dtype"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":118 + * + * cdef int assert_same_dtype(np.ndarray arr1, np.ndarray arr2) except -1: + * if arr1.dtype != arr2.dtype: # <<<<<<<<<<<<<< + * raise ValueError('dtypes not same') + * return 1 + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr1), __pyx_kp_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr2), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":119 + * cdef int assert_same_dtype(np.ndarray arr1, np.ndarray arr2) except -1: + * if arr1.dtype != arr2.dtype: + * raise ValueError('dtypes not same') # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_kp_50); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_50); + __Pyx_GIVEREF(__pyx_kp_50); + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":120 + * if arr1.dtype != arr2.dtype: + * raise ValueError('dtypes not same') + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_same_shape(np.ndarray arr1, np.ndarray arr2) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_same_dtype"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":122 + * return 1 + * + * cdef int assert_same_shape(np.ndarray arr1, np.ndarray arr2) except -1: # <<<<<<<<<<<<<< + * if not np.PyArray_SAMESHAPE(arr1, arr2): + * raise ValueError('arrays not same shape') + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(PyArrayObject *__pyx_v_arr1, PyArrayObject *__pyx_v_arr2) { + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("assert_same_shape"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":123 + * + * cdef int assert_same_shape(np.ndarray arr1, np.ndarray arr2) except -1: + * if not np.PyArray_SAMESHAPE(arr1, arr2): # <<<<<<<<<<<<<< + * raise ValueError('arrays not same shape') + * return 1 + */ + __pyx_t_1 = (!PyArray_SAMESHAPE(__pyx_v_arr1, __pyx_v_arr2)); + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":124 + * cdef int assert_same_shape(np.ndarray arr1, np.ndarray arr2) except -1: + * if not np.PyArray_SAMESHAPE(arr1, arr2): + * raise ValueError('arrays not same shape') # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_51); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_51); + __Pyx_GIVEREF(__pyx_kp_51); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":125 + * if not np.PyArray_SAMESHAPE(arr1, arr2): + * raise ValueError('arrays not same shape') + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_same_width_and_height(np.ndarray arr1, np.ndarray arr2) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_same_shape"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":127 + * return 1 + * + * cdef int assert_same_width_and_height(np.ndarray arr1, np.ndarray arr2) except -1: # <<<<<<<<<<<<<< + * cdef np.npy_intp* shape1 = arr1.shape + * cdef np.npy_intp* shape2 = arr2.shape + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_width_and_height(PyArrayObject *__pyx_v_arr1, PyArrayObject *__pyx_v_arr2) { + npy_intp *__pyx_v_shape1; + npy_intp *__pyx_v_shape2; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("assert_same_width_and_height"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":128 + * + * cdef int assert_same_width_and_height(np.ndarray arr1, np.ndarray arr2) except -1: + * cdef np.npy_intp* shape1 = arr1.shape # <<<<<<<<<<<<<< + * cdef np.npy_intp* shape2 = arr2.shape + * if (shape1[0] != shape2[0]) or (shape1[1] != shape2[1]): + */ + __pyx_v_shape1 = __pyx_v_arr1->dimensions; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":129 + * cdef int assert_same_width_and_height(np.ndarray arr1, np.ndarray arr2) except -1: + * cdef np.npy_intp* shape1 = arr1.shape + * cdef np.npy_intp* shape2 = arr2.shape # <<<<<<<<<<<<<< + * if (shape1[0] != shape2[0]) or (shape1[1] != shape2[1]): + * raise ValueError('Arrays must have same width and height') + */ + __pyx_v_shape2 = __pyx_v_arr2->dimensions; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":130 + * cdef np.npy_intp* shape1 = arr1.shape + * cdef np.npy_intp* shape2 = arr2.shape + * if (shape1[0] != shape2[0]) or (shape1[1] != shape2[1]): # <<<<<<<<<<<<<< + * raise ValueError('Arrays must have same width and height') + * return 1 + */ + if (!((__pyx_v_shape1[0]) != (__pyx_v_shape2[0]))) { + __pyx_t_1 = ((__pyx_v_shape1[1]) != (__pyx_v_shape2[1])); + } else { + __pyx_t_1 = ((__pyx_v_shape1[0]) != (__pyx_v_shape2[0])); + } + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":131 + * cdef np.npy_intp* shape2 = arr2.shape + * if (shape1[0] != shape2[0]) or (shape1[1] != shape2[1]): + * raise ValueError('Arrays must have same width and height') # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_52); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_52); + __Pyx_GIVEREF(__pyx_kp_52); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":132 + * if (shape1[0] != shape2[0]) or (shape1[1] != shape2[1]): + * raise ValueError('Arrays must have same width and height') + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_like(np.ndarray arr1, np.ndarray arr2) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_same_width_and_height"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":134 + * return 1 + * + * cdef int assert_like(np.ndarray arr1, np.ndarray arr2) except -1: # <<<<<<<<<<<<<< + * assert_same_dtype(arr1, arr2) + * assert_same_shape(arr1, arr2) + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_like(PyArrayObject *__pyx_v_arr1, PyArrayObject *__pyx_v_arr2) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("assert_like"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":135 + * + * cdef int assert_like(np.ndarray arr1, np.ndarray arr2) except -1: + * assert_same_dtype(arr1, arr2) # <<<<<<<<<<<<<< + * assert_same_shape(arr1, arr2) + * return 1 + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_dtype(__pyx_v_arr1, __pyx_v_arr2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":136 + * cdef int assert_like(np.ndarray arr1, np.ndarray arr2) except -1: + * assert_same_dtype(arr1, arr2) + * assert_same_shape(arr1, arr2) # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(__pyx_v_arr1, __pyx_v_arr2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":137 + * assert_same_dtype(arr1, arr2) + * assert_same_shape(arr1, arr2) + * return 1 # <<<<<<<<<<<<<< + * + * cdef int assert_not_sharing_data(np.ndarray arr1, np.ndarray arr2) except -1: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_like"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":139 + * return 1 + * + * cdef int assert_not_sharing_data(np.ndarray arr1, np.ndarray arr2) except -1: # <<<<<<<<<<<<<< + * if arr1.data == arr2.data: + * raise ValueError('In place operation not supported. Make sure \ + */ + +static int __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data(PyArrayObject *__pyx_v_arr1, PyArrayObject *__pyx_v_arr2) { + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_SetupRefcountContext("assert_not_sharing_data"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":140 + * + * cdef int assert_not_sharing_data(np.ndarray arr1, np.ndarray arr2) except -1: + * if arr1.data == arr2.data: # <<<<<<<<<<<<<< + * raise ValueError('In place operation not supported. Make sure \ + * the out array is not just a view of src array') + */ + __pyx_t_1 = (__pyx_v_arr1->data == __pyx_v_arr2->data); + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":141 + * cdef int assert_not_sharing_data(np.ndarray arr1, np.ndarray arr2) except -1: + * if arr1.data == arr2.data: + * raise ValueError('In place operation not supported. Make sure \ # <<<<<<<<<<<<<< + * the out array is not just a view of src array') + * return 1 + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_53); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_53); + __Pyx_GIVEREF(__pyx_kp_53); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":143 + * raise ValueError('In place operation not supported. Make sure \ + * the out array is not just a view of src array') + * return 1 # <<<<<<<<<<<<<< + * + * #------------------------------------------------------------------------------- + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.assert_not_sharing_data"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":148 + * # NumPy array convienences + * #------------------------------------------------------------------------------- + * cdef np.ndarray new_array(int ndim, np.npy_intp* shape, dtype): # <<<<<<<<<<<<<< + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(dtype) + */ + +static PyArrayObject *__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array(int __pyx_v_ndim, npy_intp *__pyx_v_shape, PyObject *__pyx_v_dtype) { + PyArrayObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("new_array"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":150 + * cdef np.ndarray new_array(int ndim, np.npy_intp* shape, dtype): + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(dtype) # <<<<<<<<<<<<<< + * return PyArray_Empty(ndim, shape, dtype, 0) + * + */ + Py_INCREF(__pyx_v_dtype); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":151 + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(dtype) + * return PyArray_Empty(ndim, shape, dtype, 0) # <<<<<<<<<<<<<< + * + * cdef np.ndarray new_array_like(np.ndarray arr): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = PyArray_Empty(__pyx_v_ndim, __pyx_v_shape, __pyx_v_dtype, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.new_array"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":153 + * return PyArray_Empty(ndim, shape, dtype, 0) + * + * cdef np.ndarray new_array_like(np.ndarray arr): # <<<<<<<<<<<<<< + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(arr.dtype) + */ + +static PyArrayObject *__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(PyArrayObject *__pyx_v_arr) { + PyArrayObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_SetupRefcountContext("new_array_like"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":155 + * cdef np.ndarray new_array_like(np.ndarray arr): + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(arr.dtype) # <<<<<<<<<<<<<< + * return PyArray_Empty(arr.ndim, arr.shape, arr.dtype, 0) + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + Py_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":156 + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(arr.dtype) + * return PyArray_Empty(arr.ndim, arr.shape, arr.dtype, 0) # <<<<<<<<<<<<<< + * + * cdef np.ndarray new_array_like_diff_dtype(np.ndarray arr, dtype): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyArray_Empty(__pyx_v_arr->nd, __pyx_v_arr->dimensions, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.new_array_like"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":158 + * return PyArray_Empty(arr.ndim, arr.shape, arr.dtype, 0) + * + * cdef np.ndarray new_array_like_diff_dtype(np.ndarray arr, dtype): # <<<<<<<<<<<<<< + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(dtype) + */ + +static PyArrayObject *__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_dtype) { + PyArrayObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("new_array_like_diff_dtype"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":160 + * cdef np.ndarray new_array_like_diff_dtype(np.ndarray arr, dtype): + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(dtype) # <<<<<<<<<<<<<< + * return PyArray_Empty(arr.ndim, arr.shape, dtype, 0) + * + */ + Py_INCREF(__pyx_v_dtype); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":161 + * # need to incref because numpy will apprently steal a dtype reference + * Py_INCREF(dtype) + * return PyArray_Empty(arr.ndim, arr.shape, dtype, 0) # <<<<<<<<<<<<<< + * + * cdef np.npy_intp* clone_array_shape(np.ndarray arr): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = PyArray_Empty(__pyx_v_arr->nd, __pyx_v_arr->dimensions, __pyx_v_dtype, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend.new_array_like_diff_dtype"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":163 + * return PyArray_Empty(arr.ndim, arr.shape, dtype, 0) + * + * cdef np.npy_intp* clone_array_shape(np.ndarray arr): # <<<<<<<<<<<<<< + * # make sure you call PyMem_Free after your done with the shape + * cdef int ndim = arr.ndim + */ + +static npy_intp *__pyx_f_7scikits_5image_6opencv_14opencv_backend_clone_array_shape(PyArrayObject *__pyx_v_arr) { + int __pyx_v_ndim; + npy_intp *__pyx_v_shape; + int __pyx_v_i; + npy_intp *__pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("clone_array_shape"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":165 + * cdef np.npy_intp* clone_array_shape(np.ndarray arr): + * # make sure you call PyMem_Free after your done with the shape + * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< + * cdef np.npy_intp* shape = PyMem_Malloc(ndim * sizeof(np.npy_intp)) + * cdef int i + */ + __pyx_v_ndim = __pyx_v_arr->nd; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":166 + * # make sure you call PyMem_Free after your done with the shape + * cdef int ndim = arr.ndim + * cdef np.npy_intp* shape = PyMem_Malloc(ndim * sizeof(np.npy_intp)) # <<<<<<<<<<<<<< + * cdef int i + * for i in range(ndim): + */ + __pyx_v_shape = ((npy_intp *)PyMem_Malloc((__pyx_v_ndim * (sizeof(npy_intp))))); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":168 + * cdef np.npy_intp* shape = PyMem_Malloc(ndim * sizeof(np.npy_intp)) + * cdef int i + * for i in range(ndim): # <<<<<<<<<<<<<< + * shape[i] = arr.shape[i] + * return shape + */ + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_v_ndim; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":169 + * cdef int i + * for i in range(ndim): + * shape[i] = arr.shape[i] # <<<<<<<<<<<<<< + * return shape + * + */ + (__pyx_v_shape[__pyx_v_i]) = (__pyx_v_arr->dimensions[__pyx_v_i]); + } + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":170 + * for i in range(ndim): + * shape[i] = arr.shape[i] + * return shape # <<<<<<<<<<<<<< + * + * cdef np.npy_intp get_array_nbytes(np.ndarray arr): + */ + __pyx_r = __pyx_v_shape; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":172 + * return shape + * + * cdef np.npy_intp get_array_nbytes(np.ndarray arr): # <<<<<<<<<<<<<< + * cdef np.npy_intp nbytes = np.PyArray_NBYTES(arr) + * return nbytes + */ + +static npy_intp __pyx_f_7scikits_5image_6opencv_14opencv_backend_get_array_nbytes(PyArrayObject *__pyx_v_arr) { + npy_intp __pyx_v_nbytes; + npy_intp __pyx_r; + __Pyx_SetupRefcountContext("get_array_nbytes"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":173 + * + * cdef np.npy_intp get_array_nbytes(np.ndarray arr): + * cdef np.npy_intp nbytes = np.PyArray_NBYTES(arr) # <<<<<<<<<<<<<< + * return nbytes + * + */ + __pyx_v_nbytes = PyArray_NBYTES(__pyx_v_arr); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":174 + * cdef np.npy_intp get_array_nbytes(np.ndarray arr): + * cdef np.npy_intp nbytes = np.PyArray_NBYTES(arr) + * return nbytes # <<<<<<<<<<<<<< + * + * #------------------------------------------------------------------------------- + */ + __pyx_r = __pyx_v_nbytes; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":179 + * # OpenCV convienences + * #------------------------------------------------------------------------------- + * cdef CvPoint2D32f* array_as_cvPoint2D32f_ptr(np.ndarray arr): # <<<<<<<<<<<<<< + * cdef CvPoint2D32f* point2Darr + * point2Darr = arr.data + */ + +static struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *__pyx_f_7scikits_5image_6opencv_14opencv_backend_array_as_cvPoint2D32f_ptr(PyArrayObject *__pyx_v_arr) { + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *__pyx_v_point2Darr; + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *__pyx_r; + __Pyx_SetupRefcountContext("array_as_cvPoint2D32f_ptr"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":181 + * cdef CvPoint2D32f* array_as_cvPoint2D32f_ptr(np.ndarray arr): + * cdef CvPoint2D32f* point2Darr + * point2Darr = arr.data # <<<<<<<<<<<<<< + * return point2Darr + * + */ + __pyx_v_point2Darr = ((struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *)__pyx_v_arr->data); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":182 + * cdef CvPoint2D32f* point2Darr + * point2Darr = arr.data + * return point2Darr # <<<<<<<<<<<<<< + * + * cdef CvTermCriteria get_cvTermCriteria(int iterations, double epsilon): + */ + __pyx_r = __pyx_v_point2Darr; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":184 + * return point2Darr + * + * cdef CvTermCriteria get_cvTermCriteria(int iterations, double epsilon): # <<<<<<<<<<<<<< + * cdef CvTermCriteria crit + * if iterations and epsilon: + */ + +static struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria __pyx_f_7scikits_5image_6opencv_14opencv_backend_get_cvTermCriteria(int __pyx_v_iterations, double __pyx_v_epsilon) { + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria __pyx_v_crit; + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria __pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_SetupRefcountContext("get_cvTermCriteria"); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":186 + * cdef CvTermCriteria get_cvTermCriteria(int iterations, double epsilon): + * cdef CvTermCriteria crit + * if iterations and epsilon: # <<<<<<<<<<<<<< + * crit.type = (CV_TERMCRIT_ITER | CV_TERMCRIT_EPS) + * crit.max_iter = iterations + */ + if (__pyx_v_iterations) { + __pyx_t_1 = (__pyx_v_epsilon != 0); + } else { + __pyx_t_1 = __pyx_v_iterations; + } + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":187 + * cdef CvTermCriteria crit + * if iterations and epsilon: + * crit.type = (CV_TERMCRIT_ITER | CV_TERMCRIT_EPS) # <<<<<<<<<<<<<< + * crit.max_iter = iterations + * crit.epsilon = epsilon + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_TERMCRIT_ITER); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_TERMCRIT_EPS); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyNumber_Or(__pyx_1, __pyx_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_crit.type = ((int)__pyx_t_3); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":188 + * if iterations and epsilon: + * crit.type = (CV_TERMCRIT_ITER | CV_TERMCRIT_EPS) + * crit.max_iter = iterations # <<<<<<<<<<<<<< + * crit.epsilon = epsilon + * elif iterations and not epsilon: + */ + __pyx_v_crit.max_iter = __pyx_v_iterations; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":189 + * crit.type = (CV_TERMCRIT_ITER | CV_TERMCRIT_EPS) + * crit.max_iter = iterations + * crit.epsilon = epsilon # <<<<<<<<<<<<<< + * elif iterations and not epsilon: + * crit.type = CV_TERMCRIT_ITER + */ + __pyx_v_crit.epsilon = __pyx_v_epsilon; + goto __pyx_L3; + } + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":190 + * crit.max_iter = iterations + * crit.epsilon = epsilon + * elif iterations and not epsilon: # <<<<<<<<<<<<<< + * crit.type = CV_TERMCRIT_ITER + * crit.max_iter = iterations + */ + if (__pyx_v_iterations) { + __pyx_t_1 = (!(__pyx_v_epsilon != 0)); + } else { + __pyx_t_1 = __pyx_v_iterations; + } + if (__pyx_t_1) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":191 + * crit.epsilon = epsilon + * elif iterations and not epsilon: + * crit.type = CV_TERMCRIT_ITER # <<<<<<<<<<<<<< + * crit.max_iter = iterations + * crit.epsilon = 0. + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_TERMCRIT_ITER); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_crit.type = ((int)__pyx_t_3); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":192 + * elif iterations and not epsilon: + * crit.type = CV_TERMCRIT_ITER + * crit.max_iter = iterations # <<<<<<<<<<<<<< + * crit.epsilon = 0. + * else: + */ + __pyx_v_crit.max_iter = __pyx_v_iterations; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":193 + * crit.type = CV_TERMCRIT_ITER + * crit.max_iter = iterations + * crit.epsilon = 0. # <<<<<<<<<<<<<< + * else: + * crit.type = CV_TERMCRIT_EPS + */ + __pyx_v_crit.epsilon = 0.0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":195 + * crit.epsilon = 0. + * else: + * crit.type = CV_TERMCRIT_EPS # <<<<<<<<<<<<<< + * crit.max_iter = 0 + * crit.epsilon = epsilon + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_TERMCRIT_EPS); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_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_2); __pyx_2 = 0; + __pyx_v_crit.type = ((int)__pyx_t_3); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":196 + * else: + * crit.type = CV_TERMCRIT_EPS + * crit.max_iter = 0 # <<<<<<<<<<<<<< + * crit.epsilon = epsilon + * return crit + */ + __pyx_v_crit.max_iter = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":197 + * crit.type = CV_TERMCRIT_EPS + * crit.max_iter = 0 + * crit.epsilon = epsilon # <<<<<<<<<<<<<< + * return crit + * + */ + __pyx_v_crit.epsilon = __pyx_v_epsilon; + } + __pyx_L3:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":198 + * crit.max_iter = 0 + * crit.epsilon = epsilon + * return crit # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_crit; + goto __pyx_L0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("scikits.image.opencv.opencv_backend.get_cvTermCriteria"); + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":152 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + char *__pyx_t_7; + __Pyx_SetupRefcountContext("__getbuffer__"); + if (__pyx_v_info == NULL) return 0; + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":158 + * # of flags + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":159 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":161 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":163 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":164 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L5; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":166 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L5:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":168 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError("ndarray is not C contiguous") + */ + if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":169 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError("ndarray is not C contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + } else { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + } + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":170 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1); + __Pyx_GIVEREF(__pyx_kp_1); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":172 + * raise ValueError("ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError("ndarray is not Fortran contiguous") + */ + if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":173 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError("ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + } else { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + } + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":174 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_kp_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2); + __Pyx_GIVEREF(__pyx_kp_2); + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":176 + * raise ValueError("ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":177 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. This is allocated + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":178 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + */ + __pyx_t_4 = __pyx_v_copy_shape; + if (__pyx_t_4) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":181 + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":182 + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":183 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":184 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":185 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L8; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":187 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":188 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L8:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":189 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":190 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":191 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":194 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":195 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":199 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":201 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + if ((!__pyx_v_hasfields)) { + __pyx_t_1 = (!__pyx_v_copy_shape); + } else { + __pyx_t_1 = (!__pyx_v_hasfields); + } + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":203 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L11; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":206 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L11:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":208 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":209 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":210 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + */ + if ((__pyx_v_descr->byteorder == '>')) { + __pyx_t_1 = __pyx_v_little_endian; + } else { + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + } + if (!__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":211 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + if ((__pyx_v_descr->byteorder == '<')) { + __pyx_t_5 = (!__pyx_v_little_endian); + } else { + __pyx_t_5 = (__pyx_v_descr->byteorder == '<'); + } + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_1; + } + if (__pyx_t_6) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":212 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_5); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5); + __Pyx_GIVEREF(__pyx_kp_5); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":213 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_6 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_6; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":214 + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_6 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_7; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":215 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_6 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_8; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":216 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_6 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_9; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":217 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_6 = (__pyx_v_t == NPY_INT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_10; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":218 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_6 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_11; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":219 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_6 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_12; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":220 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_6 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_13; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":221 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_6 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_14; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":222 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_6 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_15; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":223 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_6 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_16; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":224 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_6 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_17; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":225 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_6 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_18; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":226 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_6 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_19; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":227 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_6 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_20; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":228 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_6 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_21; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":229 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_6 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_22; + goto __pyx_L14; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":231 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(__pyx_kp_23, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L14:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":232 + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":233 + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L12; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":235 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":236 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":237 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":240 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_7; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":241 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":243 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__releasebuffer__"); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":244 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":245 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":246 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":247 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_FinishRefcountContext(); +} + +/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":690 + * ctypedef npy_cdouble complex_t + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_SetupRefcountContext("_util_dtypestring"); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":697 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":698 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":701 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":702 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_1 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(likely(PyTuple_CheckExact(__pyx_1)) || (__pyx_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_1)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_1); + __pyx_1 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":703 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_2); + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_3; + __pyx_3 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":705 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_3 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":706 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_kp_25); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_25); + __Pyx_GIVEREF(__pyx_kp_25); + __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":708 + * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + */ + if ((__pyx_v_child->byteorder == '>')) { + __pyx_t_6 = __pyx_v_little_endian; + } else { + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + } + if (!__pyx_t_6) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":709 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError("Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + if ((__pyx_v_child->byteorder == '<')) { + __pyx_t_7 = (!__pyx_v_little_endian); + } else { + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + } + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_6; + } + if (__pyx_t_8) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":710 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_28); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_28); + __Pyx_GIVEREF(__pyx_kp_28); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":720 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_8) break; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":721 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":722 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f += 1; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":723 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + (__pyx_v_offset[0]) += 1; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":725 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + (__pyx_v_offset[0]) += __pyx_v_child->elsize; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":727 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_8 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_8) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":728 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError("Format string allocated too short.") + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":729 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError("Format string allocated too short.") + * + */ + __pyx_t_8 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_8) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":730 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_29); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_29); + __Pyx_GIVEREF(__pyx_kp_29); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":733 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":734 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_4 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":735 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":736 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_4 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":737 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":738 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_4 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":739 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":740 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_4 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":741 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":742 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_4 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":743 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":744 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_4 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":745 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":746 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_4 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":747 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":748 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_4 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":749 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":751 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, __pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":752 + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":756 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":757 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +static struct PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +char* __pyx_import_star_type_names[] = { + "IplImage", + "va_list", + "Py_complex", + "_IplImage", + "FILE", + "_inittab", + "UINT8_t", + "INT16_t", + "FLOAT64_t", + "FLOAT32_t", + "INT32_t", + "PyTypeObject", + "CvTermCriteria", + "PyObject", + "INT8_t", + "CvPoint2D32f", + "CvSize", + "PY_LONG_LONG", + "Py_UNICODE", + 0 +}; + +static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) { + char** type_name = __pyx_import_star_type_names; + while (*type_name) { + if (__Pyx_StrEq(name, *type_name)) { + PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name); + goto bad; + } + type_name++; + } + if (0); + else if (__Pyx_StrEq(name, "IPL_DEPTH_8U")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8U = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8U == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else if (__Pyx_StrEq(name, "IPL_DEPTH_SIGN")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_SIGN = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_SIGN == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else if (__Pyx_StrEq(name, "IPL_DEPTH_32S")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32S = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32S == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else if (__Pyx_StrEq(name, "IPL_DEPTH_32F")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32F = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32F == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else if (__Pyx_StrEq(name, "IPL_DEPTH_8S")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8S = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8S == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else if (__Pyx_StrEq(name, "IPL_DEPTH_64F")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_64F = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_64F == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else if (__Pyx_StrEq(name, "IPL_DEPTH_16S")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_16S = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_16S == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else if (__Pyx_StrEq(name, "IPLIMAGE_SIZE")) { + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPLIMAGE_SIZE = __Pyx_PyInt_AsInt(o); if ((__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPLIMAGE_SIZE == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L2_error;}; + Py_DECREF(o); + } + else { + if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad; + } + return 0; + __pyx_L2_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_backend"); + bad: + Py_DECREF(o); + return -1; +} + + +/* import_all_from is an unexposed function from ceval.c */ + +static int +__Pyx_import_all_from(PyObject *locals, PyObject *v) +{ + PyObject *all = __Pyx_GetAttrString(v, "__all__"); + PyObject *dict, *name, *value; + int skip_leading_underscores = 0; + int pos, err; + + if (all == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; /* Unexpected error */ + PyErr_Clear(); + dict = __Pyx_GetAttrString(v, "__dict__"); + if (dict == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; + PyErr_SetString(PyExc_ImportError, + "from-import-* object has no __dict__ and no __all__"); + return -1; + } + all = PyMapping_Keys(dict); + Py_DECREF(dict); + if (all == NULL) + return -1; + skip_leading_underscores = 1; + } + + for (pos = 0, err = 0; ; pos++) { + name = PySequence_GetItem(all, pos); + if (name == NULL) { + if (!PyErr_ExceptionMatches(PyExc_IndexError)) + err = -1; + else + PyErr_Clear(); + break; + } + if (skip_leading_underscores && +#if PY_MAJOR_VERSION < 3 + PyString_Check(name) && + PyString_AS_STRING(name)[0] == '_') +#else + PyUnicode_Check(name) && + PyUnicode_AS_UNICODE(name)[0] == '_') +#endif + { + Py_DECREF(name); + continue; + } + value = PyObject_GetAttr(v, name); + if (value == NULL) + err = -1; + else if (PyDict_CheckExact(locals)) + err = PyDict_SetItem(locals, name, value); + else + err = PyObject_SetItem(locals, name, value); + Py_DECREF(name); + Py_XDECREF(value); + if (err != 0) + break; + } + Py_DECREF(all); + return err; +} + + +static int __pyx_import_star(PyObject* m) { + + int i; + int ret = -1; + char* s; + PyObject *locals = 0; + PyObject *list = 0; + PyObject *name; + PyObject *item; + + locals = PyDict_New(); if (!locals) goto bad; + if (__Pyx_import_all_from(locals, m) < 0) goto bad; + list = PyDict_Items(locals); if (!list) goto bad; + + for(i=0; i= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("opencv_backend"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, + {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, + {&__pyx_kp_opencv_constants, __pyx_k_opencv_constants, sizeof(__pyx_k_opencv_constants), 1, 1, 1}, + {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 1, 1, 1}, + {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0}, + {&__pyx_kp_33, __pyx_k_33, sizeof(__pyx_k_33), 1, 1, 1}, + {&__pyx_kp_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0}, + {&__pyx_kp_35, __pyx_k_35, sizeof(__pyx_k_35), 1, 1, 1}, + {&__pyx_kp_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0}, + {&__pyx_kp_37, __pyx_k_37, sizeof(__pyx_k_37), 1, 1, 1}, + {&__pyx_kp_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0}, + {&__pyx_kp_39, __pyx_k_39, sizeof(__pyx_k_39), 1, 1, 1}, + {&__pyx_kp_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0}, + {&__pyx_kp_41, __pyx_k_41, sizeof(__pyx_k_41), 1, 1, 1}, + {&__pyx_kp_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0}, + {&__pyx_kp_43, __pyx_k_43, sizeof(__pyx_k_43), 1, 1, 1}, + {&__pyx_kp__ipltypes, __pyx_k__ipltypes, sizeof(__pyx_k__ipltypes), 1, 1, 1}, + {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, + {&__pyx_kp_nbytes, __pyx_k_nbytes, sizeof(__pyx_k_nbytes), 1, 1, 1}, + {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, + {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, + {&__pyx_kp_CV_TERMCRIT_ITER, __pyx_k_CV_TERMCRIT_ITER, sizeof(__pyx_k_CV_TERMCRIT_ITER), 1, 1, 1}, + {&__pyx_kp_CV_TERMCRIT_EPS, __pyx_k_CV_TERMCRIT_EPS, sizeof(__pyx_k_CV_TERMCRIT_EPS), 1, 1, 1}, + {&__pyx_kp_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 0}, + {&__pyx_kp_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 0}, + {&__pyx_kp_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 0}, + {&__pyx_kp_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 0}, + {&__pyx_kp_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 0}, + {&__pyx_kp_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 0}, + {&__pyx_kp_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 0}, + {&__pyx_kp_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 0}, + {&__pyx_kp_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 0}, + {&__pyx_kp_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 0}, + {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, + {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, + {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, + {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, + {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, + {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, + {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, + {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, + {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 0}, + {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0}, + {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0}, + {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0}, + {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitGlobals(void) { + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initopencv_backend(void); /*proto*/ +PyMODINIT_FUNC initopencv_backend(void) +#else +PyMODINIT_FUNC PyInit_opencv_backend(void); /*proto*/ +PyMODINIT_FUNC PyInit_opencv_backend(void) +#endif +{ + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_opencv_backend(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("opencv_backend"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__pyx_module_is_main_scikits__image__opencv__opencv_backend) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- Global init code ---*/ + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("populate_iplimage", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage, "void (PyArrayObject *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("validate_array", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array, "int (PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_dtype", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype, "int (PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_ndims", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_ndims, "int (PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_nchannels", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels, "int (PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_same_dtype", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_dtype, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_same_shape", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_same_width_and_height", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_width_and_height, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_like", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_like, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("assert_not_sharing_data", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("new_array", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array, "PyArrayObject *(int, npy_intp *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("new_array_like", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like, "PyArrayObject *(PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("new_array_like_diff_dtype", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype, "PyArrayObject *(PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("get_array_nbytes", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_get_array_nbytes, "npy_intp (PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("clone_array_shape", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_clone_array_shape, "npy_intp *(PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("array_as_cvPoint2D32f_ptr", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_array_as_cvPoint2D32f_ptr, "struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *(PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("get_cvTermCriteria", (void (*)(void))__pyx_f_7scikits_5image_6opencv_14opencv_backend_get_cvTermCriteria, "struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria (int, double)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Type init code ---*/ + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":1 + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * from python cimport * + */ + __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":4 + * cimport numpy as np + * from python cimport * + * from opencv_constants import * # <<<<<<<<<<<<<< + * from opencv_type cimport * + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_31); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_31); + __Pyx_GIVEREF(__pyx_kp_31); + __pyx_1 = __Pyx_Import(__pyx_kp_opencv_constants, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__pyx_import_star(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":8 + * + * + * np.import_array() # <<<<<<<<<<<<<< + * + * #------------------------------------------------------------------------------- + */ + import_array(); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":16 + * # for some reason these have to declared as dtype objects rather than just the + * # dtype itself.... + * UINT8 = np.dtype('uint8') # <<<<<<<<<<<<<< + * INT8 = np.dtype('int8') + * INT16 = np.dtype('int16') + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_32); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_32); + __Pyx_GIVEREF(__pyx_kp_32); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_33, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":17 + * # dtype itself.... + * UINT8 = np.dtype('uint8') + * INT8 = np.dtype('int8') # <<<<<<<<<<<<<< + * INT16 = np.dtype('int16') + * INT32 = np.dtype('int32') + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_34); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_34); + __Pyx_GIVEREF(__pyx_kp_34); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_35, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":18 + * UINT8 = np.dtype('uint8') + * INT8 = np.dtype('int8') + * INT16 = np.dtype('int16') # <<<<<<<<<<<<<< + * INT32 = np.dtype('int32') + * FLOAT32 = np.dtype('float32') + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_36); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_36); + __Pyx_GIVEREF(__pyx_kp_36); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_37, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":19 + * INT8 = np.dtype('int8') + * INT16 = np.dtype('int16') + * INT32 = np.dtype('int32') # <<<<<<<<<<<<<< + * FLOAT32 = np.dtype('float32') + * FLOAT64 = np.dtype('float64') + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_38); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_38); + __Pyx_GIVEREF(__pyx_kp_38); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_39, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":20 + * INT16 = np.dtype('int16') + * INT32 = np.dtype('int32') + * FLOAT32 = np.dtype('float32') # <<<<<<<<<<<<<< + * FLOAT64 = np.dtype('float64') + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_40); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_40); + __Pyx_GIVEREF(__pyx_kp_40); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_41, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":21 + * INT32 = np.dtype('int32') + * FLOAT32 = np.dtype('float32') + * FLOAT64 = np.dtype('float64') # <<<<<<<<<<<<<< + * + * cdef int IPL_DEPTH_SIGN = 0x80000000 + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_42); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_42); + __Pyx_GIVEREF(__pyx_kp_42); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_43, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":23 + * FLOAT64 = np.dtype('float64') + * + * cdef int IPL_DEPTH_SIGN = 0x80000000 # <<<<<<<<<<<<<< + * cdef int IPL_DEPTH_8U = 8 + * cdef int IPL_DEPTH_8S = (IPL_DEPTH_SIGN | 8) + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_SIGN = 0x80000000; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":24 + * + * cdef int IPL_DEPTH_SIGN = 0x80000000 + * cdef int IPL_DEPTH_8U = 8 # <<<<<<<<<<<<<< + * cdef int IPL_DEPTH_8S = (IPL_DEPTH_SIGN | 8) + * cdef int IPL_DEPTH_16S = (IPL_DEPTH_SIGN | 16) + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8U = 8; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":25 + * cdef int IPL_DEPTH_SIGN = 0x80000000 + * cdef int IPL_DEPTH_8U = 8 + * cdef int IPL_DEPTH_8S = (IPL_DEPTH_SIGN | 8) # <<<<<<<<<<<<<< + * cdef int IPL_DEPTH_16S = (IPL_DEPTH_SIGN | 16) + * cdef int IPL_DEPTH_32S = (IPL_DEPTH_SIGN | 32) + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8S = (__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_SIGN | 8); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":26 + * cdef int IPL_DEPTH_8U = 8 + * cdef int IPL_DEPTH_8S = (IPL_DEPTH_SIGN | 8) + * cdef int IPL_DEPTH_16S = (IPL_DEPTH_SIGN | 16) # <<<<<<<<<<<<<< + * cdef int IPL_DEPTH_32S = (IPL_DEPTH_SIGN | 32) + * cdef int IPL_DEPTH_32F = 32 + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_16S = (__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_SIGN | 16); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":27 + * cdef int IPL_DEPTH_8S = (IPL_DEPTH_SIGN | 8) + * cdef int IPL_DEPTH_16S = (IPL_DEPTH_SIGN | 16) + * cdef int IPL_DEPTH_32S = (IPL_DEPTH_SIGN | 32) # <<<<<<<<<<<<<< + * cdef int IPL_DEPTH_32F = 32 + * cdef int IPL_DEPTH_64F = 64 + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32S = (__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_SIGN | 32); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":28 + * cdef int IPL_DEPTH_16S = (IPL_DEPTH_SIGN | 16) + * cdef int IPL_DEPTH_32S = (IPL_DEPTH_SIGN | 32) + * cdef int IPL_DEPTH_32F = 32 # <<<<<<<<<<<<<< + * cdef int IPL_DEPTH_64F = 64 + * + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32F = 32; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":29 + * cdef int IPL_DEPTH_32S = (IPL_DEPTH_SIGN | 32) + * cdef int IPL_DEPTH_32F = 32 + * cdef int IPL_DEPTH_64F = 64 # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_64F = 64; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":34 + * # I'd like a better to associate the IPL data type flag to the proper numpy + * # types without using a dictionary. + * _ipltypes = {UINT8: IPL_DEPTH_8U, INT8: IPL_DEPTH_8S, INT16: IPL_DEPTH_16S, # <<<<<<<<<<<<<< + * INT32: IPL_DEPTH_32S, FLOAT32: IPL_DEPTH_32F, + * FLOAT64: IPL_DEPTH_64F} + */ + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_33); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8U); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, __pyx_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_35); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_8S); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, __pyx_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_37); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_16S); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, __pyx_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":35 + * # types without using a dictionary. + * _ipltypes = {UINT8: IPL_DEPTH_8U, INT8: IPL_DEPTH_8S, INT16: IPL_DEPTH_16S, + * INT32: IPL_DEPTH_32S, FLOAT32: IPL_DEPTH_32F, # <<<<<<<<<<<<<< + * FLOAT64: IPL_DEPTH_64F} + * + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_39); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32S); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, __pyx_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_41); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_32F); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_1, __pyx_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":36 + * _ipltypes = {UINT8: IPL_DEPTH_8U, INT8: IPL_DEPTH_8S, INT16: IPL_DEPTH_16S, + * INT32: IPL_DEPTH_32S, FLOAT32: IPL_DEPTH_32F, + * FLOAT64: IPL_DEPTH_64F} # <<<<<<<<<<<<<< + * + * + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_43); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_7scikits_5image_6opencv_14opencv_backend_IPL_DEPTH_64F); 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); + if (PyDict_SetItem(__pyx_1, __pyx_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp__ipltypes, ((PyObject *)__pyx_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_backend.pyx":44 + * + * + * cdef int IPLIMAGE_SIZE = sizeof(IplImage) # <<<<<<<<<<<<<< + * + * cdef void populate_iplimage(np.ndarray arr, IplImage* img): + */ + __pyx_v_7scikits_5image_6opencv_14opencv_backend_IPLIMAGE_SIZE = (sizeof(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/python_mem.pxd":1 + * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * + * ##################################################################### + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init scikits.image.opencv.opencv_backend"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init scikits.image.opencv.opencv_backend"); + } + __pyx_L0:; + __Pyx_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "opencv_backend.pyx", + "numpy.pxd", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (obj == Py_None || PyObject_TypeCheck(obj, type)) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(); + } +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *__import__ = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!__import__) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(__import__); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((char)-1) > ((char)0) && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((short)-1) > ((short)0) && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((int)-1) > ((int)0) && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static INLINE int __Pyx_StrEq(const char *s1, const char *s2) { + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + return *s1 == *s2; +} + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { +#if PY_VERSION_HEX < 0x02050000 + char *api = (char *)"__pyx_capi__"; +#else + const char *api = "__pyx_capi__"; +#endif + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + + + d = PyObject_GetAttrString(__pyx_m, api); + if (!d) { + PyErr_Clear(); + d = PyDict_New(); + if (!d) + goto bad; + Py_INCREF(d); + if (PyModule_AddObject(__pyx_m, api, d) < 0) + goto bad; + } + tmp.fp = f; + cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); + if (!cobj) + goto bad; + if (PyDict_SetItemString(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode && (!t->is_identifier)) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/scikits/image/opencv/opencv_backend.pxd b/scikits/image/opencv/opencv_backend.pxd new file mode 100644 index 00000000..25fc845b --- /dev/null +++ b/scikits/image/opencv/opencv_backend.pxd @@ -0,0 +1,45 @@ +import numpy as np +cimport numpy as np +from opencv_type cimport * + +cdef extern from "Python.h": + void Py_INCREF(object) + +cdef extern from "numpy/arrayobject.h": + object PyArray_Empty(int, np.npy_intp*, dtype, int) + +ctypedef np.uint8_t UINT8_t +ctypedef np.int8_t INT8_t +ctypedef np.int16_t INT16_t +ctypedef np.int32_t INT32_t +ctypedef np.float32_t FLOAT32_t +ctypedef np.float64_t FLOAT64_t + +#------------------------------------------------------------------------------- +# Utility functions for IplImage creation, array validation, etc... +#------------------------------------------------------------------------------- +cdef void populate_iplimage(np.ndarray arr, IplImage* img) +cdef int validate_array(np.ndarray arr) except -1 +cdef int assert_dtype(np.ndarray arr, dtypes) except -1 +cdef int assert_ndims(np.ndarray arr, dims) except -1 +cdef int assert_nchannels(np.ndarray arr, channels) except -1 +cdef int assert_same_dtype(np.ndarray arr1, np.ndarray arr2) except -1 +cdef int assert_same_shape(np.ndarray arr1, np.ndarray arr2) except -1 +cdef int assert_same_width_and_height(np.ndarray arr1, np.ndarray arr2) except -1 +cdef int assert_like(np.ndarray arr1, np.ndarray arr2) except -1 +cdef int assert_not_sharing_data(np.ndarray arr1, np.ndarray arr2) except -1 + +#------------------------------------------------------------------------------- +# NumPy convienences +#------------------------------------------------------------------------------- +cdef np.ndarray new_array(int ndim, np.npy_intp* shape, dtype) +cdef np.ndarray new_array_like(np.ndarray arr) +cdef np.ndarray new_array_like_diff_dtype(np.ndarray arr, dtype) +cdef np.npy_intp get_array_nbytes(np.ndarray arr) +cdef np.npy_intp* clone_array_shape(np.ndarray arr) + +#------------------------------------------------------------------------------- +# OpenCV convienences +#------------------------------------------------------------------------------- +cdef CvPoint2D32f* array_as_cvPoint2D32f_ptr(np.ndarray arr) +cdef CvTermCriteria get_cvTermCriteria(int, double) diff --git a/scikits/image/opencv/opencv_backend.pyx b/scikits/image/opencv/opencv_backend.pyx new file mode 100644 index 00000000..78f6f543 --- /dev/null +++ b/scikits/image/opencv/opencv_backend.pyx @@ -0,0 +1,205 @@ +import numpy as np +cimport numpy as np +from python cimport * +from opencv_constants import * +from opencv_type cimport * + + +np.import_array() + +#------------------------------------------------------------------------------- +# Data Type Handling +#------------------------------------------------------------------------------- + +# for some reason these have to declared as dtype objects rather than just the +# dtype itself.... +UINT8 = np.dtype('uint8') +INT8 = np.dtype('int8') +INT16 = np.dtype('int16') +INT32 = np.dtype('int32') +FLOAT32 = np.dtype('float32') +FLOAT64 = np.dtype('float64') + +cdef int IPL_DEPTH_SIGN = 0x80000000 +cdef int IPL_DEPTH_8U = 8 +cdef int IPL_DEPTH_8S = (IPL_DEPTH_SIGN | 8) +cdef int IPL_DEPTH_16S = (IPL_DEPTH_SIGN | 16) +cdef int IPL_DEPTH_32S = (IPL_DEPTH_SIGN | 32) +cdef int IPL_DEPTH_32F = 32 +cdef int IPL_DEPTH_64F = 64 + + +# I'd like a better to associate the IPL data type flag to the proper numpy +# types without using a dictionary. +_ipltypes = {UINT8: IPL_DEPTH_8U, INT8: IPL_DEPTH_8S, INT16: IPL_DEPTH_16S, + INT32: IPL_DEPTH_32S, FLOAT32: IPL_DEPTH_32F, + FLOAT64: IPL_DEPTH_64F} + + +#------------------------------------------------------------------------------- +# Utility functions for IplImage creation, array validation, etc... +#------------------------------------------------------------------------------- + + +cdef int IPLIMAGE_SIZE = sizeof(IplImage) + +cdef void populate_iplimage(np.ndarray arr, IplImage* img): + # The numpy array should be validated with the validate_array + # function before using this function. + # This function assumes that the array has successfully passed + # validation + + # everything that will never change + img.nSize = IPLIMAGE_SIZE + img.ID = 0 + img.dataOrder = 0 + img.origin = 0 + img.roi = NULL + img.maskROI = NULL + img.imageId = NULL + img.tileInfo = NULL + + cdef int channels + cdef int ndim = arr.ndim + cdef np.npy_intp* shape = arr.shape + cdef np.npy_intp* strides = arr.strides + + # nChannels is essentially the value of np.shape[2] of a 3D numpy array + # for a 2D array, nChannels is 1 + if ndim == 2: + img.nChannels = 1 + else: + img.nChannels = shape[2] + + img.depth = _ipltypes[arr.dtype] + img.width = shape[1] + img.height = shape[0] + img.imageSize = arr.nbytes + img.imageData = arr.data + img.widthStep = strides[0] + + # really doesn't matter what this is set to, because opencv only uses it to + # deallocate images, but it will never attempt to deallocate images we + # create ourselves. + img.imageDataOrigin = NULL + +cdef int validate_array(np.ndarray arr) except -1: + if arr.ndim != 2 and arr.ndim != 3: + raise ValueError('Arrays must have either 2 or 3 dimensions') + if arr.ndim == 3: + if arr.shape[2] > 4: + raise ValueError('A 3D array must have 4 or less channels') + if arr.dtype not in _ipltypes: + raise ValueError('Arrays must have one of the following dtypes: uint8, int8, int16, int32, float32, float64') + return 1 + +cdef int assert_dtype(np.ndarray arr, dtypes) except -1: + if arr.dtype not in dtypes: + raise ValueError('Unsupported dtype for this operation. \ + Supported dtypes are %s' % str(dtypes)) + return 1 + +cdef int assert_ndims(np.ndarray arr, dims) except -1: + if arr.ndim not in dims: + raise ValueError('Incorrect number of dimensions') + return 1 + +cdef int assert_nchannels(np.ndarray arr, channels) except -1: + cdef int nchannels + if arr.ndim == 2: + nchannels = 1 + else: + nchannels = arr.shape[2] + if nchannels not in channels: + raise ValueError('Incorrect number of channels') + return 1 + +cdef int assert_same_dtype(np.ndarray arr1, np.ndarray arr2) except -1: + if arr1.dtype != arr2.dtype: + raise ValueError('dtypes not same') + return 1 + +cdef int assert_same_shape(np.ndarray arr1, np.ndarray arr2) except -1: + if not np.PyArray_SAMESHAPE(arr1, arr2): + raise ValueError('arrays not same shape') + return 1 + +cdef int assert_same_width_and_height(np.ndarray arr1, np.ndarray arr2) except -1: + cdef np.npy_intp* shape1 = arr1.shape + cdef np.npy_intp* shape2 = arr2.shape + if (shape1[0] != shape2[0]) or (shape1[1] != shape2[1]): + raise ValueError('Arrays must have same width and height') + return 1 + +cdef int assert_like(np.ndarray arr1, np.ndarray arr2) except -1: + assert_same_dtype(arr1, arr2) + assert_same_shape(arr1, arr2) + return 1 + +cdef int assert_not_sharing_data(np.ndarray arr1, np.ndarray arr2) except -1: + if arr1.data == arr2.data: + raise ValueError('In place operation not supported. Make sure \ + the out array is not just a view of src array') + return 1 + +#------------------------------------------------------------------------------- +# NumPy array convienences +#------------------------------------------------------------------------------- +cdef np.ndarray new_array(int ndim, np.npy_intp* shape, dtype): + # need to incref because numpy will apprently steal a dtype reference + Py_INCREF(dtype) + return PyArray_Empty(ndim, shape, dtype, 0) + +cdef np.ndarray new_array_like(np.ndarray arr): + # need to incref because numpy will apprently steal a dtype reference + Py_INCREF(arr.dtype) + return PyArray_Empty(arr.ndim, arr.shape, arr.dtype, 0) + +cdef np.ndarray new_array_like_diff_dtype(np.ndarray arr, dtype): + # need to incref because numpy will apprently steal a dtype reference + Py_INCREF(dtype) + return PyArray_Empty(arr.ndim, arr.shape, dtype, 0) + +cdef np.npy_intp* clone_array_shape(np.ndarray arr): + # make sure you call PyMem_Free after your done with the shape + cdef int ndim = arr.ndim + cdef np.npy_intp* shape = PyMem_Malloc(ndim * sizeof(np.npy_intp)) + cdef int i + for i in range(ndim): + shape[i] = arr.shape[i] + return shape + +cdef np.npy_intp get_array_nbytes(np.ndarray arr): + cdef np.npy_intp nbytes = np.PyArray_NBYTES(arr) + return nbytes + +#------------------------------------------------------------------------------- +# OpenCV convienences +#------------------------------------------------------------------------------- +cdef CvPoint2D32f* array_as_cvPoint2D32f_ptr(np.ndarray arr): + cdef CvPoint2D32f* point2Darr + point2Darr = arr.data + return point2Darr + +cdef CvTermCriteria get_cvTermCriteria(int iterations, double epsilon): + cdef CvTermCriteria crit + if iterations and epsilon: + crit.type = (CV_TERMCRIT_ITER | CV_TERMCRIT_EPS) + crit.max_iter = iterations + crit.epsilon = epsilon + elif iterations and not epsilon: + crit.type = CV_TERMCRIT_ITER + crit.max_iter = iterations + crit.epsilon = 0. + else: + crit.type = CV_TERMCRIT_EPS + crit.max_iter = 0 + crit.epsilon = epsilon + return crit + + + + + + + diff --git a/scikits/image/opencv/opencv_constants.py b/scikits/image/opencv/opencv_constants.py new file mode 100644 index 00000000..3d62421b --- /dev/null +++ b/scikits/image/opencv/opencv_constants.py @@ -0,0 +1,20 @@ + +############################################# +# Constants (need a better place for these) +############################################ + + +CV_BLUR_NO_SCALE = 0 +CV_BLUR = 1 +CV_GAUSSIAN = 2 +CV_MEDIAN = 3 +CV_BILATERAL = 4 + +CV_TERMCRIT_NUMBER = 1 +CV_TERMCRIT_ITER = 1 +CV_TERMCRIT_EPS = 2 + +CV_INTER_NN = 0 +CV_INTER_LINEAR = 1 +CV_INTER_CUBIC = 2 +CV_INTER_AREA = 3 diff --git a/scikits/image/opencv/opencv_cv.c b/scikits/image/opencv/opencv_cv.c new file mode 100644 index 00000000..3d2ab972 --- /dev/null +++ b/scikits/image/opencv/opencv_cv.c @@ -0,0 +1,9070 @@ +/* Generated by Cython 0.11.3 on Wed Oct 14 17:34:09 2009 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +#include +#define __PYX_HAVE_API__scikits__image__opencv__opencv_cv +#include "stdlib.h" +#include "stdio.h" +#include "numpy/arrayobject.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; +static const char **__pyx_f; + + +#ifdef CYTHON_REFNANNY +typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#define __Pyx_INCREF(r) Py_INCREF(r) +#define __Pyx_DECREF(r) Py_DECREF(r) +#define __Pyx_GOTREF(r) +#define __Pyx_GIVEREF(r) +#define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + + +static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); + } + return r; +} + +static INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject *); + +#if __PYX_USE_C99_COMPLEX + #define __Pyx_REAL_PART(z) __real__(z) + #define __Pyx_IMAG_PART(z) __imag__(z) +#else + #define __Pyx_REAL_PART(z) ((z).real) + #define __Pyx_IMAG_PART(z) ((z).imag) +#endif + +#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z)) + +#if __PYX_USE_C99_COMPLEX + + typedef float _Complex __pyx_t_float_complex; + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + + #define __pyx_t_float_complex_is_zero(a) ((a) == 0) + #define __pyx_t_float_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_float_complex_add(a, b) ((a)+(b)) + #define __pyx_t_float_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_float_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_float_complex_div(a, b) ((a)/(b)) + #define __pyx_t_float_complex_neg(a) (-(a)) + +#else + + typedef struct { float real, imag; } __pyx_t_float_complex; + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real*b.real + b.imag*b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +#if __PYX_USE_C99_COMPLEX + + typedef double _Complex __pyx_t_double_complex; + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + + #define __pyx_t_double_complex_is_zero(a) ((a) == 0) + #define __pyx_t_double_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_double_complex_add(a, b) ((a)+(b)) + #define __pyx_t_double_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_double_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_double_complex_div(a, b) ((a)/(b)) + #define __pyx_t_double_complex_neg(a) (-(a)) + +#else + + typedef struct { double real, imag; } __pyx_t_double_complex; + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real*b.real + b.imag*b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +#if __PYX_USE_C99_COMPLEX + + typedef long double _Complex __pyx_t_long__double_complex; + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long__double_complex)_Complex_I; + } + + #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0) + #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_long__double_complex_add(a, b) ((a)+(b)) + #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_long__double_complex_div(a, b) ((a)/(b)) + #define __pyx_t_long__double_complex_neg(a) (-(a)) + +#else + + typedef struct { long double real, imag; } __pyx_t_long__double_complex; + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { + __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + long double denom = b.real*b.real + b.imag*b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) { + __pyx_t_long__double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Type declarations */ + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef __pyx_t_float_complex __pyx_t_5numpy_complex64_t; + +typedef __pyx_t_double_complex __pyx_t_5numpy_complex128_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":5 + * # available at build time. + * + * cdef struct _IplImage: # <<<<<<<<<<<<<< + * int nSize # sizeof(_IplImage) + * int ID # must be 0 + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type__IplImage { + int nSize; + int ID; + int nChannels; + int alphaChannel; + int depth; + char colorModel[4]; + char channelSeq[4]; + int dataOrder; + int origin; + int align; + int width; + int height; + void *roi; + void *maskROI; + void *imageId; + void *tileInfo; + int imageSize; + char *imageData; + int widthStep; + int BorderMode[4]; + int BorderConst[4]; + char *imageDataOrigin; +}; + +typedef struct __pyx_t_7scikits_5image_6opencv_11opencv_type__IplImage __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":38 + * ctypedef _IplImage IplImage + * + * cdef struct CvPoint2D32f: # <<<<<<<<<<<<<< + * float x + * float y + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f { + float x; + float y; +}; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":42 + * float y + * + * cdef struct CvSize: # <<<<<<<<<<<<<< + * int width + * int height + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvSize { + int width; + int height; +}; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_type.pxd":46 + * int height + * + * cdef struct CvTermCriteria: # <<<<<<<<<<<<<< + * int type + * int max_iter + */ + +struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria { + int type; + int max_iter; + double epsilon; +}; + +typedef __pyx_t_5numpy_uint8_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_UINT8_t; + +typedef __pyx_t_5numpy_int8_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_INT8_t; + +typedef __pyx_t_5numpy_int16_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_INT16_t; + +typedef __pyx_t_5numpy_int32_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_INT32_t; + +typedef __pyx_t_5numpy_float32_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_FLOAT32_t; + +typedef __pyx_t_5numpy_float64_t __pyx_t_7scikits_5image_6opencv_14opencv_backend_FLOAT64_t; + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvSobelPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int, int, int); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvLaplacePtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCannyPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, double, double, int); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvPreCorneDetectPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecsPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int, int); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenValPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int, int); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerHarrisPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int, int, double); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPixPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *, int, struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvSize, struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvSize, struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvSmoothPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int, int, int, double, double); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrackPtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *, int *, double, double, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int, int, double); + +typedef void (*__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvResizePtr)(__pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *, int); +/* Module declarations from python_buffer */ + +/* Module declarations from stdlib */ + +/* Module declarations from stdio */ + +/* Module declarations from numpy */ + +/* Module declarations from numpy */ + +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +/* Module declarations from python_version */ + +/* Module declarations from python_ref */ + +/* Module declarations from python_exc */ + +/* Module declarations from python_module */ + +/* Module declarations from python_mem */ + +/* Module declarations from python_tuple */ + +/* Module declarations from python_list */ + +/* Module declarations from python_object */ + +/* Module declarations from python_sequence */ + +/* Module declarations from python_mapping */ + +/* Module declarations from python_iterator */ + +/* Module declarations from python_type */ + +/* Module declarations from python_number */ + +/* Module declarations from python_int */ + +/* Module declarations from python_bool */ + +/* Module declarations from python_long */ + +/* Module declarations from python_float */ + +/* Module declarations from python_complex */ + +/* Module declarations from python_string */ + +/* Module declarations from python_unicode */ + +/* Module declarations from python_dict */ + +/* Module declarations from python_instance */ + +/* Module declarations from python_function */ + +/* Module declarations from python_method */ + +/* Module declarations from python_set */ + +/* Module declarations from python */ + +/* Module declarations from scikits.image.opencv.opencv_type */ + +/* Module declarations from scikits.image.opencv.opencv_backend */ + +static void (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage)(PyArrayObject *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array)(PyArrayObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype)(PyArrayObject *, PyObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_ndims)(PyArrayObject *, PyObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels)(PyArrayObject *, PyObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_dtype)(PyArrayObject *, PyArrayObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape)(PyArrayObject *, PyArrayObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_width_and_height)(PyArrayObject *, PyArrayObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_like)(PyArrayObject *, PyArrayObject *); /*proto*/ +static int (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data)(PyArrayObject *, PyArrayObject *); /*proto*/ +static PyArrayObject *(*__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array)(int, npy_intp *, PyObject *); /*proto*/ +static PyArrayObject *(*__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like)(PyArrayObject *); /*proto*/ +static PyArrayObject *(*__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype)(PyArrayObject *, PyObject *); /*proto*/ +static npy_intp (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_get_array_nbytes)(PyArrayObject *); /*proto*/ +static npy_intp *(*__pyx_f_7scikits_5image_6opencv_14opencv_backend_clone_array_shape)(PyArrayObject *); /*proto*/ +static struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *(*__pyx_f_7scikits_5image_6opencv_14opencv_backend_array_as_cvPoint2D32f_ptr)(PyArrayObject *); /*proto*/ +static struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria (*__pyx_f_7scikits_5image_6opencv_14opencv_backend_get_cvTermCriteria)(int, double); /*proto*/ +/* Module declarations from scikits.image.opencv.opencv_cv */ + +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvSobelPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvSobel; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvLaplacePtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvLaplace; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCannyPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCanny; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvPreCorneDetectPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvPreCornerDetect; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecsPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerEigenValsAndVecs; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenValPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerMinEigenVal; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerHarrisPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerHarris; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPixPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvFindCornerSubPix; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvSmoothPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvSmooth; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrackPtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvGoodFeaturesToTrack; +static __pyx_t_7scikits_5image_6opencv_9opencv_cv_cvResizePtr __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvResize; +static PyObject *__pyx_k_43 = 0; +static int __pyx_k_44; +static PyObject *__pyx_k_45 = 0; +static int __pyx_k_46; +#define __Pyx_MODULE_NAME "scikits.image.opencv.opencv_cv" +int __pyx_module_is_main_scikits__image__opencv__opencv_cv = 0; + +/* Implementation of scikits.image.opencv.opencv_cv */ +static char __pyx_k_38[] = "libcv.so"; +static char __pyx_k_39[] = "cv.dll"; +static char __pyx_k_40[] = "The opencv libraries were not found. Please make sure they are installed and available on the system path."; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_6; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_0; +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k_src[] = "src"; +static PyObject *__pyx_kp_src; +static char __pyx_k_out[] = "out"; +static PyObject *__pyx_kp_out; +static char __pyx_k_xorder[] = "xorder"; +static PyObject *__pyx_kp_xorder; +static char __pyx_k_yorder[] = "yorder"; +static PyObject *__pyx_kp_yorder; +static char __pyx_k_aperture_size[] = "aperture_size"; +static PyObject *__pyx_kp_aperture_size; +static char __pyx_k_31[] = "threshold1"; +static PyObject *__pyx_kp_31; +static char __pyx_k_32[] = "threshold2"; +static PyObject *__pyx_kp_32; +static char __pyx_k_block_size[] = "block_size"; +static PyObject *__pyx_kp_block_size; +static char __pyx_k_k[] = "k"; +static PyObject *__pyx_kp_k; +static char __pyx_k_corners[] = "corners"; +static PyObject *__pyx_kp_corners; +static char __pyx_k_count[] = "count"; +static PyObject *__pyx_kp_count; +static char __pyx_k_win[] = "win"; +static PyObject *__pyx_kp_win; +static char __pyx_k_zero_zone[] = "zero_zone"; +static PyObject *__pyx_kp_zero_zone; +static char __pyx_k_iterations[] = "iterations"; +static PyObject *__pyx_kp_iterations; +static char __pyx_k_epsilon[] = "epsilon"; +static PyObject *__pyx_kp_epsilon; +static char __pyx_k_smoothtype[] = "smoothtype"; +static PyObject *__pyx_kp_smoothtype; +static char __pyx_k_33[] = "param1"; +static PyObject *__pyx_kp_33; +static char __pyx_k_34[] = "param2"; +static PyObject *__pyx_kp_34; +static char __pyx_k_35[] = "param3"; +static PyObject *__pyx_kp_35; +static char __pyx_k_36[] = "param4"; +static PyObject *__pyx_kp_36; +static char __pyx_k_in_place[] = "in_place"; +static PyObject *__pyx_kp_in_place; +static char __pyx_k_corner_count[] = "corner_count"; +static PyObject *__pyx_kp_corner_count; +static char __pyx_k_quality_level[] = "quality_level"; +static PyObject *__pyx_kp_quality_level; +static char __pyx_k_min_distance[] = "min_distance"; +static PyObject *__pyx_kp_min_distance; +static char __pyx_k_mask[] = "mask"; +static PyObject *__pyx_kp_mask; +static char __pyx_k_use_harris[] = "use_harris"; +static PyObject *__pyx_kp_use_harris; +static char __pyx_k_height[] = "height"; +static PyObject *__pyx_kp_height; +static char __pyx_k_width[] = "width"; +static PyObject *__pyx_kp_width; +static char __pyx_k_method[] = "method"; +static PyObject *__pyx_kp_method; +static char __pyx_k_ctypes[] = "ctypes"; +static PyObject *__pyx_kp_ctypes; +static char __pyx_k_numpy[] = "numpy"; +static PyObject *__pyx_kp_numpy; +static char __pyx_k_np[] = "np"; +static PyObject *__pyx_kp_np; +static char __pyx_k_opencv_backend[] = "opencv_backend"; +static PyObject *__pyx_kp_opencv_backend; +static char __pyx_k_37[] = "*"; +static PyObject *__pyx_kp_37; +static char __pyx_k_opencv_constants[] = "opencv_constants"; +static PyObject *__pyx_kp_opencv_constants; +static char __pyx_k_CDLL[] = "CDLL"; +static PyObject *__pyx_kp_CDLL; +static char __pyx_k_cv[] = "cv"; +static PyObject *__pyx_kp_cv; +static char __pyx_k_RuntimeError[] = "RuntimeError"; +static PyObject *__pyx_kp_RuntimeError; +static char __pyx_k_addressof[] = "addressof"; +static PyObject *__pyx_kp_addressof; +static char __pyx_k_cvSobel[] = "cvSobel"; +static PyObject *__pyx_kp_cvSobel; +static char __pyx_k_cvLaplace[] = "cvLaplace"; +static PyObject *__pyx_kp_cvLaplace; +static char __pyx_k_cvCanny[] = "cvCanny"; +static PyObject *__pyx_kp_cvCanny; +static char __pyx_k_cvPreCornerDetect[] = "cvPreCornerDetect"; +static PyObject *__pyx_kp_cvPreCornerDetect; +static char __pyx_k_41[] = "cvCornerEigenValsAndVecs"; +static PyObject *__pyx_kp_41; +static char __pyx_k_cvCornerMinEigenVal[] = "cvCornerMinEigenVal"; +static PyObject *__pyx_kp_cvCornerMinEigenVal; +static char __pyx_k_cvCornerHarris[] = "cvCornerHarris"; +static PyObject *__pyx_kp_cvCornerHarris; +static char __pyx_k_cvFindCornerSubPix[] = "cvFindCornerSubPix"; +static PyObject *__pyx_kp_cvFindCornerSubPix; +static char __pyx_k_cvSmooth[] = "cvSmooth"; +static PyObject *__pyx_kp_cvSmooth; +static char __pyx_k_42[] = "cvGoodFeaturesToTrack"; +static PyObject *__pyx_kp_42; +static char __pyx_k_cvResize[] = "cvResize"; +static PyObject *__pyx_kp_cvResize; +static char __pyx_k_CV_GAUSSIAN[] = "CV_GAUSSIAN"; +static PyObject *__pyx_kp_CV_GAUSSIAN; +static char __pyx_k_CV_INTER_LINEAR[] = "CV_INTER_LINEAR"; +static PyObject *__pyx_kp_CV_INTER_LINEAR; +static char __pyx_k_47[] = "UINT8"; +static PyObject *__pyx_kp_47; +static char __pyx_k_48[] = "INT8"; +static PyObject *__pyx_kp_48; +static char __pyx_k_49[] = "FLOAT32"; +static PyObject *__pyx_kp_49; +static char __pyx_k_ValueError[] = "ValueError"; +static PyObject *__pyx_kp_ValueError; +static char __pyx_k_dtype[] = "dtype"; +static PyObject *__pyx_kp_dtype; +static char __pyx_k_51[] = "INT16"; +static PyObject *__pyx_kp_51; +static char __pyx_k_reshape[] = "reshape"; +static PyObject *__pyx_kp_reshape; +static char __pyx_k_shape[] = "shape"; +static PyObject *__pyx_kp_shape; +static char __pyx_k_CV_BLUR_NO_SCALE[] = "CV_BLUR_NO_SCALE"; +static PyObject *__pyx_kp_CV_BLUR_NO_SCALE; +static char __pyx_k_CV_BLUR[] = "CV_BLUR"; +static PyObject *__pyx_kp_CV_BLUR; +static char __pyx_k_range[] = "range"; +static PyObject *__pyx_kp_range; +static PyObject *__pyx_kp_38; +static PyObject *__pyx_kp_39; +static PyObject *__pyx_kp_40; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_kp_50; +static char __pyx_k_50[] = "aperture_size must be 3, 5, or 7"; +static PyObject *__pyx_kp_52; +static char __pyx_k_52[] = "aperture_size must be 3, 5, or 7"; +static PyObject *__pyx_kp_53; +static char __pyx_k_53[] = "aperture_size must be 3, 5, or 7"; +static PyObject *__pyx_kp_54; +static char __pyx_k_54[] = "aperture_size must be 3, 5, or 7"; +static PyObject *__pyx_kp_55; +static char __pyx_k_55[] = "aperture_size must be 3, 5, or 7"; +static PyObject *__pyx_kp_56; +static char __pyx_k_56[] = "aperture_size must be 3, 5, or 7"; +static PyObject *__pyx_kp_57; +static char __pyx_k_57[] = "aperture_size must be 3, 5, or 7"; +static PyObject *__pyx_kp_58; +static char __pyx_k_58[] = "the number of declared points is different than exists in the array"; +static PyObject *__pyx_kp_59; +static PyObject *__pyx_kp_60; +static char __pyx_k_59[] = "In place operation not supported with this filter"; +static char __pyx_k_60[] = "In place operation not supported with this filter"; +static PyObject *__pyx_kp_61; +static char __pyx_k_61[] = "width and height must not be none"; +static PyObject *__pyx_int_15; +static char __pyx_k___getbuffer__[] = "__getbuffer__"; +static PyObject *__pyx_kp___getbuffer__; +static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; +static PyObject *__pyx_kp___releasebuffer__; +static char __pyx_k_info[] = "info"; +static PyObject *__pyx_kp_info; +static char __pyx_k_flags[] = "flags"; +static PyObject *__pyx_kp_flags; +static PyObject *__pyx_kp_1; +static PyObject *__pyx_kp_2; +static PyObject *__pyx_kp_5; +static PyObject *__pyx_kp_23; +static char __pyx_k_1[] = "ndarray is not C contiguous"; +static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_3[] = ">"; +static char __pyx_k_4[] = "<"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_6[] = "b"; +static char __pyx_k_7[] = "B"; +static char __pyx_k_8[] = "h"; +static char __pyx_k_9[] = "H"; +static char __pyx_k_10[] = "i"; +static char __pyx_k_11[] = "I"; +static char __pyx_k_12[] = "l"; +static char __pyx_k_13[] = "L"; +static char __pyx_k_14[] = "q"; +static char __pyx_k_15[] = "Q"; +static char __pyx_k_16[] = "f"; +static char __pyx_k_17[] = "d"; +static char __pyx_k_18[] = "g"; +static char __pyx_k_19[] = "Zf"; +static char __pyx_k_20[] = "Zd"; +static char __pyx_k_21[] = "Zg"; +static char __pyx_k_22[] = "O"; +static char __pyx_k_23[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_24[] = "^"; +static PyObject *__pyx_kp_25; +static PyObject *__pyx_kp_28; +static PyObject *__pyx_kp_29; +static PyObject *__pyx_kp_30; +static char __pyx_k_25[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_26[] = ">"; +static char __pyx_k_27[] = "<"; +static char __pyx_k_28[] = "Non-native byte order not supported"; +static char __pyx_k_29[] = "Format string allocated too short."; +static char __pyx_k_30[] = "unknown dtype code in numpy.pxd (%d)"; + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":87 + * # Function Implementations + * #################################### + * def cvSobel(np.ndarray src, np.ndarray out=None, int xorder=1, int yorder=0, # <<<<<<<<<<<<<< + * int aperture_size=3): + * + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvSobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvSobel[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvSobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + PyArrayObject *__pyx_v_out = 0; + int __pyx_v_xorder; + int __pyx_v_yorder; + int __pyx_v_aperture_size; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_out,&__pyx_kp_xorder,&__pyx_kp_yorder,&__pyx_kp_aperture_size,0}; + __Pyx_SetupRefcountContext("cvSobel"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + values[1] = (PyObject*)((PyArrayObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_out); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_xorder); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_yorder); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_aperture_size); + if (unlikely(value)) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvSobel") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_out = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_xorder = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_xorder == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_xorder = 1; + } + if (values[3]) { + __pyx_v_yorder = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_yorder == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_yorder = 0; + } + if (values[4]) { + __pyx_v_aperture_size = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_aperture_size = 3; + } + } else { + __pyx_v_out = ((PyArrayObject *)Py_None); + __pyx_v_xorder = 1; + __pyx_v_yorder = 0; + __pyx_v_aperture_size = 3; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: __pyx_v_aperture_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 4: __pyx_v_yorder = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_yorder == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_xorder = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_xorder == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_out = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvSobel", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvSobel"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_out); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":96 + * """ + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + * assert_nchannels(src, [1]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":97 + * + * validate_array(src) + * assert_dtype(src, [UINT8, INT8, FLOAT32]) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_3 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":98 + * validate_array(src) + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":100 + * assert_nchannels(src, [1]) + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): # <<<<<<<<<<<<<< + * raise ValueError('aperture_size must be 3, 5, or 7') + * + */ + if ((__pyx_v_aperture_size != 3)) { + if ((__pyx_v_aperture_size != 5)) { + __pyx_t_3 = (__pyx_v_aperture_size != 7); + } else { + __pyx_t_3 = (__pyx_v_aperture_size != 5); + } + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = (__pyx_v_aperture_size != 3); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":101 + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + * raise ValueError('aperture_size must be 3, 5, or 7') # <<<<<<<<<<<<<< + * + * if out is not None: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_50); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_50); + __Pyx_GIVEREF(__pyx_kp_50); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":103 + * raise ValueError('aperture_size must be 3, 5, or 7') + * + * if out is not None: # <<<<<<<<<<<<<< + * validate_array(out) + * assert_not_sharing_data(src, out) + */ + __pyx_t_4 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":104 + * + * if out is not None: + * validate_array(out) # <<<<<<<<<<<<<< + * assert_not_sharing_data(src, out) + * assert_same_shape(src, out) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":105 + * if out is not None: + * validate_array(out) + * assert_not_sharing_data(src, out) # <<<<<<<<<<<<<< + * assert_same_shape(src, out) + * assert_nchannels(out, [1]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":106 + * validate_array(out) + * assert_not_sharing_data(src, out) + * assert_same_shape(src, out) # <<<<<<<<<<<<<< + * assert_nchannels(out, [1]) + * if src.dtype == UINT8 or src.dtype == INT8: + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":107 + * assert_not_sharing_data(src, out) + * assert_same_shape(src, out) + * assert_nchannels(out, [1]) # <<<<<<<<<<<<<< + * if src.dtype == UINT8 or src.dtype == INT8: + * assert_dtype(out, [INT16]) + */ + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":108 + * assert_same_shape(src, out) + * assert_nchannels(out, [1]) + * if src.dtype == UINT8 or src.dtype == INT8: # <<<<<<<<<<<<<< + * assert_dtype(out, [INT16]) + * else: + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_2, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __pyx_t_3; + } else { + __pyx_t_6 = __pyx_t_4; + } + if (__pyx_t_6) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":109 + * assert_nchannels(out, [1]) + * if src.dtype == UINT8 or src.dtype == INT8: + * assert_dtype(out, [INT16]) # <<<<<<<<<<<<<< + * else: + * assert_dtype(out, [FLOAT32]) + */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_51); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":111 + * assert_dtype(out, [INT16]) + * else: + * assert_dtype(out, [FLOAT32]) # <<<<<<<<<<<<<< + * else: + * if src.dtype == UINT8 or src.dtype == INT8: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + } + __pyx_L8:; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":113 + * assert_dtype(out, [FLOAT32]) + * else: + * if src.dtype == UINT8 or src.dtype == INT8: # <<<<<<<<<<<<<< + * out = new_array_like_diff_dtype(src, INT16) + * else: + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_2, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_6) { + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __pyx_t_4; + } else { + __pyx_t_3 = __pyx_t_6; + } + if (__pyx_t_3) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":114 + * else: + * if src.dtype == UINT8 or src.dtype == INT8: + * out = new_array_like_diff_dtype(src, INT16) # <<<<<<<<<<<<<< + * else: + * out = new_array_like(src) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_51); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(__pyx_v_src, __pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":116 + * out = new_array_like_diff_dtype(src, INT16) + * else: + * out = new_array_like(src) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(__pyx_v_src)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L9:; + } + __pyx_L7:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":121 + * cdef IplImage outimg + * + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":122 + * + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvSobel(&srcimg, &outimg, xorder, yorder, aperture_size) + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_out, (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":124 + * populate_iplimage(out, &outimg) + * + * c_cvSobel(&srcimg, &outimg, xorder, yorder, aperture_size) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvSobel((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_xorder, __pyx_v_yorder, __pyx_v_aperture_size); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":126 + * c_cvSobel(&srcimg, &outimg, xorder, yorder, aperture_size) + * + * return out # <<<<<<<<<<<<<< + * + * def cvLaplace(np.ndarray src, np.ndarray out=None, int aperture_size=3): + */ + __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvSobel"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":128 + * return out + * + * def cvLaplace(np.ndarray src, np.ndarray out=None, int aperture_size=3): # <<<<<<<<<<<<<< + * + * """ + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvLaplace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvLaplace[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvLaplace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + PyArrayObject *__pyx_v_out = 0; + int __pyx_v_aperture_size; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_out,&__pyx_kp_aperture_size,0}; + __Pyx_SetupRefcountContext("cvLaplace"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = (PyObject*)((PyArrayObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_out); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_aperture_size); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvLaplace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_out = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_aperture_size = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_aperture_size = 3; + } + } else { + __pyx_v_out = ((PyArrayObject *)Py_None); + __pyx_v_aperture_size = 3; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: __pyx_v_aperture_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_out = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvLaplace", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvLaplace"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_out); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":136 + * """ + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + * assert_nchannels(src, [1]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":137 + * + * validate_array(src) + * assert_dtype(src, [UINT8, INT8, FLOAT32]) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_3 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":138 + * validate_array(src) + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":140 + * assert_nchannels(src, [1]) + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): # <<<<<<<<<<<<<< + * raise ValueError('aperture_size must be 3, 5, or 7') + * + */ + if ((__pyx_v_aperture_size != 3)) { + if ((__pyx_v_aperture_size != 5)) { + __pyx_t_3 = (__pyx_v_aperture_size != 7); + } else { + __pyx_t_3 = (__pyx_v_aperture_size != 5); + } + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = (__pyx_v_aperture_size != 3); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":141 + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + * raise ValueError('aperture_size must be 3, 5, or 7') # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_52); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_52); + __Pyx_GIVEREF(__pyx_kp_52); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":144 + * + * + * if out is not None: # <<<<<<<<<<<<<< + * validate_array(out) + * assert_not_sharing_data(src, out) + */ + __pyx_t_4 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":145 + * + * if out is not None: + * validate_array(out) # <<<<<<<<<<<<<< + * assert_not_sharing_data(src, out) + * assert_same_shape(src, out) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":146 + * if out is not None: + * validate_array(out) + * assert_not_sharing_data(src, out) # <<<<<<<<<<<<<< + * assert_same_shape(src, out) + * assert_nchannels(out, [1]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":147 + * validate_array(out) + * assert_not_sharing_data(src, out) + * assert_same_shape(src, out) # <<<<<<<<<<<<<< + * assert_nchannels(out, [1]) + * if src.dtype == UINT8 or src.dtype == INT8: + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":148 + * assert_not_sharing_data(src, out) + * assert_same_shape(src, out) + * assert_nchannels(out, [1]) # <<<<<<<<<<<<<< + * if src.dtype == UINT8 or src.dtype == INT8: + * assert_dtype(out, [INT16]) + */ + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":149 + * assert_same_shape(src, out) + * assert_nchannels(out, [1]) + * if src.dtype == UINT8 or src.dtype == INT8: # <<<<<<<<<<<<<< + * assert_dtype(out, [INT16]) + * else: + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_2, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __pyx_t_3; + } else { + __pyx_t_6 = __pyx_t_4; + } + if (__pyx_t_6) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":150 + * assert_nchannels(out, [1]) + * if src.dtype == UINT8 or src.dtype == INT8: + * assert_dtype(out, [INT16]) # <<<<<<<<<<<<<< + * else: + * assert_dtype(out, [FLOAT32]) + */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_51); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":152 + * assert_dtype(out, [INT16]) + * else: + * assert_dtype(out, [FLOAT32]) # <<<<<<<<<<<<<< + * else: + * if src.dtype == UINT8 or src.dtype == INT8: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + } + __pyx_L8:; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":154 + * assert_dtype(out, [FLOAT32]) + * else: + * if src.dtype == UINT8 or src.dtype == INT8: # <<<<<<<<<<<<<< + * out = new_array_like_diff_dtype(src, INT16) + * else: + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_2, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_6) { + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __pyx_t_4; + } else { + __pyx_t_3 = __pyx_t_6; + } + if (__pyx_t_3) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":155 + * else: + * if src.dtype == UINT8 or src.dtype == INT8: + * out = new_array_like_diff_dtype(src, INT16) # <<<<<<<<<<<<<< + * else: + * out = new_array_like(src) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_51); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(__pyx_v_src, __pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":157 + * out = new_array_like_diff_dtype(src, INT16) + * else: + * out = new_array_like(src) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(__pyx_v_src)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L9:; + } + __pyx_L7:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":162 + * cdef IplImage outimg + * + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":163 + * + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvLaplace(&srcimg, &outimg, aperture_size) + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_out, (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":165 + * populate_iplimage(out, &outimg) + * + * c_cvLaplace(&srcimg, &outimg, aperture_size) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvLaplace((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_aperture_size); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":167 + * c_cvLaplace(&srcimg, &outimg, aperture_size) + * + * return out # <<<<<<<<<<<<<< + * + * def cvCanny(np.ndarray src, np.ndarray out=None, double threshold1=10, + */ + __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvLaplace"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":169 + * return out + * + * def cvCanny(np.ndarray src, np.ndarray out=None, double threshold1=10, # <<<<<<<<<<<<<< + * double threshold2=50, int aperture_size=3): + * + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCanny(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCanny[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCanny(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + PyArrayObject *__pyx_v_out = 0; + double __pyx_v_threshold1; + double __pyx_v_threshold2; + int __pyx_v_aperture_size; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_out,&__pyx_kp_31,&__pyx_kp_32,&__pyx_kp_aperture_size,0}; + __Pyx_SetupRefcountContext("cvCanny"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + values[1] = (PyObject*)((PyArrayObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_out); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_31); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_32); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_aperture_size); + if (unlikely(value)) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvCanny") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_out = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_threshold1 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_threshold1 = ((double)10); + } + if (values[3]) { + __pyx_v_threshold2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_threshold2 = ((double)50); + } + if (values[4]) { + __pyx_v_aperture_size = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_aperture_size = 3; + } + } else { + __pyx_v_out = ((PyArrayObject *)Py_None); + __pyx_v_threshold1 = ((double)10); + __pyx_v_threshold2 = ((double)50); + __pyx_v_aperture_size = 3; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: __pyx_v_aperture_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 4: __pyx_v_threshold2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_threshold1 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_out = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvCanny", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCanny"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_out); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":178 + * """ + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":179 + * + * validate_array(src) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":181 + * assert_nchannels(src, [1]) + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): # <<<<<<<<<<<<<< + * raise ValueError('aperture_size must be 3, 5, or 7') + * + */ + if ((__pyx_v_aperture_size != 3)) { + if ((__pyx_v_aperture_size != 5)) { + __pyx_t_3 = (__pyx_v_aperture_size != 7); + } else { + __pyx_t_3 = (__pyx_v_aperture_size != 5); + } + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = (__pyx_v_aperture_size != 3); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":182 + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + * raise ValueError('aperture_size must be 3, 5, or 7') # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_53); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_53); + __Pyx_GIVEREF(__pyx_kp_53); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":185 + * + * + * if out is not None: # <<<<<<<<<<<<<< + * validate_array(out) + * assert_nchannels(out, [1]) + */ + __pyx_t_4 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":186 + * + * if out is not None: + * validate_array(out) # <<<<<<<<<<<<<< + * assert_nchannels(out, [1]) + * assert_same_shape(src, out) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":187 + * if out is not None: + * validate_array(out) + * assert_nchannels(out, [1]) # <<<<<<<<<<<<<< + * assert_same_shape(src, out) + * assert_not_sharing_data(src, out) + */ + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":188 + * validate_array(out) + * assert_nchannels(out, [1]) + * assert_same_shape(src, out) # <<<<<<<<<<<<<< + * assert_not_sharing_data(src, out) + * else: + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":189 + * assert_nchannels(out, [1]) + * assert_same_shape(src, out) + * assert_not_sharing_data(src, out) # <<<<<<<<<<<<<< + * else: + * out = new_array_like(src) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":191 + * assert_not_sharing_data(src, out) + * else: + * out = new_array_like(src) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(__pyx_v_src)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L7:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":195 + * cdef IplImage srcimg + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":196 + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvCanny(&srcimg, &outimg, threshold1, threshold2, aperture_size) + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_out, (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":198 + * populate_iplimage(out, &outimg) + * + * c_cvCanny(&srcimg, &outimg, threshold1, threshold2, aperture_size) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCanny((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_threshold1, __pyx_v_threshold2, __pyx_v_aperture_size); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":200 + * c_cvCanny(&srcimg, &outimg, threshold1, threshold2, aperture_size) + * + * return out # <<<<<<<<<<<<<< + * + * def cvPreCornerDetect(np.ndarray src, np.ndarray out=None, int aperture_size=3): + */ + __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_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCanny"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":202 + * return out + * + * def cvPreCornerDetect(np.ndarray src, np.ndarray out=None, int aperture_size=3): # <<<<<<<<<<<<<< + * + * """ + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvPreCornerDetect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvPreCornerDetect[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvPreCornerDetect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + PyArrayObject *__pyx_v_out = 0; + int __pyx_v_aperture_size; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_out,&__pyx_kp_aperture_size,0}; + __Pyx_SetupRefcountContext("cvPreCornerDetect"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[1] = (PyObject*)((PyArrayObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_out); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_aperture_size); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvPreCornerDetect") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_out = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_aperture_size = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_aperture_size = 3; + } + } else { + __pyx_v_out = ((PyArrayObject *)Py_None); + __pyx_v_aperture_size = 3; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: __pyx_v_aperture_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_out = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvPreCornerDetect", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvPreCornerDetect"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_out); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":210 + * """ + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8, FLOAT32]) + * assert_nchannels(src, [1]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":211 + * + * validate_array(src) + * assert_dtype(src, [UINT8, FLOAT32]) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":212 + * validate_array(src) + * assert_dtype(src, [UINT8, FLOAT32]) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":214 + * assert_nchannels(src, [1]) + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): # <<<<<<<<<<<<<< + * raise ValueError('aperture_size must be 3, 5, or 7') + * + */ + if ((__pyx_v_aperture_size != 3)) { + if ((__pyx_v_aperture_size != 5)) { + __pyx_t_3 = (__pyx_v_aperture_size != 7); + } else { + __pyx_t_3 = (__pyx_v_aperture_size != 5); + } + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = (__pyx_v_aperture_size != 3); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":215 + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + * raise ValueError('aperture_size must be 3, 5, or 7') # <<<<<<<<<<<<<< + * + * if out is not None: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_54); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_54); + __Pyx_GIVEREF(__pyx_kp_54); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":217 + * raise ValueError('aperture_size must be 3, 5, or 7') + * + * if out is not None: # <<<<<<<<<<<<<< + * validate_array(out) + * assert_same_shape(src, out) + */ + __pyx_t_4 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":218 + * + * if out is not None: + * validate_array(out) # <<<<<<<<<<<<<< + * assert_same_shape(src, out) + * assert_dtype(out, [FLOAT32]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":219 + * if out is not None: + * validate_array(out) + * assert_same_shape(src, out) # <<<<<<<<<<<<<< + * assert_dtype(out, [FLOAT32]) + * assert_not_sharing_data(src, out) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":220 + * validate_array(out) + * assert_same_shape(src, out) + * assert_dtype(out, [FLOAT32]) # <<<<<<<<<<<<<< + * assert_not_sharing_data(src, out) + * else: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_out, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":221 + * assert_same_shape(src, out) + * assert_dtype(out, [FLOAT32]) + * assert_not_sharing_data(src, out) # <<<<<<<<<<<<<< + * else: + * out = new_array_like_diff_dtype(src, FLOAT32) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":223 + * assert_not_sharing_data(src, out) + * else: + * out = new_array_like_diff_dtype(src, FLOAT32) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(__pyx_v_src, __pyx_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L7:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":227 + * cdef IplImage srcimg + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":228 + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvPreCornerDetect(&srcimg, &outimg, aperture_size) + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_out, (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":230 + * populate_iplimage(out, &outimg) + * + * c_cvPreCornerDetect(&srcimg, &outimg, aperture_size) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvPreCornerDetect((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_aperture_size); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":232 + * c_cvPreCornerDetect(&srcimg, &outimg, aperture_size) + * + * return out # <<<<<<<<<<<<<< + * + * def cvCornerEigenValsAndVecs(np.ndarray src, int block_size=3, + */ + __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvPreCornerDetect"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":234 + * return out + * + * def cvCornerEigenValsAndVecs(np.ndarray src, int block_size=3, # <<<<<<<<<<<<<< + * int aperture_size=3): + * + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecs[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + int __pyx_v_block_size; + int __pyx_v_aperture_size; + npy_intp __pyx_v_outshape[2]; + PyObject *__pyx_v_out; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_block_size,&__pyx_kp_aperture_size,0}; + __Pyx_SetupRefcountContext("cvCornerEigenValsAndVecs"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_block_size); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_aperture_size); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvCornerEigenValsAndVecs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + if (values[1]) { + __pyx_v_block_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_block_size = 3; + } + if (values[2]) { + __pyx_v_aperture_size = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_aperture_size = 3; + } + } else { + __pyx_v_block_size = 3; + __pyx_v_aperture_size = 3; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: __pyx_v_aperture_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvCornerEigenValsAndVecs", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCornerEigenValsAndVecs"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_out = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":247 + * # given source array + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * assert_dtype(src, [UINT8, FLOAT32]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":248 + * + * validate_array(src) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8, FLOAT32]) + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":249 + * validate_array(src) + * assert_nchannels(src, [1]) + * assert_dtype(src, [UINT8, FLOAT32]) # <<<<<<<<<<<<<< + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":251 + * assert_dtype(src, [UINT8, FLOAT32]) + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): # <<<<<<<<<<<<<< + * raise ValueError('aperture_size must be 3, 5, or 7') + * + */ + if ((__pyx_v_aperture_size != 3)) { + if ((__pyx_v_aperture_size != 5)) { + __pyx_t_3 = (__pyx_v_aperture_size != 7); + } else { + __pyx_t_3 = (__pyx_v_aperture_size != 5); + } + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = (__pyx_v_aperture_size != 3); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":252 + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + * raise ValueError('aperture_size must be 3, 5, or 7') # <<<<<<<<<<<<<< + * + * cdef np.npy_intp outshape[2] + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_55); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_55); + __Pyx_GIVEREF(__pyx_kp_55); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":255 + * + * cdef np.npy_intp outshape[2] + * outshape[0] = src.shape[0] # <<<<<<<<<<<<<< + * outshape[1] = src.shape[1] * 6 + * + */ + (__pyx_v_outshape[0]) = (__pyx_v_src->dimensions[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":256 + * cdef np.npy_intp outshape[2] + * outshape[0] = src.shape[0] + * outshape[1] = src.shape[1] * 6 # <<<<<<<<<<<<<< + * + * out = new_array(2, outshape, FLOAT32) + */ + (__pyx_v_outshape[1]) = ((__pyx_v_src->dimensions[1]) * ((npy_intp)6)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":258 + * outshape[1] = src.shape[1] * 6 + * + * out = new_array(2, outshape, FLOAT32) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array(2, __pyx_v_outshape, __pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_out); + __pyx_v_out = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":262 + * cdef IplImage srcimg + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":263 + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvCornerEigenValsAndVecs(&srcimg, &outimg, block_size, aperture_size) + */ + if (!(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(((PyArrayObject *)__pyx_v_out), (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":265 + * populate_iplimage(out, &outimg) + * + * c_cvCornerEigenValsAndVecs(&srcimg, &outimg, block_size, aperture_size) # <<<<<<<<<<<<<< + * + * return out.reshape(out.shape[0], -1, 6) + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerEigenValsAndVecs((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_block_size, __pyx_v_aperture_size); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":267 + * c_cvCornerEigenValsAndVecs(&srcimg, &outimg, block_size, aperture_size) + * + * return out.reshape(out.shape[0], -1, 6) # <<<<<<<<<<<<<< + * + * def cvCornerMinEigenVal(np.ndarray src, int block_size=3, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_out, __pyx_kp_reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_out, __pyx_kp_shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_2 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(__pyx_int_6); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + __pyx_2 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCornerEigenValsAndVecs"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":269 + * return out.reshape(out.shape[0], -1, 6) + * + * def cvCornerMinEigenVal(np.ndarray src, int block_size=3, # <<<<<<<<<<<<<< + * int aperture_size=3): + * """ + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenVal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenVal[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenVal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + int __pyx_v_block_size; + int __pyx_v_aperture_size; + PyObject *__pyx_v_out; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_block_size,&__pyx_kp_aperture_size,0}; + __Pyx_SetupRefcountContext("cvCornerMinEigenVal"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_block_size); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_aperture_size); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvCornerMinEigenVal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + if (values[1]) { + __pyx_v_block_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_block_size = 3; + } + if (values[2]) { + __pyx_v_aperture_size = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_aperture_size = 3; + } + } else { + __pyx_v_block_size = 3; + __pyx_v_aperture_size = 3; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: __pyx_v_aperture_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvCornerMinEigenVal", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCornerMinEigenVal"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_out = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":280 + * # given source array + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * assert_dtype(src, [UINT8, FLOAT32]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":281 + * + * validate_array(src) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8, FLOAT32]) + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":282 + * validate_array(src) + * assert_nchannels(src, [1]) + * assert_dtype(src, [UINT8, FLOAT32]) # <<<<<<<<<<<<<< + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":284 + * assert_dtype(src, [UINT8, FLOAT32]) + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): # <<<<<<<<<<<<<< + * raise ValueError('aperture_size must be 3, 5, or 7') + * + */ + if ((__pyx_v_aperture_size != 3)) { + if ((__pyx_v_aperture_size != 5)) { + __pyx_t_3 = (__pyx_v_aperture_size != 7); + } else { + __pyx_t_3 = (__pyx_v_aperture_size != 5); + } + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = (__pyx_v_aperture_size != 3); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":285 + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + * raise ValueError('aperture_size must be 3, 5, or 7') # <<<<<<<<<<<<<< + * + * out = new_array_like_diff_dtype(src, FLOAT32) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_56); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_56); + __Pyx_GIVEREF(__pyx_kp_56); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":287 + * raise ValueError('aperture_size must be 3, 5, or 7') + * + * out = new_array_like_diff_dtype(src, FLOAT32) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(__pyx_v_src, __pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_out); + __pyx_v_out = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":291 + * cdef IplImage srcimg + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":292 + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvCornerMinEigenVal(&srcimg, &outimg, block_size, aperture_size) + */ + if (!(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(((PyArrayObject *)__pyx_v_out), (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":294 + * populate_iplimage(out, &outimg) + * + * c_cvCornerMinEigenVal(&srcimg, &outimg, block_size, aperture_size) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerMinEigenVal((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_block_size, __pyx_v_aperture_size); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":296 + * c_cvCornerMinEigenVal(&srcimg, &outimg, block_size, aperture_size) + * + * return out # <<<<<<<<<<<<<< + * + * def cvCornerHarris(np.ndarray src, int block_size=3, int aperture_size=3, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_out); + __pyx_r = __pyx_v_out; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCornerMinEigenVal"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":298 + * return out + * + * def cvCornerHarris(np.ndarray src, int block_size=3, int aperture_size=3, # <<<<<<<<<<<<<< + * double k=0.04): + * """ + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerHarris(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCornerHarris[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerHarris(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + int __pyx_v_block_size; + int __pyx_v_aperture_size; + double __pyx_v_k; + PyObject *__pyx_v_out; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_block_size,&__pyx_kp_aperture_size,&__pyx_kp_k,0}; + __Pyx_SetupRefcountContext("cvCornerHarris"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_block_size); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_aperture_size); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_k); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvCornerHarris") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + if (values[1]) { + __pyx_v_block_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_block_size = 3; + } + if (values[2]) { + __pyx_v_aperture_size = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_aperture_size = 3; + } + if (values[3]) { + __pyx_v_k = __pyx_PyFloat_AsDouble(values[3]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_k = 0.040000000000000001; + } + } else { + __pyx_v_block_size = 3; + __pyx_v_aperture_size = 3; + __pyx_v_k = 0.040000000000000001; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_k = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_aperture_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_aperture_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvCornerHarris", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCornerHarris"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_out = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":309 + * # given source array + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * assert_dtype(src, [UINT8, FLOAT32]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":310 + * + * validate_array(src) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8, FLOAT32]) + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":311 + * validate_array(src) + * assert_nchannels(src, [1]) + * assert_dtype(src, [UINT8, FLOAT32]) # <<<<<<<<<<<<<< + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":313 + * assert_dtype(src, [UINT8, FLOAT32]) + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): # <<<<<<<<<<<<<< + * raise ValueError('aperture_size must be 3, 5, or 7') + * + */ + if ((__pyx_v_aperture_size != 3)) { + if ((__pyx_v_aperture_size != 5)) { + __pyx_t_3 = (__pyx_v_aperture_size != 7); + } else { + __pyx_t_3 = (__pyx_v_aperture_size != 5); + } + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = (__pyx_v_aperture_size != 3); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":314 + * + * if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + * raise ValueError('aperture_size must be 3, 5, or 7') # <<<<<<<<<<<<<< + * + * out = new_array_like_diff_dtype(src, FLOAT32) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_57); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_57); + __Pyx_GIVEREF(__pyx_kp_57); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":316 + * raise ValueError('aperture_size must be 3, 5, or 7') + * + * out = new_array_like_diff_dtype(src, FLOAT32) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(__pyx_v_src, __pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_out); + __pyx_v_out = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":320 + * cdef IplImage srcimg + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":321 + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvCornerHarris(&srcimg, &outimg, block_size, aperture_size, k) + */ + if (!(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(((PyArrayObject *)__pyx_v_out), (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":323 + * populate_iplimage(out, &outimg) + * + * c_cvCornerHarris(&srcimg, &outimg, block_size, aperture_size, k) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerHarris((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_block_size, __pyx_v_aperture_size, __pyx_v_k); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":325 + * c_cvCornerHarris(&srcimg, &outimg, block_size, aperture_size, k) + * + * return out # <<<<<<<<<<<<<< + * + * def cvFindCornerSubPix(np.ndarray src, np.ndarray corners, int count, win, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_out); + __pyx_r = __pyx_v_out; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvCornerHarris"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":327 + * return out + * + * def cvFindCornerSubPix(np.ndarray src, np.ndarray corners, int count, win, # <<<<<<<<<<<<<< + * zero_zone=(-1, -1), int iterations=0, + * double epsilon=1e-5): + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPix[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + PyArrayObject *__pyx_v_corners = 0; + int __pyx_v_count; + PyObject *__pyx_v_win = 0; + PyObject *__pyx_v_zero_zone = 0; + int __pyx_v_iterations; + double __pyx_v_epsilon; + int __pyx_v_nbytes; + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *__pyx_v_cvcorners; + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvSize __pyx_v_cvwin; + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvSize __pyx_v_cvzerozone; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria __pyx_v_crit; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_corners,&__pyx_kp_count,&__pyx_kp_win,&__pyx_kp_zero_zone,&__pyx_kp_iterations,&__pyx_kp_epsilon,0}; + __Pyx_SetupRefcountContext("cvFindCornerSubPix"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[4] = __pyx_k_43; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_corners); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cvFindCornerSubPix", 0, 4, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_count); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cvFindCornerSubPix", 0, 4, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_win); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cvFindCornerSubPix", 0, 4, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_zero_zone); + if (unlikely(value)) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_iterations); + if (unlikely(value)) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_epsilon); + if (unlikely(value)) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvFindCornerSubPix") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_corners = ((PyArrayObject *)values[1]); + __pyx_v_count = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_win = values[3]; + __pyx_v_zero_zone = values[4]; + if (values[5]) { + __pyx_v_iterations = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_iterations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_iterations = 0; + } + if (values[6]) { + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[6]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_epsilon = 1.0000000000000001e-05; + } + } else { + __pyx_v_zero_zone = __pyx_k_43; + __pyx_v_iterations = 0; + __pyx_v_epsilon = 1.0000000000000001e-05; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 6: + __pyx_v_iterations = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_iterations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 5: + __pyx_v_zero_zone = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: + __pyx_v_win = PyTuple_GET_ITEM(__pyx_args, 3); + __pyx_v_count = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_corners = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvFindCornerSubPix", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvFindCornerSubPix"); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corners), __pyx_ptype_5numpy_ndarray, 1, "corners", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":337 + * """ + * + * validate_array(src) # <<<<<<<<<<<<<< + * validate_array(corners) + * + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":338 + * + * validate_array(src) + * validate_array(corners) # <<<<<<<<<<<<<< + * + * assert_nchannels(src, [1]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_corners); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":340 + * validate_array(corners) + * + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8]) + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":341 + * + * assert_nchannels(src, [1]) + * assert_dtype(src, [UINT8]) # <<<<<<<<<<<<<< + * + * assert_nchannels(corners, [1]) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":343 + * assert_dtype(src, [UINT8]) + * + * assert_nchannels(corners, [1]) # <<<<<<<<<<<<<< + * assert_dtype(corners, [FLOAT32]) + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_corners, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":344 + * + * assert_nchannels(corners, [1]) + * assert_dtype(corners, [FLOAT32]) # <<<<<<<<<<<<<< + * + * # make sure the number of points + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_1 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_corners, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":352 + * # flat anyway, but regardless, the validate_array function ensures + * # that it is 2D + * cdef int nbytes = get_array_nbytes(corners) # <<<<<<<<<<<<<< + * if nbytes != (count * 2 * 4): + * raise ValueError('the number of declared points is different than exists in the array') + */ + __pyx_v_nbytes = ((int)__pyx_f_7scikits_5image_6opencv_14opencv_backend_get_array_nbytes(__pyx_v_corners)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":353 + * # that it is 2D + * cdef int nbytes = get_array_nbytes(corners) + * if nbytes != (count * 2 * 4): # <<<<<<<<<<<<<< + * raise ValueError('the number of declared points is different than exists in the array') + * + */ + __pyx_t_3 = (__pyx_v_nbytes != ((__pyx_v_count * 2) * 4)); + if (__pyx_t_3) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":354 + * cdef int nbytes = get_array_nbytes(corners) + * if nbytes != (count * 2 * 4): + * raise ValueError('the number of declared points is different than exists in the array') # <<<<<<<<<<<<<< + * + * cdef CvPoint2D32f* cvcorners = array_as_cvPoint2D32f_ptr(corners) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_58); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_58); + __Pyx_GIVEREF(__pyx_kp_58); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":356 + * raise ValueError('the number of declared points is different than exists in the array') + * + * cdef CvPoint2D32f* cvcorners = array_as_cvPoint2D32f_ptr(corners) # <<<<<<<<<<<<<< + * + * cdef CvSize cvwin + */ + __pyx_v_cvcorners = __pyx_f_7scikits_5image_6opencv_14opencv_backend_array_as_cvPoint2D32f_ptr(__pyx_v_corners); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":359 + * + * cdef CvSize cvwin + * cvwin.height = win[0] # <<<<<<<<<<<<<< + * cvwin.width = win[1] + * + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_win, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_cvwin.height = ((int)__pyx_t_1); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":360 + * cdef CvSize cvwin + * cvwin.height = win[0] + * cvwin.width = win[1] # <<<<<<<<<<<<<< + * + * cdef CvSize cvzerozone + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_win, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_cvwin.width = ((int)__pyx_t_1); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":363 + * + * cdef CvSize cvzerozone + * cvzerozone.height = zero_zone[0] # <<<<<<<<<<<<<< + * cvzerozone.width = zero_zone[1] + * + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_zero_zone, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_cvzerozone.height = ((int)__pyx_t_1); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":364 + * cdef CvSize cvzerozone + * cvzerozone.height = zero_zone[0] + * cvzerozone.width = zero_zone[1] # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_1 = __Pyx_GetItemInt(__pyx_v_zero_zone, 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_cvzerozone.width = ((int)__pyx_t_1); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":367 + * + * cdef IplImage srcimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * + * cdef CvTermCriteria crit + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":370 + * + * cdef CvTermCriteria crit + * crit = get_cvTermCriteria(iterations, epsilon) # <<<<<<<<<<<<<< + * + * c_cvFindCornerSubPix(&srcimg, cvcorners, count, cvwin, cvzerozone, crit) + */ + __pyx_v_crit = __pyx_f_7scikits_5image_6opencv_14opencv_backend_get_cvTermCriteria(__pyx_v_iterations, __pyx_v_epsilon); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":372 + * crit = get_cvTermCriteria(iterations, epsilon) + * + * c_cvFindCornerSubPix(&srcimg, cvcorners, count, cvwin, cvzerozone, crit) # <<<<<<<<<<<<<< + * + * return None + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvFindCornerSubPix((&__pyx_v_srcimg), __pyx_v_cvcorners, __pyx_v_count, __pyx_v_cvwin, __pyx_v_cvzerozone, __pyx_v_crit); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":374 + * c_cvFindCornerSubPix(&srcimg, cvcorners, count, cvwin, cvzerozone, crit) + * + * return None # <<<<<<<<<<<<<< + * + * def cvSmooth(np.ndarray src, np.ndarray out=None, int smoothtype=CV_GAUSSIAN, int param1=3, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvFindCornerSubPix"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":376 + * return None + * + * def cvSmooth(np.ndarray src, np.ndarray out=None, int smoothtype=CV_GAUSSIAN, int param1=3, # <<<<<<<<<<<<<< + * int param2=0, double param3=0, double param4=0, bool in_place=False): + * """ + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvSmooth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvSmooth[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvSmooth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + PyArrayObject *__pyx_v_out = 0; + int __pyx_v_smoothtype; + int __pyx_v_param1; + int __pyx_v_param2; + double __pyx_v_param3; + double __pyx_v_param4; + PyObject *__pyx_v_in_place = 0; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_out,&__pyx_kp_smoothtype,&__pyx_kp_33,&__pyx_kp_34,&__pyx_kp_35,&__pyx_kp_36,&__pyx_kp_in_place,0}; + __Pyx_SetupRefcountContext("cvSmooth"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + values[1] = (PyObject*)((PyArrayObject *)Py_None); + values[7] = (PyObject*)__pyx_k_45; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_out); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_smoothtype); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_33); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_34); + if (unlikely(value)) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_35); + if (unlikely(value)) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_36); + if (unlikely(value)) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_in_place); + if (unlikely(value)) { values[7] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvSmooth") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_out = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_smoothtype = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_smoothtype == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_smoothtype = __pyx_k_44; + } + if (values[3]) { + __pyx_v_param1 = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_param1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_param1 = 3; + } + if (values[4]) { + __pyx_v_param2 = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_param2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_param2 = 0; + } + if (values[5]) { + __pyx_v_param3 = __pyx_PyFloat_AsDouble(values[5]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_param3 = ((double)0); + } + if (values[6]) { + __pyx_v_param4 = __pyx_PyFloat_AsDouble(values[6]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_param4 = ((double)0); + } + __pyx_v_in_place = ((PyObject *)values[7]); + } else { + __pyx_v_out = ((PyArrayObject *)Py_None); + __pyx_v_smoothtype = __pyx_k_44; + __pyx_v_param1 = 3; + __pyx_v_param2 = 0; + __pyx_v_param3 = ((double)0); + __pyx_v_param4 = ((double)0); + __pyx_v_in_place = __pyx_k_45; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: __pyx_v_in_place = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 7)); + case 7: __pyx_v_param4 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 6: __pyx_v_param3 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 5: __pyx_v_param2 = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_param2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 4: __pyx_v_param1 = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_param1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_smoothtype = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_smoothtype == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_out = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvSmooth", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvSmooth"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_out); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_place), &PyBool_Type, 1, "in_place", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":384 + * """ + * + * validate_array(src) # <<<<<<<<<<<<<< + * if out is not None: + * validate_array(out) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":385 + * + * validate_array(src) + * if out is not None: # <<<<<<<<<<<<<< + * validate_array(out) + * + */ + __pyx_t_2 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":386 + * validate_array(src) + * if out is not None: + * validate_array(out) # <<<<<<<<<<<<<< + * + * # there are restrictions that must be placed on the data depending on + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":392 + * + * # CV_BLUR_NO_SCALE + * if smoothtype == CV_BLUR_NO_SCALE: # <<<<<<<<<<<<<< + * + * if in_place: + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_smoothtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_BLUR_NO_SCALE); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":394 + * if smoothtype == CV_BLUR_NO_SCALE: + * + * if in_place: # <<<<<<<<<<<<<< + * raise RuntimeError('In place operation not supported with this filter') + * + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_in_place)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":395 + * + * if in_place: + * raise RuntimeError('In place operation not supported with this filter') # <<<<<<<<<<<<<< + * + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_59); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_59); + __Pyx_GIVEREF(__pyx_kp_59); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":397 + * raise RuntimeError('In place operation not supported with this filter') + * + * assert_dtype(src, [UINT8, INT8, FLOAT32]) # <<<<<<<<<<<<<< + * assert_ndims(src, [2]) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_3 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":398 + * + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + * assert_ndims(src, [2]) # <<<<<<<<<<<<<< + * + * if out is not None: + */ + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_2); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_ndims(__pyx_v_src, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":400 + * assert_ndims(src, [2]) + * + * if out is not None: # <<<<<<<<<<<<<< + * if src.dtype == FLOAT32: + * assert_dtype(out, [FLOAT32]) + */ + __pyx_t_2 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":401 + * + * if out is not None: + * if src.dtype == FLOAT32: # <<<<<<<<<<<<<< + * assert_dtype(out, [FLOAT32]) + * else: + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":402 + * if out is not None: + * if src.dtype == FLOAT32: + * assert_dtype(out, [FLOAT32]) # <<<<<<<<<<<<<< + * else: + * assert_dtype(out, [INT16]) + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __pyx_2 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_out, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":404 + * assert_dtype(out, [FLOAT32]) + * else: + * assert_dtype(out, [INT16]) # <<<<<<<<<<<<<< + * assert_same_shape(src, out) + * else: + */ + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_51); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_3 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_out, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + } + __pyx_L10:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":405 + * else: + * assert_dtype(out, [INT16]) + * assert_same_shape(src, out) # <<<<<<<<<<<<<< + * else: + * if src.dtype == FLOAT32: + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":407 + * assert_same_shape(src, out) + * else: + * if src.dtype == FLOAT32: # <<<<<<<<<<<<<< + * out = new_array_like(src) + * else: + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":408 + * else: + * if src.dtype == FLOAT32: + * out = new_array_like(src) # <<<<<<<<<<<<<< + * else: + * out = new_array_like_diff_dtype(src, INT16) + */ + __pyx_t_3 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(__pyx_v_src)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L11; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":410 + * out = new_array_like(src) + * else: + * out = new_array_like_diff_dtype(src, INT16) # <<<<<<<<<<<<<< + * + * # CV_BLUR and CV_GAUSSIAN + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_51); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(__pyx_v_src, __pyx_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L11:; + } + __pyx_L9:; + goto __pyx_L7; + } + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":413 + * + * # CV_BLUR and CV_GAUSSIAN + * elif smoothtype == CV_BLUR or smoothtype == CV_GAUSSIAN: # <<<<<<<<<<<<<< + * + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_smoothtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_BLUR); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_2) { + __pyx_t_4 = PyInt_FromLong(__pyx_v_smoothtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_GAUSSIAN); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_2; + } + if (__pyx_t_6) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":415 + * elif smoothtype == CV_BLUR or smoothtype == CV_GAUSSIAN: + * + * assert_dtype(src, [UINT8, INT8, FLOAT32]) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1, 3]) + * + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_2 = 0; + __pyx_3 = 0; + __pyx_1 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":416 + * + * assert_dtype(src, [UINT8, INT8, FLOAT32]) + * assert_nchannels(src, [1, 3]) # <<<<<<<<<<<<<< + * + * if in_place: + */ + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_3); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":418 + * assert_nchannels(src, [1, 3]) + * + * if in_place: # <<<<<<<<<<<<<< + * out = src + * elif out is not None: + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_in_place)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":419 + * + * if in_place: + * out = src # <<<<<<<<<<<<<< + * elif out is not None: + * assert_like(src, out) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_src)); + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = __pyx_v_src; + goto __pyx_L12; + } + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":420 + * if in_place: + * out = src + * elif out is not None: # <<<<<<<<<<<<<< + * assert_like(src, out) + * else: + */ + __pyx_t_6 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_6) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":421 + * out = src + * elif out is not None: + * assert_like(src, out) # <<<<<<<<<<<<<< + * else: + * out = new_array_like(src) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_like(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":423 + * assert_like(src, out) + * else: + * out = new_array_like(src) # <<<<<<<<<<<<<< + * + * # CV_MEDIAN and CV_BILATERAL + */ + __pyx_t_3 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(__pyx_v_src)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L12:; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":427 + * # CV_MEDIAN and CV_BILATERAL + * else: + * assert_dtype(src, [UINT8, INT8]) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1, 3]) + * + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_48); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_2 = 0; + __pyx_3 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":428 + * else: + * assert_dtype(src, [UINT8, INT8]) + * assert_nchannels(src, [1, 3]) # <<<<<<<<<<<<<< + * + * if in_place: + */ + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_3); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":430 + * assert_nchannels(src, [1, 3]) + * + * if in_place: # <<<<<<<<<<<<<< + * raise RuntimeError('In place operation not supported with this filter') + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_in_place)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":431 + * + * if in_place: + * raise RuntimeError('In place operation not supported with this filter') # <<<<<<<<<<<<<< + * + * if out is not None: + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_kp_60); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_60); + __Pyx_GIVEREF(__pyx_kp_60); + __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":433 + * raise RuntimeError('In place operation not supported with this filter') + * + * if out is not None: # <<<<<<<<<<<<<< + * assert_like(src, out) + * else: + */ + __pyx_t_6 = (((PyObject *)__pyx_v_out) != Py_None); + if (__pyx_t_6) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":434 + * + * if out is not None: + * assert_like(src, out) # <<<<<<<<<<<<<< + * else: + * out = new_array_like(src) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_like(__pyx_v_src, __pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":436 + * assert_like(src, out) + * else: + * out = new_array_like(src) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_t_4 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(__pyx_v_src)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_out)); + __pyx_v_out = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L14:; + } + __pyx_L7:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":440 + * cdef IplImage srcimg + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":441 + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvSmooth(&srcimg, &outimg, smoothtype, param1, param2, param3, param4) + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_out, (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":443 + * populate_iplimage(out, &outimg) + * + * c_cvSmooth(&srcimg, &outimg, smoothtype, param1, param2, param3, param4) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvSmooth((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_smoothtype, __pyx_v_param1, __pyx_v_param2, __pyx_v_param3, __pyx_v_param4); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":445 + * c_cvSmooth(&srcimg, &outimg, smoothtype, param1, param2, param3, param4) + * + * return out # <<<<<<<<<<<<<< + * + * def cvGoodFeaturesToTrack(np.ndarray src, int corner_count, double quality_level, + */ + __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_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvSmooth"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":447 + * return out + * + * def cvGoodFeaturesToTrack(np.ndarray src, int corner_count, double quality_level, # <<<<<<<<<<<<<< + * double min_distance, np.ndarray mask=None, + * int block_size=3, int use_harris=0, double k=0.04): + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrack[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + int __pyx_v_corner_count; + double __pyx_v_quality_level; + double __pyx_v_min_distance; + PyArrayObject *__pyx_v_mask = 0; + int __pyx_v_block_size; + int __pyx_v_use_harris; + double __pyx_v_k; + PyArrayObject *__pyx_v_eig = 0; + PyArrayObject *__pyx_v_temp = 0; + struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *__pyx_v_corners; + int __pyx_v_out_corner_count; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_eigimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_tempimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *__pyx_v_maskimg; + npy_intp __pyx_v_cornershape[2]; + PyArrayObject *__pyx_v_cornersarr = 0; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_corner_count,&__pyx_kp_quality_level,&__pyx_kp_min_distance,&__pyx_kp_mask,&__pyx_kp_block_size,&__pyx_kp_use_harris,&__pyx_kp_k,0}; + __Pyx_SetupRefcountContext("cvGoodFeaturesToTrack"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + values[4] = (PyObject*)((PyArrayObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_corner_count); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cvGoodFeaturesToTrack", 0, 4, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_quality_level); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cvGoodFeaturesToTrack", 0, 4, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_min_distance); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cvGoodFeaturesToTrack", 0, 4, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_mask); + if (unlikely(value)) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_block_size); + if (unlikely(value)) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_use_harris); + if (unlikely(value)) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_k); + if (unlikely(value)) { values[7] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvGoodFeaturesToTrack") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_corner_count = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_corner_count == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_quality_level = __pyx_PyFloat_AsDouble(values[2]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_distance = __pyx_PyFloat_AsDouble(values[3]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mask = ((PyArrayObject *)values[4]); + if (values[5]) { + __pyx_v_block_size = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_block_size = 3; + } + if (values[6]) { + __pyx_v_use_harris = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_use_harris == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_use_harris = 0; + } + if (values[7]) { + __pyx_v_k = __pyx_PyFloat_AsDouble(values[7]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_k = 0.040000000000000001; + } + } else { + __pyx_v_mask = ((PyArrayObject *)Py_None); + __pyx_v_block_size = 3; + __pyx_v_use_harris = 0; + __pyx_v_k = 0.040000000000000001; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: + __pyx_v_k = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 7: + __pyx_v_use_harris = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_use_harris == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 6: + __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 5: + __pyx_v_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + case 4: + __pyx_v_min_distance = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_quality_level = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_corner_count = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_corner_count == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvGoodFeaturesToTrack", 0, 4, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvGoodFeaturesToTrack"); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":456 + * """ + * + * validate_array(src) # <<<<<<<<<<<<<< + * assert_dtype(src, [UINT8, FLOAT32]) + * assert_nchannels(src, [1]) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":457 + * + * validate_array(src) + * assert_dtype(src, [UINT8, FLOAT32]) # <<<<<<<<<<<<<< + * assert_nchannels(src, [1]) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_47); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":458 + * validate_array(src) + * assert_dtype(src, [UINT8, FLOAT32]) + * assert_nchannels(src, [1]) # <<<<<<<<<<<<<< + * + * cdef np.ndarray eig = new_array_like_diff_dtype(src, FLOAT32) + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_src, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":460 + * assert_nchannels(src, [1]) + * + * cdef np.ndarray eig = new_array_like_diff_dtype(src, FLOAT32) # <<<<<<<<<<<<<< + * cdef np.ndarray temp = new_array_like(eig) + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype(__pyx_v_src, __pyx_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_eig = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":461 + * + * cdef np.ndarray eig = new_array_like_diff_dtype(src, FLOAT32) + * cdef np.ndarray temp = new_array_like(eig) # <<<<<<<<<<<<<< + * + * cdef CvPoint2D32f* corners = ( + */ + __pyx_t_2 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like(__pyx_v_eig)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_temp = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":464 + * + * cdef CvPoint2D32f* corners = ( + * PyMem_Malloc(corner_count * sizeof(CvPoint2D32f))) # <<<<<<<<<<<<<< + * + * cdef int out_corner_count + */ + __pyx_v_corners = ((struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *)PyMem_Malloc((__pyx_v_corner_count * (sizeof(struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f))))); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":467 + * + * cdef int out_corner_count + * out_corner_count = corner_count # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + __pyx_v_out_corner_count = __pyx_v_corner_count; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":474 + * cdef IplImage *maskimg + * + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(eig, &eigimg) + * populate_iplimage(temp, &tempimg) + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":475 + * + * populate_iplimage(src, &srcimg) + * populate_iplimage(eig, &eigimg) # <<<<<<<<<<<<<< + * populate_iplimage(temp, &tempimg) + * if mask is None: + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_eig, (&__pyx_v_eigimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":476 + * populate_iplimage(src, &srcimg) + * populate_iplimage(eig, &eigimg) + * populate_iplimage(temp, &tempimg) # <<<<<<<<<<<<<< + * if mask is None: + * maskimg = NULL + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_temp, (&__pyx_v_tempimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":477 + * populate_iplimage(eig, &eigimg) + * populate_iplimage(temp, &tempimg) + * if mask is None: # <<<<<<<<<<<<<< + * maskimg = NULL + * else: + */ + __pyx_t_3 = (((PyObject *)__pyx_v_mask) == Py_None); + if (__pyx_t_3) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":478 + * populate_iplimage(temp, &tempimg) + * if mask is None: + * maskimg = NULL # <<<<<<<<<<<<<< + * else: + * validate_array(mask) + */ + __pyx_v_maskimg = NULL; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":480 + * maskimg = NULL + * else: + * validate_array(mask) # <<<<<<<<<<<<<< + * assert_nchannels(mask, [1]) + * populate_iplimage(mask, maskimg) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_mask); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":481 + * else: + * validate_array(mask) + * assert_nchannels(mask, [1]) # <<<<<<<<<<<<<< + * populate_iplimage(mask, maskimg) + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels(__pyx_v_mask, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":482 + * validate_array(mask) + * assert_nchannels(mask, [1]) + * populate_iplimage(mask, maskimg) # <<<<<<<<<<<<<< + * + * c_cvGoodFeaturesToTrack(&srcimg, &eigimg, &tempimg, corners, &out_corner_count, + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_mask, __pyx_v_maskimg); + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":486 + * c_cvGoodFeaturesToTrack(&srcimg, &eigimg, &tempimg, corners, &out_corner_count, + * quality_level, min_distance, maskimg, block_size, + * use_harris, k) # <<<<<<<<<<<<<< + * + * # since the maximum allowed corners may not have been found + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvGoodFeaturesToTrack((&__pyx_v_srcimg), (&__pyx_v_eigimg), (&__pyx_v_tempimg), __pyx_v_corners, (&__pyx_v_out_corner_count), __pyx_v_quality_level, __pyx_v_min_distance, __pyx_v_maskimg, __pyx_v_block_size, __pyx_v_use_harris, __pyx_v_k); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":496 + * + * cdef np.npy_intp cornershape[2] + * cornershape[0] = out_corner_count # <<<<<<<<<<<<<< + * cornershape[1] = 2 + * + */ + (__pyx_v_cornershape[0]) = ((npy_intp)__pyx_v_out_corner_count); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":497 + * cdef np.npy_intp cornershape[2] + * cornershape[0] = out_corner_count + * cornershape[1] = 2 # <<<<<<<<<<<<<< + * + * cdef np.ndarray cornersarr = new_array(2, cornershape, FLOAT32) + */ + (__pyx_v_cornershape[1]) = 2; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":499 + * cornershape[1] = 2 + * + * cdef np.ndarray cornersarr = new_array(2, cornershape, FLOAT32) # <<<<<<<<<<<<<< + * cdef int i + * for i in range(out_corner_count): + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_49); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array(2, __pyx_v_cornershape, __pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_v_cornersarr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":501 + * cdef np.ndarray cornersarr = new_array(2, cornershape, FLOAT32) + * cdef int i + * for i in range(out_corner_count): # <<<<<<<<<<<<<< + * cornersarr[i,0] = corners[i].x + * cornersarr[i,1] = corners[i].y + */ + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_v_out_corner_count; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":502 + * cdef int i + * for i in range(out_corner_count): + * cornersarr[i,0] = corners[i].x # <<<<<<<<<<<<<< + * cornersarr[i,1] = corners[i].y + * + */ + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_corners[__pyx_v_i]).x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_4 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_cornersarr), ((PyObject *)__pyx_t_5), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":503 + * for i in range(out_corner_count): + * cornersarr[i,0] = corners[i].x + * cornersarr[i,1] = corners[i].y # <<<<<<<<<<<<<< + * + * PyMem_Free(corners) + */ + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_corners[__pyx_v_i]).y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_5 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_cornersarr), ((PyObject *)__pyx_t_4), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":505 + * cornersarr[i,1] = corners[i].y + * + * PyMem_Free(corners) # <<<<<<<<<<<<<< + * + * return cornersarr + */ + PyMem_Free(__pyx_v_corners); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":507 + * PyMem_Free(corners) + * + * return cornersarr # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_cornersarr)); + __pyx_r = ((PyObject *)__pyx_v_cornersarr); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvGoodFeaturesToTrack"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_eig); + __Pyx_XDECREF((PyObject *)__pyx_v_temp); + __Pyx_XDECREF((PyObject *)__pyx_v_cornersarr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":510 + * + * + * def cvResize(np.ndarray src, height=None, width=None, # <<<<<<<<<<<<<< + * int method=CV_INTER_LINEAR): + * """ + */ + +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvResize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvResize[] = "\n better doc string needed. \n for now:\n http://opencv.willowgarage.com/documentation/cvreference.html\n "; +static PyObject *__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvResize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_src = 0; + PyObject *__pyx_v_height = 0; + PyObject *__pyx_v_width = 0; + int __pyx_v_method; + int __pyx_v_ndim; + npy_intp *__pyx_v_shape; + PyArrayObject *__pyx_v_out = 0; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_srcimg; + __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage __pyx_v_outimg; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + npy_intp __pyx_t_7; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_src,&__pyx_kp_height,&__pyx_kp_width,&__pyx_kp_method,0}; + __Pyx_SetupRefcountContext("cvResize"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[1] = Py_None; + values[2] = Py_None; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_src); + 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_kp_height); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_width); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_method); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cvResize") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_src = ((PyArrayObject *)values[0]); + __pyx_v_height = values[1]; + __pyx_v_width = values[2]; + if (values[3]) { + __pyx_v_method = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_method = __pyx_k_46; + } + } else { + __pyx_v_height = Py_None; + __pyx_v_width = Py_None; + __pyx_v_method = __pyx_k_46; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_method = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_width = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_height = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_src = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cvResize", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvResize"); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_ptype_5numpy_ndarray, 1, "src", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":517 + * http://opencv.willowgarage.com/documentation/cvreference.html + * """ + * validate_array(src) # <<<<<<<<<<<<<< + * + * if not height or not width: + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":519 + * validate_array(src) + * + * if not height or not width: # <<<<<<<<<<<<<< + * raise ValueError('width and height must not be none') + * + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_height); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(!__pyx_t_2)) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_width); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (!__pyx_t_3); + } else { + __pyx_t_4 = (!__pyx_t_2); + } + if (__pyx_t_4) { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":520 + * + * if not height or not width: + * raise ValueError('width and height must not be none') # <<<<<<<<<<<<<< + * + * cdef int ndim = src.ndim + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_kp_61); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_61); + __Pyx_GIVEREF(__pyx_kp_61); + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":522 + * raise ValueError('width and height must not be none') + * + * cdef int ndim = src.ndim # <<<<<<<<<<<<<< + * cdef np.npy_intp* shape = clone_array_shape(src) + * shape[0] = height + */ + __pyx_v_ndim = __pyx_v_src->nd; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":523 + * + * cdef int ndim = src.ndim + * cdef np.npy_intp* shape = clone_array_shape(src) # <<<<<<<<<<<<<< + * shape[0] = height + * shape[1] = width + */ + __pyx_v_shape = __pyx_f_7scikits_5image_6opencv_14opencv_backend_clone_array_shape(__pyx_v_src); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":524 + * cdef int ndim = src.ndim + * cdef np.npy_intp* shape = clone_array_shape(src) + * shape[0] = height # <<<<<<<<<<<<<< + * shape[1] = width + * + */ + __pyx_t_7 = __Pyx_PyInt_from_py_npy_intp(__pyx_v_height); if (unlikely((__pyx_t_7 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_shape[0]) = __pyx_t_7; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":525 + * cdef np.npy_intp* shape = clone_array_shape(src) + * shape[0] = height + * shape[1] = width # <<<<<<<<<<<<<< + * + * cdef np.ndarray out = new_array(ndim, shape, src.dtype) + */ + __pyx_t_7 = __Pyx_PyInt_from_py_npy_intp(__pyx_v_width); if (unlikely((__pyx_t_7 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_shape[1]) = __pyx_t_7; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":527 + * shape[1] = width + * + * cdef np.ndarray out = new_array(ndim, shape, src.dtype) # <<<<<<<<<<<<<< + * validate_array(out) + * + */ + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_src), __pyx_kp_dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = ((PyObject *)__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array(__pyx_v_ndim, __pyx_v_shape, __pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_out = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":528 + * + * cdef np.ndarray out = new_array(ndim, shape, src.dtype) + * validate_array(out) # <<<<<<<<<<<<<< + * + * PyMem_Free(shape) + */ + __pyx_t_1 = __pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array(__pyx_v_out); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":530 + * validate_array(out) + * + * PyMem_Free(shape) # <<<<<<<<<<<<<< + * + * cdef IplImage srcimg + */ + PyMem_Free(__pyx_v_shape); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":534 + * cdef IplImage srcimg + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) # <<<<<<<<<<<<<< + * populate_iplimage(out, &outimg) + * + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_src, (&__pyx_v_srcimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":535 + * cdef IplImage outimg + * populate_iplimage(src, &srcimg) + * populate_iplimage(out, &outimg) # <<<<<<<<<<<<<< + * + * c_cvResize(&srcimg, &outimg, method) + */ + __pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage(__pyx_v_out, (&__pyx_v_outimg)); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":537 + * populate_iplimage(out, &outimg) + * + * c_cvResize(&srcimg, &outimg, method) # <<<<<<<<<<<<<< + * + * return out + */ + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvResize((&__pyx_v_srcimg), (&__pyx_v_outimg), __pyx_v_method); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":539 + * c_cvResize(&srcimg, &outimg, method) + * + * return out # <<<<<<<<<<<<<< + * + */ + __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_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv.cvResize"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_out); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":152 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + char *__pyx_t_7; + __Pyx_SetupRefcountContext("__getbuffer__"); + if (__pyx_v_info == NULL) return 0; + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":158 + * # of flags + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":159 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":161 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":163 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":164 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L5; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":166 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L5:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":168 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError("ndarray is not C contiguous") + */ + if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":169 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError("ndarray is not C contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + } else { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + } + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":170 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1); + __Pyx_GIVEREF(__pyx_kp_1); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":172 + * raise ValueError("ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError("ndarray is not Fortran contiguous") + */ + if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":173 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError("ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + } else { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + } + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":174 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_kp_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2); + __Pyx_GIVEREF(__pyx_kp_2); + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":176 + * raise ValueError("ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":177 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. This is allocated + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":178 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + */ + __pyx_t_4 = __pyx_v_copy_shape; + if (__pyx_t_4) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":181 + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":182 + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":183 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":184 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":185 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L8; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":187 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":188 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L8:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":189 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":190 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":191 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":194 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":195 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":199 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":201 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + if ((!__pyx_v_hasfields)) { + __pyx_t_1 = (!__pyx_v_copy_shape); + } else { + __pyx_t_1 = (!__pyx_v_hasfields); + } + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":203 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L11; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":206 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L11:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":208 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":209 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":210 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + */ + if ((__pyx_v_descr->byteorder == '>')) { + __pyx_t_1 = __pyx_v_little_endian; + } else { + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + } + if (!__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":211 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + if ((__pyx_v_descr->byteorder == '<')) { + __pyx_t_5 = (!__pyx_v_little_endian); + } else { + __pyx_t_5 = (__pyx_v_descr->byteorder == '<'); + } + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_1; + } + if (__pyx_t_6) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":212 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_5); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5); + __Pyx_GIVEREF(__pyx_kp_5); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":213 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_6 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_6; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":214 + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_6 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_7; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":215 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_6 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_8; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":216 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_6 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_9; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":217 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_6 = (__pyx_v_t == NPY_INT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_10; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":218 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_6 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_11; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":219 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_6 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_12; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":220 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_6 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_13; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":221 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_6 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_14; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":222 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_6 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_15; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":223 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_6 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_16; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":224 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_6 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_17; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":225 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_6 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_18; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":226 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_6 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_19; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":227 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_6 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_20; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":228 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_6 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_21; + goto __pyx_L14; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":229 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_6 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_6) { + __pyx_v_f = __pyx_k_22; + goto __pyx_L14; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":231 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(__pyx_kp_23, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L14:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":232 + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":233 + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L12; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":235 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":236 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":237 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":240 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_7; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":241 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":243 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("__releasebuffer__"); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":244 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":245 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":246 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":247 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_FinishRefcountContext(); +} + +/* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":690 + * ctypedef npy_cdouble complex_t + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_SetupRefcountContext("_util_dtypestring"); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":697 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":698 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":701 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":702 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_1 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(likely(PyTuple_CheckExact(__pyx_1)) || (__pyx_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_1)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_1); + __pyx_1 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":703 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_2); + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_3; + __pyx_3 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":705 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_3 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":706 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_kp_25); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_25); + __Pyx_GIVEREF(__pyx_kp_25); + __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":708 + * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + */ + if ((__pyx_v_child->byteorder == '>')) { + __pyx_t_6 = __pyx_v_little_endian; + } else { + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + } + if (!__pyx_t_6) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":709 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError("Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + if ((__pyx_v_child->byteorder == '<')) { + __pyx_t_7 = (!__pyx_v_little_endian); + } else { + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + } + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_6; + } + if (__pyx_t_8) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":710 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_28); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_28); + __Pyx_GIVEREF(__pyx_kp_28); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":720 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_8) break; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":721 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":722 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f += 1; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":723 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + (__pyx_v_offset[0]) += 1; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":725 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + (__pyx_v_offset[0]) += __pyx_v_child->elsize; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":727 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_8 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_8) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":728 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError("Format string allocated too short.") + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":729 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError("Format string allocated too short.") + * + */ + __pyx_t_8 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_8) { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":730 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_29); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_29); + __Pyx_GIVEREF(__pyx_kp_29); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":733 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":734 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_4 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":735 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":736 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_4 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":737 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":738 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_4 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":739 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":740 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_4 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":741 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":742 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_4 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":743 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":744 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_4 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":745 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":746 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_4 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":747 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":748 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_4 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":749 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":751 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, __pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":752 + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":756 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/numpy.pxd":757 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +static struct PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("cvSobel"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvSobel, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvSobel)}, + {__Pyx_NAMESTR("cvLaplace"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvLaplace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvLaplace)}, + {__Pyx_NAMESTR("cvCanny"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCanny, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCanny)}, + {__Pyx_NAMESTR("cvPreCornerDetect"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvPreCornerDetect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvPreCornerDetect)}, + {__Pyx_NAMESTR("cvCornerEigenValsAndVecs"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecs, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecs)}, + {__Pyx_NAMESTR("cvCornerMinEigenVal"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenVal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenVal)}, + {__Pyx_NAMESTR("cvCornerHarris"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvCornerHarris, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvCornerHarris)}, + {__Pyx_NAMESTR("cvFindCornerSubPix"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPix, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPix)}, + {__Pyx_NAMESTR("cvSmooth"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvSmooth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvSmooth)}, + {__Pyx_NAMESTR("cvGoodFeaturesToTrack"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrack, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrack)}, + {__Pyx_NAMESTR("cvResize"), (PyCFunction)__pyx_pf_7scikits_5image_6opencv_9opencv_cv_cvResize, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7scikits_5image_6opencv_9opencv_cv_cvResize)}, + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +char* __pyx_import_star_type_names[] = { + "IplImage", + "cvFindCornerSubPixPtr", + "va_list", + "cvCornerEigenValsAndVecsPtr", + "cvCannyPtr", + "cvResizePtr", + "Py_complex", + "_IplImage", + "FILE", + "cvGoodFeaturesToTrackPtr", + "_inittab", + "UINT8_t", + "cvCornerHarrisPtr", + "cvSobelPtr", + "INT16_t", + "FLOAT64_t", + "FLOAT32_t", + "INT32_t", + "PyTypeObject", + "CvTermCriteria", + "PyObject", + "cvLaplacePtr", + "cvCornerMinEigenValPtr", + "INT8_t", + "CvPoint2D32f", + "CvSize", + "cvPreCorneDetectPtr", + "PY_LONG_LONG", + "cvSmoothPtr", + "Py_UNICODE", + 0 +}; + +static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) { + char** type_name = __pyx_import_star_type_names; + while (*type_name) { + if (__Pyx_StrEq(name, *type_name)) { + PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name); + goto bad; + } + type_name++; + } + if (0); + else if (__Pyx_StrEq(name, "c_cvSmooth")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvSmooth to scikits.image.opencv.opencv_cv.cvSmoothPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvCanny")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvCanny to scikits.image.opencv.opencv_cv.cvCannyPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvCornerMinEigenVal")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvCornerMinEigenVal to scikits.image.opencv.opencv_cv.cvCornerMinEigenValPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvResize")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvResize to scikits.image.opencv.opencv_cv.cvResizePtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvGoodFeaturesToTrack")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvGoodFeaturesToTrack to scikits.image.opencv.opencv_cv.cvGoodFeaturesToTrackPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvCornerEigenValsAndVecs")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvCornerEigenValsAndVecs to scikits.image.opencv.opencv_cv.cvCornerEigenValsAndVecsPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvPreCornerDetect")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvPreCornerDetect to scikits.image.opencv.opencv_cv.cvPreCorneDetectPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvLaplace")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvLaplace to scikits.image.opencv.opencv_cv.cvLaplacePtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvCornerHarris")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvCornerHarris to scikits.image.opencv.opencv_cv.cvCornerHarrisPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvSobel")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvSobel to scikits.image.opencv.opencv_cv.cvSobelPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else if (__Pyx_StrEq(name, "c_cvFindCornerSubPix")) { + PyErr_Format(PyExc_TypeError, "Cannot convert Python object c_cvFindCornerSubPix to scikits.image.opencv.opencv_cv.cvFindCornerSubPixPtr"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + } + else { + if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad; + } + return 0; + __pyx_L2_error:; + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv"); + bad: + Py_DECREF(o); + return -1; +} + + +/* import_all_from is an unexposed function from ceval.c */ + +static int +__Pyx_import_all_from(PyObject *locals, PyObject *v) +{ + PyObject *all = __Pyx_GetAttrString(v, "__all__"); + PyObject *dict, *name, *value; + int skip_leading_underscores = 0; + int pos, err; + + if (all == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; /* Unexpected error */ + PyErr_Clear(); + dict = __Pyx_GetAttrString(v, "__dict__"); + if (dict == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; + PyErr_SetString(PyExc_ImportError, + "from-import-* object has no __dict__ and no __all__"); + return -1; + } + all = PyMapping_Keys(dict); + Py_DECREF(dict); + if (all == NULL) + return -1; + skip_leading_underscores = 1; + } + + for (pos = 0, err = 0; ; pos++) { + name = PySequence_GetItem(all, pos); + if (name == NULL) { + if (!PyErr_ExceptionMatches(PyExc_IndexError)) + err = -1; + else + PyErr_Clear(); + break; + } + if (skip_leading_underscores && +#if PY_MAJOR_VERSION < 3 + PyString_Check(name) && + PyString_AS_STRING(name)[0] == '_') +#else + PyUnicode_Check(name) && + PyUnicode_AS_UNICODE(name)[0] == '_') +#endif + { + Py_DECREF(name); + continue; + } + value = PyObject_GetAttr(v, name); + if (value == NULL) + err = -1; + else if (PyDict_CheckExact(locals)) + err = PyDict_SetItem(locals, name, value); + else + err = PyObject_SetItem(locals, name, value); + Py_DECREF(name); + Py_XDECREF(value); + if (err != 0) + break; + } + Py_DECREF(all); + return err; +} + + +static int __pyx_import_star(PyObject* m) { + + int i; + int ret = -1; + char* s; + PyObject *locals = 0; + PyObject *list = 0; + PyObject *name; + PyObject *item; + + locals = PyDict_New(); if (!locals) goto bad; + if (__Pyx_import_all_from(locals, m) < 0) goto bad; + list = PyDict_Items(locals); if (!list) goto bad; + + for(i=0; i= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("opencv_cv"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp_src, __pyx_k_src, sizeof(__pyx_k_src), 1, 1, 1}, + {&__pyx_kp_out, __pyx_k_out, sizeof(__pyx_k_out), 1, 1, 1}, + {&__pyx_kp_xorder, __pyx_k_xorder, sizeof(__pyx_k_xorder), 1, 1, 1}, + {&__pyx_kp_yorder, __pyx_k_yorder, sizeof(__pyx_k_yorder), 1, 1, 1}, + {&__pyx_kp_aperture_size, __pyx_k_aperture_size, sizeof(__pyx_k_aperture_size), 1, 1, 1}, + {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 1, 1, 1}, + {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 1, 1, 1}, + {&__pyx_kp_block_size, __pyx_k_block_size, sizeof(__pyx_k_block_size), 1, 1, 1}, + {&__pyx_kp_k, __pyx_k_k, sizeof(__pyx_k_k), 1, 1, 1}, + {&__pyx_kp_corners, __pyx_k_corners, sizeof(__pyx_k_corners), 1, 1, 1}, + {&__pyx_kp_count, __pyx_k_count, sizeof(__pyx_k_count), 1, 1, 1}, + {&__pyx_kp_win, __pyx_k_win, sizeof(__pyx_k_win), 1, 1, 1}, + {&__pyx_kp_zero_zone, __pyx_k_zero_zone, sizeof(__pyx_k_zero_zone), 1, 1, 1}, + {&__pyx_kp_iterations, __pyx_k_iterations, sizeof(__pyx_k_iterations), 1, 1, 1}, + {&__pyx_kp_epsilon, __pyx_k_epsilon, sizeof(__pyx_k_epsilon), 1, 1, 1}, + {&__pyx_kp_smoothtype, __pyx_k_smoothtype, sizeof(__pyx_k_smoothtype), 1, 1, 1}, + {&__pyx_kp_33, __pyx_k_33, sizeof(__pyx_k_33), 1, 1, 1}, + {&__pyx_kp_34, __pyx_k_34, sizeof(__pyx_k_34), 1, 1, 1}, + {&__pyx_kp_35, __pyx_k_35, sizeof(__pyx_k_35), 1, 1, 1}, + {&__pyx_kp_36, __pyx_k_36, sizeof(__pyx_k_36), 1, 1, 1}, + {&__pyx_kp_in_place, __pyx_k_in_place, sizeof(__pyx_k_in_place), 1, 1, 1}, + {&__pyx_kp_corner_count, __pyx_k_corner_count, sizeof(__pyx_k_corner_count), 1, 1, 1}, + {&__pyx_kp_quality_level, __pyx_k_quality_level, sizeof(__pyx_k_quality_level), 1, 1, 1}, + {&__pyx_kp_min_distance, __pyx_k_min_distance, sizeof(__pyx_k_min_distance), 1, 1, 1}, + {&__pyx_kp_mask, __pyx_k_mask, sizeof(__pyx_k_mask), 1, 1, 1}, + {&__pyx_kp_use_harris, __pyx_k_use_harris, sizeof(__pyx_k_use_harris), 1, 1, 1}, + {&__pyx_kp_height, __pyx_k_height, sizeof(__pyx_k_height), 1, 1, 1}, + {&__pyx_kp_width, __pyx_k_width, sizeof(__pyx_k_width), 1, 1, 1}, + {&__pyx_kp_method, __pyx_k_method, sizeof(__pyx_k_method), 1, 1, 1}, + {&__pyx_kp_ctypes, __pyx_k_ctypes, sizeof(__pyx_k_ctypes), 1, 1, 1}, + {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, + {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, + {&__pyx_kp_opencv_backend, __pyx_k_opencv_backend, sizeof(__pyx_k_opencv_backend), 1, 1, 1}, + {&__pyx_kp_37, __pyx_k_37, sizeof(__pyx_k_37), 1, 1, 1}, + {&__pyx_kp_opencv_constants, __pyx_k_opencv_constants, sizeof(__pyx_k_opencv_constants), 1, 1, 1}, + {&__pyx_kp_CDLL, __pyx_k_CDLL, sizeof(__pyx_k_CDLL), 1, 1, 1}, + {&__pyx_kp_cv, __pyx_k_cv, sizeof(__pyx_k_cv), 1, 1, 1}, + {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, + {&__pyx_kp_addressof, __pyx_k_addressof, sizeof(__pyx_k_addressof), 1, 1, 1}, + {&__pyx_kp_cvSobel, __pyx_k_cvSobel, sizeof(__pyx_k_cvSobel), 1, 1, 1}, + {&__pyx_kp_cvLaplace, __pyx_k_cvLaplace, sizeof(__pyx_k_cvLaplace), 1, 1, 1}, + {&__pyx_kp_cvCanny, __pyx_k_cvCanny, sizeof(__pyx_k_cvCanny), 1, 1, 1}, + {&__pyx_kp_cvPreCornerDetect, __pyx_k_cvPreCornerDetect, sizeof(__pyx_k_cvPreCornerDetect), 1, 1, 1}, + {&__pyx_kp_41, __pyx_k_41, sizeof(__pyx_k_41), 1, 1, 1}, + {&__pyx_kp_cvCornerMinEigenVal, __pyx_k_cvCornerMinEigenVal, sizeof(__pyx_k_cvCornerMinEigenVal), 1, 1, 1}, + {&__pyx_kp_cvCornerHarris, __pyx_k_cvCornerHarris, sizeof(__pyx_k_cvCornerHarris), 1, 1, 1}, + {&__pyx_kp_cvFindCornerSubPix, __pyx_k_cvFindCornerSubPix, sizeof(__pyx_k_cvFindCornerSubPix), 1, 1, 1}, + {&__pyx_kp_cvSmooth, __pyx_k_cvSmooth, sizeof(__pyx_k_cvSmooth), 1, 1, 1}, + {&__pyx_kp_42, __pyx_k_42, sizeof(__pyx_k_42), 1, 1, 1}, + {&__pyx_kp_cvResize, __pyx_k_cvResize, sizeof(__pyx_k_cvResize), 1, 1, 1}, + {&__pyx_kp_CV_GAUSSIAN, __pyx_k_CV_GAUSSIAN, sizeof(__pyx_k_CV_GAUSSIAN), 1, 1, 1}, + {&__pyx_kp_CV_INTER_LINEAR, __pyx_k_CV_INTER_LINEAR, sizeof(__pyx_k_CV_INTER_LINEAR), 1, 1, 1}, + {&__pyx_kp_47, __pyx_k_47, sizeof(__pyx_k_47), 1, 1, 1}, + {&__pyx_kp_48, __pyx_k_48, sizeof(__pyx_k_48), 1, 1, 1}, + {&__pyx_kp_49, __pyx_k_49, sizeof(__pyx_k_49), 1, 1, 1}, + {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, + {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, + {&__pyx_kp_51, __pyx_k_51, sizeof(__pyx_k_51), 1, 1, 1}, + {&__pyx_kp_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 1, 1, 1}, + {&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1}, + {&__pyx_kp_CV_BLUR_NO_SCALE, __pyx_k_CV_BLUR_NO_SCALE, sizeof(__pyx_k_CV_BLUR_NO_SCALE), 1, 1, 1}, + {&__pyx_kp_CV_BLUR, __pyx_k_CV_BLUR, sizeof(__pyx_k_CV_BLUR), 1, 1, 1}, + {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, + {&__pyx_kp_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 0}, + {&__pyx_kp_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 0}, + {&__pyx_kp_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 0}, + {&__pyx_kp_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 0}, + {&__pyx_kp_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 0}, + {&__pyx_kp_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 0}, + {&__pyx_kp_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 0}, + {&__pyx_kp_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 0}, + {&__pyx_kp_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 0}, + {&__pyx_kp_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 0}, + {&__pyx_kp_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 0}, + {&__pyx_kp_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 0}, + {&__pyx_kp_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 0}, + {&__pyx_kp_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 0}, + {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, + {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, + {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, + {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, + {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, + {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, + {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, + {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 0}, + {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0}, + {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0}, + {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0}, + {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitGlobals(void) { + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initopencv_cv(void); /*proto*/ +PyMODINIT_FUNC initopencv_cv(void) +#else +PyMODINIT_FUNC PyInit_opencv_cv(void); /*proto*/ +PyMODINIT_FUNC PyInit_opencv_cv(void) +#endif +{ + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + int __pyx_t_10; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_opencv_cv(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("opencv_cv"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__pyx_module_is_main_scikits__image__opencv__opencv_cv) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + __pyx_1 = __Pyx_ImportModule("scikits.image.opencv.opencv_backend"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "populate_iplimage", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_populate_iplimage, "void (PyArrayObject *, __pyx_t_7scikits_5image_6opencv_11opencv_type_IplImage *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "validate_array", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_validate_array, "int (PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_dtype", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_dtype, "int (PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_ndims", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_ndims, "int (PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_nchannels", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_nchannels, "int (PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_same_dtype", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_dtype, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_same_shape", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_shape, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_same_width_and_height", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_same_width_and_height, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_like", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_like, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "assert_not_sharing_data", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_assert_not_sharing_data, "int (PyArrayObject *, PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "new_array", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array, "PyArrayObject *(int, npy_intp *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "new_array_like", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like, "PyArrayObject *(PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "new_array_like_diff_dtype", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_new_array_like_diff_dtype, "PyArrayObject *(PyArrayObject *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "get_array_nbytes", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_get_array_nbytes, "npy_intp (PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "clone_array_shape", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_clone_array_shape, "npy_intp *(PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "array_as_cvPoint2D32f_ptr", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_array_as_cvPoint2D32f_ptr, "struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvPoint2D32f *(PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "get_cvTermCriteria", (void (**)(void))&__pyx_f_7scikits_5image_6opencv_14opencv_backend_get_cvTermCriteria, "struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria (int, double)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + /*--- Execution code ---*/ + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":1 + * import ctypes # <<<<<<<<<<<<<< + * import numpy as np + * cimport numpy as np + */ + __pyx_1 = __Pyx_Import(__pyx_kp_ctypes, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_ctypes, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":2 + * import ctypes + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * from python cimport * + */ + __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":7 + * #from stdlib cimport * + * from opencv_type cimport * + * from opencv_backend import * # <<<<<<<<<<<<<< + * from opencv_backend cimport * + * from opencv_constants import * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_37); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_37); + __Pyx_GIVEREF(__pyx_kp_37); + __pyx_1 = __Pyx_Import(__pyx_kp_opencv_backend, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__pyx_import_star(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":9 + * from opencv_backend import * + * from opencv_backend cimport * + * from opencv_constants import * # <<<<<<<<<<<<<< + * + * #one of these should work if the user imported the package properly + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_37); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_37); + __Pyx_GIVEREF(__pyx_kp_37); + __pyx_1 = __Pyx_Import(__pyx_kp_opencv_constants, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__pyx_import_star(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":12 + * + * #one of these should work if the user imported the package properly + * try: # <<<<<<<<<<<<<< + * cv = ctypes.CDLL('libcv.so') + * except: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":13 + * #one of these should work if the user imported the package properly + * try: + * cv = ctypes.CDLL('libcv.so') # <<<<<<<<<<<<<< + * except: + * try: + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_CDLL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_38); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_38); + __Pyx_GIVEREF(__pyx_kp_38); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_cv, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L2_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L9_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":14 + * try: + * cv = ctypes.CDLL('libcv.so') + * except: # <<<<<<<<<<<<<< + * try: + * cv = ctypes.CDLL('cv.dll') + */ + /*except:*/ { + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":15 + * cv = ctypes.CDLL('libcv.so') + * except: + * try: # <<<<<<<<<<<<<< + * cv = ctypes.CDLL('cv.dll') + * except: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":16 + * except: + * try: + * cv = ctypes.CDLL('cv.dll') # <<<<<<<<<<<<<< + * except: + * raise RuntimeError('The opencv libraries were not found. Please make sure they are installed and available on the system path.') + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_CDLL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_kp_39); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_39); + __Pyx_GIVEREF(__pyx_kp_39); + __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_kp_cv, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L12_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L19_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_1); __pyx_1 = 0; + __Pyx_XDECREF(__pyx_2); __pyx_2 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":17 + * try: + * cv = ctypes.CDLL('cv.dll') + * except: # <<<<<<<<<<<<<< + * raise RuntimeError('The opencv libraries were not found. Please make sure they are installed and available on the system path.') + * + */ + /*except:*/ { + __Pyx_AddTraceback("scikits.image.opencv.opencv_cv"); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_4); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":18 + * cv = ctypes.CDLL('cv.dll') + * except: + * raise RuntimeError('The opencv libraries were not found. Please make sure they are installed and available on the system path.') # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_kp_40); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_40); + __Pyx_GIVEREF(__pyx_kp_40); + __pyx_t_8 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L13_exception_handled; + } + __pyx_L14_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__pyx_save_exc_tb); + goto __pyx_L4_except_error; + __pyx_L13_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L19_try_end:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3_exception_handled; + } + __pyx_L4_except_error:; + __Pyx_XDECREF(__pyx_save_exc_type); + __Pyx_XDECREF(__pyx_save_exc_value); + __Pyx_XDECREF(__pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L9_try_end:; + } + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":28 + * ctypedef void (*cvSobelPtr)(IplImage*, IplImage*, int, int, int) + * cdef cvSobelPtr c_cvSobel + * c_cvSobel = (ctypes.addressof(cv.cvSobel))[0] # <<<<<<<<<<<<<< + * + * # cvLaplace + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvSobel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvSobel = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvSobelPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":33 + * ctypedef void (*cvLaplacePtr)(IplImage*, IplImage*, int) + * cdef cvLaplacePtr c_cvLaplace + * c_cvLaplace = (ctypes.addressof(cv.cvLaplace))[0] # <<<<<<<<<<<<<< + * + * # cvCanny + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvLaplace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvLaplace = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvLaplacePtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":38 + * ctypedef void (*cvCannyPtr)(IplImage*, IplImage*, double, double, int) + * cdef cvCannyPtr c_cvCanny + * c_cvCanny = (ctypes.addressof(cv.cvCanny))[0] # <<<<<<<<<<<<<< + * + * # cvPreCornerDetect + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvCanny); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCanny = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCannyPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":43 + * ctypedef void (*cvPreCorneDetectPtr)(IplImage*, IplImage*, int) + * cdef cvPreCorneDetectPtr c_cvPreCornerDetect + * c_cvPreCornerDetect = (ctypes.addressof(cv.cvPreCornerDetect))[0] # <<<<<<<<<<<<<< + * + * # cvCornerEigenValsAndVecs + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvPreCornerDetect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvPreCornerDetect = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvPreCorneDetectPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":48 + * ctypedef void (*cvCornerEigenValsAndVecsPtr)(IplImage*, IplImage*, int, int) + * cdef cvCornerEigenValsAndVecsPtr c_cvCornerEigenValsAndVecs + * c_cvCornerEigenValsAndVecs = (ctypes.addressof(cv.cvCornerEigenValsAndVecs))[0] # <<<<<<<<<<<<<< + * + * # cvCornerMinEigenVal + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_41); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerEigenValsAndVecs = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerEigenValsAndVecsPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":53 + * ctypedef void (*cvCornerMinEigenValPtr)(IplImage*, IplImage*, int, int) + * cdef cvCornerMinEigenValPtr c_cvCornerMinEigenVal + * c_cvCornerMinEigenVal = (ctypes.addressof(cv.cvCornerMinEigenVal))[0] # <<<<<<<<<<<<<< + * + * # cvCornerHarris + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvCornerMinEigenVal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerMinEigenVal = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerMinEigenValPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":58 + * ctypedef void (*cvCornerHarrisPtr)(IplImage*, IplImage*, int, int, double) + * cdef cvCornerHarrisPtr c_cvCornerHarris + * c_cvCornerHarris = (ctypes.addressof(cv.cvCornerHarris))[0] # <<<<<<<<<<<<<< + * + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvCornerHarris); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvCornerHarris = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvCornerHarrisPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":64 + * ctypedef void (*cvFindCornerSubPixPtr)(IplImage*, CvPoint2D32f*, int, CvSize, CvSize, CvTermCriteria) + * cdef cvFindCornerSubPixPtr c_cvFindCornerSubPix + * c_cvFindCornerSubPix = (ctypes.addressof(cv.cvFindCornerSubPix))[0] # <<<<<<<<<<<<<< + * + * # cvSmooth + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvFindCornerSubPix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvFindCornerSubPix = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvFindCornerSubPixPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":69 + * ctypedef void (*cvSmoothPtr)(IplImage*, IplImage*, int, int, int, double, double) + * cdef cvSmoothPtr c_cvSmooth + * c_cvSmooth = (ctypes.addressof(cv.cvSmooth))[0] # <<<<<<<<<<<<<< + * + * # cvGoodFeaturesToTrack + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvSmooth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvSmooth = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvSmoothPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":76 + * IplImage*, int, int, double) + * cdef cvGoodFeaturesToTrackPtr c_cvGoodFeaturesToTrack + * c_cvGoodFeaturesToTrack = (ctypes.addressof(cv.cvGoodFeaturesToTrack))[0] # <<<<<<<<<<<<<< + * + * # cvResize + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_42); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvGoodFeaturesToTrack = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvGoodFeaturesToTrackPtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":81 + * ctypedef void (*cvResizePtr)(IplImage*, IplImage*, int) + * cdef cvResizePtr c_cvResize + * c_cvResize = (ctypes.addressof(cv.cvResize))[0] # <<<<<<<<<<<<<< + * + * + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ctypes); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_addressof); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_cv); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_cvResize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_7scikits_5image_6opencv_9opencv_cv_c_cvResize = (((__pyx_t_7scikits_5image_6opencv_9opencv_cv_cvResizePtr *)((size_t)__pyx_t_9))[0]); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":328 + * + * def cvFindCornerSubPix(np.ndarray src, np.ndarray corners, int count, win, + * zero_zone=(-1, -1), int iterations=0, # <<<<<<<<<<<<<< + * double epsilon=1e-5): + * + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_k_43 = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_k_43); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":376 + * return None + * + * def cvSmooth(np.ndarray src, np.ndarray out=None, int smoothtype=CV_GAUSSIAN, int param1=3, # <<<<<<<<<<<<<< + * int param2=0, double param3=0, double param4=0, bool in_place=False): + * """ + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_GAUSSIAN); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_k_44 = __pyx_t_10; + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":377 + * + * def cvSmooth(np.ndarray src, np.ndarray out=None, int smoothtype=CV_GAUSSIAN, int param1=3, + * int param2=0, double param3=0, double param4=0, bool in_place=False): # <<<<<<<<<<<<<< + * """ + * better doc string needed. + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyBool_Check(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected bool, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_45 = ((PyObject *)__pyx_t_3); + __Pyx_GIVEREF(__pyx_k_45); + + /* "/home/brucewayne/scikits_image/scikits.image/scikits/image/opencv/opencv_cv.pyx":511 + * + * def cvResize(np.ndarray src, height=None, width=None, + * int method=CV_INTER_LINEAR): # <<<<<<<<<<<<<< + * """ + * better doc string needed. + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_CV_INTER_LINEAR); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_k_46 = __pyx_t_10; + + /* "/usr/local/lib/python2.6/dist-packages/Cython-0.11.3-py2.6-linux-x86_64.egg/Cython/Includes/python_mem.pxd":1 + * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * + * ##################################################################### + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __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); + if (__pyx_m) { + __Pyx_AddTraceback("init scikits.image.opencv.opencv_cv"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init scikits.image.opencv.opencv_cv"); + } + __pyx_L0:; + __Pyx_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "opencv_cv.pyx", + "numpy.pxd", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (obj == Py_None || PyObject_TypeCheck(obj, type)) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + + +static INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(); + } +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + PyErr_NormalizeException(type, value, tb); + if (PyErr_Occurred()) + goto bad; + Py_INCREF(*type); + Py_INCREF(*value); + Py_INCREF(*tb); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (XDECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + return 0; +bad: + Py_XDECREF(*type); + Py_XDECREF(*value); + Py_XDECREF(*tb); + return -1; +} + + +static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} + +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *__import__ = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!__import__) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(__import__); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject* x) { + /**/ if (sizeof(npy_intp) == sizeof(char)) + return (((npy_intp)-1) < ((npy_intp)0)) ? + (npy_intp)__Pyx_PyInt_AsSignedChar(x) : + (npy_intp)__Pyx_PyInt_AsUnsignedChar(x); + else if (sizeof(npy_intp) == sizeof(short)) + return (((npy_intp)-1) < ((npy_intp)0)) ? + (npy_intp)__Pyx_PyInt_AsSignedShort(x) : + (npy_intp)__Pyx_PyInt_AsUnsignedShort(x); + else if (sizeof(npy_intp) == sizeof(int)) + return (((npy_intp)-1) < ((npy_intp)0)) ? + (npy_intp)__Pyx_PyInt_AsSignedInt(x) : + (npy_intp)__Pyx_PyInt_AsUnsignedInt(x); + else if (sizeof(npy_intp) == sizeof(long)) + return (((npy_intp)-1) < ((npy_intp)0)) ? + (npy_intp)__Pyx_PyInt_AsSignedLong(x) : + (npy_intp)__Pyx_PyInt_AsUnsignedLong(x); + else if (sizeof(npy_intp) == sizeof(PY_LONG_LONG)) + return (((npy_intp)-1) < ((npy_intp)0)) ? + (npy_intp)__Pyx_PyInt_AsSignedLongLong(x) : + (npy_intp)__Pyx_PyInt_AsUnsignedLongLong(x); +#if 0 + else if (sizeof(npy_intp) > sizeof(short) && + sizeof(npy_intp) < sizeof(int)) /* __int32 ILP64 ? */ + return (((npy_intp)-1) < ((npy_intp)0)) ? + (npy_intp)__Pyx_PyInt_AsSignedInt(x) : + (npy_intp)__Pyx_PyInt_AsUnsignedInt(x); +#endif + PyErr_SetString(PyExc_TypeError, "npy_intp"); + return (npy_intp)-1; +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((char)-1) > ((char)0) && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((short)-1) > ((short)0) && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((int)-1) > ((int)0) && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE int __Pyx_StrEq(const char *s1, const char *s2) { + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + return *s1 == *s2; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#if PY_VERSION_HEX < 0x02050000 + char *api = (char *)"__pyx_capi__"; +#else + const char *api = "__pyx_capi__"; +#endif + PyObject *d = 0; + PyObject *cobj = 0; + const char *desc; + const char *s1, *s2; + union { + void (*fp)(void); + void *p; + } tmp; + + d = PyObject_GetAttrString(module, api); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj); + *f = tmp.fp; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode && (!t->is_identifier)) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/scikits/image/opencv/opencv_cv.pyx b/scikits/image/opencv/opencv_cv.pyx new file mode 100644 index 00000000..b7ed826a --- /dev/null +++ b/scikits/image/opencv/opencv_cv.pyx @@ -0,0 +1,540 @@ +import ctypes +import numpy as np +cimport numpy as np +from python cimport * +#from stdlib cimport * +from opencv_type cimport * +from opencv_backend import * +from opencv_backend cimport * +from opencv_constants import * + +#one of these should work if the user imported the package properly +try: + cv = ctypes.CDLL('libcv.so') +except: + try: + cv = ctypes.CDLL('cv.dll') + except: + raise RuntimeError('The opencv libraries were not found. Please make sure they are installed and available on the system path.') + + +################################### +# opencv function declarations +################################### + +# cvSobel +ctypedef void (*cvSobelPtr)(IplImage*, IplImage*, int, int, int) +cdef cvSobelPtr c_cvSobel +c_cvSobel = (ctypes.addressof(cv.cvSobel))[0] + +# cvLaplace +ctypedef void (*cvLaplacePtr)(IplImage*, IplImage*, int) +cdef cvLaplacePtr c_cvLaplace +c_cvLaplace = (ctypes.addressof(cv.cvLaplace))[0] + +# cvCanny +ctypedef void (*cvCannyPtr)(IplImage*, IplImage*, double, double, int) +cdef cvCannyPtr c_cvCanny +c_cvCanny = (ctypes.addressof(cv.cvCanny))[0] + +# cvPreCornerDetect +ctypedef void (*cvPreCorneDetectPtr)(IplImage*, IplImage*, int) +cdef cvPreCorneDetectPtr c_cvPreCornerDetect +c_cvPreCornerDetect = (ctypes.addressof(cv.cvPreCornerDetect))[0] + +# cvCornerEigenValsAndVecs +ctypedef void (*cvCornerEigenValsAndVecsPtr)(IplImage*, IplImage*, int, int) +cdef cvCornerEigenValsAndVecsPtr c_cvCornerEigenValsAndVecs +c_cvCornerEigenValsAndVecs = (ctypes.addressof(cv.cvCornerEigenValsAndVecs))[0] + +# cvCornerMinEigenVal +ctypedef void (*cvCornerMinEigenValPtr)(IplImage*, IplImage*, int, int) +cdef cvCornerMinEigenValPtr c_cvCornerMinEigenVal +c_cvCornerMinEigenVal = (ctypes.addressof(cv.cvCornerMinEigenVal))[0] + +# cvCornerHarris +ctypedef void (*cvCornerHarrisPtr)(IplImage*, IplImage*, int, int, double) +cdef cvCornerHarrisPtr c_cvCornerHarris +c_cvCornerHarris = (ctypes.addressof(cv.cvCornerHarris))[0] + + +# cvFindCornerSubPix +ctypedef void (*cvFindCornerSubPixPtr)(IplImage*, CvPoint2D32f*, int, CvSize, CvSize, CvTermCriteria) +cdef cvFindCornerSubPixPtr c_cvFindCornerSubPix +c_cvFindCornerSubPix = (ctypes.addressof(cv.cvFindCornerSubPix))[0] + +# cvSmooth +ctypedef void (*cvSmoothPtr)(IplImage*, IplImage*, int, int, int, double, double) +cdef cvSmoothPtr c_cvSmooth +c_cvSmooth = (ctypes.addressof(cv.cvSmooth))[0] + +# cvGoodFeaturesToTrack +ctypedef void (*cvGoodFeaturesToTrackPtr)(IplImage*, IplImage*, IplImage*, + CvPoint2D32f*, int*, double, double, + IplImage*, int, int, double) +cdef cvGoodFeaturesToTrackPtr c_cvGoodFeaturesToTrack +c_cvGoodFeaturesToTrack = (ctypes.addressof(cv.cvGoodFeaturesToTrack))[0] + +# cvResize +ctypedef void (*cvResizePtr)(IplImage*, IplImage*, int) +cdef cvResizePtr c_cvResize +c_cvResize = (ctypes.addressof(cv.cvResize))[0] + + +#################################### +# Function Implementations +#################################### +def cvSobel(np.ndarray src, np.ndarray out=None, int xorder=1, int yorder=0, + int aperture_size=3): + + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + validate_array(src) + assert_dtype(src, [UINT8, INT8, FLOAT32]) + assert_nchannels(src, [1]) + + if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + raise ValueError('aperture_size must be 3, 5, or 7') + + if out is not None: + validate_array(out) + assert_not_sharing_data(src, out) + assert_same_shape(src, out) + assert_nchannels(out, [1]) + if src.dtype == UINT8 or src.dtype == INT8: + assert_dtype(out, [INT16]) + else: + assert_dtype(out, [FLOAT32]) + else: + if src.dtype == UINT8 or src.dtype == INT8: + out = new_array_like_diff_dtype(src, INT16) + else: + out = new_array_like(src) + + cdef IplImage srcimg + cdef IplImage outimg + + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvSobel(&srcimg, &outimg, xorder, yorder, aperture_size) + + return out + +def cvLaplace(np.ndarray src, np.ndarray out=None, int aperture_size=3): + + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + validate_array(src) + assert_dtype(src, [UINT8, INT8, FLOAT32]) + assert_nchannels(src, [1]) + + if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + raise ValueError('aperture_size must be 3, 5, or 7') + + + if out is not None: + validate_array(out) + assert_not_sharing_data(src, out) + assert_same_shape(src, out) + assert_nchannels(out, [1]) + if src.dtype == UINT8 or src.dtype == INT8: + assert_dtype(out, [INT16]) + else: + assert_dtype(out, [FLOAT32]) + else: + if src.dtype == UINT8 or src.dtype == INT8: + out = new_array_like_diff_dtype(src, INT16) + else: + out = new_array_like(src) + + cdef IplImage srcimg + cdef IplImage outimg + + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvLaplace(&srcimg, &outimg, aperture_size) + + return out + +def cvCanny(np.ndarray src, np.ndarray out=None, double threshold1=10, + double threshold2=50, int aperture_size=3): + + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + validate_array(src) + assert_nchannels(src, [1]) + + if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + raise ValueError('aperture_size must be 3, 5, or 7') + + + if out is not None: + validate_array(out) + assert_nchannels(out, [1]) + assert_same_shape(src, out) + assert_not_sharing_data(src, out) + else: + out = new_array_like(src) + + cdef IplImage srcimg + cdef IplImage outimg + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvCanny(&srcimg, &outimg, threshold1, threshold2, aperture_size) + + return out + +def cvPreCornerDetect(np.ndarray src, np.ndarray out=None, int aperture_size=3): + + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + validate_array(src) + assert_dtype(src, [UINT8, FLOAT32]) + assert_nchannels(src, [1]) + + if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + raise ValueError('aperture_size must be 3, 5, or 7') + + if out is not None: + validate_array(out) + assert_same_shape(src, out) + assert_dtype(out, [FLOAT32]) + assert_not_sharing_data(src, out) + else: + out = new_array_like_diff_dtype(src, FLOAT32) + + cdef IplImage srcimg + cdef IplImage outimg + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvPreCornerDetect(&srcimg, &outimg, aperture_size) + + return out + +def cvCornerEigenValsAndVecs(np.ndarray src, int block_size=3, + int aperture_size=3): + + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + # no option for the out argument on this one. Its easier just + # to make it for them as there is only 1 valid out array for any + # given source array + + validate_array(src) + assert_nchannels(src, [1]) + assert_dtype(src, [UINT8, FLOAT32]) + + if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + raise ValueError('aperture_size must be 3, 5, or 7') + + cdef np.npy_intp outshape[2] + outshape[0] = src.shape[0] + outshape[1] = src.shape[1] * 6 + + out = new_array(2, outshape, FLOAT32) + + cdef IplImage srcimg + cdef IplImage outimg + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvCornerEigenValsAndVecs(&srcimg, &outimg, block_size, aperture_size) + + return out.reshape(out.shape[0], -1, 6) + +def cvCornerMinEigenVal(np.ndarray src, int block_size=3, + int aperture_size=3): + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + # no option for the out argument on this one. Its easier just + # to make it for them as there is only 1 valid out array for any + # given source array + + validate_array(src) + assert_nchannels(src, [1]) + assert_dtype(src, [UINT8, FLOAT32]) + + if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + raise ValueError('aperture_size must be 3, 5, or 7') + + out = new_array_like_diff_dtype(src, FLOAT32) + + cdef IplImage srcimg + cdef IplImage outimg + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvCornerMinEigenVal(&srcimg, &outimg, block_size, aperture_size) + + return out + +def cvCornerHarris(np.ndarray src, int block_size=3, int aperture_size=3, + double k=0.04): + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + # no option for the out argument on this one. Its easier just + # to make it for them as there is only 1 valid out array for any + # given source array + + validate_array(src) + assert_nchannels(src, [1]) + assert_dtype(src, [UINT8, FLOAT32]) + + if (aperture_size != 3 and aperture_size != 5 and aperture_size != 7): + raise ValueError('aperture_size must be 3, 5, or 7') + + out = new_array_like_diff_dtype(src, FLOAT32) + + cdef IplImage srcimg + cdef IplImage outimg + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvCornerHarris(&srcimg, &outimg, block_size, aperture_size, k) + + return out + +def cvFindCornerSubPix(np.ndarray src, np.ndarray corners, int count, win, + zero_zone=(-1, -1), int iterations=0, + double epsilon=1e-5): + + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + validate_array(src) + validate_array(corners) + + assert_nchannels(src, [1]) + assert_dtype(src, [UINT8]) + + assert_nchannels(corners, [1]) + assert_dtype(corners, [FLOAT32]) + + # make sure the number of points + # jives with the elements in the array + # the shape of the array is irrelevant + # because opencv will index it as if it were + # flat anyway, but regardless, the validate_array function ensures + # that it is 2D + cdef int nbytes = get_array_nbytes(corners) + if nbytes != (count * 2 * 4): + raise ValueError('the number of declared points is different than exists in the array') + + cdef CvPoint2D32f* cvcorners = array_as_cvPoint2D32f_ptr(corners) + + cdef CvSize cvwin + cvwin.height = win[0] + cvwin.width = win[1] + + cdef CvSize cvzerozone + cvzerozone.height = zero_zone[0] + cvzerozone.width = zero_zone[1] + + cdef IplImage srcimg + populate_iplimage(src, &srcimg) + + cdef CvTermCriteria crit + crit = get_cvTermCriteria(iterations, epsilon) + + c_cvFindCornerSubPix(&srcimg, cvcorners, count, cvwin, cvzerozone, crit) + + return None + +def cvSmooth(np.ndarray src, np.ndarray out=None, int smoothtype=CV_GAUSSIAN, int param1=3, + int param2=0, double param3=0, double param4=0, bool in_place=False): + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + validate_array(src) + if out is not None: + validate_array(out) + + # there are restrictions that must be placed on the data depending on + # the smoothing operation requested + + # CV_BLUR_NO_SCALE + if smoothtype == CV_BLUR_NO_SCALE: + + if in_place: + raise RuntimeError('In place operation not supported with this filter') + + assert_dtype(src, [UINT8, INT8, FLOAT32]) + assert_ndims(src, [2]) + + if out is not None: + if src.dtype == FLOAT32: + assert_dtype(out, [FLOAT32]) + else: + assert_dtype(out, [INT16]) + assert_same_shape(src, out) + else: + if src.dtype == FLOAT32: + out = new_array_like(src) + else: + out = new_array_like_diff_dtype(src, INT16) + + # CV_BLUR and CV_GAUSSIAN + elif smoothtype == CV_BLUR or smoothtype == CV_GAUSSIAN: + + assert_dtype(src, [UINT8, INT8, FLOAT32]) + assert_nchannels(src, [1, 3]) + + if in_place: + out = src + elif out is not None: + assert_like(src, out) + else: + out = new_array_like(src) + + # CV_MEDIAN and CV_BILATERAL + else: + assert_dtype(src, [UINT8, INT8]) + assert_nchannels(src, [1, 3]) + + if in_place: + raise RuntimeError('In place operation not supported with this filter') + + if out is not None: + assert_like(src, out) + else: + out = new_array_like(src) + + cdef IplImage srcimg + cdef IplImage outimg + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvSmooth(&srcimg, &outimg, smoothtype, param1, param2, param3, param4) + + return out + +def cvGoodFeaturesToTrack(np.ndarray src, int corner_count, double quality_level, + double min_distance, np.ndarray mask=None, + int block_size=3, int use_harris=0, double k=0.04): + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + + validate_array(src) + assert_dtype(src, [UINT8, FLOAT32]) + assert_nchannels(src, [1]) + + cdef np.ndarray eig = new_array_like_diff_dtype(src, FLOAT32) + cdef np.ndarray temp = new_array_like(eig) + + cdef CvPoint2D32f* corners = ( + PyMem_Malloc(corner_count * sizeof(CvPoint2D32f))) + + cdef int out_corner_count + out_corner_count = corner_count + + cdef IplImage srcimg + cdef IplImage eigimg + cdef IplImage tempimg + cdef IplImage *maskimg + + populate_iplimage(src, &srcimg) + populate_iplimage(eig, &eigimg) + populate_iplimage(temp, &tempimg) + if mask is None: + maskimg = NULL + else: + validate_array(mask) + assert_nchannels(mask, [1]) + populate_iplimage(mask, maskimg) + + c_cvGoodFeaturesToTrack(&srcimg, &eigimg, &tempimg, corners, &out_corner_count, + quality_level, min_distance, maskimg, block_size, + use_harris, k) + + # since the maximum allowed corners may not have been found + # the array might be too long, we create a new array and copy + # the the data into it + # + # It would be nice to use the numpy C-Api for this, but I couldn't quite + # get it to work + + cdef np.npy_intp cornershape[2] + cornershape[0] = out_corner_count + cornershape[1] = 2 + + cdef np.ndarray cornersarr = new_array(2, cornershape, FLOAT32) + cdef int i + for i in range(out_corner_count): + cornersarr[i,0] = corners[i].x + cornersarr[i,1] = corners[i].y + + PyMem_Free(corners) + + return cornersarr + + +def cvResize(np.ndarray src, height=None, width=None, + int method=CV_INTER_LINEAR): + """ + better doc string needed. + for now: + http://opencv.willowgarage.com/documentation/cvreference.html + """ + validate_array(src) + + if not height or not width: + raise ValueError('width and height must not be none') + + cdef int ndim = src.ndim + cdef np.npy_intp* shape = clone_array_shape(src) + shape[0] = height + shape[1] = width + + cdef np.ndarray out = new_array(ndim, shape, src.dtype) + validate_array(out) + + PyMem_Free(shape) + + cdef IplImage srcimg + cdef IplImage outimg + populate_iplimage(src, &srcimg) + populate_iplimage(out, &outimg) + + c_cvResize(&srcimg, &outimg, method) + + return out + \ No newline at end of file diff --git a/scikits/image/opencv/opencv_type.pxd b/scikits/image/opencv/opencv_type.pxd new file mode 100644 index 00000000..1bebca06 --- /dev/null +++ b/scikits/image/opencv/opencv_type.pxd @@ -0,0 +1,50 @@ +# a reimplementation of the opencv types. +# so we dont have to worry about having the opencv headers +# available at build time. + +cdef struct _IplImage: + int nSize # sizeof(_IplImage) + int ID # must be 0 + int nChannels # number of channels 1, 2, 3 or 4 + int alphaChannel # ignored by opencv + int depth # pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F, IPL_DEPTH_64F + + char colorModel[4] # ignored by opencv + char channelSeq[4] # ignored by opencv + int dataOrder # must be 0 + + int origin # should be 0 for top-left origin + + int align # ignored by opencv + + int width # width in pixels + int height # height in pixels + + void *roi # must be NULL + void *maskROI # must be NULL + void *imageId # must be NULL + void *tileInfo # must be NULL + int imageSize # image size in bytes + + char *imageData # pointer to the data + int widthStep # row size in bytes (first stride of numpy array) + int BorderMode[4] # ignored by opencv + int BorderConst[4] # ignored by opencv + char* imageDataOrigin # pointer to origin of data. Used for deallocation, but python will handle this so we'll set it to void* + + +ctypedef _IplImage IplImage + +cdef struct CvPoint2D32f: + float x + float y + +cdef struct CvSize: + int width + int height + +cdef struct CvTermCriteria: + int type + int max_iter + double epsilon + diff --git a/scikits/image/opencv/setup.py b/scikits/image/opencv/setup.py new file mode 100644 index 00000000..5ac8c718 --- /dev/null +++ b/scikits/image/opencv/setup.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +import os +import shutil + +def configuration(parent_package='', top_path=None): + from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs + + config = Configuration('opencv', parent_package, top_path) + + config.add_data_dir('tests') + + # since distutils/cython has problems, we'll check to see if cython is + # installed and use that to rebuild the .c files, if not, we'll just build + # directly from the included .c files + + cython_files = ['opencv_backend.pyx', 'opencv_cv.pyx'] + + try: + import Cython + for pyxfile in cython_files: + # make a backup of the good c files + c_file = pyxfile.rstrip('pyx') + 'c' + src = c_file + dst = c_file + '.bak' + shutil.copy(src, dst) + + # run cython compiler + os.system('cython ' + pyxfile) + + # if the file is small, cython compilation failed + size = os.path.getsize(c_file) + if size < 100: + print 'Cython compilation failed. Restoring from backup.' + # restore from backup + shutil.copy(dst, src) + + except ImportError: + # if cython is not found, we just build from the include .c files + pass + + for pyxfile in cython_files: + c_file = pyxfile.rstrip('pyx') + 'c' + config.add_extension(pyxfile.rstrip('.pyx'), + sources=[c_file], + include_dirs=[get_numpy_include_dirs()]) + + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(maintainer = 'Scikits.Image Developers', + author = 'Steven C. Colbert', + maintainer_email = 'scikits-image@googlegroups.com', + description = 'OpenCV wrapper for NumPy arrays', + url = 'http://stefanv.github.com/scikits.image/', + license = 'SciPy License (BSD Style)', + **(configuration(top_path='').todict()) + ) + + + + + \ No newline at end of file diff --git a/scikits/image/opencv/tests/test_opencv_cv.py b/scikits/image/opencv/tests/test_opencv_cv.py new file mode 100644 index 00000000..aef35d98 --- /dev/null +++ b/scikits/image/opencv/tests/test_opencv_cv.py @@ -0,0 +1,109 @@ +# test for the opencv_cv extension module +import os +import numpy as np +from numpy.testing import * + +try: + from scikits.image.opencv import * + OPENCV_LIBS_NOTFOUND = False +except: + OPENCV_LIBS_NOTFOUND = True + +from scikits.image import data_dir + +_opencv_skip = dec.skipif(OPENCV_LIBS_NOTFOUND, + 'Skipping OpenCV test because OpenCV' + 'libs were not found') + +class OpenCVTest: + # setup only works as a module level function + def __init__(self): + self.lena_RGB_U8 = np.load(os.path.join(data_dir, 'lena_RGB_U8.npy')) + self.lena_GRAY_U8 = np.load(os.path.join(data_dir, 'lena_GRAY_U8.npy')) + + +class TestSobel(OpenCVTest): + @_opencv_skip + def test_cvSobel(self): + cvSobel(self.lena_GRAY_U8) + + +class TestLaplace(OpenCVTest): + @_opencv_skip + def test_cvLaplace(self): + cvLaplace(self.lena_GRAY_U8) + + +class TestCanny(OpenCVTest): + @_opencv_skip + def test_cvCanny(self): + cvCanny(self.lena_GRAY_U8) + + +class TestPreCornerDetect(OpenCVTest): + @_opencv_skip + def test_cvPreCornerDetect(self): + cvPreCornerDetect(self.lena_GRAY_U8) + + +class TestCornerEigenValsAndVecs(OpenCVTest): + @_opencv_skip + def test_cvCornerEigenValsAndVecs(self): + cvCornerEigenValsAndVecs(self.lena_GRAY_U8) + + +class TestCornerMinEigenVal(OpenCVTest): + @_opencv_skip + def test_cvCornerMinEigenVal(self): + cvCornerMinEigenVal(self.lena_GRAY_U8) + + +class TestCornerHarris(OpenCVTest): + @_opencv_skip + def test_cvCornerHarris(self): + cvCornerHarris(self.lena_GRAY_U8) + + +class TestSmooth(OpenCVTest): + @_opencv_skip + def test_cvSmooth(self): + for st in (CV_BLUR_NO_SCALE, CV_BLUR, CV_GAUSSIAN, CV_MEDIAN, + CV_BILATERAL): + cvSmooth(self.lena_GRAY_U8, None, st, 3, 0, 0, 0, False) + +class TestFindCornerSubPix: + @_opencv_skip + def test_cvFindCornersSubPix(self): + img = np.array([[1, 1, 1, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 1, 1, 1], + [0, 0, 0, 1, 1, 1, 0, 0, 0], + [0, 0, 0, 1, 1, 1, 0, 0, 0], + [0, 0, 0, 1, 1, 1, 0, 0, 0], + [1, 1, 1, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 1, 1, 1]], dtype='uint8') + + corners = np.array([[2, 2], + [2, 5], + [5, 2], + [5, 5]], dtype='float32') + + cvFindCornerSubPix(img, corners, 4, (2, 2)) + + +class TestGoodFeaturesToTrack(OpenCVTest): + @_opencv_skip + def test_cvGoodFeaturesToTrack(self): + cvGoodFeaturesToTrack(self.lena_GRAY_U8, 100, 0.1, 3) + + +class TestResize(OpenCVTest): + @_opencv_skip + def test_cvResize(self): + cvResize(self.lena_RGB_U8, height=50, width=50, method=CV_INTER_LINEAR) + cvResize(self.lena_RGB_U8, height=200, width=200, method=CV_INTER_CUBIC) + + +if __name__ == '__main__': + run_module_suite()