Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

[Solved] Simple application crash without errors

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

Snow4Life gravatar image

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

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;
    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;

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/".

[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

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

berak gravatar image

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

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
Login/Signup to Answer

Question Tools


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

Seen: 722 times

Last updated: Oct 13 '14