From dc55ae4065b071ee4121b377957dec5c2ad25f3b Mon Sep 17 00:00:00 2001 From: sccolbert Date: Fri, 30 Oct 2009 22:07:26 +0100 Subject: [PATCH] fixed an assertion that was preventing a slice of an array from being used. However, this may open the door for segfaults for severely non-contiguous data. I'm not too sure. --- scikits/image/opencv/opencv_backend.pyx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scikits/image/opencv/opencv_backend.pyx b/scikits/image/opencv/opencv_backend.pyx index f1227bf1..78b1b2b3 100644 --- a/scikits/image/opencv/opencv_backend.pyx +++ b/scikits/image/opencv/opencv_backend.pyx @@ -110,7 +110,13 @@ cdef CvMat* cvmat_ptr_from_iplimage(IplImage* arr): return mat_hdr cdef int validate_array(np.ndarray arr) except -1: - assert PyArray_ISCONTIGUOUS(arr), 'Array must be contiguous' + + # this assertion prevents the use of slices, so + # we need to be more creative about how to deal + # with non-contiguous arrays + #assert PyArray_ISCONTIGUOUS(arr), 'Array must be contiguous' + + if arr.ndim != 2 and arr.ndim != 3: raise ValueError('Arrays must have either 2 or 3 dimensions') if arr.ndim == 3: