| 1789 | } |
| 1790 | |
| 1791 | void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours, |
| 1792 | int contourIdx, const Scalar& color, int thickness, |
| 1793 | int lineType, InputArray _hierarchy, |
| 1794 | int maxLevel, Point offset ) |
| 1795 | { |
| 1796 | Mat image = _image.getMat(), hierarchy = _hierarchy.getMat(); |
| 1797 | CvMat _cimage = image; |
| 1798 | |
| 1799 | size_t ncontours = _contours.total(); |
| 1800 | size_t i = 0, first = 0, last = ncontours; |
| 1801 | vector<CvSeq> seq; |
| 1802 | vector<CvSeqBlock> block; |
| 1803 | |
| 1804 | if( !last ) |
| 1805 | return; |
| 1806 | |
| 1807 | seq.resize(last); |
| 1808 | block.resize(last); |
| 1809 | |
| 1810 | for( i = first; i < last; i++ ) |
| 1811 | seq[i].first = 0; |
| 1812 | |
| 1813 | if( contourIdx >= 0 ) |
| 1814 | { |
| 1815 | CV_Assert( 0 <= contourIdx && contourIdx < (int)last ); |
| 1816 | first = contourIdx; |
| 1817 | last = contourIdx + 1; |
| 1818 | } |
| 1819 | |
| 1820 | for( i = first; i < last; i++ ) |
| 1821 | { |
| 1822 | Mat ci = _contours.getMat((int)i); |
| 1823 | if( ci.empty() ) |
| 1824 | continue; |
| 1825 | int npoints = ci.checkVector(2, CV_32S); |
| 1826 | CV_Assert( npoints > 0 ); |
| 1827 | cvMakeSeqHeaderForArray( CV_SEQ_POLYGON, sizeof(CvSeq), sizeof(Point), |
| 1828 | ci.data, npoints, &seq[i], &block[i] ); |
| 1829 | } |
| 1830 | |
| 1831 | if( hierarchy.empty() || maxLevel == 0 ) |
| 1832 | for( i = first; i < last; i++ ) |
| 1833 | { |
| 1834 | seq[i].h_next = i < last-1 ? &seq[i+1] : 0; |
| 1835 | seq[i].h_prev = i > first ? &seq[i-1] : 0; |
| 1836 | } |
| 1837 | else |
| 1838 | { |
| 1839 | size_t count = last - first; |
| 1840 | CV_Assert(hierarchy.total() == ncontours && hierarchy.type() == CV_32SC4 ); |
| 1841 | const Vec4i* h = hierarchy.ptr<Vec4i>(); |
| 1842 | |
| 1843 | if( count == ncontours ) |
| 1844 | { |
| 1845 | for( i = first; i < last; i++ ) |
| 1846 | { |
| 1847 | int h_next = h[i][0], h_prev = h[i][1], |
| 1848 | v_next = h[i][2], v_prev = h[i][3]; |
nothing calls this directly
no test coverage detected