Abnormal termination when using OpenCV's function



  • My code as follow. When I execute cvCreateCameraCapture(-1) in openCamera, the app ends.

    TIP: Abnormal program termination. during startup program exited with code 0X000135

    Why? The computer is notebook, and inner-Camera.

    @int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
    }@

    @#include<highgui.h>
    #include<cv.h>

    class MainWindow : public QMainWindow
    {
    Q_OBJECT
    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private slots:
    void openCamera();
    void readFrame();
    void closeCamera();
    void takingPhote();

    private:
    Ui::MainWindow ui;
    QTimer
    timer;
    QImage* image;
    CvCapture* cam;
    IplImage* frame;
    };

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    cam = NULL;
    timer = new QTimer(this);
    image = new QImage;

    connect(ui->openCamera, SIGNAL(clicked()), this, SLOT(openCamera()));
    

    }

    void MainWindow::openCamera()
    {
    cam = cvCreateCameraCapture(-1);
    // timer->start(33);
    // connect(timer, SIGNAL(timeout()), this, SLOT(readFrame()));
    }@

    Thank you....


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.