CvException [org.opencv.core.CvException: cv::Exception] [closed]

asked 2019-01-04 09:47:13 -0600

updated 2019-01-04 09:48:15 -0600

berak gravatar image

I'm getting this error in logcat in android studio

2019-01-04 18:19:51.208 24101-24101/com.example.nabil.imagetext E/cv::error(): OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat(const cv::Mat&, const Rect&), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp, line 323
2019-01-04 18:19:51.209 24101-24101/com.example.nabil.imagetext E/org.opencv.core.Mat: Mat::n_1submat() caught cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function cv::Mat::Mat(const cv::Mat&, const Rect&)
2019-01-04 18:19:51.210 24101-24101/com.example.nabil.imagetext E/ContentValues: Error parse image. Message: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function cv::Mat::Mat(const cv::Mat&, const Rect&)

    CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function cv::Mat::Mat(const cv::Mat&, const Rect&)
    ]
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-11-09 10:32:01.429276

Comments

you did something with a ROI, and that went out of bounds. (like calling a Mat constructor with a Rect)

can you try to look up, where you did something like that, and add your resp. part of code to the question ?

berak gravatar imageberak ( 2019-01-04 09:49:25 -0600 )edit

also, do the maths: rect.x and rect.y must be > 0, also, rect.x + rect.width < img.cols(), and rect.y + rect.height < img.rows()

berak gravatar imageberak ( 2019-01-04 10:04:52 -0600 )edit