OpenCV Error: Assertion failed (s >= 0) in cv::setSize, file ..\..\..\..\opencv\modules\core\src\matrix.cpp, line 116
Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: ..\..\..\..\opencv\modules\core\src\matrix.cpp:116: error: (-215) s >= 0 in function cv::setSize
Please Help!!
JAVA, Pattern Matching, NetBeans
Pattern Matching done for 8 elements:
if (!element_six)
{
if (templateFile1.getName().startsWith("six_"))
{
if ((matchLoc.x > (img.width() / 2)) && (matchLoc.x < (img.width() / 2)+200))
{
element_six = true;
System.out.println("Element six Is Present");
match_count += 1;
Core.rectangle(img, matchLoc, new Point(matchLoc.x + templ.cols(), matchLoc.y + templ.rows()), new Scalar(0, 255, 0), 8);
}
else
{
element_six = false;
System.out.println("Element six Is Not Present");
}
}
}
for (File templateFile1 : templateFile)
{
Mat templ = Highgui.imread(templateFile1.toString()); // / Create the result matrix
int result_cols = img.cols() - templ.cols() + 1;
int result_rows = img.rows() - templ.rows() + 1;
Mat result = new Mat(result_rows, result_cols, CvType.CV_32FC1);
ORB algorithm is used and function used is
Core.normalize(result, result, 0, 1, Core.NORM_MINMAX, -1, new Mat());
}
↧