Ask Your Question
1

[Solved] Simple application crash without errors

asked 2014-10-11 12:28:41 -0600

Snow4Life gravatar image

updated 2020-11-19 00:59:14 -0600

The application is this:

#include "opencv2/opencv.hpp"

using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;
Mat edges;
namedWindow("edges",1);
for(;;)
{
    Mat frame;
    cap >> frame; // get a new frame from camera
    cvtColor(frame, edges, COLOR_BGR2GRAY);
    GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
    Canny(edges, edges, 0, 30, 3);
    imshow("edges", edges);
    if(waitKey(30) >= 0) break;
}

cap.release();  
return 0;

}

This used to run with OpenCV3, but recently I upgraded and rebuilded (as static library because of other reasons, but the same was prior upgrading) and now when I run the executable it hang without any error. (the only difference is that now I have installed Qt5, but also reverting to Qt4 lead to the same result) If I run it with GDB i get this:

(gdb) run

Starting program: /root/programs/pc_camera/build/pc_camera

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

[Inferior 1 (process 7290) exited with code 0377]

Which for me is not really helpful.

Does someone know at least how to get a hint on what is failing?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2014-10-11 13:05:50 -0600

berak gravatar image

updated 2014-10-11 13:06:36 -0600

cap >> frame; // get a new frame from camera


sometimes, cameras need a 'warmup' time, and deliver empty frames.

throw in a :

if ( frame.empty() ) continue;

also, please run a 'debug' build. lots of serious assertions get skipped in release.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-11 12:28:41 -0600

Seen: 1,414 times

Last updated: Oct 13 '14