使用Java时cornerSubPix错误“(--215:断言失败)计数> = 0”

时间:2019-10-16 02:52:00

标签: java opencv opencv4 subpixel

我的环境是macos,java,opencv 4.1.2,intellij等... 我的代码是:

    goodFeaturesToTrack(basedImg,corners,20,0.1,10,maskMat,3,false,0.04);
TermCriteria termCriteria = new TermCriteria(TermCriteria.MAX_ITER+TermCriteria.COUNT,1,0.001);
    Imgproc.cornerSubPix(basedImg,corners,new Size(5,5),new Size(-1,-1),termCriteria);

它引发错误:

Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: OpenCV(4.1.2-pre) /Users/friends/opencv/modules/imgproc/src/cornersubpix.cpp:58: error: (-215:Assertion failed) count >= 0 in function 'cornerSubPix'
]
    at org.opencv.imgproc.Imgproc.cornerSubPix_0(Native Method)
    at org.opencv.imgproc.Imgproc.cornerSubPix(Imgproc.java:4887)
    at cn.com.opencv.ImgProcess.dealContourCharacter(ImgProcess.java:432)
    at cn.com.opencv.ImgProcess.process(ImgProcess.java:276)
    at cn.com.opencv.Controller.main(Controller.java:19)

如何纠正? “错误:(-215:断言失败)计数> = 0”是什么意思?

0 个答案:

没有答案