fixed problem with Nx2 numpy arrays in geometrical functions (#2783)

This commit is contained in:
Vadim Pisarevsky
2013-02-08 18:11:56 +04:00
parent 6ffd5edfb5
commit 43d61d961e
2 changed files with 36 additions and 1 deletions

View 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,