MCPcopy Create free account
hub / github.com/creatale/node-dv / cvPointSeqFromMat

Function cvPointSeqFromMat

deps/opencv/modules/imgproc/src/utils.cpp:44–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42#include "precomp.hpp"
43
44CV_IMPL CvSeq* cvPointSeqFromMat( int seq_kind, const CvArr* arr,
45 CvContour* contour_header, CvSeqBlock* block )
46{
47 CV_Assert( arr != 0 && contour_header != 0 && block != 0 );
48
49 int eltype;
50 CvMat hdr;
51 CvMat* mat = (CvMat*)arr;
52
53 if( !CV_IS_MAT( mat ))
54 CV_Error( CV_StsBadArg, "Input array is not a valid matrix" );
55
56 if( CV_MAT_CN(mat->type) == 1 && mat->width == 2 )
57 mat = cvReshape(mat, &hdr, 2);
58
59 eltype = CV_MAT_TYPE( mat->type );
60 if( eltype != CV_32SC2 && eltype != CV_32FC2 )
61 CV_Error( CV_StsUnsupportedFormat,
62 "The matrix can not be converted to point sequence because of "
63 "inappropriate element type" );
64
65 if( (mat->width != 1 && mat->height != 1) || !CV_IS_MAT_CONT(mat->type))
66 CV_Error( CV_StsBadArg,
67 "The matrix converted to point sequence must be "
68 "1-dimensional and continuous" );
69
70 cvMakeSeqHeaderForArray(
71 (seq_kind & (CV_SEQ_KIND_MASK|CV_SEQ_FLAG_CLOSED)) | eltype,
72 sizeof(CvContour), CV_ELEM_SIZE(eltype), mat->data.ptr,
73 mat->width*mat->height, (CvSeq*)contour_header, block );
74
75 return (CvSeq*)contour_header;
76}
77
78namespace cv
79{

Callers 12

cvArcLengthFunction · 0.85
cvMinEnclosingCircleFunction · 0.85
cvContourAreaFunction · 0.85
cvFitEllipse2Function · 0.85
cvBoundingRectFunction · 0.85
cvPointPolygonTestFunction · 0.85
cvApproxPolyFunction · 0.85
cvMomentsFunction · 0.85
cvConvexHull2Function · 0.85
cvConvexityDefectsFunction · 0.85
cvCheckContourConvexityFunction · 0.85
cvMinAreaRect2Function · 0.85

Calls 2

cvReshapeFunction · 0.85
cvMakeSeqHeaderForArrayFunction · 0.85

Tested by

no test coverage detected