Qt OpenCV静态版本构建应用程序在我尝试从视频捕获中读取帧后崩溃

时间:2013-07-15 06:26:00

标签: c++ qt opencv video-capture avi

我遇到了一个有趣的问题。几个星期后,我花了我的Qt和OpenCv进行静态构建我意识到,当我尝试从VideoCapture读取帧时 - 来自.avi文件,我的程序一直崩溃。 VideoCapture与WebCamera完美配合。 VideoCapture.Open() - 返回1 - 没问题。请有人帮帮我吗?

崩溃: 问题签名:   问题事件名称:APPCRASH   应用程序名称:PrehravanieVidea.exe   应用版本:0.0.0.0   申请时间戳:51e39027   故障模块名称:msvcrt.dll   故障模块版本:7.0.7600.16385   故障模块时间戳:4a5bda6f   例外代码:c0000005   异常偏移:0000a048   操作系统版本:6.1.7600.2.0.0.256.48   区域设置ID:1051   附加信息1:0a9e   附加信息2:0a9e372d3b4ad19135b953a78882e789   附加信息3:0a9e   附加信息4:0a9e372d3b4ad19135b953a78882e789

在线阅读我们的隐私声明:   http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

如果没有在线隐私声明,请离线阅读我们的隐私声明:   C:\ WINDOWS \ SYSTEM32 \ EN-US \ erofflps.txt

我的代码:

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDir>
#include <QFileDialog>



MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
   // inicializacia ////////////////////////






}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_actionOpen_triggered()
{

   QDir directory = QDir::currentPath();

    QString path = QFileDialog::getOpenFileName (this, tr("Directory"), directory.path());
    if ( path.isNull() == false )
    {
        directory.setPath(path);
    }
    ui->console->appendPlainText(path);



   video_cap.open(path.toStdString());
   if(!video_cap.isOpened()){ui->console->appendPlainText("I can't open the file!");}
   else {ui->console->appendPlainText("Video file is opened!");

 video_cap.read(video_frame);



  video_cap.release();


   }
}

.pro文件:

#-------------------------------------------------
#
# Project created by QtCreator 2013-07-14T11:33:32
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = PrehravanieVidea
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui


CONFIG += exceptions
INCLUDEPATH +=C:/opencv/build/include
LIBS += -LC:\\opencv\\mybuild\\lib \
-lopencv_contrib246 \
-lopencv_stitching246 \
-lopencv_nonfree246 \
-lopencv_superres246 \
-lopencv_ts246 \
-lopencv_videostab246 \
-lopencv_gpu246 \
-lopencv_legacy246 \
-lopencv_ml246 \
-lopencv_objdetect246 \
-lopencv_calib3d246 \
-lopencv_photo246 \
-lopencv_video246 \
-lopencv_features2d246 \
-lopencv_highgui246 \
-llibjasper \
-lIlmImf \
-llibtiff \
-llibpng \
-llibjpeg \
-lopencv_flann246 \
-lopencv_imgproc246 \
-lopencv_core246 \
-lzlib \
-lzlib \
-lopencv_haartraining_engine
LIBS += -LC:\\ProgramFiles\\MicrosoftSDKs\\Windows\\v7.0\\Lib \
-lVfw32 \
-lmsvfw32 \
-lComCtl32 \
-lGdi32

0 个答案:

没有答案