Ask Your Question

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

asked 2013-06-27 06:39:58 -0500

I try to use cv::VideoCapture::open("path to file"). Even though the program runs without errors in bebug mode, it gives below runtime error in release mode.

Debug Assertion Failed File: f:/dd/vctools/crt_bld/self_x86/src/isctype.c Line: 56

Expression: (unsigned)(c+1) <= 256

-----------------------------------------------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

---------------------------------------------Erroneous line ---------------------------------------"C:/Users/ANURUDDHA/pedestrians/ped-crossing1.jpg"); // where cv::VideoCapture vcap;

error occurs ONLY IN RELEASE. It runs without errors in debug mode.

I have added C:\C\opencv\build\x86\vc10\bin; to system path which contains opencv_ffmpeg240.dll and other .dll

Really appriciate your kind assistance, will save a lot of time.. Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-27 09:18:41 -0500

Notas gravatar image

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

^ Don't link debug AND release version in the same build. Use the *d.lib for debug and *.lib for release. I guess that this is the problem.

And why do you open an image file with the videocapture class?

edit flag offensive delete link more


Thanks for the response Notas. Appreciated.

If I link only release version (opencv_highgui240.lib) program works neither in release nor debug mode. It pops up this error which might be due to poor linking. The program has unexpectedly finished. C:\Users\ANURUDDHA.... *.exe exited with code -1073741515

If I link only debug version (opencv_highgui240d.lib) the same Assertion Failed error shows up (only in release mode again) Any ideas?

This image file is one of a sequence of images used for testing pedestrian detection algorithms.

Thanks again.

AnuruddhaHettiarachchi gravatar imageAnuruddhaHettiarachchi ( 2013-06-27 11:33:14 -0500 )edit

There is no isctype.c in OpenCV (at least not in 2.4.5), so I have no idea what the problem even is exactly, just that c is the cause. I told you to use the release lib ONLY in the release build and the debug ONLY in debug build. Don't mix it! Please answer my question about the videocapture class and the provided image file. And lastly, show us the relevant code that produces this behaviour! Without seeing your code, how could we even think about finding the error?

Notas gravatar imageNotas ( 2013-06-27 12:42:24 -0500 )edit

Yes, I did use relevant libs in relevant builds (opencv_highgui240d.lib in debug build and opencv_highgui240.lib in release build). As it did not help, I happened to try out both types of libs in both build (which is kinda weird).

I use VideoCapture to open videos/image sequences. Above one is one of such a image sequence.

Here is the code.. So simple, just VideoCapture.

.pro file is as above (only opencv_highgui240.lib this time)


include <QMainWindow>

include <opencv2/highgui/highgui.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; };

AnuruddhaHettiarachchi gravatar imageAnuruddhaHettiarachchi ( 2013-06-28 13:08:15 -0500 )edit

oops.. sorry about the formatting.. :(


include "mainwindow.h"

include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)




MainWindow::~MainWindow() {

delete ui;


AnuruddhaHettiarachchi gravatar imageAnuruddhaHettiarachchi ( 2013-06-28 13:11:14 -0500 )edit

Can't edit posts.. Internal error.. Sorry for the formatting again..

AnuruddhaHettiarachchi gravatar imageAnuruddhaHettiarachchi ( 2013-06-28 13:28:21 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-06-27 06:39:58 -0500

Seen: 2,767 times

Last updated: Jun 27 '13