Bad input roi in function cvInitImageHeader

asked 2015-03-30 02:37:31 -0500

john_1282 gravatar image

updated 2015-03-30 08:34:31 -0500

I am using MFC to write GUI that allows to display video from webcam using opencv 2.4.10. However, I have a error that recorded in http://youtu.be/j9Z-oKrDMoU .I using thread to show video. I used a thread to open and detect face. However, I have error is

"C:\\builds\\2_4_PackSlave-win32-vc11-shared\\opencv\\modules\\core\\src\\array.cpp:2918: error: (-25) Bad input roi in function cvInitImageHeader\n"

The problem is in code

 cv::VideoCapture cap;
 cap >> frame;

Can you help me resolve it? For full code. You can download at here.

edit retag flag offensive close merge delete

Comments

Sorry to say but your code is a mess, and the video doesn't help either. Please provide a minimum example of the problem you encounter. And add relevant information (stack trace, the actual code, why you think the problem is in a certain part of the code).

boaz001 gravatar imageboaz001 ( 2015-03-30 10:06:07 -0500 )edit

Because i used try catch to find it. Please run and see the problem.

john_1282 gravatar imagejohn_1282 ( 2015-03-30 10:44:40 -0500 )edit

No, I can not run (not working on Windows) and I don't have to, to see you have a problem.

You should really simplify your program, the chances of finding help here arae really small if you just post all your garbage and say "my program has an error, tell me where it is". Also provide stack trace and other relevant information because obviously this problem is in your code and not in the cv::VideoCapture cap; cap >> frame; I'm going to give you a few tips to start with:

  • Run everything in a single thread
  • Use C++ interface, no IplImage
  • Don't use try catch to find bugs, try-catch is for exception handling, link to OpenCV's debug libraries and use your Visual Studio debugger to inspect objects to find the cause of the crash.
boaz001 gravatar imageboaz001 ( 2015-03-30 18:27:43 -0500 )edit