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

Function cvFindContours

deps/opencv/modules/imgproc/src/contours.cpp:1659–1706  ·  view source on GitHub ↗

F/////////////////////////////////////////////////////////////////////////////////////// // Name: cvFindContours // Purpose: // Finds all the contours on the bi-level image. // Context: // Parameters: // img - source image. // Non-zero pixels are considered as 1-pixels // and zero pixels as 0-pixels. // step - full width of source image in bytes.

Source from the content-addressed store, hash-verified

1657// Notes:
1658//F*/
1659CV_IMPL int
1660cvFindContours( void* img, CvMemStorage* storage,
1661 CvSeq** firstContour, int cntHeaderSize,
1662 int mode,
1663 int method, CvPoint offset )
1664{
1665 CvContourScanner scanner = 0;
1666 CvSeq *contour = 0;
1667 int count = -1;
1668
1669 if( !firstContour )
1670 CV_Error( CV_StsNullPtr, "NULL double CvSeq pointer" );
1671
1672 *firstContour = 0;
1673
1674 if( method == CV_LINK_RUNS )
1675 {
1676 if( offset.x != 0 || offset.y != 0 )
1677 CV_Error( CV_StsOutOfRange,
1678 "Nonzero offset is not supported in CV_LINK_RUNS yet" );
1679
1680 count = icvFindContoursInInterval( img, storage, firstContour, cntHeaderSize );
1681 }
1682 else
1683 {
1684 try
1685 {
1686 scanner = cvStartFindContours( img, storage, cntHeaderSize, mode, method, offset );
1687
1688 do
1689 {
1690 count++;
1691 contour = cvFindNextContour( scanner );
1692 }
1693 while( contour != 0 );
1694 }
1695 catch(...)
1696 {
1697 if( scanner )
1698 cvEndFindContours(&scanner);
1699 throw;
1700 }
1701
1702 *firstContour = cvEndFindContours( &scanner );
1703 }
1704
1705 return count;
1706}
1707
1708void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours,
1709 OutputArray _hierarchy, int mode, int method, Point offset )

Callers 2

cvDistTransformFunction · 0.85
findContoursMethod · 0.85

Calls 3

cvFindNextContourFunction · 0.85
cvEndFindContoursFunction · 0.85

Tested by

no test coverage detected