有人可以解释一下 logcat 中的这个错误是什么意思?
06-19 11:52:56.198: ERROR/cv::error()(8272): OpenCV Error: Assertion failed (corrsize.height <= img.rows + templ.rows - 1 && corrsize.width <= img.cols + templ.cols - 1) in void cv::crossCorr(const cv::Mat&, const cv::Mat&, cv::Mat&, cv::Size, int, cv::Point, double, int), file /home/reports/ci/slave/50-SDK/opencv/modules/imgproc/src/templmatch.cpp, line 70
06-19 11:52:56.208: ERROR/AndroidRuntime(8272): FATAL EXCEPTION: Thread-2151
CvException [org.opencv.core.CvException: /home/reports/ci/slave/50-SDK/opencv/modules/imgproc/src/templmatch.cpp:70: error: (-215) corrsize.height <= img.rows + templ.rows - 1 && corrsize.width <= img.cols + templ.cols - 1 in function void cv::crossCorr(const cv::Mat&, const cv::Mat&, cv::Mat&, cv::Size, int, cv::Point, double, int)
]
at org.opencv.imgproc.Imgproc.matchTemplate_0(Native Method)
at org.opencv.imgproc.Imgproc.matchTemplate(Imgproc.java:7226)
at com.micaela.myapp.Eye.match(Eye.java:256)
at com.micaela.myapp.Eye.access$100(Eye.java:22)
at com.micaela.myapp.Eye$3.run(Eye.java:146)
at java.lang.Thread.run(Thread.java:856)
在这段代码中调用了这个异常:
Mat res;
if ((roi.height() > MainActivity.tpl.height()) && (roi.width() > MainActivity.tpl.width())) {
res = new Mat(new Size(roi.cols() - MainActivity.tpl.cols() + 1, roi.rows() - MainActivity.tpl.rows() + 1), CvType.CV_32FC1);
Imgproc.matchTemplate(roi, MainActivity.tpl, res, Imgproc.TM_SQDIFF);
if (left) {
return new Point((eyeRect.x + this.roi.width() - matchRect.x - Math.round(Core.minMaxLoc(res).maxLoc.x + (MainActivity.tpl.width() / 2))),
(Math.round(Core.minMaxLoc(res).maxLoc.y + (MainActivity.tpl.height() / 2)) + matchRect.y + eyeRect.y));
} else {
return new Point((Math.round(Core.minMaxLoc(res).maxLoc.x + (MainActivity.tpl.width() / 2)) + matchRect.x + eyeRect.x), (Math.round(Core.minMaxLoc(res).maxLoc.y + (MainActivity.tpl.height() / 2)) + matchRect.y + eyeRect.y));
}
}
在:
Imgproc.matchTemplate(roi, MainActivity.tpl, res, Imgproc.TM_SQDIFF);
我正在使用最新版本的 opencv4android 库在 Android 中编程。