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

Function cvApproxPoly

deps/opencv/modules/imgproc/src/approx.cpp:680–805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

678
679
680CV_IMPL CvSeq*
681cvApproxPoly( const void* array, int header_size,
682 CvMemStorage* storage, int method,
683 double parameter, int parameter2 )
684{
685 CvSeq* dst_seq = 0;
686 CvSeq *prev_contour = 0, *parent = 0;
687 CvContour contour_header;
688 CvSeq* src_seq = 0;
689 CvSeqBlock block;
690 int recursive = 0;
691
692 if( CV_IS_SEQ( array ))
693 {
694 src_seq = (CvSeq*)array;
695 if( !CV_IS_SEQ_POLYLINE( src_seq ))
696 CV_Error( CV_StsBadArg, "Unsupported sequence type" );
697
698 recursive = parameter2;
699
700 if( !storage )
701 storage = src_seq->storage;
702 }
703 else
704 {
705 src_seq = cvPointSeqFromMat(
706 CV_SEQ_KIND_CURVE | (parameter2 ? CV_SEQ_FLAG_CLOSED : 0),
707 array, &contour_header, &block );
708 }
709
710 if( !storage )
711 CV_Error( CV_StsNullPtr, "NULL storage pointer " );
712
713 if( header_size < 0 )
714 CV_Error( CV_StsOutOfRange, "header_size is negative. "
715 "Pass 0 to make the destination header_size == input header_size" );
716
717 if( header_size == 0 )
718 header_size = src_seq->header_size;
719
720 if( !CV_IS_SEQ_POLYLINE( src_seq ))
721 {
722 if( CV_IS_SEQ_CHAIN( src_seq ))
723 {
724 CV_Error( CV_StsBadArg, "Input curves are not polygonal. "
725 "Use cvApproxChains first" );
726 }
727 else
728 {
729 CV_Error( CV_StsBadArg, "Input curves have uknown type" );
730 }
731 }
732
733 if( header_size == 0 )
734 header_size = src_seq->header_size;
735
736 if( header_size < (int)sizeof(CvContour) )
737 CV_Error( CV_StsBadSize, "New header size must be non-less than sizeof(CvContour)" );

Callers 1

approxPolyDPMethod · 0.85

Calls 2

cvPointSeqFromMatFunction · 0.85
cvBoundingRectFunction · 0.85

Tested by

no test coverage detected