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

Function cvDrawContours

deps/opencv/modules/core/src/drawing.cpp:2372–2490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2370 ((count) -= ((count) == (seq)->total && !CV_IS_SEQ_CLOSED(seq)))
2371
2372CV_IMPL void
2373cvDrawContours( void* _img, CvSeq* contour,
2374 CvScalar _externalColor, CvScalar _holeColor,
2375 int maxLevel, int thickness,
2376 int line_type, CvPoint _offset )
2377{
2378 CvSeq *contour0 = contour, *h_next = 0;
2379 CvTreeNodeIterator iterator;
2380 cv::vector<cv::PolyEdge> edges;
2381 cv::vector<cv::Point2l> pts;
2382 cv::Scalar externalColor = _externalColor, holeColor = _holeColor;
2383 cv::Mat img = cv::cvarrToMat(_img);
2384 cv::Point offset = _offset;
2385 double ext_buf[4], hole_buf[4];
2386
2387 if( line_type == CV_AA && img.depth() != CV_8U )
2388 line_type = 8;
2389
2390 if( !contour )
2391 return;
2392
2393 CV_Assert( thickness <= 255 );
2394
2395 scalarToRawData( externalColor, ext_buf, img.type(), 0 );
2396 scalarToRawData( holeColor, hole_buf, img.type(), 0 );
2397
2398 maxLevel = MAX(maxLevel, INT_MIN+2);
2399 maxLevel = MIN(maxLevel, INT_MAX-1);
2400
2401 if( maxLevel < 0 )
2402 {
2403 h_next = contour->h_next;
2404 contour->h_next = 0;
2405 maxLevel = -maxLevel+1;
2406 }
2407
2408 cvInitTreeNodeIterator( &iterator, contour, maxLevel );
2409 while( (contour = (CvSeq*)cvNextTreeNode( &iterator )) != 0 )
2410 {
2411 CvSeqReader reader;
2412 int i, count = contour->total;
2413 int elem_type = CV_MAT_TYPE(contour->flags);
2414 void* clr = (contour->flags & CV_SEQ_FLAG_HOLE) == 0 ? ext_buf : hole_buf;
2415
2416 cvStartReadSeq( contour, &reader, 0 );
2417 if( thickness < 0 )
2418 pts.resize(0);
2419
2420 if( CV_IS_SEQ_CHAIN_CONTOUR( contour ))
2421 {
2422 cv::Point pt = ((CvChain*)contour)->origin;
2423 cv::Point prev_pt = pt;
2424 char prev_code = reader.ptr ? reader.ptr[0] : '\0';
2425
2426 prev_pt += offset;
2427
2428 for( i = 0; i < count; i++ )
2429 {

Callers 2

cvDistTransformFunction · 0.85
drawContoursMethod · 0.85

Calls 14

cvarrToMatFunction · 0.85
scalarToRawDataFunction · 0.85
cvInitTreeNodeIteratorFunction · 0.85
cvNextTreeNodeFunction · 0.85
cvStartReadSeqFunction · 0.85
ThickLineFunction · 0.85
CollectPolyEdgesFunction · 0.85
FillEdgeCollectionFunction · 0.85
PointClass · 0.50
depthMethod · 0.45
typeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected