我遇到了一个有趣的问题。几周后,我将我的 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:0a9e372d9a7888889b
在线阅读我们的隐私声明: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();
}
}
。轮廓 :
#-------------------------------------------------
#
# 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