我正在研究 eclipse + opencv 2.4.6 + java api。
现在我有这个编译错误:
OpenCV Error: Assertion failed (ptnum > 3) in unknown function, file ..\..\..\src\opencv\modules\imgproc\src\contours.cpp, line 1969 Exception in thread "main" CvException [org.opencv.core.CvException: ..\..\..\src\opencv\modules\imgproc\src\contours.cpp:1969: error: (-215) ptnum > 3 ]
at org.opencv.imgproc.Imgproc.convexityDefects_0(Native Method)
at org.opencv.imgproc.Imgproc.convexityDefects(Imgproc.java:3170)
部分代码为:
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(imgframe,contours , hierarchy,Imgproc.RETR_TREE, Imgproc.CHAIN_APPROX_SIMPLE,new Point(0,0));
for(int i=0;i<contours.size();i++) {
Imgproc.drawContours(imgframe, contours,i,new Scalar(255,0,255),2,8,hierarchy,0,new Point());
MatOfInt hull_=new MatOfInt();
MatOfInt4 convexityDefects=new MatOfInt4();
Imgproc.convexHull(contours.get(0), hull_);
Imgproc.convexityDefects(contours.get(0), hull_, convexityDefects);
}
你能帮助我吗??谢谢