c++ - Opencv with fedora 23 Qt: The program has unexpectedly finished -
the program has unexpectedly finished. starting /home/tamercan/build-myfirst2-desktop_qt_5_7_0_gcc_64bit-debug/myfirst2... /home/tamercan/build-myfirst2-desktop_qt_5_7_0_gcc_64bit-debug/myfirst2 crashed.
this main.cpp
#include <opencv2/core/base.hpp> #include <opencv2/core/mat.hpp> #include <opencv2/core/types.hpp> #include <opencv2/highgui/highgui_c.h> #include <opencv2/highgui.hpp> #include <opencv2/imgproc.hpp> #include <opencv2/objdetect/objdetect_c.h> #include <opencv2/objdetect.hpp> #include <opencv2/videoio.hpp> #include <iostream> #include <vector> using namespace cv; using namespace std; int main(int argc, char* argv[]) { videocapture cap(0); // open video camera no. 0 namedwindow("myvideo",cv_window_autosize); //create window called "myvideo" // load face cascade (.xml file) cascadeclassifier face_cascade; face_cascade.load( "xml/haarcascade_frontalface_alt.xml" ); while (1) { mat frame; bool bsuccess = cap.read(frame); // read new frame video if (!bsuccess) //if not success, break loop { cout << "cannot read frame video stream" << endl; break; } // detect faces std::vector<rect> faces; face_cascade.detectmultiscale( frame, faces, 1.1, 2, 0|cv_haar_scale_image, size(30, 30) ); // draw circles on detected faces for( int = 0; < faces.size(); i++ ) { point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); ellipse( frame, center, size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, scalar( 255, 0, 255 ), 4, 8, 0 ); imshow( "detected face", frame ); } //rectangle( frame, center, size( faces[i].width*2, faces[i].height*2), scalar( 255, 0, 255 ) ); if (waitkey(30) == 27) //wait 'esc' key press 30ms. if 'esc' key pressed, break loop { cout << "esc key pressed user" << endl; break; } } return 0; }
my .pro file is
qt += core qt -= gui config += c++11 target = myfirst2 config += console config -= app_bundle qmake_default_incdirs="" && make template = app sources += main.cpp includepath += /usr/include/ libs += -l/usr/lib -lopencv_core -lopencv_highgui -lopencv_video -lopencv_videoio -lopencv_imgproc -lopencv_ml -lopencv_features2d -lopencv_calib3d -lopencv_objdetect
Comments
Post a Comment