error "matrix.cpp, line 322" or bug (Bug #2411)


Added by angel angel over 12 years ago. Updated over 12 years ago.


Status:Cancelled Start date:2012-10-04
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:android
Target version:2.4.3
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Hi I am developping using opencv in Android. My program works correctly but sometimes I get this error:

Stitching module's ROI issue (Bug #2385) 10-04 16:03:18.989: E/cv::error()(1150): 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 cv::Rect&), file /home/andreyk/OpenCV/opencv/modules/core/src/matrix.cpp, line 322
10-04 16:03:18.999: E/SurfaceTexture(1150): [unnamed-1150-1] dequeueBuffer: no available buffer slots
10-04 16:03:18.999: E/AndroidRuntime(1150): FATAL EXCEPTION: Thread-133
10-04 16:03:18.999: E/AndroidRuntime(1150): CvException [org.opencv.core.CvException: /home/andreyk/OpenCV/opencv/modules/core/src/matrix.cpp:322: 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 cv::Rect&)

My error seems to be the same king of error than "Stitching module's ROI issue (Bug #2385)". I dont know exactly what part of my code is the origine of this error. I think it is related avec Imgproc.resize but I am not sure. Related to the bug 2385 it seems now it works. But I dont understand if it was a mistake of the code or this is an Opencv error. Anyway is there a known solution for this kind of error? Thanks of your answer


Associated revisions

Revision 7dc549f1
Added by Roman Donchenko about 11 years ago

Merge pull request #2411 from asmorkalov:android_mat_leak_fix

History

Updated by Alexander Smorkalov over 12 years ago

It looks like your ROI is out of Mat size. Please attach some piece of code to reproduce the problem.

  • Category set to android
  • Target version set to 2.4.3

Updated by angel angel over 12 years ago

Hi Alexander
I think the error could be in the next lines of code. My code works correctly during a time. I am not sure if dimlado du code has to be always bigger than 160... etc. I have to debug deeply.

*Mat matrixSelec= matrixRgba.submat(0, dimlado,0, dimlado );//A sub matrix: dimlado is changing
Mat matrixSelec_matrixRgba = matrixRgba.submat(0, 160,0, 160 );
Imgproc.resize(matrixSelec, matrixSelec_mRgba, matrixSelec_matrixRgba.size());//New size: to 160x160
Mat RmatrixSeleccionada = matrixRgba.submat(0, dimlado,0, dimlado );
Mat CRmatrixSeleccionada= new Mat(RmatrixSeleccionada.size(), RmatrixSeleccionada.type());
RMatrixSeleccionada.copyTo(CRMatrixSeleccionada);*__
There is a big matrix. I take a submatrix matrixSelec. Then I reside matrixSelec to a matrix 160x160. And then I copy the result to CRMatrixSeleccionada.

regards

Updated by angel angel over 12 years ago

a mistake typing:

Mat RmatrixSeleccionada = matrixRgba.submat(0, 160,0, 160 );
Mat CRmatrixSeleccionada= new Mat(RmatrixSeleccionada.size(), RmatrixSeleccionada.type());
RMatrixSeleccionada.copyTo(CRMatrixSeleccionada);*

Updated by angel angel over 12 years ago

I think I have found the problemm... it was before the code I have shown... I use also a submat function and you are right the size of the submat sometimes is out the big matrix... and consecuently I have a Mat size error... Anyway, taking advantage of the code above,do you think the code to resize the submatrix could be done in a better way? Thanks for your support...

Updated by Vadim Pisarevsky over 12 years ago

the code is fine, just make sure that ROI is within the matrix. The ticket is cancelled, since this is not a bug

  • Status changed from Open to Cancelled

Also available in: Atom PDF