PDA

View Full Version : Debug Assertion Failed (unsigned)(c+1) <= 256 (in VideoCapture::open [Qt Creator])



AnuruddhaH
15th July 2013, 20:06
I've been trying to use cv::VideoCapture:: open("< path to video file >") in QtCreator (opencv added). Even though the program runs without errors in "bebug mode" (debug build), it gives below runtime error in "release mode" (release build).


Debug Assertion Failed File: f:/dd/vctools/crt_bld/self_x86/src/isctype.c Line: 56 Expression: (unsigned)(c+1) <= 256

It is a simple program which uses only cv::VideoCapture:: open() [for testing purposes]

Below is the .pro file


QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = untitled
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui

INCLUDEPATH += C:/C/opencv/build/include
INCLUDEPATH += C:/C/opencv/build/include/opencv

LIBS += C:/C/opencv/build/x86/vc10/lib/opencv_highgui240d.lib
LIBS += C:/C/opencv/build/x86/vc10/lib/opencv_highgui240.lib


LIBS += C:/C/opencv/build/x86/vc10/bin/opencv_highgui240d.dll
LIBS += C:/C/opencv/build/x86/vc10/bin/opencv_highgui240.dll

Below is the Header file


#include <QMainWindow>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private:
Ui::MainWindow *ui;
cv::VideoCapture vcap;
};

Below is the .cpp file


#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
vcap.open("C:/Users/ANURUDDHA/pedestrians/ThreePastShop2cor.mpg");
}

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

When I pass an int as the argument to cv::VideoCapture:: open() [eg: vcap.open(0)] it runs without errors in both debug and release build and opens webcam successfully. Problem comes only when I pass a String to arguments.

Someone please shed some light on this. Really appreciated.