Ask Your Question

OpenCV Error: Assertion failed (s >= 0) in setSize

asked 2013-06-27 05:18:20 -0500

Ferran Roure gravatar image

Hi everyone,

I'm new user and I'm trying to execute my program that uses opencv. It compiles but during the exeution it appears this error.

OpenCV Error: Assertion failed (s >= 0) in setSize, file /<path_to_opencv>/OpenCV/OpenCV-2.4.3/modules/core/src/matrix.cpp, line 115 terminate called after throwing an instance of 'cv::Exception' what(): /<path_to_opencv>/OpenCV/OpenCV-2.4.3/modules/core/src/matrix.cpp:115: error: (-215) s >= 0 in function setSize

Can you help me? I've search through the internet for solutions but I didn't find anything related.



edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-27 05:35:54 -0500

Siegfried gravatar image


when you create your cv::mat one of the size values (row or column) is lower than 0. You can't create a matrix with a negative number of rows or columns.

In future questions you should provide the code which produce the error.

edit flag offensive delete link more


Thank! I've found the error. Is the problem of working with a code that is not mine. :P

Thank you very much! :D


Ferran Roure gravatar imageFerran Roure ( 2013-06-27 05:42:11 -0500 )edit

hi, can you answer my error too ?

dott gravatar imagedott ( 2016-04-19 23:35:04 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-06-27 05:18:20 -0500

Seen: 17,311 times

Last updated: Jun 27 '13