fixed problem with Nx2 numpy arrays in geometrical functions (#2783)
[profile/ivi/opencv.git] / modules / imgproc / src / utils.cpp
index 736b7fd..72f4978 100644 (file)
@@ -47,11 +47,15 @@ CV_IMPL CvSeq* cvPointSeqFromMat( int seq_kind, const CvArr* arr,
     CV_Assert( arr != 0 && contour_header != 0 && block != 0 );
 
     int eltype;
+    CvMat hdr;
     CvMat* mat = (CvMat*)arr;
 
     if( !CV_IS_MAT( mat ))
         CV_Error( CV_StsBadArg, "Input array is not a valid matrix" );
 
+    if( CV_MAT_CN(mat->type) == 1 && mat->width == 2 )
+        mat = cvReshape(mat, &hdr, 2);
+
     eltype = CV_MAT_TYPE( mat->type );
     if( eltype != CV_32SC2 && eltype != CV_32FC2 )
         CV_Error( CV_StsUnsupportedFormat,