convexitydefects.diff
H:/OpenCVWorkspace/OpenCV2.2_Learn/include/opencv2/imgproc/imgproc.hpp (revision 31) | ||
---|---|---|
828 | 828 |
//! returns true iff the contour is convex. Does not support contours with self-intersection |
829 | 829 |
CV_EXPORTS_W bool isContourConvex( const Mat& contour ); |
830 | 830 |
|
831 |
CV_EXPORTS_W void ConvexityDefects( const Mat& points, const vector<int>& hull, vector<CvConvexityDefect> &defects ); |
|
832 |
|
|
831 | 833 |
//! fits ellipse to the set of 2D points |
832 | 834 |
CV_EXPORTS_W RotatedRect fitEllipse( const Mat& points ); |
833 | 835 |
|
H:/OpenCVWorkspace/OpenCV2.2_Learn/modules/imgproc/src/contours.cpp (revision 31) | ||
---|---|---|
1744 | 1744 |
return cvCheckContourConvexity(&c) > 0; |
1745 | 1745 |
} |
1746 | 1746 |
|
1747 |
void cv::ConvexityDefects( const Mat& points, const vector<int>& hull, vector<CvConvexityDefect> &defects ) |
|
1748 |
{ |
|
1749 |
int nelems = points.checkVector(2, CV_32S); |
|
1750 |
int nhelems = (int)hull.size(); |
|
1751 |
if (nelems < nhelems) |
|
1752 |
{ |
|
1753 |
defects.clear(); |
|
1754 |
return; |
|
1755 |
} |
|
1756 |
|
|
1757 |
// convert to CvMat (C API) |
|
1758 |
CvMat _points = Mat(points), _hull=Mat(hull); |
|
1759 |
// allocate storage for the defects |
|
1760 |
MemStorage storage(cvCreateMemStorage()); |
|
1761 |
Seq<CvConvexityDefect> defectSeq( cvConvexityDefects(&_points, &_hull, storage) ); |
|
1762 |
defectSeq.copyTo(defects); |
|
1763 |
} |
|
1764 |
|
|
1747 | 1765 |
cv::RotatedRect cv::fitEllipse( const Mat& points ) |
1748 | 1766 |
{ |
1749 | 1767 |
CV_Assert(points.checkVector(2) >= 0 && |